mirror of
https://github.com/rivea0/obsidian-match-syntax.git
synced 2026-07-22 05:46:49 +00:00
fix: clear decorations only when they are present, otherwise show Notice
This commit is contained in:
parent
98b195ab6b
commit
6991d6433f
1 changed files with 5 additions and 2 deletions
|
|
@ -51,7 +51,11 @@ export default class MatchSyntaxPlugin extends Plugin {
|
|||
const cm6Editor: EditorView = editor.cm;
|
||||
const plugin = cm6Editor.plugin(highlightViewPlugin);
|
||||
if (plugin) {
|
||||
plugin.clearDeco();
|
||||
if (plugin.decorations === Decoration.none) {
|
||||
new Notice('No decorations found!');
|
||||
} else {
|
||||
plugin.clearDeco();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -106,7 +110,6 @@ class HighlighterPlugin implements PluginValue {
|
|||
constructor(view: EditorView) {
|
||||
this.decorations = Decoration.none;
|
||||
}
|
||||
|
||||
makeDeco(ranges: IRange[]) {
|
||||
const deco = [];
|
||||
const highlightDeco = Decoration.mark({
|
||||
|
|
|
|||
Loading…
Reference in a new issue