From 4eb0faf75d324ab0ff50f15900cc987bb7611756 Mon Sep 17 00:00:00 2001 From: Aponia Date: Thu, 24 Oct 2024 06:30:14 -0700 Subject: [PATCH] fix(prosemirror): undoable inputrules --- packages/prose/src/toolkit/input-rules/custom-input-rules.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/prose/src/toolkit/input-rules/custom-input-rules.ts b/packages/prose/src/toolkit/input-rules/custom-input-rules.ts index 6fc981e0d71..42276031ba2 100644 --- a/packages/prose/src/toolkit/input-rules/custom-input-rules.ts +++ b/packages/prose/src/toolkit/input-rules/custom-input-rules.ts @@ -22,7 +22,10 @@ function run(view: EditorView, from: number, to: number, text: string, rules: In ).handler(state, match, from - (match[0].length - text.length), to) if (!tr) continue - view.dispatch(tr.setMeta(plugin, { transform: tr, from, to, text })) + // @ts-expect-error Internal property that should be in the class; only relevant if explicitly false. + if (rules[i]?.undoable !== false) + tr.setMeta(plugin, { transform: tr, from, to, text }) + view.dispatch(tr) return true } return false