From f5e0c1065afbe0b1c27aa51435d65696f10f0390 Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Tue, 16 Nov 2021 22:32:55 +0100 Subject: [PATCH] [editor] Fix TextEditor bullet list extension ProseMirror seems not to allow editing text nodes. Since a text node can be a child of an element being applied the bullet list to, it fails for that text element. It seems it was workingly correctly before. The error seen on the console was inconsequential since we don't want to apply attributes to pure text nodes anyway. This change at least removes this error. --- projects/editor/src/app/text-editor/bulletList-extension.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/editor/src/app/text-editor/bulletList-extension.ts b/projects/editor/src/app/text-editor/bulletList-extension.ts index 27b866053..cb37f6fdf 100644 --- a/projects/editor/src/app/text-editor/bulletList-extension.ts +++ b/projects/editor/src/app/text-editor/bulletList-extension.ts @@ -28,7 +28,9 @@ export const bulletListExtension = BulletList.extend({ const node = tr?.doc?.nodeAt(pos); if (node) { const nodeAttrs = { ...node.attrs, listStyle: newStyle }; - return tr.setNodeMarkup(pos, node.type, nodeAttrs, node.marks); + if (node.type.name !== 'text') { + return tr.setNodeMarkup(pos, node.type, nodeAttrs, node.marks); + } } return tr; }; -- GitLab