@rufous/ui 0.1.96 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.cjs +14 -7
- package/dist/main.js +14 -7
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -49678,15 +49678,14 @@ function createSpellCheckPlugin() {
|
|
|
49678
49678
|
let debounceTimer = null;
|
|
49679
49679
|
let viewRef = null;
|
|
49680
49680
|
let currentDecos = DecorationSet.empty;
|
|
49681
|
-
let
|
|
49681
|
+
let currentDoc = null;
|
|
49682
49682
|
const runCheck = (view) => {
|
|
49683
49683
|
try {
|
|
49684
49684
|
if (!typo || !view?.dom?.isConnected || !view.state) return;
|
|
49685
49685
|
const { doc: doc3 } = view.state;
|
|
49686
49686
|
if (!doc3 || doc3.content.size <= 4) {
|
|
49687
49687
|
currentDecos = DecorationSet.empty;
|
|
49688
|
-
|
|
49689
|
-
view.dispatch(view.state.tr.setMeta("spellCheckDone", true).setMeta("addToHistory", false));
|
|
49688
|
+
currentDoc = doc3;
|
|
49690
49689
|
return;
|
|
49691
49690
|
}
|
|
49692
49691
|
const misspelled = findMisspelled(doc3);
|
|
@@ -49698,21 +49697,28 @@ function createSpellCheckPlugin() {
|
|
|
49698
49697
|
})
|
|
49699
49698
|
);
|
|
49700
49699
|
currentDecos = DecorationSet.create(doc3, decos);
|
|
49701
|
-
|
|
49702
|
-
view.
|
|
49700
|
+
currentDoc = doc3;
|
|
49701
|
+
if (view.dom?.isConnected && !view.isDestroyed) {
|
|
49702
|
+
const tr = view.state.tr.setMeta("spellCheckDone", true);
|
|
49703
|
+
tr.setMeta("addToHistory", false);
|
|
49704
|
+
view.dispatch(tr);
|
|
49705
|
+
}
|
|
49703
49706
|
} catch {
|
|
49704
49707
|
currentDecos = DecorationSet.empty;
|
|
49708
|
+
currentDoc = null;
|
|
49705
49709
|
}
|
|
49706
49710
|
};
|
|
49707
49711
|
const scheduleCheck = (view) => {
|
|
49708
49712
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
49709
|
-
debounceTimer = setTimeout(() =>
|
|
49713
|
+
debounceTimer = setTimeout(() => {
|
|
49714
|
+
if (viewRef?.dom?.isConnected) runCheck(viewRef);
|
|
49715
|
+
}, 500);
|
|
49710
49716
|
};
|
|
49711
49717
|
return new Plugin2({
|
|
49712
49718
|
key: spellCheckPluginKey,
|
|
49713
49719
|
props: {
|
|
49714
49720
|
decorations(state) {
|
|
49715
|
-
if (state.doc
|
|
49721
|
+
if (state.doc !== currentDoc) return DecorationSet.empty;
|
|
49716
49722
|
return currentDecos;
|
|
49717
49723
|
}
|
|
49718
49724
|
},
|
|
@@ -49735,6 +49741,7 @@ function createSpellCheckPlugin() {
|
|
|
49735
49741
|
destroy() {
|
|
49736
49742
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
49737
49743
|
currentDecos = DecorationSet.empty;
|
|
49744
|
+
currentDoc = null;
|
|
49738
49745
|
viewRef = null;
|
|
49739
49746
|
scheduleRecheckFn = null;
|
|
49740
49747
|
}
|
package/dist/main.js
CHANGED
|
@@ -21008,15 +21008,14 @@ function createSpellCheckPlugin() {
|
|
|
21008
21008
|
let debounceTimer = null;
|
|
21009
21009
|
let viewRef = null;
|
|
21010
21010
|
let currentDecos = DecorationSet.empty;
|
|
21011
|
-
let
|
|
21011
|
+
let currentDoc = null;
|
|
21012
21012
|
const runCheck = (view) => {
|
|
21013
21013
|
try {
|
|
21014
21014
|
if (!typo || !view?.dom?.isConnected || !view.state) return;
|
|
21015
21015
|
const { doc: doc3 } = view.state;
|
|
21016
21016
|
if (!doc3 || doc3.content.size <= 4) {
|
|
21017
21017
|
currentDecos = DecorationSet.empty;
|
|
21018
|
-
|
|
21019
|
-
view.dispatch(view.state.tr.setMeta("spellCheckDone", true).setMeta("addToHistory", false));
|
|
21018
|
+
currentDoc = doc3;
|
|
21020
21019
|
return;
|
|
21021
21020
|
}
|
|
21022
21021
|
const misspelled = findMisspelled(doc3);
|
|
@@ -21028,21 +21027,28 @@ function createSpellCheckPlugin() {
|
|
|
21028
21027
|
})
|
|
21029
21028
|
);
|
|
21030
21029
|
currentDecos = DecorationSet.create(doc3, decos);
|
|
21031
|
-
|
|
21032
|
-
view.
|
|
21030
|
+
currentDoc = doc3;
|
|
21031
|
+
if (view.dom?.isConnected && !view.isDestroyed) {
|
|
21032
|
+
const tr = view.state.tr.setMeta("spellCheckDone", true);
|
|
21033
|
+
tr.setMeta("addToHistory", false);
|
|
21034
|
+
view.dispatch(tr);
|
|
21035
|
+
}
|
|
21033
21036
|
} catch {
|
|
21034
21037
|
currentDecos = DecorationSet.empty;
|
|
21038
|
+
currentDoc = null;
|
|
21035
21039
|
}
|
|
21036
21040
|
};
|
|
21037
21041
|
const scheduleCheck = (view) => {
|
|
21038
21042
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
21039
|
-
debounceTimer = setTimeout(() =>
|
|
21043
|
+
debounceTimer = setTimeout(() => {
|
|
21044
|
+
if (viewRef?.dom?.isConnected) runCheck(viewRef);
|
|
21045
|
+
}, 500);
|
|
21040
21046
|
};
|
|
21041
21047
|
return new Plugin({
|
|
21042
21048
|
key: spellCheckPluginKey,
|
|
21043
21049
|
props: {
|
|
21044
21050
|
decorations(state) {
|
|
21045
|
-
if (state.doc
|
|
21051
|
+
if (state.doc !== currentDoc) return DecorationSet.empty;
|
|
21046
21052
|
return currentDecos;
|
|
21047
21053
|
}
|
|
21048
21054
|
},
|
|
@@ -21065,6 +21071,7 @@ function createSpellCheckPlugin() {
|
|
|
21065
21071
|
destroy() {
|
|
21066
21072
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
21067
21073
|
currentDecos = DecorationSet.empty;
|
|
21074
|
+
currentDoc = null;
|
|
21068
21075
|
viewRef = null;
|
|
21069
21076
|
scheduleRecheckFn = null;
|
|
21070
21077
|
}
|