Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\n to br #12

Open
MarijnFK opened this issue Jul 2, 2024 · 7 comments
Open

\n to br #12

MarijnFK opened this issue Jul 2, 2024 · 7 comments

Comments

@MarijnFK
Copy link

MarijnFK commented Jul 2, 2024

In the strapi-blocks it is possible to input a shift-enter, which results in a \n
I see there is a
option for empty paragraphs, maybe it's possible to replace line-breaks inside the 'text' property to <br> aswell? This way we can place <br> inside a <p> tag

@niklasfjeldberg
Copy link
Owner

I am not sure I understand what you want. Could you give me two code examples? One for before (the current output) and one for the output you want, both in HTML. Also what will the benefit of this be?

To make things simple I am mostly trying the match the official React plugin from Strapi.

@MarijnFK
Copy link
Author

MarijnFK commented Jul 3, 2024

In the output below, there is a \n in the text-property, inside a paragraph. The \n is not replaced by a
. This results in different display from the strapi-editor and the html generated from the blocks-renderer.

[
  {
    "type": "paragraph",
    "children": [
      {
        "type": "text",
        "text": "It would be nice to have this \n render to a <br>"
      }
    ]
  }
]

@reslear
Copy link
Contributor

reslear commented Jul 21, 2024

hi @MarijnFK so i found strapi/blocks-react-renderer#42, we'll do it when it hits release.

@MarijnFK
Copy link
Author

@reslear awesome, thanks for the reply

@monolithed

This comment was marked as off-topic.

@MarijnFK
Copy link
Author

@monolithed thanks for the workaround. Unfortunatly it is a React-example, this is a vue-package. Maybe you can update it to match the vue-syntax?

@monolithed
Copy link

@MarijnFK my bad, I don't use Strapi with Vue, but the replaceNewlines function will be the same in both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants