A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: markdown formulas in quill
thecodrr33b129352337
diff --git a/apps/web/src/components/editor/modules/markdown/index.js b/apps/web/src/components/editor/modules/markdown/index.jsindex 47a7b1d85..5711664bc 100644--- a/apps/web/src/components/editor/modules/markdown/index.js+++ b/apps/web/src/components/editor/modules/markdown/index.js@@ -265,7 +265,7 @@ class MarkdownShortcuts {let char = delta.ops[i].insert;if (char === " " || char === "\n") {this.onSpace(char, true);- } else this.onSpace("", false);+ } //else this.onSpace("", false);} else if (delta.ops[i].hasOwnProperty("delete") && source === "user") {this.onDelete();}@@ -291,10 +291,14 @@ class MarkdownShortcuts {// formulas count as a single character for insertion/deletion// purposes, yet they don't show up the output of getText.// So we have to compensate:- const delta = this.quill.getContents(lineStart, selection.index);- const numFormulas = delta.ops.filter((op) => op.insert && op.insert.formula)- .length;- const text = " ".repeat(numFormulas) + rawText;+ // see https://github.com/quilljs/quill/blob/cb0fb6630a59aa8efff3e0d1caa6645e565d19bd/core/editor.js#L147+ // for the implementation of getText, which is what we were using before here+ const text = this.quill+ .getContents(lineStart, selection.index)+ .filter((op) => typeof op.insert === "string" || op.insert.formula)+ .map((op) => (op.insert.formula ? " " : op.insert))+ .join("");+if (this.isValid(text, line.domNode.tagName)) {for (let match of this.matches) {const matchedText = text.match(match.pattern);