Timothy Jaeryang Baek hai 3 meses
pai
achega
31c63d8898
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      src/lib/components/common/RichTextInput.svelte

+ 1 - 3
src/lib/components/common/RichTextInput.svelte

@@ -192,9 +192,7 @@
 			view.dispatch(tr);
 			view.dispatch(tr);
 		} else if (text === '') {
 		} else if (text === '') {
 			// Empty: replace with empty paragraph using tr
 			// Empty: replace with empty paragraph using tr
-			const emptyParagraph = schema.nodes.paragraph.create();
-			tr.replaceSelectionWith(emptyParagraph, false);
-			view.dispatch(tr);
+			editor.commands.clearContent();
 		} else {
 		} else {
 			// Single line: create paragraph with text
 			// Single line: create paragraph with text
 			const paragraph = schema.nodes.paragraph.create({}, schema.text(text));
 			const paragraph = schema.nodes.paragraph.create({}, schema.text(text));