@rufous/ui 0.1.94 → 0.1.96
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 -37
- package/dist/main.css +43 -2
- package/dist/main.js +14 -37
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -49677,14 +49677,16 @@ function findMisspelled(doc3) {
|
|
|
49677
49677
|
function createSpellCheckPlugin() {
|
|
49678
49678
|
let debounceTimer = null;
|
|
49679
49679
|
let viewRef = null;
|
|
49680
|
+
let currentDecos = DecorationSet.empty;
|
|
49681
|
+
let currentDocSize = 0;
|
|
49680
49682
|
const runCheck = (view) => {
|
|
49681
49683
|
try {
|
|
49682
49684
|
if (!typo || !view?.dom?.isConnected || !view.state) return;
|
|
49683
49685
|
const { doc: doc3 } = view.state;
|
|
49684
49686
|
if (!doc3 || doc3.content.size <= 4) {
|
|
49685
|
-
|
|
49686
|
-
|
|
49687
|
-
view.dispatch(
|
|
49687
|
+
currentDecos = DecorationSet.empty;
|
|
49688
|
+
currentDocSize = doc3?.content.size || 0;
|
|
49689
|
+
view.dispatch(view.state.tr.setMeta("spellCheckDone", true).setMeta("addToHistory", false));
|
|
49688
49690
|
return;
|
|
49689
49691
|
}
|
|
49690
49692
|
const misspelled = findMisspelled(doc3);
|
|
@@ -49695,11 +49697,11 @@ function createSpellCheckPlugin() {
|
|
|
49695
49697
|
"data-spell-word": word
|
|
49696
49698
|
})
|
|
49697
49699
|
);
|
|
49698
|
-
|
|
49699
|
-
|
|
49700
|
-
tr.setMeta("addToHistory", false);
|
|
49701
|
-
view.dispatch(tr);
|
|
49700
|
+
currentDecos = DecorationSet.create(doc3, decos);
|
|
49701
|
+
currentDocSize = doc3.content.size;
|
|
49702
|
+
view.dispatch(view.state.tr.setMeta("spellCheckDone", true).setMeta("addToHistory", false));
|
|
49702
49703
|
} catch {
|
|
49704
|
+
currentDecos = DecorationSet.empty;
|
|
49703
49705
|
}
|
|
49704
49706
|
};
|
|
49705
49707
|
const scheduleCheck = (view) => {
|
|
@@ -49708,37 +49710,10 @@ function createSpellCheckPlugin() {
|
|
|
49708
49710
|
};
|
|
49709
49711
|
return new Plugin2({
|
|
49710
49712
|
key: spellCheckPluginKey,
|
|
49711
|
-
state: {
|
|
49712
|
-
init() {
|
|
49713
|
-
return DecorationSet.empty;
|
|
49714
|
-
},
|
|
49715
|
-
apply(tr, oldDecos, _oldState, newState) {
|
|
49716
|
-
const meta = tr.getMeta(spellCheckPluginKey);
|
|
49717
|
-
if (meta?.decorations) return meta.decorations;
|
|
49718
|
-
if (tr.docChanged) {
|
|
49719
|
-
if (newState.doc.content.size <= 4) return DecorationSet.empty;
|
|
49720
|
-
if (oldDecos === DecorationSet.empty) return DecorationSet.empty;
|
|
49721
|
-
try {
|
|
49722
|
-
const mapped = oldDecos.map(tr.mapping, tr.doc);
|
|
49723
|
-
if (!mapped || typeof mapped.find !== "function") return DecorationSet.empty;
|
|
49724
|
-
return mapped;
|
|
49725
|
-
} catch {
|
|
49726
|
-
return DecorationSet.empty;
|
|
49727
|
-
}
|
|
49728
|
-
}
|
|
49729
|
-
return oldDecos;
|
|
49730
|
-
}
|
|
49731
|
-
},
|
|
49732
49713
|
props: {
|
|
49733
49714
|
decorations(state) {
|
|
49734
|
-
|
|
49735
|
-
|
|
49736
|
-
if (!decos || decos === DecorationSet.empty) return DecorationSet.empty;
|
|
49737
|
-
decos.find();
|
|
49738
|
-
return decos;
|
|
49739
|
-
} catch {
|
|
49740
|
-
return DecorationSet.empty;
|
|
49741
|
-
}
|
|
49715
|
+
if (state.doc.content.size !== currentDocSize) return DecorationSet.empty;
|
|
49716
|
+
return currentDecos;
|
|
49742
49717
|
}
|
|
49743
49718
|
},
|
|
49744
49719
|
view(editorView) {
|
|
@@ -49747,17 +49722,19 @@ function createSpellCheckPlugin() {
|
|
|
49747
49722
|
if (viewRef) scheduleCheck(viewRef);
|
|
49748
49723
|
};
|
|
49749
49724
|
initSpellChecker().then(() => {
|
|
49750
|
-
if (viewRef) runCheck(viewRef);
|
|
49725
|
+
if (viewRef?.dom?.isConnected) runCheck(viewRef);
|
|
49751
49726
|
});
|
|
49752
49727
|
return {
|
|
49753
49728
|
update(view, prevState) {
|
|
49754
49729
|
viewRef = view;
|
|
49755
49730
|
if (view.state.doc !== prevState.doc) {
|
|
49731
|
+
currentDecos = DecorationSet.empty;
|
|
49756
49732
|
scheduleCheck(view);
|
|
49757
49733
|
}
|
|
49758
49734
|
},
|
|
49759
49735
|
destroy() {
|
|
49760
49736
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
49737
|
+
currentDecos = DecorationSet.empty;
|
|
49761
49738
|
viewRef = null;
|
|
49762
49739
|
scheduleRecheckFn = null;
|
|
49763
49740
|
}
|
package/dist/main.css
CHANGED
|
@@ -16345,13 +16345,54 @@ svg.jodit-icon {
|
|
|
16345
16345
|
}
|
|
16346
16346
|
.rf-rte-content ul[data-type=taskList] {
|
|
16347
16347
|
list-style: none;
|
|
16348
|
-
padding-left:
|
|
16348
|
+
padding-left: 8px;
|
|
16349
16349
|
}
|
|
16350
16350
|
.rf-rte-content ul[data-type=taskList] li {
|
|
16351
16351
|
display: flex;
|
|
16352
16352
|
align-items: flex-start;
|
|
16353
16353
|
gap: 8px;
|
|
16354
|
-
margin:
|
|
16354
|
+
margin: 8px 0;
|
|
16355
|
+
list-style: none;
|
|
16356
|
+
}
|
|
16357
|
+
.rf-rte-content ul[data-type=taskList] li::before {
|
|
16358
|
+
content: "";
|
|
16359
|
+
flex-shrink: 0;
|
|
16360
|
+
display: inline-block;
|
|
16361
|
+
width: 18px;
|
|
16362
|
+
height: 18px;
|
|
16363
|
+
margin-top: 4px;
|
|
16364
|
+
border-radius: 3px;
|
|
16365
|
+
border: 2px solid #dc2626;
|
|
16366
|
+
background-repeat: no-repeat;
|
|
16367
|
+
background-position: center;
|
|
16368
|
+
background-size: contain;
|
|
16369
|
+
background-image: url(https://storage.googleapis.com/rufous-com-bucket-1/static/images/todo-blank.svg);
|
|
16370
|
+
}
|
|
16371
|
+
.rf-rte-content ul[data-type=taskList] li[data-status=todo]::before {
|
|
16372
|
+
border-color: #dc2626;
|
|
16373
|
+
background-image: url(https://storage.googleapis.com/rufous-com-bucket-1/static/images/todo-blank.svg);
|
|
16374
|
+
}
|
|
16375
|
+
.rf-rte-content ul[data-type=taskList] li[data-status=working]::before {
|
|
16376
|
+
border-color: #2563eb;
|
|
16377
|
+
background-image: url(https://storage.googleapis.com/rufous-com-bucket-1/static/images/working.svg);
|
|
16378
|
+
}
|
|
16379
|
+
.rf-rte-content ul[data-type=taskList] li[data-status=blocked]::before {
|
|
16380
|
+
border-color: #1f2937;
|
|
16381
|
+
background-image: url(https://storage.googleapis.com/rufous-com-bucket-1/static/images/blocked.svg);
|
|
16382
|
+
}
|
|
16383
|
+
.rf-rte-content ul[data-type=taskList] li[data-status=resolved]::before {
|
|
16384
|
+
border-color: #16a34a;
|
|
16385
|
+
background-image: url(https://storage.googleapis.com/rufous-com-bucket-1/static/images/closed.svg);
|
|
16386
|
+
}
|
|
16387
|
+
.rf-rte-content ul[data-type=taskList] li[data-status=resolved] > p {
|
|
16388
|
+
text-decoration: line-through;
|
|
16389
|
+
color: #9ca3af;
|
|
16390
|
+
}
|
|
16391
|
+
.rf-rte-content ul[data-type=taskList] li > label {
|
|
16392
|
+
display: none;
|
|
16393
|
+
}
|
|
16394
|
+
.rf-rte-content ul[data-type=taskList] li > input[type=checkbox] {
|
|
16395
|
+
display: none;
|
|
16355
16396
|
}
|
|
16356
16397
|
.rf-rte-content blockquote {
|
|
16357
16398
|
border-left: 3px solid #6366f1;
|
package/dist/main.js
CHANGED
|
@@ -21007,14 +21007,16 @@ function findMisspelled(doc3) {
|
|
|
21007
21007
|
function createSpellCheckPlugin() {
|
|
21008
21008
|
let debounceTimer = null;
|
|
21009
21009
|
let viewRef = null;
|
|
21010
|
+
let currentDecos = DecorationSet.empty;
|
|
21011
|
+
let currentDocSize = 0;
|
|
21010
21012
|
const runCheck = (view) => {
|
|
21011
21013
|
try {
|
|
21012
21014
|
if (!typo || !view?.dom?.isConnected || !view.state) return;
|
|
21013
21015
|
const { doc: doc3 } = view.state;
|
|
21014
21016
|
if (!doc3 || doc3.content.size <= 4) {
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
view.dispatch(
|
|
21017
|
+
currentDecos = DecorationSet.empty;
|
|
21018
|
+
currentDocSize = doc3?.content.size || 0;
|
|
21019
|
+
view.dispatch(view.state.tr.setMeta("spellCheckDone", true).setMeta("addToHistory", false));
|
|
21018
21020
|
return;
|
|
21019
21021
|
}
|
|
21020
21022
|
const misspelled = findMisspelled(doc3);
|
|
@@ -21025,11 +21027,11 @@ function createSpellCheckPlugin() {
|
|
|
21025
21027
|
"data-spell-word": word
|
|
21026
21028
|
})
|
|
21027
21029
|
);
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
tr.setMeta("addToHistory", false);
|
|
21031
|
-
view.dispatch(tr);
|
|
21030
|
+
currentDecos = DecorationSet.create(doc3, decos);
|
|
21031
|
+
currentDocSize = doc3.content.size;
|
|
21032
|
+
view.dispatch(view.state.tr.setMeta("spellCheckDone", true).setMeta("addToHistory", false));
|
|
21032
21033
|
} catch {
|
|
21034
|
+
currentDecos = DecorationSet.empty;
|
|
21033
21035
|
}
|
|
21034
21036
|
};
|
|
21035
21037
|
const scheduleCheck = (view) => {
|
|
@@ -21038,37 +21040,10 @@ function createSpellCheckPlugin() {
|
|
|
21038
21040
|
};
|
|
21039
21041
|
return new Plugin({
|
|
21040
21042
|
key: spellCheckPluginKey,
|
|
21041
|
-
state: {
|
|
21042
|
-
init() {
|
|
21043
|
-
return DecorationSet.empty;
|
|
21044
|
-
},
|
|
21045
|
-
apply(tr, oldDecos, _oldState, newState) {
|
|
21046
|
-
const meta = tr.getMeta(spellCheckPluginKey);
|
|
21047
|
-
if (meta?.decorations) return meta.decorations;
|
|
21048
|
-
if (tr.docChanged) {
|
|
21049
|
-
if (newState.doc.content.size <= 4) return DecorationSet.empty;
|
|
21050
|
-
if (oldDecos === DecorationSet.empty) return DecorationSet.empty;
|
|
21051
|
-
try {
|
|
21052
|
-
const mapped = oldDecos.map(tr.mapping, tr.doc);
|
|
21053
|
-
if (!mapped || typeof mapped.find !== "function") return DecorationSet.empty;
|
|
21054
|
-
return mapped;
|
|
21055
|
-
} catch {
|
|
21056
|
-
return DecorationSet.empty;
|
|
21057
|
-
}
|
|
21058
|
-
}
|
|
21059
|
-
return oldDecos;
|
|
21060
|
-
}
|
|
21061
|
-
},
|
|
21062
21043
|
props: {
|
|
21063
21044
|
decorations(state) {
|
|
21064
|
-
|
|
21065
|
-
|
|
21066
|
-
if (!decos || decos === DecorationSet.empty) return DecorationSet.empty;
|
|
21067
|
-
decos.find();
|
|
21068
|
-
return decos;
|
|
21069
|
-
} catch {
|
|
21070
|
-
return DecorationSet.empty;
|
|
21071
|
-
}
|
|
21045
|
+
if (state.doc.content.size !== currentDocSize) return DecorationSet.empty;
|
|
21046
|
+
return currentDecos;
|
|
21072
21047
|
}
|
|
21073
21048
|
},
|
|
21074
21049
|
view(editorView) {
|
|
@@ -21077,17 +21052,19 @@ function createSpellCheckPlugin() {
|
|
|
21077
21052
|
if (viewRef) scheduleCheck(viewRef);
|
|
21078
21053
|
};
|
|
21079
21054
|
initSpellChecker().then(() => {
|
|
21080
|
-
if (viewRef) runCheck(viewRef);
|
|
21055
|
+
if (viewRef?.dom?.isConnected) runCheck(viewRef);
|
|
21081
21056
|
});
|
|
21082
21057
|
return {
|
|
21083
21058
|
update(view, prevState) {
|
|
21084
21059
|
viewRef = view;
|
|
21085
21060
|
if (view.state.doc !== prevState.doc) {
|
|
21061
|
+
currentDecos = DecorationSet.empty;
|
|
21086
21062
|
scheduleCheck(view);
|
|
21087
21063
|
}
|
|
21088
21064
|
},
|
|
21089
21065
|
destroy() {
|
|
21090
21066
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
21067
|
+
currentDecos = DecorationSet.empty;
|
|
21091
21068
|
viewRef = null;
|
|
21092
21069
|
scheduleRecheckFn = null;
|
|
21093
21070
|
}
|