Skip to content

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

fix: note note saving on unlink & new list elem (fixes streetwriters/notesnook#219)

thecodrrd5b9f14e8d6d
diff --git a/apps/web/package.json b/apps/web/package.json
index 16f4a9cdc..3b85f12bb 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -11,7 +11,7 @@
"@mdi/react": "^1.4.0",
"@notesnook/desktop": "file:desktop",
"@rebass/forms": "^4.0.6",
- "@streetwritersco/tinymce-plugins": "^1.4.14",
+ "@streetwritersco/tinymce-plugins": "^1.4.15",
"@tinymce/tinymce-react": "^3.13.0",
"async-mutex": "^0.3.2",
"axios": "^0.21.4",
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index 0bbc78633..31052440c 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -24,7 +24,7 @@ import { FlexScrollContainer } from "../scroll-container";
import { formatDate } from "notes-core/utils/date";
const ReactMCE = React.lazy(() => import("./tinymce"));
-const EMPTY_CONTENT = "<p><br></p>";
+// const EMPTY_CONTENT = "<p><br></p>";
function editorSetContent(editor, content) {
const editorScroll = document.querySelector(".editorScroll");
if (editorScroll) editorScroll.scrollTop = 0;
diff --git a/apps/web/src/components/editor/tinymce.js b/apps/web/src/components/editor/tinymce.js
index c478c912d..ac1285698 100644
--- a/apps/web/src/components/editor/tinymce.js
+++ b/apps/web/src/components/editor/tinymce.js
@@ -132,10 +132,13 @@ const plugins = {
* 5. cut - called when content is cut
* 6. Redo - called after redo is done
* 7. Undo - called after undo is done
+ * 8. NewBlock - called when a new block is created (e.g. new list item)
+ * 9. ListMutation - called when a list is toggled
* We do not include the "change" event here as it is only
* invoked after the editor loses focus.
*/
-const changeEvents = "input paste ExecCommand ObjectResized cut Redo Undo";
+const changeEvents =
+ "input paste ExecCommand ObjectResized cut Redo Undo NewBlock ListMutation";
const ignoredCommand = ["mcerepaint", "mcefocus"];
function TinyMCE(props) {
@@ -248,6 +251,7 @@ function TinyMCE(props) {
}
const onEditorChange = debounce((e) => {
+ console.log(e);
if (
e.type === "execcommand" &&
ignoredCommand.includes(e.command.toLowerCase())