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: disable formula in markdown shortcuts
thecodrrf043bd1fff8e
diff --git a/apps/web/src/components/editor/modules/markdown/index.js b/apps/web/src/components/editor/modules/markdown/index.jsindex be2cd5eaa..684dc4599 100644--- a/apps/web/src/components/editor/modules/markdown/index.js+++ b/apps/web/src/components/editor/modules/markdown/index.js@@ -158,43 +158,43 @@ class MarkdownShortcuts {pattern: /(?:^|\s|\n|[^A-z0-9_*~`])(~{2})((?!\1).*?)(\1)($|\s|\n|[^A-z0-9_*~`])/g,action: this._makeInlineAction({ strike: true }),},- {- name: "displayformula",- pattern: /(?:\$\$)(.+?)(?:\$\$)/g,- action: (text, selection, pattern, lineStart) => {- let match = pattern.exec(text);+ // {+ // name: "displayformula",+ // pattern: /(?:\$\$)(.+?)(?:\$\$)/g,+ // action: (text, selection, pattern, lineStart) => {+ // let match = pattern.exec(text);- const annotatedText = match[0];- const matchedText = match[1];- const startIndex = lineStart + match.index;+ // const annotatedText = match[0];+ // const matchedText = match[1];+ // const startIndex = lineStart + match.index;- if (text.match(/^([*_ \n]+)$/g)) return;+ // if (text.match(/^([*_ \n]+)$/g)) return;- setTimeout(() => {- this.quill.deleteText(startIndex, annotatedText.length);- this.quill.insertEmbed(startIndex, "formula", matchedText);- this.quill.insertText(startIndex + 1, "\n", "align", "center");- }, 0);- },- },- {- name: "formula",- pattern: /(?:\$)(.+?)(?:\$)/g,- action: (text, selection, pattern, lineStart) => {- let match = pattern.exec(text);+ // setTimeout(() => {+ // this.quill.deleteText(startIndex, annotatedText.length);+ // this.quill.insertEmbed(startIndex, "formula", matchedText);+ // this.quill.insertText(startIndex + 1, "\n", "align", "center");+ // }, 0);+ // },+ // },+ // {+ // name: "formula",+ // pattern: /(?:\$)(.+?)(?:\$)/g,+ // action: (text, selection, pattern, lineStart) => {+ // let match = pattern.exec(text);- const annotatedText = match[0];- const matchedText = match[1];- const startIndex = lineStart + match.index;+ // const annotatedText = match[0];+ // const matchedText = match[1];+ // const startIndex = lineStart + match.index;- if (text.match(/^([*_ \n]+)$/g)) return;+ // if (text.match(/^([*_ \n]+)$/g)) return;- setTimeout(() => {- this.quill.deleteText(startIndex, annotatedText.length);- this.quill.insertEmbed(startIndex, "formula", matchedText);- }, 0);- },- },+ // setTimeout(() => {+ // this.quill.deleteText(startIndex, annotatedText.length);+ // this.quill.insertEmbed(startIndex, "formula", matchedText);+ // }, 0);+ // },+ // },{name: "code",pattern: /(?:^|\s|\n|[^A-z0-9_*~`])(`)((?!\1).*?)(\1)($|\s|\n|[^A-z0-9_*~`])/g,@@ -295,8 +295,8 @@ class MarkdownShortcuts {// for the implementation of getText, which is what we were using before hereconst text = this.quill.getContents(lineStart, selection.index)- .filter((op) => typeof op.insert === "string" || op.insert.formula)- .map((op) => (op.insert.formula ? " " : op.insert))+ .filter((op) => typeof op.insert === "string" /* || op.insert.formula*/)+ .map((op) => op.insert /*(op.insert.formula ? " " : op.insert) */).join("");if (this.isValid(text, line.domNode.tagName)) {