niklasfjeldberg / vue-strapi-blocks-renderer

A Vue renderer for the Strapi's Blocks rich text editor
https://www.npmjs.com/package/vue-strapi-blocks-renderer
MIT License
43 stars 1 forks source link

\n to br #12

Open MarijnFK opened 4 months ago

MarijnFK commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

hi @MarijnFK so i found https://github.com/strapi/blocks-react-renderer/pull/42, we'll do it when it hits release.

MarijnFK commented 4 months ago

@reslear awesome, thanks for the reply