Skip to content

Commit

Permalink
fix(NcRichContenteditable): do not break adjacent mentions
Browse files Browse the repository at this point in the history
- when injecting HTML template, newlines, tabs and consecutive whitespaces should be stripped
- when parsing innerHTML (reverse process), collapsing of whitespacing also affecting two adjacent HTML templates
- parsed ids without whitespace will be joined and won't be rendered next time

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Nov 15, 2024
1 parent 5c88fe9 commit 7733d71
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mixins/richEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ export default {
*/
parseContent(content) {
let text = content
// Consecutive spaces in HTML tags should collapse
text = text.replace(/>\s+</g, '><')
// Replace break lines with new lines
text = text.replace(/<br>/gmi, '\n')
// Replace some html special characters
Expand Down Expand Up @@ -115,8 +113,10 @@ export default {
: `@"${value}"`
}

// Return template and make sure we strip of new lines and tabs
return this.renderComponentHtml(data, NcMentionBubble).replace(/[\n\t]/gmi, '')
// Return template and make sure we strip off new lines, tabs and consecutive whitespaces
return this.renderComponentHtml(data, NcMentionBubble)
.replace(/[\n\t]/gmi, '')
.replace(/>\s+</g, '><')
},

/**
Expand Down

0 comments on commit 7733d71

Please sign in to comment.