prevent empty decorations
This commit is contained in:
@@ -42,11 +42,14 @@ function getDecorations({ doc, name }: { doc: ProsemirrorNode, name: string}) {
|
|||||||
|
|
||||||
parseNodes(nodes).forEach(node => {
|
parseNodes(nodes).forEach(node => {
|
||||||
const to = from + node.text.length
|
const to = from + node.text.length
|
||||||
const decoration = Decoration.inline(from, to, {
|
|
||||||
class: node.classes.join(' '),
|
|
||||||
})
|
|
||||||
|
|
||||||
decorations.push(decoration)
|
if (node.classes.length) {
|
||||||
|
const decoration = Decoration.inline(from, to, {
|
||||||
|
class: node.classes.join(' '),
|
||||||
|
})
|
||||||
|
|
||||||
|
decorations.push(decoration)
|
||||||
|
}
|
||||||
|
|
||||||
from = to
|
from = to
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user