Skip to content

Commit

Permalink
pushed fix for breaking editor and rule operators
Browse files Browse the repository at this point in the history
  • Loading branch information
arausly committed Dec 14, 2024
1 parent 9c33568 commit d14507b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/components/AutoSuggestion/extensions/markText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@ 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: {
title: config.title ?? "",
},
});
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 };
};

Expand Down

0 comments on commit d14507b

Please sign in to comment.