hi guys, line breaks that we enter within a rich text box are not pulling through to our site...
Hi Savio,
Welcome to Prismic community, I will try to help you on this.
Did you try hitting shift/cmd+enter in the prismic editor? If you are a developer on this project you might also need to update “prismic-dom” library to the latest version.
Here a discussion related to this.
Also make sure that you use asHtml
method in your codebase such as
PrismicDOM.RichText.asHtml(content.home.data.description)
as if you use asText
you lose the formatting.
Please let us know if that doesn’t solve the issue for you,
Fares
thanks Fares. i tried shift enter, did not work, i am checking with my dev team on the prismic-dom input.
I’m one of the developers. We are using latest prismic.io .net nuget package to achieve this.
We are already taking the text as html. Following is sample of how we do it:
document.GetStructuredText(section).AsHtml(DocumentLinkResolver.For((doc) => “/test-path/”)) ;
Threads close after a period of inactivity. Flag this thread to re-open it and continue the conversation.
Hello, I have the same problem I am using next.js, here the version of the technologies used: "react-dom": "^18.2.0" "next": "^12.3.1",
"react": "^18.2.0", "@prismicio/react": "^2.4.2", "@prismicio/helpers": "^2.3.1".The editors reported me that PrismicRichText does not recognize the line breaks in the text, I would like to know if there is any solution. I would like to know if there is a solution.
Hello @marketing10, it should work if you're using the correct latest versions of the kit.
Maybe it is something related to what Sam mentions in this post: Rich Text seems broken - #3 by samlittlefair
... you're using a line feed (
shift + enter
) instead of a carriage return (enter
) to create a line break. A line feed doesn't create a new paragraph; it creates a line break within the same paragraph, so the styles are applied to everything.