Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: remove old decorations before applying new ones

Abdullah Attab6e368d73089
diff --git a/packages/editor/src/extensions/code-block/highlighter.ts b/packages/editor/src/extensions/code-block/highlighter.ts
index cabc816ee..dd47d307d 100644
--- a/packages/editor/src/extensions/code-block/highlighter.ts
+++ b/packages/editor/src/extensions/code-block/highlighter.ts
@@ -160,6 +160,9 @@ export function HighlighterPlugin({
return decorationSet
.map(transaction.mapping, transaction.doc)
+ .remove(
+ decorationSet.find(block.start, block.pos + block.node.nodeSize)
+ )
.add(transaction.doc, newDecorations);
}
diff --git a/packages/editor/src/extensions/list-item/commands.ts b/packages/editor/src/extensions/list-item/commands.ts
index 6d4d05dce..7c7838445 100644
--- a/packages/editor/src/extensions/list-item/commands.ts
+++ b/packages/editor/src/extensions/list-item/commands.ts
@@ -68,6 +68,7 @@ export function onBackspacePressed(
return editor.chain().joinBackward().joinBackward().run();
}
}
+ return false;
}
export function onArrowUpPressed(editor: Editor, name: string, type: NodeType) {