@ylzcc/editor 0.1.1 → 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 +23 -30
- package/dist/editor.umd.js +2 -2
- package/package.json +1 -1
package/dist/editor.es.js
CHANGED
|
@@ -64394,42 +64394,33 @@ 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
|
-
// handleKeyDown(view, event) {
|
|
64421
|
-
// const { state } = view
|
|
64422
|
-
// const { selection, doc } = state
|
|
64423
|
-
// const { anchor, $from } = selection
|
|
64424
|
-
// // 仅针对第一个节点做限制
|
|
64425
|
-
// const node = doc.firstChild
|
|
64426
|
-
// console.log(anchor, node?.nodeSize)
|
|
64427
|
-
// if (event.key === 'Enter' && node && anchor <= node?.nodeSize) {
|
|
64428
|
-
// console.log(view, event)
|
|
64429
|
-
// return true
|
|
64430
|
-
// }
|
|
64431
|
-
// return false
|
|
64432
|
-
// },
|
|
64433
64424
|
}
|
|
64434
64425
|
})
|
|
64435
64426
|
];
|
|
@@ -140126,11 +140117,13 @@ let Editor = (Ff, kh) => {
|
|
|
140126
140117
|
},
|
|
140127
140118
|
changeMdTest: (Ome) => {
|
|
140128
140119
|
console.log(Ome, sme);
|
|
140129
|
-
const Cme =
|
|
140130
|
-
|
|
140131
|
-
|
|
140132
|
-
|
|
140133
|
-
|
|
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);
|
|
140134
140127
|
if (cme(Mme), (_me == null ? void 0 : _me.readyState) === 1) {
|
|
140135
140128
|
const $me = Mme ? textToBase64(Mme) : "";
|
|
140136
140129
|
_me == null || _me.send(JSON.stringify({
|