From d14507ba8307b6b5f93fbcb9ef1a65c570a276f6 Mon Sep 17 00:00:00 2001 From: arausly Date: Sat, 14 Dec 2024 20:29:55 +0100 Subject: [PATCH] pushed fix for breaking editor and rule operators --- src/components/AutoSuggestion/extensions/markText.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/AutoSuggestion/extensions/markText.ts b/src/components/AutoSuggestion/extensions/markText.ts index 015d6d1c..9c536cf0 100644 --- a/src/components/AutoSuggestion/extensions/markText.ts +++ b/src/components/AutoSuggestion/extensions/markText.ts @@ -35,7 +35,6 @@ type marksConfig = { export const markText = (config: marksConfig) => { const docLength = config.view.state.doc.length; - if (!docLength) return { from: 0, to: 0 }; const strikeMark = Decoration.mark({ class: config.className, attributes: { @@ -43,10 +42,10 @@ export const markText = (config: marksConfig) => { }, }); const stopRange = Math.min(config.to, docLength); + if (!docLength || config.from === stopRange) return { from: 0, to: 0 }; config.view.dispatch({ effects: addMarks.of([strikeMark.range(config.from, stopRange)] as any), }); - return { from: config.from, to: stopRange }; };