Skip to content

Commit

Permalink
fix: Duplicate br tags added in html when there is a line break in json
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwini1997727 committed Jan 9, 2024
1 parent d47d282 commit b5675ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/toRedactor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const toRedactor = (jsonValue: any,options?:IJsonToHtmlOptions) : string
text = `<span id=${jsonValue['id']}>${text}</span>`
}
}
if (jsonValue.text.includes('\n')) {
if (jsonValue.text.includes('\n') && !jsonValue['break']) {
text = text.replace(/\n/g, '<br/>')
}
Object.entries(jsonValue).forEach(([key, value]) => {
Expand Down

0 comments on commit b5675ef

Please sign in to comment.