Skip to content

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

fix: editor crash when readding code block

thecodrr7ed7390dcd77
diff --git a/apps/web/src/components/editor/plugins/code/plugin.js b/apps/web/src/components/editor/plugins/code/plugin.js
index c988a7de9..44bdab2f4 100644
--- a/apps/web/src/components/editor/plugins/code/plugin.js
+++ b/apps/web/src/components/editor/plugins/code/plugin.js
@@ -4,17 +4,9 @@ import tinymce from "tinymce/tinymce";
var global = tinymce.util.Tools.resolve("tinymce.PluginManager");
var replaceContent = function (editor, content) {
- const rng = editor.selection.getRng();
- let node = editor.selection.getNode();
- const innerHTML = node.innerHTML;
- node.remove();
editor.undoManager.transact(function () {
- setImmediate(() =>
- editor.execCommand("mceInsertContent", false, content(innerHTML))
- );
+ editor.execCommand("mceInsertContent", false, content("<br>"));
});
- editor.selection.setRng(rng, true);
- editor.nodeChanged();
};
var addCodeBlock = function (editor, api, type) {