Skip to content

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

editor: fix backticks create inline code even with Markdown Shortcuts disabled (#9415)

Copilotd5bf8a6e3cb1
diff --git a/packages/editor/patches/prosemirror-codemark+0.4.2.patch b/packages/editor/patches/prosemirror-codemark+0.4.2.patch
new file mode 100644
index 000000000..464860335
--- /dev/null
+++ b/packages/editor/patches/prosemirror-codemark+0.4.2.patch
@@ -0,0 +1,47 @@
+diff --git a/node_modules/prosemirror-codemark/dist/cjs/plugin.js b/node_modules/prosemirror-codemark/dist/cjs/plugin.js
+index 8cd0b87..768083c 100644
+--- a/node_modules/prosemirror-codemark/dist/cjs/plugin.js
++++ b/node_modules/prosemirror-codemark/dist/cjs/plugin.js
+@@ -4,7 +4,6 @@ exports.codemark = exports.getDecorationPlugin = void 0;
+ const prosemirror_state_1 = require("prosemirror-state");
+ const prosemirror_view_1 = require("prosemirror-view");
+ const utils_1 = require("./utils");
+-const inputRules_1 = require("./inputRules");
+ const actions_1 = require("./actions");
+ function toDom() {
+ const span = document.createElement('span');
+@@ -106,8 +105,8 @@ function getDecorationPlugin(opts) {
+ exports.getDecorationPlugin = getDecorationPlugin;
+ function codemark(opts) {
+ const cursorPlugin = getDecorationPlugin(opts);
+- const inputRule = (0, inputRules_1.createInputRule)(cursorPlugin, opts);
+- const rules = [cursorPlugin, inputRule];
++ // const inputRule = (0, inputRules_1.createInputRule)(cursorPlugin, opts);
++ const rules = [cursorPlugin];
+ return rules;
+ }
+ exports.codemark = codemark;
+diff --git a/node_modules/prosemirror-codemark/dist/esm/plugin.js b/node_modules/prosemirror-codemark/dist/esm/plugin.js
+index c530022..a71d29e 100644
+--- a/node_modules/prosemirror-codemark/dist/esm/plugin.js
++++ b/node_modules/prosemirror-codemark/dist/esm/plugin.js
+@@ -1,7 +1,6 @@
+ import { Plugin } from 'prosemirror-state';
+ import { Decoration, DecorationSet } from 'prosemirror-view';
+ import { getMarkType, pluginKey, safeResolve } from './utils';
+-import { createInputRule } from './inputRules';
+ import { onArrowLeft, onArrowRight, onBackspace, onBacktick, onDelete, stepOutside, stepOutsideNextTrAndPass, } from './actions';
+ function toDom() {
+ const span = document.createElement('span');
+@@ -102,8 +101,8 @@ export function getDecorationPlugin(opts) {
+ }
+ export function codemark(opts) {
+ const cursorPlugin = getDecorationPlugin(opts);
+- const inputRule = createInputRule(cursorPlugin, opts);
+- const rules = [cursorPlugin, inputRule];
++ // const inputRule = createInputRule(cursorPlugin, opts);
++ const rules = [cursorPlugin];
+ return rules;
+ }
+ //# sourceMappingURL=plugin.js.map
+\ No newline at end of file
diff --git a/packages/editor/src/extensions/inline-code/inline-code.ts b/packages/editor/src/extensions/inline-code/inline-code.ts
index 9fddbc881..84c4209c2 100644
--- a/packages/editor/src/extensions/inline-code/inline-code.ts
+++ b/packages/editor/src/extensions/inline-code/inline-code.ts
@@ -1,3 +1,22 @@
+/*
+This file is part of the Notesnook project (https://notesnook.com/)
+
+Copyright (C) 2023 Streetwriters (Private) Limited
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
import Code from "@tiptap/extension-code";
export const InlineCode = Code.extend({