@ylzcc/editor 0.1.3 → 0.1.5
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 +38 -15
- package/dist/editor.umd.js +3 -3
- package/package.json +1 -1
package/dist/editor.es.js
CHANGED
|
@@ -64396,6 +64396,17 @@ const Heading = Node$1.create({
|
|
|
64396
64396
|
// 标题是否可以编辑
|
|
64397
64397
|
};
|
|
64398
64398
|
},
|
|
64399
|
+
// addKeyboardShortcuts() {
|
|
64400
|
+
// return {
|
|
64401
|
+
// 'Mod-x': (props) => {
|
|
64402
|
+
// console.log(props)
|
|
64403
|
+
// return true
|
|
64404
|
+
// },
|
|
64405
|
+
// 'Mod-v': (props) => {
|
|
64406
|
+
// return true
|
|
64407
|
+
// }
|
|
64408
|
+
// }
|
|
64409
|
+
// },
|
|
64399
64410
|
addProseMirrorPlugins() {
|
|
64400
64411
|
const { limitChar: Ff, onChange: kh, editable: x_ } = this.options, { editor: B_ } = this;
|
|
64401
64412
|
return [
|
|
@@ -64404,7 +64415,7 @@ const Heading = Node$1.create({
|
|
|
64404
64415
|
view: ($_) => ({
|
|
64405
64416
|
update($P, zP) {
|
|
64406
64417
|
const { state: eme } = $P, { doc: tme } = eme, nme = tme.firstChild, rme = zP.doc.firstChild;
|
|
64407
|
-
(nme == null ? void 0 : nme.textContent) !== (rme == null ? void 0 : rme.textContent) && kh(nme == null ? void 0 : nme.textContent);
|
|
64418
|
+
x_ && (nme == null ? void 0 : nme.textContent) !== (rme == null ? void 0 : rme.textContent) && kh(nme == null ? void 0 : nme.textContent);
|
|
64408
64419
|
}
|
|
64409
64420
|
}),
|
|
64410
64421
|
props: {
|
|
@@ -64424,6 +64435,12 @@ const Heading = Node$1.create({
|
|
|
64424
64435
|
const { state: zP } = $_, { selection: eme, doc: tme } = zP, { anchor: nme, $from: rme } = eme, ime = tme.firstChild;
|
|
64425
64436
|
return $P.key === "Enter" && ime && nme <= (ime == null ? void 0 : ime.nodeSize) ? (B_.commands.focus((ime == null ? void 0 : ime.nodeSize) + 1), !0) : !1;
|
|
64426
64437
|
}
|
|
64438
|
+
},
|
|
64439
|
+
filterTransaction($_, $P) {
|
|
64440
|
+
if (x_)
|
|
64441
|
+
return !0;
|
|
64442
|
+
const zP = $_.doc.firstChild, eme = $P.doc.firstChild;
|
|
64443
|
+
return (zP == null ? void 0 : zP.textContent) === (eme == null ? void 0 : eme.textContent);
|
|
64427
64444
|
}
|
|
64428
64445
|
})
|
|
64429
64446
|
];
|
|
@@ -88215,7 +88232,7 @@ const upload = async (Ff) => {
|
|
|
88215
88232
|
x_.type = "text", x_.text = Ff == null ? void 0 : Ff.value;
|
|
88216
88233
|
break;
|
|
88217
88234
|
case "code":
|
|
88218
|
-
(Ff == null ? void 0 : Ff.props) === "active" ? (x_.type = "active", x_.attrs = { language: Ff == null ? void 0 : Ff.lang, id: Ff == null ? void 0 : Ff.value }) : (Ff == null ? void 0 : Ff.props) === "exec" ? (x_.type = "codeBlock", x_.attrs = { language: Ff == null ? void 0 : Ff.lang, exec: !0 }, x_.content = [{ type: "text", text: Ff == null ? void 0 : Ff.value }]) : (x_.type = "codeBlock", x_.attrs = { language: Ff == null ? void 0 : Ff.lang }, x_.content = [{ type: "text", text: Ff == null ? void 0 : Ff.value }]);
|
|
88235
|
+
(Ff == null ? void 0 : Ff.props) === "active" ? (x_.type = "active", x_.attrs = { language: Ff == null ? void 0 : Ff.lang, id: Ff == null ? void 0 : Ff.value }) : (Ff == null ? void 0 : Ff.props) === "exec" ? (x_.type = "codeBlock", x_.attrs = { language: Ff == null ? void 0 : Ff.lang, exec: !0 }, x_.content = Ff != null && Ff.value ? [{ type: "text", text: Ff == null ? void 0 : Ff.value }] : []) : (x_.type = "codeBlock", x_.attrs = { language: Ff == null ? void 0 : Ff.lang }, x_.content = Ff != null && Ff.value ? [{ type: "text", text: Ff == null ? void 0 : Ff.value }] : []);
|
|
88219
88236
|
break;
|
|
88220
88237
|
case "inlineCode":
|
|
88221
88238
|
x_.type = "text", x_.text = Ff == null ? void 0 : Ff.value, x_.marks = [{ type: "code" }];
|
|
@@ -139996,19 +140013,22 @@ let Editor = (Ff, kh) => {
|
|
|
139996
140013
|
const { data: $me } = Bme;
|
|
139997
140014
|
try {
|
|
139998
140015
|
const Ume = JSON.parse($me), Vme = Ume == null ? void 0 : Ume.type, Gme = Ume == null ? void 0 : Ume.data;
|
|
139999
|
-
if (Vme === "read"
|
|
140000
|
-
|
|
140001
|
-
|
|
140002
|
-
|
|
140003
|
-
|
|
140004
|
-
|
|
140005
|
-
|
|
140006
|
-
|
|
140016
|
+
if (Vme === "read")
|
|
140017
|
+
if (Gme) {
|
|
140018
|
+
const zme = base64ToText$1(Gme);
|
|
140019
|
+
sme(zme);
|
|
140020
|
+
const qme = Fme(zme);
|
|
140021
|
+
dme(qme);
|
|
140022
|
+
const u_e = toEditorJSON(qme);
|
|
140023
|
+
Pme(u_e);
|
|
140024
|
+
} else
|
|
140025
|
+
Pme("");
|
|
140007
140026
|
} catch (Ume) {
|
|
140008
140027
|
console.log(Ume);
|
|
140009
140028
|
}
|
|
140010
140029
|
}, Dme.onclose = function(Bme) {
|
|
140011
|
-
Bme.code
|
|
140030
|
+
const $me = Bme.code;
|
|
140031
|
+
$me < 3e3 && $me !== 1005 && Ame(!0);
|
|
140012
140032
|
};
|
|
140013
140033
|
} catch (Dme) {
|
|
140014
140034
|
console.log(Dme);
|
|
@@ -140048,7 +140068,7 @@ let Editor = (Ff, kh) => {
|
|
|
140048
140068
|
};
|
|
140049
140069
|
useEffect(() => (fme && (fme == null || fme.on("update", Ome)), () => {
|
|
140050
140070
|
fme && (fme == null || fme.off("update", Ome));
|
|
140051
|
-
}), [fme, yme]), useEffect(() => {
|
|
140071
|
+
}), [fme, yme, Sme]), useEffect(() => {
|
|
140052
140072
|
if (fme && xme !== void 0 && Lme) {
|
|
140053
140073
|
if (x_) {
|
|
140054
140074
|
const Dme = {
|
|
@@ -140057,9 +140077,12 @@ let Editor = (Ff, kh) => {
|
|
|
140057
140077
|
type: "text",
|
|
140058
140078
|
text: nme
|
|
140059
140079
|
}] : []
|
|
140060
|
-
}, Bme = {
|
|
140080
|
+
}, Bme = xme ? {
|
|
140061
140081
|
...xme,
|
|
140062
140082
|
content: xme != null && xme.content ? [Dme, ...xme.content] : [Dme]
|
|
140083
|
+
} : {
|
|
140084
|
+
type: "document",
|
|
140085
|
+
content: [Dme]
|
|
140063
140086
|
};
|
|
140064
140087
|
fme.commands.setContent(Bme);
|
|
140065
140088
|
} else
|
|
@@ -140094,7 +140117,7 @@ let Editor = (Ff, kh) => {
|
|
|
140094
140117
|
}, [eme]);
|
|
140095
140118
|
const Tme = (Dme) => {
|
|
140096
140119
|
const Bme = Dme == null ? void 0 : Dme.target;
|
|
140097
|
-
Bme.classList.contains("exec-btn") && ome && (ome == null || ome(Bme.getAttribute("data-value") ?? ""));
|
|
140120
|
+
Bme.classList.contains("exec-btn") && (console.log(Bme), ome && (ome == null || ome(Bme.getAttribute("data-value") ?? "")));
|
|
140098
140121
|
};
|
|
140099
140122
|
return useEffect(() => {
|
|
140100
140123
|
if (tme) {
|
|
@@ -140103,7 +140126,7 @@ let Editor = (Ff, kh) => {
|
|
|
140103
140126
|
}
|
|
140104
140127
|
}, [tme]), useEffect(() => (window.addEventListener("click", Tme), () => {
|
|
140105
140128
|
window.removeEventListener("click", Tme);
|
|
140106
|
-
}), []), useImperativeHandle(kh, () => ({
|
|
140129
|
+
}), [fme]), useImperativeHandle(kh, () => ({
|
|
140107
140130
|
update: () => {
|
|
140108
140131
|
const Dme = setTimeout(() => {
|
|
140109
140132
|
var Bme;
|