@ylzcc/editor 0.1.0 → 0.1.2
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/editor.es.js +25 -19
- package/dist/editor.umd.js +2 -2
- package/package.json +1 -1
package/dist/editor.es.js
CHANGED
|
@@ -64394,28 +64394,32 @@ const Heading = Node$1.create({
|
|
|
64394
64394
|
};
|
|
64395
64395
|
},
|
|
64396
64396
|
addProseMirrorPlugins() {
|
|
64397
|
-
const { limitChar: Ff, onChange: kh } = this.options;
|
|
64397
|
+
const { limitChar: Ff, onChange: kh } = this.options, { editor: x_ } = this;
|
|
64398
64398
|
return [
|
|
64399
64399
|
new Plugin({
|
|
64400
64400
|
key: new PluginKey("titleLimit"),
|
|
64401
|
-
view: (
|
|
64402
|
-
update(
|
|
64403
|
-
const { state:
|
|
64404
|
-
(
|
|
64401
|
+
view: (B_) => ({
|
|
64402
|
+
update($_, $P) {
|
|
64403
|
+
const { state: zP } = $_, { doc: eme } = zP, tme = eme.firstChild, nme = $P.doc.firstChild;
|
|
64404
|
+
(tme == null ? void 0 : tme.textContent) !== (nme == null ? void 0 : nme.textContent) && kh(tme == null ? void 0 : tme.textContent);
|
|
64405
64405
|
}
|
|
64406
64406
|
}),
|
|
64407
64407
|
props: {
|
|
64408
|
-
handleTextInput(
|
|
64409
|
-
var
|
|
64410
|
-
const { state:
|
|
64411
|
-
if (
|
|
64412
|
-
if (
|
|
64408
|
+
handleTextInput(B_, $_, $P, zP) {
|
|
64409
|
+
var ame;
|
|
64410
|
+
const { state: eme } = B_, { selection: tme, doc: nme } = eme, { anchor: rme, $from: ime } = tme, ome = nme.firstChild;
|
|
64411
|
+
if (ome && rme <= (ome == null ? void 0 : ome.nodeSize)) {
|
|
64412
|
+
if (ome != null && ome.textContent && ((ame = ome == null ? void 0 : ome.textContent) == null ? void 0 : ame.length) >= Ff)
|
|
64413
64413
|
return !0;
|
|
64414
|
-
const
|
|
64415
|
-
if (
|
|
64414
|
+
const ume = new RegExp("^[a-zA-Z0-9 \\u4e00-\\u9fa5\\_\\-]+$");
|
|
64415
|
+
if (ome != null && ome.textContent && !ume.test((ome == null ? void 0 : ome.textContent) + zP))
|
|
64416
64416
|
return !0;
|
|
64417
64417
|
}
|
|
64418
64418
|
return !1;
|
|
64419
|
+
},
|
|
64420
|
+
handleKeyDown(B_, $_) {
|
|
64421
|
+
const { state: $P } = B_, { selection: zP, doc: eme } = $P, { anchor: tme, $from: nme } = zP, rme = eme.firstChild;
|
|
64422
|
+
return $_.key === "Enter" && rme && tme <= (rme == null ? void 0 : rme.nodeSize) ? (x_.commands.focus((rme == null ? void 0 : rme.nodeSize) + 1), !0) : !1;
|
|
64419
64423
|
}
|
|
64420
64424
|
}
|
|
64421
64425
|
})
|
|
@@ -140084,8 +140088,8 @@ let Editor = (Ff, kh) => {
|
|
|
140084
140088
|
Tme(eme);
|
|
140085
140089
|
}, [eme]), useEffect(() => {
|
|
140086
140090
|
if (tme) {
|
|
140087
|
-
const Ome =
|
|
140088
|
-
xme(
|
|
140091
|
+
const Ome = Ime(tme), Cme = toEditorJSON(Ome);
|
|
140092
|
+
xme(Cme);
|
|
140089
140093
|
}
|
|
140090
140094
|
}, [tme]), useImperativeHandle(kh, () => ({
|
|
140091
140095
|
update: () => {
|
|
@@ -140113,11 +140117,13 @@ let Editor = (Ff, kh) => {
|
|
|
140113
140117
|
},
|
|
140114
140118
|
changeMdTest: (Ome) => {
|
|
140115
140119
|
console.log(Ome, sme);
|
|
140116
|
-
const Cme =
|
|
140117
|
-
|
|
140118
|
-
|
|
140119
|
-
|
|
140120
|
-
|
|
140120
|
+
const Cme = [];
|
|
140121
|
+
sme == null || sme.children.forEach(
|
|
140122
|
+
($me) => {
|
|
140123
|
+
(($me == null ? void 0 : $me.props) !== "active" || ($me == null ? void 0 : $me.value) !== Ome[0].value) && Cme.push($me);
|
|
140124
|
+
}
|
|
140125
|
+
), sme.children = Cme;
|
|
140126
|
+
const Mme = Fme(sme);
|
|
140121
140127
|
if (cme(Mme), (_me == null ? void 0 : _me.readyState) === 1) {
|
|
140122
140128
|
const $me = Mme ? textToBase64(Mme) : "";
|
|
140123
140129
|
_me == null || _me.send(JSON.stringify({
|