Skip to content

Commit

Permalink
fix(NcRichText): unlock tests, patch component
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Feb 7, 2025
1 parent 292ffdd commit 67d8c5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/NcRichText/NcRichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,9 @@ export default {
})
.processSync(this.text
// escape special symbol "<" to not treat text as HTML
.replace(/<[^>]+>/g, (match) => match.replace(/</g, '&lt;')),
.replace(/<[^>]+>/g, (match) => match.replace(/</g, '&lt;'))
// unescape special symbol ">" to parse blockquotes
.replace(/&gt;/gmi, '>'),
)
.result

Expand All @@ -506,7 +508,7 @@ export default {
props.key = key
}
// Children should be always an array
let children = props.children ?? []
const children = props.children ?? []
delete props.children

if (!String(type).startsWith('#')) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NcRichText/remarkUnescape.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { visit, SKIP } from 'unist-util-visit'

export const remarkUnescape = function() {
return function(tree) {
visit(tree, (node) => node.type === 'text' || node.type === 'code',
visit(tree, (node) => ['text', 'code', 'inlineCode'].includes(node.type),
(node, index, parent) => {
parent.children.splice(index, 1, {
...node,
Expand Down

0 comments on commit 67d8c5d

Please sign in to comment.