We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c33568 commit d14507bCopy full SHA for d14507b
1 file changed
src/components/AutoSuggestion/extensions/markText.ts
@@ -35,18 +35,17 @@ type marksConfig = {
35
36
export const markText = (config: marksConfig) => {
37
const docLength = config.view.state.doc.length;
38
- if (!docLength) return { from: 0, to: 0 };
39
const strikeMark = Decoration.mark({
40
class: config.className,
41
attributes: {
42
title: config.title ?? "",
43
},
44
});
45
const stopRange = Math.min(config.to, docLength);
+ if (!docLength || config.from === stopRange) return { from: 0, to: 0 };
46
config.view.dispatch({
47
effects: addMarks.of([strikeMark.range(config.from, stopRange)] as any),
48
49
-
50
return { from: config.from, to: stopRange };
51
};
52
0 commit comments