@jenkin-a/jeditor 1.0.4 → 1.0.8
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/README.en.md +36 -156
- package/README.md +39 -161
- package/dist/jeditor.css +1 -1
- package/dist/jeditor.es.js +824 -695
- package/dist/jeditor.iife.js +57 -57
- package/dist/jeditor.umd.js +57 -57
- package/package.json +1 -1
package/dist/jeditor.es.js
CHANGED
|
@@ -505,13 +505,13 @@ function re(e, t, n, r) {
|
|
|
505
505
|
if (i == t.index(r) && r < e.depth - n.openStart) {
|
|
506
506
|
let o = re(e, t, n, r + 1);
|
|
507
507
|
return a.copy(a.content.replaceChild(i, o));
|
|
508
|
-
} else if (!n.content.size) return
|
|
508
|
+
} else if (!n.content.size) return N(a, ce(e, t, r));
|
|
509
509
|
else if (!n.openStart && !n.openEnd && e.depth == r && t.depth == r) {
|
|
510
510
|
let r = e.parent, i = r.content;
|
|
511
|
-
return
|
|
511
|
+
return N(r, i.cut(0, e.parentOffset).append(n.content).append(i.cut(t.parentOffset)));
|
|
512
512
|
} else {
|
|
513
|
-
let { start: i, end: o } =
|
|
514
|
-
return
|
|
513
|
+
let { start: i, end: o } = le(n, e);
|
|
514
|
+
return N(a, se(e, i, o, t, r));
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
function ie(e, t) {
|
|
@@ -525,24 +525,24 @@ function M(e, t) {
|
|
|
525
525
|
let n = t.length - 1;
|
|
526
526
|
n >= 0 && e.isText && e.sameMarkup(t[n]) ? t[n] = e.withText(t[n].text + e.text) : t.push(e);
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function oe(e, t, n, r) {
|
|
529
529
|
let i = (t || e).node(n), a = 0, o = t ? t.index(n) : i.childCount;
|
|
530
530
|
e && (a = e.index(n), e.depth > n ? a++ : e.textOffset && (M(e.nodeAfter, r), a++));
|
|
531
531
|
for (let e = a; e < o; e++) M(i.child(e), r);
|
|
532
532
|
t && t.depth == n && t.textOffset && M(t.nodeBefore, r);
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function N(e, t) {
|
|
535
535
|
return e.type.checkContent(t), e.copy(t);
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function se(e, t, n, r, i) {
|
|
538
538
|
let a = e.depth > i && ae(e, t, i + 1), o = r.depth > i && ae(n, r, i + 1), s = [];
|
|
539
|
-
return
|
|
539
|
+
return oe(null, e, i, s), a && o && t.index(i) == n.index(i) ? (ie(a, o), M(N(a, se(e, t, n, r, i + 1)), s)) : (a && M(N(a, ce(e, t, i + 1)), s), oe(t, n, i, s), o && M(N(o, ce(n, r, i + 1)), s)), oe(r, null, i, s), new T(s);
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function ce(e, t, n) {
|
|
542
542
|
let r = [];
|
|
543
|
-
return
|
|
543
|
+
return oe(null, e, n, r), e.depth > n && M(N(ae(e, t, n + 1), ce(e, t, n + 1)), r), oe(t, null, n, r), new T(r);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function le(e, t) {
|
|
546
546
|
let n = t.depth - e.openStart, r = t.node(n).copy(e.content);
|
|
547
547
|
for (let e = n - 1; e >= 0; e--) r = t.node(e).copy(T.from(r));
|
|
548
548
|
return {
|
|
@@ -550,7 +550,7 @@ function ce(e, t) {
|
|
|
550
550
|
end: r.resolveNoCache(r.content.size - e.openEnd - n)
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
|
-
var
|
|
553
|
+
var ue = class e {
|
|
554
554
|
constructor(e, t, n) {
|
|
555
555
|
this.pos = e, this.path = t, this.parentOffset = n, this.depth = t.length / 3 - 1;
|
|
556
556
|
}
|
|
@@ -631,7 +631,7 @@ var le = class e {
|
|
|
631
631
|
}
|
|
632
632
|
blockRange(e = this, t) {
|
|
633
633
|
if (e.pos < this.pos) return e.blockRange(this);
|
|
634
|
-
for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--) if (e.pos <= this.end(n) && (!t || t(this.node(n)))) return new
|
|
634
|
+
for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--) if (e.pos <= this.end(n) && (!t || t(this.node(n)))) return new me(this, e, n);
|
|
635
635
|
return null;
|
|
636
636
|
}
|
|
637
637
|
sameParent(e) {
|
|
@@ -659,20 +659,20 @@ var le = class e {
|
|
|
659
659
|
return new e(n, r, a);
|
|
660
660
|
}
|
|
661
661
|
static resolveCached(t, n) {
|
|
662
|
-
let r =
|
|
662
|
+
let r = pe.get(t);
|
|
663
663
|
if (r) for (let e = 0; e < r.elts.length; e++) {
|
|
664
664
|
let t = r.elts[e];
|
|
665
665
|
if (t.pos == n) return t;
|
|
666
666
|
}
|
|
667
|
-
else
|
|
667
|
+
else pe.set(t, r = new de());
|
|
668
668
|
let i = r.elts[r.i] = e.resolve(t, n);
|
|
669
|
-
return r.i = (r.i + 1) %
|
|
669
|
+
return r.i = (r.i + 1) % fe, i;
|
|
670
670
|
}
|
|
671
|
-
},
|
|
671
|
+
}, de = class {
|
|
672
672
|
constructor() {
|
|
673
673
|
this.elts = [], this.i = 0;
|
|
674
674
|
}
|
|
675
|
-
},
|
|
675
|
+
}, fe = 12, pe = /* @__PURE__ */ new WeakMap(), me = class {
|
|
676
676
|
constructor(e, t, n) {
|
|
677
677
|
this.$from = e, this.$to = t, this.depth = n;
|
|
678
678
|
}
|
|
@@ -691,7 +691,7 @@ var le = class e {
|
|
|
691
691
|
get endIndex() {
|
|
692
692
|
return this.$to.indexAfter(this.depth);
|
|
693
693
|
}
|
|
694
|
-
},
|
|
694
|
+
}, he = Object.create(null), ge = class e {
|
|
695
695
|
constructor(e, t, n, r = k.none) {
|
|
696
696
|
this.type = e, this.attrs = t, this.marks = r, this.content = n || T.empty;
|
|
697
697
|
}
|
|
@@ -738,7 +738,7 @@ var le = class e {
|
|
|
738
738
|
return this.hasMarkup(e.type, e.attrs, e.marks);
|
|
739
739
|
}
|
|
740
740
|
hasMarkup(e, t, n) {
|
|
741
|
-
return this.type == e && O(this.attrs, t || e.defaultAttrs ||
|
|
741
|
+
return this.type == e && O(this.attrs, t || e.defaultAttrs || he) && k.sameSet(this.marks, n || k.none);
|
|
742
742
|
}
|
|
743
743
|
copy(t = null) {
|
|
744
744
|
return t == this.content ? this : new e(this.type, this.attrs, t, this.marks);
|
|
@@ -793,10 +793,10 @@ var le = class e {
|
|
|
793
793
|
};
|
|
794
794
|
}
|
|
795
795
|
resolve(e) {
|
|
796
|
-
return
|
|
796
|
+
return ue.resolveCached(this, e);
|
|
797
797
|
}
|
|
798
798
|
resolveNoCache(e) {
|
|
799
|
-
return
|
|
799
|
+
return ue.resolve(this, e);
|
|
800
800
|
}
|
|
801
801
|
rangeHasMark(e, t, n) {
|
|
802
802
|
let r = !1;
|
|
@@ -826,7 +826,7 @@ var le = class e {
|
|
|
826
826
|
toString() {
|
|
827
827
|
if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
|
|
828
828
|
let e = this.type.name;
|
|
829
|
-
return this.content.size && (e += "(" + this.content.toStringInner() + ")"),
|
|
829
|
+
return this.content.size && (e += "(" + this.content.toStringInner() + ")"), _e(this.marks, e);
|
|
830
830
|
}
|
|
831
831
|
contentMatchAt(e) {
|
|
832
832
|
let t = this.type.contentMatch.matchFragment(this.content, 0, e);
|
|
@@ -880,22 +880,22 @@ var le = class e {
|
|
|
880
880
|
return i.type.checkAttrs(i.attrs), i;
|
|
881
881
|
}
|
|
882
882
|
};
|
|
883
|
-
|
|
884
|
-
function
|
|
883
|
+
ge.prototype.text = void 0;
|
|
884
|
+
function _e(e, t) {
|
|
885
885
|
for (let n = e.length - 1; n >= 0; n--) t = e[n].type.name + "(" + t + ")";
|
|
886
886
|
return t;
|
|
887
887
|
}
|
|
888
|
-
var
|
|
888
|
+
var ve = class e {
|
|
889
889
|
constructor(e) {
|
|
890
890
|
this.validEnd = e, this.next = [], this.wrapCache = [];
|
|
891
891
|
}
|
|
892
892
|
static parse(t, n) {
|
|
893
|
-
let r = new
|
|
893
|
+
let r = new ye(t, n);
|
|
894
894
|
if (r.next == null) return e.empty;
|
|
895
|
-
let i =
|
|
895
|
+
let i = be(r);
|
|
896
896
|
r.next && r.err("Unexpected trailing text");
|
|
897
|
-
let a =
|
|
898
|
-
return
|
|
897
|
+
let a = Ae(De(i));
|
|
898
|
+
return je(a, r), a;
|
|
899
899
|
}
|
|
900
900
|
matchType(e) {
|
|
901
901
|
for (let t = 0; t < this.next.length; t++) if (this.next[t].type == e) return this.next[t].next;
|
|
@@ -986,8 +986,8 @@ var _e = class e {
|
|
|
986
986
|
}).join("\n");
|
|
987
987
|
}
|
|
988
988
|
};
|
|
989
|
-
|
|
990
|
-
var
|
|
989
|
+
ve.empty = new ve(!0);
|
|
990
|
+
var ye = class {
|
|
991
991
|
constructor(e, t) {
|
|
992
992
|
this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
|
|
993
993
|
}
|
|
@@ -1001,28 +1001,28 @@ var ve = class {
|
|
|
1001
1001
|
throw SyntaxError(e + " (in content expression '" + this.string + "')");
|
|
1002
1002
|
}
|
|
1003
1003
|
};
|
|
1004
|
-
function
|
|
1004
|
+
function be(e) {
|
|
1005
1005
|
let t = [];
|
|
1006
1006
|
do
|
|
1007
|
-
t.push(
|
|
1007
|
+
t.push(xe(e));
|
|
1008
1008
|
while (e.eat("|"));
|
|
1009
1009
|
return t.length == 1 ? t[0] : {
|
|
1010
1010
|
type: "choice",
|
|
1011
1011
|
exprs: t
|
|
1012
1012
|
};
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function xe(e) {
|
|
1015
1015
|
let t = [];
|
|
1016
1016
|
do
|
|
1017
|
-
t.push(
|
|
1017
|
+
t.push(Se(e));
|
|
1018
1018
|
while (e.next && e.next != ")" && e.next != "|");
|
|
1019
1019
|
return t.length == 1 ? t[0] : {
|
|
1020
1020
|
type: "seq",
|
|
1021
1021
|
exprs: t
|
|
1022
1022
|
};
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1025
|
-
let t =
|
|
1024
|
+
function Se(e) {
|
|
1025
|
+
let t = Ee(e);
|
|
1026
1026
|
for (;;) if (e.eat("+")) t = {
|
|
1027
1027
|
type: "plus",
|
|
1028
1028
|
expr: t
|
|
@@ -1035,25 +1035,25 @@ function xe(e) {
|
|
|
1035
1035
|
type: "opt",
|
|
1036
1036
|
expr: t
|
|
1037
1037
|
};
|
|
1038
|
-
else if (e.eat("{")) t =
|
|
1038
|
+
else if (e.eat("{")) t = we(e, t);
|
|
1039
1039
|
else break;
|
|
1040
1040
|
return t;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1042
|
+
function Ce(e) {
|
|
1043
1043
|
/\D/.test(e.next) && e.err("Expected number, got '" + e.next + "'");
|
|
1044
1044
|
let t = Number(e.next);
|
|
1045
1045
|
return e.pos++, t;
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1048
|
-
let n =
|
|
1049
|
-
return e.eat(",") && (r = e.next == "}" ? -1 :
|
|
1047
|
+
function we(e, t) {
|
|
1048
|
+
let n = Ce(e), r = n;
|
|
1049
|
+
return e.eat(",") && (r = e.next == "}" ? -1 : Ce(e)), e.eat("}") || e.err("Unclosed braced range"), {
|
|
1050
1050
|
type: "range",
|
|
1051
1051
|
min: n,
|
|
1052
1052
|
max: r,
|
|
1053
1053
|
expr: t
|
|
1054
1054
|
};
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1056
|
+
function Te(e, t) {
|
|
1057
1057
|
let n = e.nodeTypes, r = n[t];
|
|
1058
1058
|
if (r) return [r];
|
|
1059
1059
|
let i = [];
|
|
@@ -1063,13 +1063,13 @@ function we(e, t) {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
return i.length == 0 && e.err("No node type or group '" + t + "' found"), i;
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function Ee(e) {
|
|
1067
1067
|
if (e.eat("(")) {
|
|
1068
|
-
let t =
|
|
1068
|
+
let t = be(e);
|
|
1069
1069
|
return e.eat(")") || e.err("Missing closing paren"), t;
|
|
1070
1070
|
} else if (/\W/.test(e.next)) e.err("Unexpected token '" + e.next + "'");
|
|
1071
1071
|
else {
|
|
1072
|
-
let t =
|
|
1072
|
+
let t = Te(e, e.next).map((t) => (e.inline == null ? e.inline = t.isInline : e.inline != t.isInline && e.err("Mixing inline and block content"), {
|
|
1073
1073
|
type: "name",
|
|
1074
1074
|
value: t
|
|
1075
1075
|
}));
|
|
@@ -1079,7 +1079,7 @@ function Te(e) {
|
|
|
1079
1079
|
};
|
|
1080
1080
|
}
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1082
|
+
function De(e) {
|
|
1083
1083
|
let t = [[]];
|
|
1084
1084
|
return i(a(e, 0), n()), t;
|
|
1085
1085
|
function n() {
|
|
@@ -1125,12 +1125,12 @@ function Ee(e) {
|
|
|
1125
1125
|
else throw Error("Unknown expr type");
|
|
1126
1126
|
}
|
|
1127
1127
|
}
|
|
1128
|
-
function
|
|
1128
|
+
function Oe(e, t) {
|
|
1129
1129
|
return t - e;
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function ke(e, t) {
|
|
1132
1132
|
let n = [];
|
|
1133
|
-
return r(t), n.sort(
|
|
1133
|
+
return r(t), n.sort(Oe);
|
|
1134
1134
|
function r(t) {
|
|
1135
1135
|
let i = e[t];
|
|
1136
1136
|
if (i.length == 1 && !i[0].term) return r(i[0].to);
|
|
@@ -1141,9 +1141,9 @@ function Oe(e, t) {
|
|
|
1141
1141
|
}
|
|
1142
1142
|
}
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function Ae(e) {
|
|
1145
1145
|
let t = Object.create(null);
|
|
1146
|
-
return n(
|
|
1146
|
+
return n(ke(e, 0));
|
|
1147
1147
|
function n(r) {
|
|
1148
1148
|
let i = [];
|
|
1149
1149
|
r.forEach((t) => {
|
|
@@ -1151,14 +1151,14 @@ function ke(e) {
|
|
|
1151
1151
|
if (!t) return;
|
|
1152
1152
|
let r;
|
|
1153
1153
|
for (let e = 0; e < i.length; e++) i[e][0] == t && (r = i[e][1]);
|
|
1154
|
-
|
|
1154
|
+
ke(e, n).forEach((e) => {
|
|
1155
1155
|
r || i.push([t, r = []]), r.indexOf(e) == -1 && r.push(e);
|
|
1156
1156
|
});
|
|
1157
1157
|
});
|
|
1158
1158
|
});
|
|
1159
|
-
let a = t[r.join(",")] = new
|
|
1159
|
+
let a = t[r.join(",")] = new ve(r.indexOf(e.length - 1) > -1);
|
|
1160
1160
|
for (let e = 0; e < i.length; e++) {
|
|
1161
|
-
let r = i[e][1].sort(
|
|
1161
|
+
let r = i[e][1].sort(Oe);
|
|
1162
1162
|
a.next.push({
|
|
1163
1163
|
type: i[e][0],
|
|
1164
1164
|
next: t[r.join(",")] || n(r)
|
|
@@ -1167,7 +1167,7 @@ function ke(e) {
|
|
|
1167
1167
|
return a;
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1170
|
+
function je(e, t) {
|
|
1171
1171
|
for (let n = 0, r = [e]; n < r.length; n++) {
|
|
1172
1172
|
let e = r[n], i = !e.validEnd, a = [];
|
|
1173
1173
|
for (let t = 0; t < e.next.length; t++) {
|
|
@@ -1179,40 +1179,40 @@ function Ae(e, t) {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
//#endregion
|
|
1181
1181
|
//#region node_modules/prosemirror-transform/dist/index.js
|
|
1182
|
-
var
|
|
1183
|
-
function
|
|
1184
|
-
return e + t *
|
|
1185
|
-
}
|
|
1186
|
-
function Pe(e) {
|
|
1187
|
-
return e & je;
|
|
1182
|
+
var Me = 65535, Ne = 2 ** 16;
|
|
1183
|
+
function Pe(e, t) {
|
|
1184
|
+
return e + t * Ne;
|
|
1188
1185
|
}
|
|
1189
1186
|
function Fe(e) {
|
|
1190
|
-
return
|
|
1187
|
+
return e & Me;
|
|
1188
|
+
}
|
|
1189
|
+
function Ie(e) {
|
|
1190
|
+
return (e - (e & Me)) / Ne;
|
|
1191
1191
|
}
|
|
1192
|
-
var
|
|
1192
|
+
var Le = 1, Re = 2, ze = 4, Be = 8, Ve = class {
|
|
1193
1193
|
constructor(e, t, n) {
|
|
1194
1194
|
this.pos = e, this.delInfo = t, this.recover = n;
|
|
1195
1195
|
}
|
|
1196
1196
|
get deleted() {
|
|
1197
|
-
return (this.delInfo &
|
|
1197
|
+
return (this.delInfo & Be) > 0;
|
|
1198
1198
|
}
|
|
1199
1199
|
get deletedBefore() {
|
|
1200
|
-
return (this.delInfo & (
|
|
1200
|
+
return (this.delInfo & (Le | ze)) > 0;
|
|
1201
1201
|
}
|
|
1202
1202
|
get deletedAfter() {
|
|
1203
|
-
return (this.delInfo & (
|
|
1203
|
+
return (this.delInfo & (Re | ze)) > 0;
|
|
1204
1204
|
}
|
|
1205
1205
|
get deletedAcross() {
|
|
1206
|
-
return (this.delInfo &
|
|
1206
|
+
return (this.delInfo & ze) > 0;
|
|
1207
1207
|
}
|
|
1208
|
-
},
|
|
1208
|
+
}, P = class e {
|
|
1209
1209
|
constructor(t, n = !1) {
|
|
1210
1210
|
if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
|
|
1211
1211
|
}
|
|
1212
1212
|
recover(e) {
|
|
1213
|
-
let t = 0, n =
|
|
1213
|
+
let t = 0, n = Fe(e);
|
|
1214
1214
|
if (!this.inverted) for (let e = 0; e < n; e++) t += this.ranges[e * 3 + 2] - this.ranges[e * 3 + 1];
|
|
1215
|
-
return this.ranges[n * 3] + t +
|
|
1215
|
+
return this.ranges[n * 3] + t + Ie(e);
|
|
1216
1216
|
}
|
|
1217
1217
|
mapResult(e, t = 1) {
|
|
1218
1218
|
return this._map(e, t, !1);
|
|
@@ -1229,15 +1229,15 @@ var Ie = 1, Le = 2, Re = 4, ze = 8, Be = class {
|
|
|
1229
1229
|
if (e <= u) {
|
|
1230
1230
|
let i = c ? e == s ? -1 : e == u ? 1 : t : t, a = s + r + (i < 0 ? 0 : l);
|
|
1231
1231
|
if (n) return a;
|
|
1232
|
-
let d = e == (t < 0 ? s : u) ? null :
|
|
1233
|
-
return (t < 0 ? e != s : e != u) && (f |=
|
|
1232
|
+
let d = e == (t < 0 ? s : u) ? null : Pe(o / 3, e - s), f = e == s ? Re : e == u ? Le : ze;
|
|
1233
|
+
return (t < 0 ? e != s : e != u) && (f |= Be), new Ve(a, f, d);
|
|
1234
1234
|
}
|
|
1235
1235
|
r += l - c;
|
|
1236
1236
|
}
|
|
1237
|
-
return n ? e + r : new
|
|
1237
|
+
return n ? e + r : new Ve(e + r, 0, null);
|
|
1238
1238
|
}
|
|
1239
1239
|
touches(e, t) {
|
|
1240
|
-
let n = 0, r =
|
|
1240
|
+
let n = 0, r = Fe(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
|
|
1241
1241
|
for (let t = 0; t < this.ranges.length; t += 3) {
|
|
1242
1242
|
let o = this.ranges[t] - (this.inverted ? n : 0);
|
|
1243
1243
|
if (o > e) break;
|
|
@@ -1272,25 +1272,25 @@ var Ie = 1, Le = 2, Re = 4, ze = 8, Be = class {
|
|
|
1272
1272
|
]);
|
|
1273
1273
|
}
|
|
1274
1274
|
};
|
|
1275
|
-
|
|
1276
|
-
var
|
|
1275
|
+
P.empty = new P([]);
|
|
1276
|
+
var He = Object.create(null), F = class {
|
|
1277
1277
|
getMap() {
|
|
1278
|
-
return
|
|
1278
|
+
return P.empty;
|
|
1279
1279
|
}
|
|
1280
1280
|
merge(e) {
|
|
1281
1281
|
return null;
|
|
1282
1282
|
}
|
|
1283
1283
|
static fromJSON(e, t) {
|
|
1284
1284
|
if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
|
|
1285
|
-
let n =
|
|
1285
|
+
let n = He[t.stepType];
|
|
1286
1286
|
if (!n) throw RangeError(`No step type ${t.stepType} defined`);
|
|
1287
1287
|
return n.fromJSON(e, t);
|
|
1288
1288
|
}
|
|
1289
1289
|
static jsonID(e, t) {
|
|
1290
|
-
if (e in
|
|
1291
|
-
return
|
|
1290
|
+
if (e in He) throw RangeError("Duplicate use of step JSON ID " + e);
|
|
1291
|
+
return He[e] = t, t.prototype.jsonID = e, t;
|
|
1292
1292
|
}
|
|
1293
|
-
},
|
|
1293
|
+
}, I = class e {
|
|
1294
1294
|
constructor(e, t) {
|
|
1295
1295
|
this.doc = e, this.failed = t;
|
|
1296
1296
|
}
|
|
@@ -1309,24 +1309,24 @@ var Ve = Object.create(null), I = class {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
1311
|
};
|
|
1312
|
-
function
|
|
1312
|
+
function Ue(e, t, n) {
|
|
1313
1313
|
let r = [];
|
|
1314
1314
|
for (let i = 0; i < e.childCount; i++) {
|
|
1315
1315
|
let a = e.child(i);
|
|
1316
|
-
a.content.size && (a = a.copy(
|
|
1316
|
+
a.content.size && (a = a.copy(Ue(a.content, t, a))), a.isInline && (a = t(a, n, i)), r.push(a);
|
|
1317
1317
|
}
|
|
1318
1318
|
return T.fromArray(r);
|
|
1319
1319
|
}
|
|
1320
|
-
var
|
|
1320
|
+
var We = class e extends F {
|
|
1321
1321
|
constructor(e, t, n) {
|
|
1322
1322
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1323
1323
|
}
|
|
1324
1324
|
apply(e) {
|
|
1325
|
-
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new j(
|
|
1326
|
-
return
|
|
1325
|
+
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new j(Ue(t.content, (e, t) => !e.isAtom || !t.type.allowsMarkType(this.mark.type) ? e : e.mark(this.mark.addToSet(e.marks)), r), t.openStart, t.openEnd);
|
|
1326
|
+
return I.fromReplace(e, this.from, this.to, i);
|
|
1327
1327
|
}
|
|
1328
1328
|
invert() {
|
|
1329
|
-
return new
|
|
1329
|
+
return new Ge(this.from, this.to, this.mark);
|
|
1330
1330
|
}
|
|
1331
1331
|
map(t) {
|
|
1332
1332
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -1348,17 +1348,17 @@ var Ue = class e extends I {
|
|
|
1348
1348
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
1349
1349
|
}
|
|
1350
1350
|
};
|
|
1351
|
-
|
|
1352
|
-
var
|
|
1351
|
+
F.jsonID("addMark", We);
|
|
1352
|
+
var Ge = class e extends F {
|
|
1353
1353
|
constructor(e, t, n) {
|
|
1354
1354
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1355
1355
|
}
|
|
1356
1356
|
apply(e) {
|
|
1357
|
-
let t = e.slice(this.from, this.to), n = new j(
|
|
1358
|
-
return
|
|
1357
|
+
let t = e.slice(this.from, this.to), n = new j(Ue(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
|
|
1358
|
+
return I.fromReplace(e, this.from, this.to, n);
|
|
1359
1359
|
}
|
|
1360
1360
|
invert() {
|
|
1361
|
-
return new
|
|
1361
|
+
return new We(this.from, this.to, this.mark);
|
|
1362
1362
|
}
|
|
1363
1363
|
map(t) {
|
|
1364
1364
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -1380,16 +1380,16 @@ var We = class e extends I {
|
|
|
1380
1380
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
1381
1381
|
}
|
|
1382
1382
|
};
|
|
1383
|
-
|
|
1384
|
-
var
|
|
1383
|
+
F.jsonID("removeMark", Ge);
|
|
1384
|
+
var Ke = class e extends F {
|
|
1385
1385
|
constructor(e, t) {
|
|
1386
1386
|
super(), this.pos = e, this.mark = t;
|
|
1387
1387
|
}
|
|
1388
1388
|
apply(e) {
|
|
1389
1389
|
let t = e.nodeAt(this.pos);
|
|
1390
|
-
if (!t) return
|
|
1390
|
+
if (!t) return I.fail("No node at mark step's position");
|
|
1391
1391
|
let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
1392
|
-
return
|
|
1392
|
+
return I.fromReplace(e, this.pos, this.pos + 1, new j(T.from(n), 0, t.isLeaf ? 0 : 1));
|
|
1393
1393
|
}
|
|
1394
1394
|
invert(t) {
|
|
1395
1395
|
let n = t.nodeAt(this.pos);
|
|
@@ -1400,7 +1400,7 @@ var Ge = class e extends I {
|
|
|
1400
1400
|
return new e(this.pos, this.mark);
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
|
-
return new
|
|
1403
|
+
return new qe(this.pos, this.mark);
|
|
1404
1404
|
}
|
|
1405
1405
|
map(t) {
|
|
1406
1406
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -1418,20 +1418,20 @@ var Ge = class e extends I {
|
|
|
1418
1418
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
1419
1419
|
}
|
|
1420
1420
|
};
|
|
1421
|
-
|
|
1422
|
-
var
|
|
1421
|
+
F.jsonID("addNodeMark", Ke);
|
|
1422
|
+
var qe = class e extends F {
|
|
1423
1423
|
constructor(e, t) {
|
|
1424
1424
|
super(), this.pos = e, this.mark = t;
|
|
1425
1425
|
}
|
|
1426
1426
|
apply(e) {
|
|
1427
1427
|
let t = e.nodeAt(this.pos);
|
|
1428
|
-
if (!t) return
|
|
1428
|
+
if (!t) return I.fail("No node at mark step's position");
|
|
1429
1429
|
let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
1430
|
-
return
|
|
1430
|
+
return I.fromReplace(e, this.pos, this.pos + 1, new j(T.from(n), 0, t.isLeaf ? 0 : 1));
|
|
1431
1431
|
}
|
|
1432
1432
|
invert(e) {
|
|
1433
1433
|
let t = e.nodeAt(this.pos);
|
|
1434
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
1434
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new Ke(this.pos, this.mark);
|
|
1435
1435
|
}
|
|
1436
1436
|
map(t) {
|
|
1437
1437
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -1449,16 +1449,16 @@ var Ke = class e extends I {
|
|
|
1449
1449
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
1450
1450
|
}
|
|
1451
1451
|
};
|
|
1452
|
-
|
|
1453
|
-
var
|
|
1452
|
+
F.jsonID("removeNodeMark", qe);
|
|
1453
|
+
var Je = class e extends F {
|
|
1454
1454
|
constructor(e, t, n, r = !1) {
|
|
1455
1455
|
super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
|
|
1456
1456
|
}
|
|
1457
1457
|
apply(e) {
|
|
1458
|
-
return this.structure &&
|
|
1458
|
+
return this.structure && Xe(e, this.from, this.to) ? I.fail("Structure replace would overwrite content") : I.fromReplace(e, this.from, this.to, this.slice);
|
|
1459
1459
|
}
|
|
1460
1460
|
getMap() {
|
|
1461
|
-
return new
|
|
1461
|
+
return new P([
|
|
1462
1462
|
this.from,
|
|
1463
1463
|
this.to - this.from,
|
|
1464
1464
|
this.slice.size
|
|
@@ -1494,20 +1494,20 @@ var qe = class e extends I {
|
|
|
1494
1494
|
return new e(n.from, n.to, j.fromJSON(t, n.slice), !!n.structure);
|
|
1495
1495
|
}
|
|
1496
1496
|
};
|
|
1497
|
-
|
|
1498
|
-
var
|
|
1497
|
+
F.jsonID("replace", Je);
|
|
1498
|
+
var Ye = class e extends F {
|
|
1499
1499
|
constructor(e, t, n, r, i, a, o = !1) {
|
|
1500
1500
|
super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
|
|
1501
1501
|
}
|
|
1502
1502
|
apply(e) {
|
|
1503
|
-
if (this.structure && (
|
|
1503
|
+
if (this.structure && (Xe(e, this.from, this.gapFrom) || Xe(e, this.gapTo, this.to))) return I.fail("Structure gap-replace would overwrite content");
|
|
1504
1504
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
1505
|
-
if (t.openStart || t.openEnd) return
|
|
1505
|
+
if (t.openStart || t.openEnd) return I.fail("Gap is not a flat range");
|
|
1506
1506
|
let n = this.slice.insertAt(this.insert, t.content);
|
|
1507
|
-
return n ?
|
|
1507
|
+
return n ? I.fromReplace(e, this.from, this.to, n) : I.fail("Content does not fit in gap");
|
|
1508
1508
|
}
|
|
1509
1509
|
getMap() {
|
|
1510
|
-
return new
|
|
1510
|
+
return new P([
|
|
1511
1511
|
this.from,
|
|
1512
1512
|
this.gapFrom - this.from,
|
|
1513
1513
|
this.insert,
|
|
@@ -1540,8 +1540,8 @@ var Je = class e extends I {
|
|
|
1540
1540
|
return new e(n.from, n.to, n.gapFrom, n.gapTo, j.fromJSON(t, n.slice), n.insert, !!n.structure);
|
|
1541
1541
|
}
|
|
1542
1542
|
};
|
|
1543
|
-
|
|
1544
|
-
function
|
|
1543
|
+
F.jsonID("replaceAround", Ye);
|
|
1544
|
+
function Xe(e, t, n) {
|
|
1545
1545
|
let r = e.resolve(t), i = n - t, a = r.depth;
|
|
1546
1546
|
for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
|
|
1547
1547
|
if (i > 0) {
|
|
@@ -1553,21 +1553,21 @@ function Ye(e, t, n) {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
return !1;
|
|
1555
1555
|
}
|
|
1556
|
-
var
|
|
1556
|
+
var Ze = class e extends F {
|
|
1557
1557
|
constructor(e, t, n) {
|
|
1558
1558
|
super(), this.pos = e, this.attr = t, this.value = n;
|
|
1559
1559
|
}
|
|
1560
1560
|
apply(e) {
|
|
1561
1561
|
let t = e.nodeAt(this.pos);
|
|
1562
|
-
if (!t) return
|
|
1562
|
+
if (!t) return I.fail("No node at attribute step's position");
|
|
1563
1563
|
let n = Object.create(null);
|
|
1564
1564
|
for (let e in t.attrs) n[e] = t.attrs[e];
|
|
1565
1565
|
n[this.attr] = this.value;
|
|
1566
1566
|
let r = t.type.create(n, null, t.marks);
|
|
1567
|
-
return
|
|
1567
|
+
return I.fromReplace(e, this.pos, this.pos + 1, new j(T.from(r), 0, t.isLeaf ? 0 : 1));
|
|
1568
1568
|
}
|
|
1569
1569
|
getMap() {
|
|
1570
|
-
return
|
|
1570
|
+
return P.empty;
|
|
1571
1571
|
}
|
|
1572
1572
|
invert(t) {
|
|
1573
1573
|
return new e(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -1589,8 +1589,8 @@ var Xe = class e extends I {
|
|
|
1589
1589
|
return new e(n.pos, n.attr, n.value);
|
|
1590
1590
|
}
|
|
1591
1591
|
};
|
|
1592
|
-
|
|
1593
|
-
var
|
|
1592
|
+
F.jsonID("attr", Ze);
|
|
1593
|
+
var Qe = class e extends F {
|
|
1594
1594
|
constructor(e, t) {
|
|
1595
1595
|
super(), this.attr = e, this.value = t;
|
|
1596
1596
|
}
|
|
@@ -1599,10 +1599,10 @@ var Ze = class e extends I {
|
|
|
1599
1599
|
for (let n in e.attrs) t[n] = e.attrs[n];
|
|
1600
1600
|
t[this.attr] = this.value;
|
|
1601
1601
|
let n = e.type.create(t, e.content, e.marks);
|
|
1602
|
-
return
|
|
1602
|
+
return I.ok(n);
|
|
1603
1603
|
}
|
|
1604
1604
|
getMap() {
|
|
1605
|
-
return
|
|
1605
|
+
return P.empty;
|
|
1606
1606
|
}
|
|
1607
1607
|
invert(t) {
|
|
1608
1608
|
return new e(this.attr, t.attrs[this.attr]);
|
|
@@ -1622,17 +1622,17 @@ var Ze = class e extends I {
|
|
|
1622
1622
|
return new e(n.attr, n.value);
|
|
1623
1623
|
}
|
|
1624
1624
|
};
|
|
1625
|
-
|
|
1626
|
-
var
|
|
1627
|
-
|
|
1625
|
+
F.jsonID("docAttr", Qe);
|
|
1626
|
+
var L = class extends Error {};
|
|
1627
|
+
L = function e(t) {
|
|
1628
1628
|
let n = Error.call(this, t);
|
|
1629
1629
|
return n.__proto__ = e.prototype, n;
|
|
1630
|
-
},
|
|
1630
|
+
}, L.prototype = Object.create(Error.prototype), L.prototype.constructor = L, L.prototype.name = "TransformError";
|
|
1631
1631
|
//#endregion
|
|
1632
1632
|
//#region node_modules/prosemirror-state/dist/index.js
|
|
1633
|
-
var
|
|
1633
|
+
var $e = Object.create(null), R = class {
|
|
1634
1634
|
constructor(e, t, n) {
|
|
1635
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new
|
|
1635
|
+
this.$anchor = e, this.$head = t, this.ranges = n || [new et(e.min(t), e.max(t))];
|
|
1636
1636
|
}
|
|
1637
1637
|
get anchor() {
|
|
1638
1638
|
return this.$anchor.pos;
|
|
@@ -1666,67 +1666,67 @@ var Qe = Object.create(null), z = class {
|
|
|
1666
1666
|
let i = e.steps.length, a = this.ranges;
|
|
1667
1667
|
for (let o = 0; o < a.length; o++) {
|
|
1668
1668
|
let { $from: s, $to: c } = a[o], l = e.mapping.slice(i);
|
|
1669
|
-
e.replaceRange(l.map(s.pos), l.map(c.pos), o ? j.empty : t), o == 0 &&
|
|
1669
|
+
e.replaceRange(l.map(s.pos), l.map(c.pos), o ? j.empty : t), o == 0 && ot(e, i, (n ? n.isInline : r && r.isTextblock) ? -1 : 1);
|
|
1670
1670
|
}
|
|
1671
1671
|
}
|
|
1672
1672
|
replaceWith(e, t) {
|
|
1673
1673
|
let n = e.steps.length, r = this.ranges;
|
|
1674
1674
|
for (let i = 0; i < r.length; i++) {
|
|
1675
1675
|
let { $from: a, $to: o } = r[i], s = e.mapping.slice(n), c = s.map(a.pos), l = s.map(o.pos);
|
|
1676
|
-
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t),
|
|
1676
|
+
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t), ot(e, n, t.isInline ? -1 : 1));
|
|
1677
1677
|
}
|
|
1678
1678
|
}
|
|
1679
1679
|
static findFrom(e, t, n = !1) {
|
|
1680
|
-
let r = e.parent.inlineContent ? new
|
|
1680
|
+
let r = e.parent.inlineContent ? new z(e) : H(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
1681
1681
|
if (r) return r;
|
|
1682
1682
|
for (let r = e.depth - 1; r >= 0; r--) {
|
|
1683
|
-
let i = t < 0 ?
|
|
1683
|
+
let i = t < 0 ? H(e.node(0), e.node(r), e.before(r + 1), e.index(r), t, n) : H(e.node(0), e.node(r), e.after(r + 1), e.index(r) + 1, t, n);
|
|
1684
1684
|
if (i) return i;
|
|
1685
1685
|
}
|
|
1686
1686
|
return null;
|
|
1687
1687
|
}
|
|
1688
1688
|
static near(e, t = 1) {
|
|
1689
|
-
return this.findFrom(e, t) || this.findFrom(e, -t) || new
|
|
1689
|
+
return this.findFrom(e, t) || this.findFrom(e, -t) || new V(e.node(0));
|
|
1690
1690
|
}
|
|
1691
1691
|
static atStart(e) {
|
|
1692
|
-
return
|
|
1692
|
+
return H(e, e, 0, 0, 1) || new V(e);
|
|
1693
1693
|
}
|
|
1694
1694
|
static atEnd(e) {
|
|
1695
|
-
return
|
|
1695
|
+
return H(e, e, e.content.size, e.childCount, -1) || new V(e);
|
|
1696
1696
|
}
|
|
1697
1697
|
static fromJSON(e, t) {
|
|
1698
1698
|
if (!t || !t.type) throw RangeError("Invalid input for Selection.fromJSON");
|
|
1699
|
-
let n =
|
|
1699
|
+
let n = $e[t.type];
|
|
1700
1700
|
if (!n) throw RangeError(`No selection type ${t.type} defined`);
|
|
1701
1701
|
return n.fromJSON(e, t);
|
|
1702
1702
|
}
|
|
1703
1703
|
static jsonID(e, t) {
|
|
1704
|
-
if (e in
|
|
1705
|
-
return
|
|
1704
|
+
if (e in $e) throw RangeError("Duplicate use of selection JSON ID " + e);
|
|
1705
|
+
return $e[e] = t, t.prototype.jsonID = e, t;
|
|
1706
1706
|
}
|
|
1707
1707
|
getBookmark() {
|
|
1708
|
-
return
|
|
1708
|
+
return z.between(this.$anchor, this.$head).getBookmark();
|
|
1709
1709
|
}
|
|
1710
1710
|
};
|
|
1711
|
-
|
|
1712
|
-
var
|
|
1711
|
+
R.prototype.visible = !0;
|
|
1712
|
+
var et = class {
|
|
1713
1713
|
constructor(e, t) {
|
|
1714
1714
|
this.$from = e, this.$to = t;
|
|
1715
1715
|
}
|
|
1716
|
-
},
|
|
1717
|
-
function
|
|
1718
|
-
!
|
|
1716
|
+
}, tt = !1;
|
|
1717
|
+
function nt(e) {
|
|
1718
|
+
!tt && !e.parent.inlineContent && (tt = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + e.parent.type.name + ")"));
|
|
1719
1719
|
}
|
|
1720
|
-
var
|
|
1720
|
+
var z = class e extends R {
|
|
1721
1721
|
constructor(e, t = e) {
|
|
1722
|
-
|
|
1722
|
+
nt(e), nt(t), super(e, t);
|
|
1723
1723
|
}
|
|
1724
1724
|
get $cursor() {
|
|
1725
1725
|
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
1726
1726
|
}
|
|
1727
1727
|
map(t, n) {
|
|
1728
1728
|
let r = t.resolve(n.map(this.head));
|
|
1729
|
-
if (!r.parent.inlineContent) return
|
|
1729
|
+
if (!r.parent.inlineContent) return R.near(r);
|
|
1730
1730
|
let i = t.resolve(n.map(this.anchor));
|
|
1731
1731
|
return new e(i.parent.inlineContent ? i : r, r);
|
|
1732
1732
|
}
|
|
@@ -1740,7 +1740,7 @@ var B = class e extends z {
|
|
|
1740
1740
|
return t instanceof e && t.anchor == this.anchor && t.head == this.head;
|
|
1741
1741
|
}
|
|
1742
1742
|
getBookmark() {
|
|
1743
|
-
return new
|
|
1743
|
+
return new rt(this.anchor, this.head);
|
|
1744
1744
|
}
|
|
1745
1745
|
toJSON() {
|
|
1746
1746
|
return {
|
|
@@ -1760,15 +1760,15 @@ var B = class e extends z {
|
|
|
1760
1760
|
static between(t, n, r) {
|
|
1761
1761
|
let i = t.pos - n.pos;
|
|
1762
1762
|
if ((!r || i) && (r = i >= 0 ? 1 : -1), !n.parent.inlineContent) {
|
|
1763
|
-
let e =
|
|
1763
|
+
let e = R.findFrom(n, r, !0) || R.findFrom(n, -r, !0);
|
|
1764
1764
|
if (e) n = e.$head;
|
|
1765
|
-
else return
|
|
1765
|
+
else return R.near(n, r);
|
|
1766
1766
|
}
|
|
1767
|
-
return t.parent.inlineContent || (i == 0 ? t = n : (t = (
|
|
1767
|
+
return t.parent.inlineContent || (i == 0 ? t = n : (t = (R.findFrom(t, -r, !0) || R.findFrom(t, r, !0)).$anchor, t.pos < n.pos != i < 0 && (t = n))), new e(t, n);
|
|
1768
1768
|
}
|
|
1769
1769
|
};
|
|
1770
|
-
|
|
1771
|
-
var
|
|
1770
|
+
R.jsonID("text", z);
|
|
1771
|
+
var rt = class e {
|
|
1772
1772
|
constructor(e, t) {
|
|
1773
1773
|
this.anchor = e, this.head = t;
|
|
1774
1774
|
}
|
|
@@ -1776,16 +1776,16 @@ var nt = class e {
|
|
|
1776
1776
|
return new e(t.map(this.anchor), t.map(this.head));
|
|
1777
1777
|
}
|
|
1778
1778
|
resolve(e) {
|
|
1779
|
-
return
|
|
1779
|
+
return z.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
1780
1780
|
}
|
|
1781
|
-
},
|
|
1781
|
+
}, B = class e extends R {
|
|
1782
1782
|
constructor(e) {
|
|
1783
1783
|
let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
|
|
1784
1784
|
super(e, n), this.node = t;
|
|
1785
1785
|
}
|
|
1786
1786
|
map(t, n) {
|
|
1787
1787
|
let { deleted: r, pos: i } = n.mapResult(this.anchor), a = t.resolve(i);
|
|
1788
|
-
return r ?
|
|
1788
|
+
return r ? R.near(a) : new e(a);
|
|
1789
1789
|
}
|
|
1790
1790
|
content() {
|
|
1791
1791
|
return new j(T.from(this.node), 0, 0);
|
|
@@ -1800,7 +1800,7 @@ var nt = class e {
|
|
|
1800
1800
|
};
|
|
1801
1801
|
}
|
|
1802
1802
|
getBookmark() {
|
|
1803
|
-
return new
|
|
1803
|
+
return new it(this.anchor);
|
|
1804
1804
|
}
|
|
1805
1805
|
static fromJSON(t, n) {
|
|
1806
1806
|
if (typeof n.anchor != "number") throw RangeError("Invalid input for NodeSelection.fromJSON");
|
|
@@ -1813,27 +1813,27 @@ var nt = class e {
|
|
|
1813
1813
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
1814
1814
|
}
|
|
1815
1815
|
};
|
|
1816
|
-
|
|
1817
|
-
var
|
|
1816
|
+
B.prototype.visible = !1, R.jsonID("node", B);
|
|
1817
|
+
var it = class e {
|
|
1818
1818
|
constructor(e) {
|
|
1819
1819
|
this.anchor = e;
|
|
1820
1820
|
}
|
|
1821
1821
|
map(t) {
|
|
1822
1822
|
let { deleted: n, pos: r } = t.mapResult(this.anchor);
|
|
1823
|
-
return n ? new
|
|
1823
|
+
return n ? new rt(r, r) : new e(r);
|
|
1824
1824
|
}
|
|
1825
1825
|
resolve(e) {
|
|
1826
1826
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
1827
|
-
return n &&
|
|
1827
|
+
return n && B.isSelectable(n) ? new B(t) : R.near(t);
|
|
1828
1828
|
}
|
|
1829
|
-
},
|
|
1829
|
+
}, V = class e extends R {
|
|
1830
1830
|
constructor(e) {
|
|
1831
1831
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
1832
1832
|
}
|
|
1833
1833
|
replace(e, t = j.empty) {
|
|
1834
1834
|
if (t == j.empty) {
|
|
1835
1835
|
e.delete(0, e.doc.content.size);
|
|
1836
|
-
let t =
|
|
1836
|
+
let t = R.atStart(e.doc);
|
|
1837
1837
|
t.eq(e.selection) || e.setSelection(t);
|
|
1838
1838
|
} else super.replace(e, t);
|
|
1839
1839
|
}
|
|
@@ -1850,70 +1850,70 @@ var rt = class e {
|
|
|
1850
1850
|
return t instanceof e;
|
|
1851
1851
|
}
|
|
1852
1852
|
getBookmark() {
|
|
1853
|
-
return
|
|
1853
|
+
return at;
|
|
1854
1854
|
}
|
|
1855
1855
|
};
|
|
1856
|
-
|
|
1857
|
-
var
|
|
1856
|
+
R.jsonID("all", V);
|
|
1857
|
+
var at = {
|
|
1858
1858
|
map() {
|
|
1859
1859
|
return this;
|
|
1860
1860
|
},
|
|
1861
1861
|
resolve(e) {
|
|
1862
|
-
return new
|
|
1862
|
+
return new V(e);
|
|
1863
1863
|
}
|
|
1864
1864
|
};
|
|
1865
|
-
function
|
|
1866
|
-
if (t.inlineContent) return
|
|
1865
|
+
function H(e, t, n, r, i, a = !1) {
|
|
1866
|
+
if (t.inlineContent) return z.create(e, n);
|
|
1867
1867
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
|
|
1868
1868
|
let r = t.child(o);
|
|
1869
1869
|
if (!r.isAtom) {
|
|
1870
|
-
let t =
|
|
1870
|
+
let t = H(e, r, n + i, i < 0 ? r.childCount : 0, i, a);
|
|
1871
1871
|
if (t) return t;
|
|
1872
|
-
} else if (!a &&
|
|
1872
|
+
} else if (!a && B.isSelectable(r)) return B.create(e, n - (i < 0 ? r.nodeSize : 0));
|
|
1873
1873
|
n += r.nodeSize * i;
|
|
1874
1874
|
}
|
|
1875
1875
|
return null;
|
|
1876
1876
|
}
|
|
1877
|
-
function
|
|
1877
|
+
function ot(e, t, n) {
|
|
1878
1878
|
let r = e.steps.length - 1;
|
|
1879
1879
|
if (r < t) return;
|
|
1880
1880
|
let i = e.steps[r];
|
|
1881
|
-
if (!(i instanceof
|
|
1881
|
+
if (!(i instanceof Je || i instanceof Ye)) return;
|
|
1882
1882
|
let a = e.mapping.maps[r], o;
|
|
1883
1883
|
a.forEach((e, t, n, r) => {
|
|
1884
1884
|
o ??= r;
|
|
1885
|
-
}), e.setSelection(
|
|
1885
|
+
}), e.setSelection(R.near(e.doc.resolve(o), n));
|
|
1886
1886
|
}
|
|
1887
|
-
function
|
|
1887
|
+
function st(e, t) {
|
|
1888
1888
|
return !t || !e ? e : e.bind(t);
|
|
1889
1889
|
}
|
|
1890
|
-
var
|
|
1890
|
+
var ct = class {
|
|
1891
1891
|
constructor(e, t, n) {
|
|
1892
|
-
this.name = e, this.init =
|
|
1892
|
+
this.name = e, this.init = st(t.init, n), this.apply = st(t.apply, n);
|
|
1893
1893
|
}
|
|
1894
1894
|
};
|
|
1895
|
-
new
|
|
1895
|
+
new ct("doc", {
|
|
1896
1896
|
init(e) {
|
|
1897
1897
|
return e.doc || e.schema.topNodeType.createAndFill();
|
|
1898
1898
|
},
|
|
1899
1899
|
apply(e) {
|
|
1900
1900
|
return e.doc;
|
|
1901
1901
|
}
|
|
1902
|
-
}), new
|
|
1902
|
+
}), new ct("selection", {
|
|
1903
1903
|
init(e, t) {
|
|
1904
|
-
return e.selection ||
|
|
1904
|
+
return e.selection || R.atStart(t.doc);
|
|
1905
1905
|
},
|
|
1906
1906
|
apply(e) {
|
|
1907
1907
|
return e.selection;
|
|
1908
1908
|
}
|
|
1909
|
-
}), new
|
|
1909
|
+
}), new ct("storedMarks", {
|
|
1910
1910
|
init(e) {
|
|
1911
1911
|
return e.storedMarks || null;
|
|
1912
1912
|
},
|
|
1913
1913
|
apply(e, t, n, r) {
|
|
1914
1914
|
return r.selection.$cursor ? e.storedMarks : null;
|
|
1915
1915
|
}
|
|
1916
|
-
}), new
|
|
1916
|
+
}), new ct("scrollToSelection", {
|
|
1917
1917
|
init() {
|
|
1918
1918
|
return 0;
|
|
1919
1919
|
},
|
|
@@ -1923,8 +1923,8 @@ new st("doc", {
|
|
|
1923
1923
|
});
|
|
1924
1924
|
//#endregion
|
|
1925
1925
|
//#region src/plugins/format-painter.js
|
|
1926
|
-
var
|
|
1927
|
-
function
|
|
1926
|
+
var lt = "url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTcuMyAzLjNjLS43LS43LTEuOS0uNy0yLjYgMEw2LjEgMTEuOUw0LjkgMTZsNC4xLTEuMmw4LjYtOC42Yy43LS43LjctMS45IDAtMi42ek04LjIgMTUuN2wtMS45LjUgLjUtMS45bDguNi04LjZsMS40IDEuNC04LjYgOC42eiIgZmlsbD0iIzE3Mjc0MiIvPjwvc3ZnPg==\") 0 16, auto";
|
|
1927
|
+
function ut() {
|
|
1928
1928
|
return {
|
|
1929
1929
|
active: !1,
|
|
1930
1930
|
sticky: !1,
|
|
@@ -1935,11 +1935,11 @@ function lt() {
|
|
|
1935
1935
|
keydownHandler: null
|
|
1936
1936
|
};
|
|
1937
1937
|
}
|
|
1938
|
-
var
|
|
1939
|
-
function
|
|
1940
|
-
return
|
|
1938
|
+
var dt = /* @__PURE__ */ new WeakMap();
|
|
1939
|
+
function U(e) {
|
|
1940
|
+
return dt.has(e) || dt.set(e, ut()), dt.get(e);
|
|
1941
1941
|
}
|
|
1942
|
-
function
|
|
1942
|
+
function ft(e) {
|
|
1943
1943
|
let t = e.getAttributes("heading");
|
|
1944
1944
|
return {
|
|
1945
1945
|
block: e.isActive("heading") && t.level ? {
|
|
@@ -1957,62 +1957,62 @@ function dt(e) {
|
|
|
1957
1957
|
}
|
|
1958
1958
|
};
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function pt(e, t) {
|
|
1961
1961
|
let n = e.view.dom;
|
|
1962
|
-
n && (n.style.cursor = t ?
|
|
1962
|
+
n && (n.style.cursor = t ? lt : "", document.body.style.cursor = t ? lt : "");
|
|
1963
1963
|
}
|
|
1964
|
-
function
|
|
1965
|
-
let t =
|
|
1966
|
-
t.active = !1, t.sticky = !1, t.snapshot = null, t.sourceRange = null,
|
|
1964
|
+
function mt(e) {
|
|
1965
|
+
let t = U(e);
|
|
1966
|
+
t.active = !1, t.sticky = !1, t.snapshot = null, t.sourceRange = null, pt(e, !1);
|
|
1967
1967
|
}
|
|
1968
|
-
function
|
|
1968
|
+
function ht(e, t) {
|
|
1969
1969
|
t.marks.bold ? e.setBold() : e.unsetBold(), t.marks.italic ? e.setItalic() : e.unsetItalic(), t.marks.underline ? e.setUnderline() : e.unsetUnderline(), t.marks.strike ? e.setStrike() : e.unsetStrike(), t.marks.fontFamily ? e.setFontFamily(t.marks.fontFamily) : e.unsetFontFamily(), t.marks.textColor ? e.setTextColor(t.marks.textColor) : e.unsetTextColor(), t.marks.highlightColor ? e.setHighlightColor(t.marks.highlightColor) : e.unsetHighlightColor();
|
|
1970
1970
|
}
|
|
1971
|
-
function
|
|
1971
|
+
function gt(e, t, n) {
|
|
1972
1972
|
if (!t) return;
|
|
1973
1973
|
let r = e.chain().focus();
|
|
1974
|
-
n instanceof
|
|
1974
|
+
n instanceof B && n.node?.isBlock && (t.block.type === "heading" ? r.setHeading({ level: t.block.level }) : r.setParagraph()), ht(r, t), r.run();
|
|
1975
1975
|
}
|
|
1976
|
-
function
|
|
1976
|
+
function _t(e, t) {
|
|
1977
1977
|
let { selection: n } = e.state;
|
|
1978
1978
|
if (n.empty) return;
|
|
1979
|
-
let r =
|
|
1979
|
+
let r = U(e);
|
|
1980
1980
|
if (r.active && !t) {
|
|
1981
|
-
|
|
1981
|
+
mt(e);
|
|
1982
1982
|
return;
|
|
1983
1983
|
}
|
|
1984
|
-
r.snapshot =
|
|
1984
|
+
r.snapshot = ft(e), r.sourceRange = {
|
|
1985
1985
|
from: n.from,
|
|
1986
1986
|
to: n.to
|
|
1987
|
-
}, r.active = !0, r.sticky = t,
|
|
1987
|
+
}, r.active = !0, r.sticky = t, pt(e, !0);
|
|
1988
1988
|
}
|
|
1989
|
-
function
|
|
1990
|
-
let t =
|
|
1991
|
-
!t.active || t.applying || n.empty || t.sourceRange && n.from === t.sourceRange.from && n.to === t.sourceRange.to || (t.applying = !0,
|
|
1989
|
+
function vt(e) {
|
|
1990
|
+
let t = U(e), { selection: n } = e.state;
|
|
1991
|
+
!t.active || t.applying || n.empty || t.sourceRange && n.from === t.sourceRange.from && n.to === t.sourceRange.to || (t.applying = !0, gt(e, t.snapshot, n), t.applying = !1, t.sticky || mt(e));
|
|
1992
1992
|
}
|
|
1993
|
-
var
|
|
1993
|
+
var yt = {
|
|
1994
1994
|
name: "formatPainter",
|
|
1995
1995
|
toolbar: {
|
|
1996
1996
|
icon: h.formatPainter,
|
|
1997
1997
|
title: "格式刷"
|
|
1998
1998
|
},
|
|
1999
1999
|
tiptapExtension: null,
|
|
2000
|
-
command: (e) =>
|
|
2001
|
-
onDoubleClick: (e) =>
|
|
2002
|
-
isActive: (e) =>
|
|
2000
|
+
command: (e) => _t(e, !1),
|
|
2001
|
+
onDoubleClick: (e) => _t(e, !0),
|
|
2002
|
+
isActive: (e) => U(e).active,
|
|
2003
2003
|
init(e) {
|
|
2004
|
-
let t =
|
|
2005
|
-
t.mouseupHandler = () =>
|
|
2006
|
-
t.key === "Escape" &&
|
|
2004
|
+
let t = U(e);
|
|
2005
|
+
t.mouseupHandler = () => vt(e), t.keydownHandler = (t) => {
|
|
2006
|
+
t.key === "Escape" && mt(e);
|
|
2007
2007
|
};
|
|
2008
2008
|
let n = e.view.dom.ownerDocument;
|
|
2009
2009
|
n.addEventListener("mouseup", t.mouseupHandler, !0), n.addEventListener("keydown", t.keydownHandler, !0);
|
|
2010
2010
|
},
|
|
2011
2011
|
destroy(e) {
|
|
2012
|
-
let t =
|
|
2013
|
-
n && (n.removeEventListener("mouseup", t.mouseupHandler, !0), n.removeEventListener("keydown", t.keydownHandler, !0)),
|
|
2012
|
+
let t = U(e), n = e?.view?.dom?.ownerDocument;
|
|
2013
|
+
n && (n.removeEventListener("mouseup", t.mouseupHandler, !0), n.removeEventListener("keydown", t.keydownHandler, !0)), mt(e);
|
|
2014
2014
|
}
|
|
2015
|
-
},
|
|
2015
|
+
}, bt = class {
|
|
2016
2016
|
constructor({ node: e, editor: t, getPos: n }) {
|
|
2017
2017
|
this.node = e, this.editor = t, this.getPos = n, this._startX = 0, this._startWidth = 0, this._pendingWidth = null, this._activeCorner = null, this.dom = document.createElement("span"), this.dom.className = "image-node-wrapper", this.dom.contentEditable = "false", this.img = document.createElement("img"), this.img.src = e.attrs.src, this.img.alt = e.attrs.alt || "", this.img.draggable = !1, e.attrs.width && (this.img.style.width = e.attrs.width + "px"), this.dom.appendChild(this.img);
|
|
2018
2018
|
for (let e of [
|
|
@@ -2058,7 +2058,7 @@ var vt = {
|
|
|
2058
2058
|
destroy() {
|
|
2059
2059
|
document.removeEventListener("mousemove", this._boundMouseMove), document.removeEventListener("mouseup", this._boundMouseUp), document.body.style.userSelect = "";
|
|
2060
2060
|
}
|
|
2061
|
-
},
|
|
2061
|
+
}, xt = i.create({
|
|
2062
2062
|
name: "image",
|
|
2063
2063
|
group: "inline",
|
|
2064
2064
|
inline: !0,
|
|
@@ -2079,7 +2079,7 @@ var vt = {
|
|
|
2079
2079
|
return t.width && (t.style = `width:${t.width}px`), delete t.width, ["img", a(t)];
|
|
2080
2080
|
},
|
|
2081
2081
|
addNodeView() {
|
|
2082
|
-
return (e) => new
|
|
2082
|
+
return (e) => new bt(e);
|
|
2083
2083
|
},
|
|
2084
2084
|
addCommands() {
|
|
2085
2085
|
return { setImage: (e) => ({ commands: t }) => t.insertContent({
|
|
@@ -2087,63 +2087,63 @@ var vt = {
|
|
|
2087
2087
|
attrs: e
|
|
2088
2088
|
}) };
|
|
2089
2089
|
}
|
|
2090
|
-
}),
|
|
2091
|
-
function
|
|
2090
|
+
}), W = null, St = null, Ct = {};
|
|
2091
|
+
function wt(e) {
|
|
2092
2092
|
if (!e || !e.type.startsWith("image/")) return;
|
|
2093
|
-
let t =
|
|
2093
|
+
let t = Ct.maxSize || 20 * 1024 * 1024;
|
|
2094
2094
|
if (e.size > t) {
|
|
2095
2095
|
alert(`图片大小不能超过 ${Math.round(t / 1024 / 1024)}MB`);
|
|
2096
2096
|
return;
|
|
2097
2097
|
}
|
|
2098
2098
|
let n = new FileReader();
|
|
2099
2099
|
n.onload = (e) => {
|
|
2100
|
-
|
|
2100
|
+
St.chain().focus().setImage({ src: e.target.result }).run();
|
|
2101
2101
|
}, n.readAsDataURL(e);
|
|
2102
2102
|
}
|
|
2103
|
-
function
|
|
2103
|
+
function Tt(e) {
|
|
2104
2104
|
let t = e.clipboardData?.items;
|
|
2105
2105
|
if (t) {
|
|
2106
2106
|
for (let n of t) if (n.type.startsWith("image/")) {
|
|
2107
|
-
e.preventDefault(),
|
|
2107
|
+
e.preventDefault(), wt(n.getAsFile());
|
|
2108
2108
|
return;
|
|
2109
2109
|
}
|
|
2110
2110
|
}
|
|
2111
2111
|
}
|
|
2112
|
-
var
|
|
2112
|
+
var Et = {
|
|
2113
2113
|
name: "insertImage",
|
|
2114
2114
|
configKey: "image",
|
|
2115
2115
|
toolbar: {
|
|
2116
2116
|
icon: h.imageUp,
|
|
2117
2117
|
title: "插入图片"
|
|
2118
2118
|
},
|
|
2119
|
-
tiptapExtension:
|
|
2119
|
+
tiptapExtension: xt,
|
|
2120
2120
|
command: () => {
|
|
2121
|
-
|
|
2121
|
+
W?.click();
|
|
2122
2122
|
},
|
|
2123
2123
|
isActive: () => !1,
|
|
2124
2124
|
init(e, t) {
|
|
2125
|
-
|
|
2126
|
-
let e =
|
|
2127
|
-
e &&
|
|
2128
|
-
}), e.view.dom.addEventListener("paste",
|
|
2125
|
+
St = e, Ct = t || {}, W = document.createElement("input"), W.type = "file", W.accept = t.accept || "image/png,image/jpeg,image/gif,image/webp,image/svg+xml", W.style.display = "none", document.body.appendChild(W), W.addEventListener("change", () => {
|
|
2126
|
+
let e = W.files[0];
|
|
2127
|
+
e && wt(e), W.value = "";
|
|
2128
|
+
}), e.view.dom.addEventListener("paste", Tt);
|
|
2129
2129
|
},
|
|
2130
2130
|
destroy() {
|
|
2131
|
-
|
|
2131
|
+
W?.remove(), W = null, St &&= (St.view.dom.removeEventListener("paste", Tt), null);
|
|
2132
2132
|
}
|
|
2133
2133
|
};
|
|
2134
2134
|
//#endregion
|
|
2135
2135
|
//#region src/plugins/shared/modal.js
|
|
2136
|
-
function
|
|
2136
|
+
function Dt(e, t) {
|
|
2137
2137
|
let n = document.createElement("label");
|
|
2138
2138
|
n.className = "je-modal-field";
|
|
2139
2139
|
let r = document.createElement("span");
|
|
2140
2140
|
return r.className = "je-modal-label", r.textContent = e, n.append(r, t), n;
|
|
2141
2141
|
}
|
|
2142
|
-
function
|
|
2142
|
+
function Ot(e, t = "") {
|
|
2143
2143
|
let n = document.createElement("input");
|
|
2144
2144
|
return n.type = "text", n.className = "je-modal-input", n.placeholder = e, n.value = t, n;
|
|
2145
2145
|
}
|
|
2146
|
-
function
|
|
2146
|
+
function kt(e = {}) {
|
|
2147
2147
|
return new Promise((t) => {
|
|
2148
2148
|
let n = document.createElement("div");
|
|
2149
2149
|
n.className = "je-modal-overlay";
|
|
@@ -2151,7 +2151,7 @@ function Ot(e = {}) {
|
|
|
2151
2151
|
r.className = "je-modal";
|
|
2152
2152
|
let i = document.createElement("div");
|
|
2153
2153
|
i.className = "je-modal-title", i.textContent = "链接";
|
|
2154
|
-
let a =
|
|
2154
|
+
let a = Ot("输入文本", e.text || ""), o = Ot("粘贴或输入 链接", e.href || ""), s = document.createElement("div");
|
|
2155
2155
|
s.className = "je-modal-actions";
|
|
2156
2156
|
let c = document.createElement("button");
|
|
2157
2157
|
c.type = "button", c.className = "je-modal-btn is-primary", c.textContent = "确定";
|
|
@@ -2172,24 +2172,24 @@ function Ot(e = {}) {
|
|
|
2172
2172
|
});
|
|
2173
2173
|
}), l.addEventListener("click", () => u(null)), n.addEventListener("mousedown", (e) => {
|
|
2174
2174
|
e.target === n && u(null);
|
|
2175
|
-
}), s.append(c, l), r.append(i,
|
|
2175
|
+
}), s.append(c, l), r.append(i, Dt("文本", a), Dt("链接", o), s), n.appendChild(r), document.body.appendChild(n), document.addEventListener("keydown", d, !0), a.focus(), a.select();
|
|
2176
2176
|
});
|
|
2177
2177
|
}
|
|
2178
2178
|
//#endregion
|
|
2179
2179
|
//#region src/plugins/link.js
|
|
2180
|
-
var
|
|
2181
|
-
function
|
|
2180
|
+
var At = null, G = null, jt = null;
|
|
2181
|
+
function Mt(e) {
|
|
2182
2182
|
if (!e) return null;
|
|
2183
2183
|
let t = e.trim();
|
|
2184
2184
|
return t ? /^(https?:|mailto:|tel:|\/)/i.test(t) ? t : `https://${t}` : null;
|
|
2185
2185
|
}
|
|
2186
|
-
function
|
|
2187
|
-
|
|
2186
|
+
function K() {
|
|
2187
|
+
G &&= (window.clearTimeout(G), null), At &&= (At.remove(), null);
|
|
2188
2188
|
}
|
|
2189
|
-
function
|
|
2190
|
-
|
|
2189
|
+
function Nt() {
|
|
2190
|
+
G && window.clearTimeout(G), G = window.setTimeout(() => K(), 120);
|
|
2191
2191
|
}
|
|
2192
|
-
function
|
|
2192
|
+
function Pt(e, t) {
|
|
2193
2193
|
try {
|
|
2194
2194
|
let n = e.view.posAtDOM(t, 0);
|
|
2195
2195
|
e.chain().focus().setTextSelection(Math.max(1, n + 1)).extendMarkRange("link").run();
|
|
@@ -2197,8 +2197,8 @@ function Nt(e, t) {
|
|
|
2197
2197
|
e.commands.focus();
|
|
2198
2198
|
}
|
|
2199
2199
|
}
|
|
2200
|
-
function
|
|
2201
|
-
|
|
2200
|
+
function Ft(e, t) {
|
|
2201
|
+
K();
|
|
2202
2202
|
let n = t.getAttribute("href");
|
|
2203
2203
|
if (!n) return;
|
|
2204
2204
|
let r = document.createElement("div");
|
|
@@ -2209,25 +2209,25 @@ function Pt(e, t) {
|
|
|
2209
2209
|
a.className = "je-link-popover__actions";
|
|
2210
2210
|
let o = document.createElement("button");
|
|
2211
2211
|
o.type = "button", o.className = "je-link-popover__action", o.innerHTML = h.clearFormat.replace("width=\"24\" height=\"24\"", "width=\"16\" height=\"16\""), o.title = "修改链接", o.addEventListener("click", () => {
|
|
2212
|
-
|
|
2212
|
+
Pt(e, t), It(e), K();
|
|
2213
2213
|
});
|
|
2214
2214
|
let s = document.createElement("button");
|
|
2215
2215
|
s.type = "button", s.className = "je-link-popover__action", s.innerHTML = h.linkOff.replace("width=\"24\" height=\"24\"", "width=\"16\" height=\"16\""), s.title = "取消链接", s.addEventListener("click", () => {
|
|
2216
|
-
|
|
2216
|
+
Pt(e, t), e.chain().focus().extendMarkRange("link").unsetLink().run(), K();
|
|
2217
2217
|
}), a.append(o, s), r.append(i, a), r.addEventListener("mouseenter", () => {
|
|
2218
|
-
|
|
2219
|
-
}), r.addEventListener("mouseleave",
|
|
2218
|
+
G && window.clearTimeout(G);
|
|
2219
|
+
}), r.addEventListener("mouseleave", Nt), document.body.appendChild(r);
|
|
2220
2220
|
let c = t.getBoundingClientRect();
|
|
2221
|
-
r.style.top = `${c.bottom + window.scrollY + 8}px`, r.style.left = `${Math.max(12, c.left + window.scrollX)}px`,
|
|
2221
|
+
r.style.top = `${c.bottom + window.scrollY + 8}px`, r.style.left = `${Math.max(12, c.left + window.scrollX)}px`, At = r;
|
|
2222
2222
|
}
|
|
2223
|
-
function
|
|
2223
|
+
function It(e) {
|
|
2224
2224
|
let t = e.getAttributes("link").href || "", n = e.state.doc.textBetween(e.state.selection.from, e.state.selection.to, " ");
|
|
2225
|
-
|
|
2225
|
+
kt({
|
|
2226
2226
|
text: n || "",
|
|
2227
2227
|
href: t
|
|
2228
2228
|
}).then((t) => {
|
|
2229
2229
|
if (!t) return;
|
|
2230
|
-
let r =
|
|
2230
|
+
let r = Mt(t.href), i = e.chain().focus();
|
|
2231
2231
|
if (!r) {
|
|
2232
2232
|
i.extendMarkRange("link").unsetLink().run();
|
|
2233
2233
|
return;
|
|
@@ -2248,7 +2248,7 @@ function Ft(e) {
|
|
|
2248
2248
|
}), i.extendMarkRange("link").setLink({ href: r }).run();
|
|
2249
2249
|
});
|
|
2250
2250
|
}
|
|
2251
|
-
function
|
|
2251
|
+
function Lt(e) {
|
|
2252
2252
|
let t = e.view.dom, n = (e) => {
|
|
2253
2253
|
let n = e.target.closest("a[href]");
|
|
2254
2254
|
if (!(!n || !t.contains(n))) {
|
|
@@ -2260,18 +2260,18 @@ function It(e) {
|
|
|
2260
2260
|
}
|
|
2261
2261
|
}, r = (n) => {
|
|
2262
2262
|
let r = n.target.closest("a[href]");
|
|
2263
|
-
!r || !t.contains(r) ||
|
|
2263
|
+
!r || !t.contains(r) || Ft(e, r);
|
|
2264
2264
|
}, i = (e) => {
|
|
2265
2265
|
let n = e.target.closest("a[href]");
|
|
2266
|
-
!n || !t.contains(n) ||
|
|
2266
|
+
!n || !t.contains(n) || Nt();
|
|
2267
2267
|
}, a = (e) => {
|
|
2268
|
-
|
|
2268
|
+
At?.contains(e.target) || K();
|
|
2269
2269
|
};
|
|
2270
2270
|
return t.addEventListener("click", n), t.addEventListener("mouseover", r), t.addEventListener("mouseout", i), document.addEventListener("mousedown", a, !0), () => {
|
|
2271
|
-
t.removeEventListener("click", n), t.removeEventListener("mouseover", r), t.removeEventListener("mouseout", i), document.removeEventListener("mousedown", a, !0),
|
|
2271
|
+
t.removeEventListener("click", n), t.removeEventListener("mouseover", r), t.removeEventListener("mouseout", i), document.removeEventListener("mousedown", a, !0), K();
|
|
2272
2272
|
};
|
|
2273
2273
|
}
|
|
2274
|
-
var
|
|
2274
|
+
var Rt = {
|
|
2275
2275
|
name: "link",
|
|
2276
2276
|
toolbar: {
|
|
2277
2277
|
icon: h.link,
|
|
@@ -2282,69 +2282,192 @@ var Lt = {
|
|
|
2282
2282
|
autolink: !0,
|
|
2283
2283
|
defaultProtocol: "https"
|
|
2284
2284
|
}),
|
|
2285
|
-
command: (e) =>
|
|
2285
|
+
command: (e) => It(e),
|
|
2286
2286
|
isActive: (e) => e.isActive("link"),
|
|
2287
2287
|
init(e) {
|
|
2288
|
-
|
|
2288
|
+
jt = Lt(e);
|
|
2289
2289
|
},
|
|
2290
2290
|
destroy() {
|
|
2291
|
-
|
|
2291
|
+
jt?.(), jt = null;
|
|
2292
2292
|
}
|
|
2293
|
-
};
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2293
|
+
}, zt = "\n <svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"9\" cy=\"12\" r=\"1.2\" fill=\"currentColor\"/>\n <circle cx=\"9\" cy=\"5\" r=\"1.2\" fill=\"currentColor\"/>\n <circle cx=\"9\" cy=\"19\" r=\"1.2\" fill=\"currentColor\"/>\n <circle cx=\"15\" cy=\"12\" r=\"1.2\" fill=\"currentColor\"/>\n <circle cx=\"15\" cy=\"5\" r=\"1.2\" fill=\"currentColor\"/>\n <circle cx=\"15\" cy=\"19\" r=\"1.2\" fill=\"currentColor\"/>\n </svg>\n";
|
|
2294
|
+
function Bt(e = "", t = {}) {
|
|
2295
|
+
let n = document.createElement("div");
|
|
2296
|
+
return n.setAttribute("style", e || ""), Object.entries(t).forEach(([e, t]) => {
|
|
2297
|
+
t == null || t === "" ? n.style.removeProperty(e) : n.style.setProperty(e, t);
|
|
2298
|
+
}), n.getAttribute("style") || null;
|
|
2299
|
+
}
|
|
2300
|
+
function q(e, t) {
|
|
2301
|
+
if (!t) return null;
|
|
2302
|
+
let n = t.querySelector("table");
|
|
2303
|
+
if (!n) return null;
|
|
2304
|
+
let r = e.view.posAtDOM(t, 0), i = e.state.doc.nodeAt(r);
|
|
2305
|
+
if (!i || i.type.name !== "table") return null;
|
|
2306
|
+
let a = [];
|
|
2307
|
+
return i.forEach((e, t) => {
|
|
2308
|
+
let n = r + 1 + t, i = [];
|
|
2309
|
+
e.forEach((e, t, r) => {
|
|
2310
|
+
i.push({
|
|
2311
|
+
pos: n + 1 + t,
|
|
2312
|
+
node: e,
|
|
2313
|
+
index: r
|
|
2314
|
+
});
|
|
2315
|
+
}), a.push({
|
|
2316
|
+
pos: n,
|
|
2317
|
+
node: e,
|
|
2318
|
+
index: a.length,
|
|
2319
|
+
cells: i
|
|
2320
|
+
});
|
|
2321
|
+
}), {
|
|
2322
|
+
table: n,
|
|
2323
|
+
tableNode: i,
|
|
2324
|
+
tablePos: r,
|
|
2325
|
+
rows: a
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2328
|
+
function Vt(e, t, n) {
|
|
2329
|
+
let r = q(e, t);
|
|
2330
|
+
if (!r) return;
|
|
2331
|
+
let { tableNode: i, tablePos: a } = r, o = Bt(i.attrs.style, n);
|
|
2332
|
+
e.view.dispatch(e.state.tr.setNodeMarkup(a, void 0, {
|
|
2333
|
+
...i.attrs,
|
|
2334
|
+
style: o
|
|
2335
|
+
}));
|
|
2336
|
+
}
|
|
2337
|
+
function Ht(e, t, n, r) {
|
|
2338
|
+
let i = q(e, t);
|
|
2339
|
+
if (!i) return;
|
|
2340
|
+
let { rows: a } = i, o = e.state.tr, s = !1;
|
|
2341
|
+
a.forEach((e, t) => {
|
|
2342
|
+
e.cells.forEach((i, a) => {
|
|
2343
|
+
if (!n({
|
|
2344
|
+
row: e,
|
|
2345
|
+
rowIndex: t,
|
|
2346
|
+
cell: i,
|
|
2347
|
+
colIndex: a
|
|
2348
|
+
})) return;
|
|
2349
|
+
let c = Bt(i.node.attrs.style, r({
|
|
2350
|
+
row: e,
|
|
2351
|
+
rowIndex: t,
|
|
2352
|
+
cell: i,
|
|
2353
|
+
colIndex: a
|
|
2354
|
+
}));
|
|
2355
|
+
c !== (i.node.attrs.style || null) && (o = o.setNodeMarkup(i.pos, void 0, {
|
|
2356
|
+
...i.node.attrs,
|
|
2357
|
+
style: c
|
|
2358
|
+
}), s = !0);
|
|
2359
|
+
});
|
|
2360
|
+
}), s && e.view.dispatch(o);
|
|
2361
|
+
}
|
|
2362
|
+
function Ut(e, t) {
|
|
2297
2363
|
let n = e.view.posAtDOM(t, 0);
|
|
2298
|
-
e.view.dispatch(e.state.tr.setSelection(
|
|
2364
|
+
e.view.dispatch(e.state.tr.setSelection(B.create(e.state.doc, n))), e.view.focus();
|
|
2299
2365
|
}
|
|
2300
|
-
function
|
|
2301
|
-
e.
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2366
|
+
function Wt(e, t, n) {
|
|
2367
|
+
let r = e.chain().focus().setTextSelection(t + 1);
|
|
2368
|
+
typeof r[n] == "function" && r[n]().run();
|
|
2369
|
+
}
|
|
2370
|
+
function Gt(e, t) {
|
|
2371
|
+
let n = q(e, t);
|
|
2372
|
+
if (!n) return;
|
|
2373
|
+
let { tableNode: r, tablePos: i } = n, a = r.attrs.style || "";
|
|
2374
|
+
/width\s*:/i.test(a) || e.view.dispatch(e.state.tr.setNodeMarkup(i, void 0, {
|
|
2375
|
+
...r.attrs,
|
|
2376
|
+
style: Bt(a, { width: "100%" })
|
|
2377
|
+
}));
|
|
2378
|
+
}
|
|
2379
|
+
function Kt(e, t, n) {
|
|
2380
|
+
let r = t.querySelector("table");
|
|
2381
|
+
if (!r || r.offsetWidth === 0) return;
|
|
2382
|
+
let i = r.getBoundingClientRect(), a = t.getBoundingClientRect(), o = r.querySelector("tr");
|
|
2383
|
+
if (!o) return;
|
|
2384
|
+
let s = Array.from(o.children), c = Array.from(r.querySelectorAll("tr"));
|
|
2385
|
+
n.innerHTML = "";
|
|
2386
|
+
let l = document.createElement("button");
|
|
2387
|
+
l.type = "button", l.className = "je-table-move-handle", l.innerHTML = zt, l.style.top = `${i.top - a.top + 8}px`, l.style.left = `${i.left - a.left - 22}px`, l.addEventListener("mousedown", (n) => {
|
|
2388
|
+
n.preventDefault(), Ut(e, t);
|
|
2389
|
+
}), n.appendChild(l);
|
|
2390
|
+
let u = document.createElement("div");
|
|
2391
|
+
u.className = "je-table-resize-handle", u.style.left = `${i.right - a.left - 8}px`, u.style.top = `${i.bottom - a.top - 8}px`, n.appendChild(u);
|
|
2392
|
+
let d = 0, f = 0, p = 0, m = 0, h = (n) => {
|
|
2393
|
+
let r = Math.max(240, p + (n.clientX - d)), i = Math.max(28, m + (n.clientY - f));
|
|
2394
|
+
Vt(e, t, { width: `${r}px` }), Ht(e, t, () => !0, () => ({ height: `${i}px` }));
|
|
2395
|
+
}, g = () => {
|
|
2396
|
+
window.removeEventListener("pointermove", h), window.removeEventListener("pointerup", g);
|
|
2397
|
+
};
|
|
2398
|
+
u.addEventListener("pointerdown", (e) => {
|
|
2399
|
+
e.preventDefault();
|
|
2400
|
+
let t = r.querySelector("th, td");
|
|
2401
|
+
d = e.clientX, f = e.clientY, p = r.getBoundingClientRect().width, m = t ? t.getBoundingClientRect().height : 36, window.addEventListener("pointermove", h), window.addEventListener("pointerup", g);
|
|
2402
|
+
}), s.forEach((o, s) => {
|
|
2403
|
+
let c = o.getBoundingClientRect(), l = document.createElement("div");
|
|
2404
|
+
l.className = "je-table-col-handle", l.style.left = `${c.right - a.left - 3}px`, l.style.top = `${i.top - a.top}px`, l.style.height = `${i.height}px`;
|
|
2405
|
+
let u = document.createElement("button");
|
|
2406
|
+
u.type = "button", u.className = "je-table-add-control je-table-add-control--column", u.textContent = "+", u.style.left = `${c.right - a.left - 8}px`, u.style.top = `${i.top - a.top - 12}px`;
|
|
2407
|
+
let d = q(e, t)?.rows?.[0]?.cells?.[s]?.pos;
|
|
2408
|
+
u.addEventListener("mousedown", (t) => {
|
|
2409
|
+
t.preventDefault(), t.stopPropagation(), d != null && Wt(e, d, "addColumnAfter");
|
|
2309
2410
|
});
|
|
2310
|
-
let
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
});
|
|
2316
|
-
}, u = () => {
|
|
2317
|
-
c = null, window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", u);
|
|
2411
|
+
let f = 0, p = 0, m = (n) => {
|
|
2412
|
+
let i = Math.max(60, p + (n.clientX - f));
|
|
2413
|
+
Vt(e, t, { width: `${r.getBoundingClientRect().width}px` }), Ht(e, t, ({ colIndex: e }) => e === s, () => ({ width: `${i}px` }));
|
|
2414
|
+
}, h = () => {
|
|
2415
|
+
window.removeEventListener("pointermove", m), window.removeEventListener("pointerup", h);
|
|
2318
2416
|
};
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2417
|
+
l.addEventListener("pointerdown", (e) => {
|
|
2418
|
+
e.preventDefault(), f = e.clientX, p = c.width, window.addEventListener("pointermove", m), window.addEventListener("pointerup", h);
|
|
2419
|
+
}), n.append(l, u);
|
|
2420
|
+
}), c.forEach((r, o) => {
|
|
2421
|
+
if (!r.children[0]) return;
|
|
2422
|
+
let s = r.getBoundingClientRect(), c = document.createElement("div");
|
|
2423
|
+
c.className = "je-table-row-handle", c.style.left = `${i.left - a.left}px`, c.style.top = `${s.bottom - a.top - 3}px`, c.style.width = `${i.width}px`;
|
|
2424
|
+
let l = document.createElement("button");
|
|
2425
|
+
l.type = "button", l.className = "je-table-add-control je-table-add-control--row", l.textContent = "+", l.style.left = `${i.left - a.left - 12}px`, l.style.top = `${s.bottom - a.top - 8}px`;
|
|
2426
|
+
let u = q(e, t)?.rows?.[o]?.cells?.[0]?.pos;
|
|
2427
|
+
l.addEventListener("mousedown", (t) => {
|
|
2428
|
+
t.preventDefault(), t.stopPropagation(), u != null && Wt(e, u, "addRowAfter");
|
|
2429
|
+
});
|
|
2430
|
+
let d = 0, f = 0, p = (n) => {
|
|
2431
|
+
let r = Math.max(28, f + (n.clientY - d));
|
|
2432
|
+
Ht(e, t, ({ rowIndex: e }) => e === o, () => ({ height: `${r}px` }));
|
|
2433
|
+
}, m = () => {
|
|
2434
|
+
window.removeEventListener("pointermove", p), window.removeEventListener("pointerup", m);
|
|
2435
|
+
};
|
|
2436
|
+
c.addEventListener("pointerdown", (e) => {
|
|
2437
|
+
e.preventDefault(), d = e.clientY, f = s.height, window.addEventListener("pointermove", p), window.addEventListener("pointerup", m);
|
|
2438
|
+
}), n.append(c, l);
|
|
2326
2439
|
});
|
|
2327
2440
|
}
|
|
2328
|
-
function
|
|
2441
|
+
function qt(e) {
|
|
2442
|
+
e.view.dom.querySelectorAll(".tableWrapper").forEach((t) => {
|
|
2443
|
+
t.classList.add("je-table-wrap"), Gt(e, t);
|
|
2444
|
+
let n = t.querySelector(".je-table-overlay");
|
|
2445
|
+
n || (n = document.createElement("div"), n.className = "je-table-overlay", t.appendChild(n)), Kt(e, t, n);
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
function Jt(e, t = 4, n = 8) {
|
|
2329
2449
|
e.chain().focus().insertTable({
|
|
2330
2450
|
rows: t,
|
|
2331
2451
|
cols: n,
|
|
2332
2452
|
withHeaderRow: !0
|
|
2333
2453
|
}).run();
|
|
2334
2454
|
}
|
|
2335
|
-
var
|
|
2455
|
+
var Yt = {
|
|
2336
2456
|
name: "table",
|
|
2337
2457
|
toolbar: {
|
|
2338
2458
|
icon: "grid",
|
|
2339
2459
|
title: "表格"
|
|
2340
2460
|
},
|
|
2341
2461
|
tiptapExtension: c.configure({
|
|
2342
|
-
resizable: !
|
|
2462
|
+
resizable: !1,
|
|
2343
2463
|
table: {
|
|
2344
|
-
HTMLAttributes: {
|
|
2464
|
+
HTMLAttributes: {
|
|
2465
|
+
class: "je-table",
|
|
2466
|
+
style: "width:100%;"
|
|
2467
|
+
},
|
|
2345
2468
|
renderWrapper: !0,
|
|
2346
2469
|
allowTableNodeSelection: !0,
|
|
2347
|
-
cellMinWidth:
|
|
2470
|
+
cellMinWidth: 80
|
|
2348
2471
|
}
|
|
2349
2472
|
}),
|
|
2350
2473
|
command: (e) => {
|
|
@@ -2352,24 +2475,28 @@ var Vt = {
|
|
|
2352
2475
|
window.confirm("当前已在表格中,是否删除整个表格?") && e.chain().focus().deleteTable().run();
|
|
2353
2476
|
return;
|
|
2354
2477
|
}
|
|
2355
|
-
|
|
2478
|
+
Jt(e, 4, 8);
|
|
2356
2479
|
},
|
|
2357
2480
|
isActive: (e) => e.isActive("table"),
|
|
2358
2481
|
init(e) {
|
|
2359
|
-
let t = () =>
|
|
2360
|
-
|
|
2361
|
-
|
|
2482
|
+
let t = !1, n = () => {
|
|
2483
|
+
e.view.composing || t || (t = !0, window.requestAnimationFrame(() => {
|
|
2484
|
+
qt(e), t = !1;
|
|
2485
|
+
}));
|
|
2486
|
+
};
|
|
2487
|
+
e.on("update", n), e.on("selectionUpdate", n), window.addEventListener("resize", n), this._cleanup = () => {
|
|
2488
|
+
e.off("update", n), e.off("selectionUpdate", n), window.removeEventListener("resize", n);
|
|
2362
2489
|
};
|
|
2363
2490
|
},
|
|
2364
2491
|
destroy() {
|
|
2365
2492
|
this._cleanup?.(), this._cleanup = null;
|
|
2366
2493
|
}
|
|
2367
|
-
},
|
|
2368
|
-
function
|
|
2494
|
+
}, Xt = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 6 15 12 9 18\"></polyline></svg>", Zt = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"4\" y=\"5\" width=\"16\" height=\"14\" rx=\"1\"/><path d=\"M4 10h16\"/><path d=\"M9 5v14\"/><path d=\"M15 5v14\"/></svg>";
|
|
2495
|
+
function Qt(e) {
|
|
2369
2496
|
let t = document.createElement("input");
|
|
2370
2497
|
return t.type = "number", t.min = "1", t.max = "99", t.value = String(e), t.className = "je-insert-table-number", t;
|
|
2371
2498
|
}
|
|
2372
|
-
function
|
|
2499
|
+
function $t(e, t) {
|
|
2373
2500
|
let n = document.createElement("div");
|
|
2374
2501
|
n.className = "je-popover je-insert-table-panel";
|
|
2375
2502
|
let r = document.createElement("div");
|
|
@@ -2380,13 +2507,13 @@ function Gt(e, t) {
|
|
|
2380
2507
|
a.className = "je-insert-table-info", a.textContent = "0 x 0";
|
|
2381
2508
|
let o = document.createElement("div");
|
|
2382
2509
|
o.className = "je-insert-table-custom";
|
|
2383
|
-
let s =
|
|
2510
|
+
let s = Qt(4), c = Qt(8), l = document.createElement("label");
|
|
2384
2511
|
l.className = "je-insert-table-custom-field", l.innerHTML = "<span>行</span>", l.appendChild(s);
|
|
2385
2512
|
let u = document.createElement("label");
|
|
2386
2513
|
u.className = "je-insert-table-custom-field", u.innerHTML = "<span>列</span>", u.appendChild(c);
|
|
2387
2514
|
let d = document.createElement("button");
|
|
2388
2515
|
d.type = "button", d.className = "je-insert-table-confirm", d.textContent = "插入", d.addEventListener("click", () => {
|
|
2389
|
-
|
|
2516
|
+
Jt(e, Number(s.value) || 1, Number(c.value) || 1), t.closePopover();
|
|
2390
2517
|
}), o.append(l, u, d);
|
|
2391
2518
|
let f = 0, p = 0, m = () => {
|
|
2392
2519
|
Array.from(i.children).forEach((e, t) => {
|
|
@@ -2399,24 +2526,24 @@ function Gt(e, t) {
|
|
|
2399
2526
|
a.type = "button", a.className = "je-insert-table-cell", a.addEventListener("mouseenter", () => {
|
|
2400
2527
|
f = r, p = n, m();
|
|
2401
2528
|
}), a.addEventListener("click", () => {
|
|
2402
|
-
|
|
2529
|
+
Jt(e, p, f), t.closePopover();
|
|
2403
2530
|
}), i.appendChild(a);
|
|
2404
2531
|
}
|
|
2405
2532
|
return i.addEventListener("mouseleave", () => {
|
|
2406
2533
|
f = 0, p = 0, m();
|
|
2407
2534
|
}), m(), n.append(r, i, a, o), n;
|
|
2408
2535
|
}
|
|
2409
|
-
function
|
|
2536
|
+
function en(e, t, n) {
|
|
2410
2537
|
let r = document.createElement("button");
|
|
2411
2538
|
r.type = "button", r.className = "je-insert-item", r.innerHTML = `
|
|
2412
2539
|
<span class="je-insert-item-main">
|
|
2413
2540
|
<span class="je-insert-item-icon">${e.icon || ""}</span>
|
|
2414
2541
|
<span>${e.label}</span>
|
|
2415
2542
|
</span>
|
|
2416
|
-
${e.hasSubmenu ? `<span class="je-insert-item-arrow">${
|
|
2543
|
+
${e.hasSubmenu ? `<span class="je-insert-item-arrow">${Xt}</span>` : ""}
|
|
2417
2544
|
`, e.hasSubmenu ? r.addEventListener("mouseenter", () => e.onHover(r)) : r.addEventListener("click", e.onClick), t.appendChild(r);
|
|
2418
2545
|
}
|
|
2419
|
-
var
|
|
2546
|
+
var tn = {
|
|
2420
2547
|
name: "insert",
|
|
2421
2548
|
toolbar: {
|
|
2422
2549
|
text: "插入",
|
|
@@ -2431,17 +2558,17 @@ var qt = {
|
|
|
2431
2558
|
return n.className = "je-popover je-insert-popover", [
|
|
2432
2559
|
{
|
|
2433
2560
|
label: "表格",
|
|
2434
|
-
icon:
|
|
2561
|
+
icon: Zt,
|
|
2435
2562
|
hasSubmenu: !0,
|
|
2436
2563
|
onHover(n) {
|
|
2437
|
-
t.openNestedPopover(
|
|
2564
|
+
t.openNestedPopover($t(e, t), n);
|
|
2438
2565
|
}
|
|
2439
2566
|
},
|
|
2440
2567
|
{
|
|
2441
2568
|
label: "链接",
|
|
2442
2569
|
icon: h.link,
|
|
2443
2570
|
onClick() {
|
|
2444
|
-
t.closePopover(),
|
|
2571
|
+
t.closePopover(), It(e);
|
|
2445
2572
|
}
|
|
2446
2573
|
},
|
|
2447
2574
|
{
|
|
@@ -2451,18 +2578,18 @@ var qt = {
|
|
|
2451
2578
|
t.closePopover(), e.chain().focus().insertRawHtmlIsland("<div>\n Raw HTML\n</div>").run();
|
|
2452
2579
|
}
|
|
2453
2580
|
}
|
|
2454
|
-
].forEach((e) =>
|
|
2581
|
+
].forEach((e) => en(e, n, t)), n;
|
|
2455
2582
|
}
|
|
2456
2583
|
};
|
|
2457
2584
|
//#endregion
|
|
2458
2585
|
//#region src/plugins/fullscreen.js
|
|
2459
|
-
function
|
|
2586
|
+
function nn(e) {
|
|
2460
2587
|
return e.options.element?.closest(".je-container");
|
|
2461
2588
|
}
|
|
2462
|
-
function
|
|
2463
|
-
|
|
2589
|
+
function rn(e, t) {
|
|
2590
|
+
e && e.classList.toggle("je-is-fullscreen", t);
|
|
2464
2591
|
}
|
|
2465
|
-
var
|
|
2592
|
+
var an = {
|
|
2466
2593
|
name: "fullscreen",
|
|
2467
2594
|
toolbar: {
|
|
2468
2595
|
icon: h.maximize,
|
|
@@ -2470,33 +2597,35 @@ var Xt = {
|
|
|
2470
2597
|
},
|
|
2471
2598
|
tiptapExtension: null,
|
|
2472
2599
|
command: async (e) => {
|
|
2473
|
-
let t =
|
|
2600
|
+
let t = nn(e);
|
|
2474
2601
|
if (t) {
|
|
2475
2602
|
if (document.fullscreenElement === t) {
|
|
2476
|
-
await document.exitFullscreen(),
|
|
2603
|
+
await document.exitFullscreen(), rn(t, !1);
|
|
2477
2604
|
return;
|
|
2478
2605
|
}
|
|
2479
|
-
await t.requestFullscreen?.(),
|
|
2606
|
+
await t.requestFullscreen?.(), rn(t, !0);
|
|
2480
2607
|
}
|
|
2481
2608
|
},
|
|
2482
|
-
isActive: (e) => document.fullscreenElement ===
|
|
2609
|
+
isActive: (e) => document.fullscreenElement === nn(e),
|
|
2483
2610
|
getToolbarState(e) {
|
|
2484
|
-
let t = document.fullscreenElement ===
|
|
2611
|
+
let t = document.fullscreenElement === nn(e);
|
|
2485
2612
|
return {
|
|
2486
2613
|
icon: t ? h.minimize : h.maximize,
|
|
2487
2614
|
title: t ? "退出全屏" : "全屏"
|
|
2488
2615
|
};
|
|
2489
2616
|
},
|
|
2490
2617
|
init(e, t = {}) {
|
|
2491
|
-
let n = () => {
|
|
2492
|
-
document.fullscreenElement
|
|
2618
|
+
let n = nn(e), r = () => {
|
|
2619
|
+
rn(n, document.fullscreenElement === n), t.controller?.sync?.();
|
|
2493
2620
|
};
|
|
2494
|
-
this._onFsChange =
|
|
2621
|
+
this._onFsChange = r, document.addEventListener("fullscreenchange", r);
|
|
2495
2622
|
},
|
|
2496
2623
|
destroy() {
|
|
2497
|
-
this._onFsChange &&= (document.removeEventListener("fullscreenchange", this._onFsChange), null)
|
|
2624
|
+
this._onFsChange &&= (document.removeEventListener("fullscreenchange", this._onFsChange), null), document.querySelectorAll(".je-container.je-is-fullscreen").forEach((e) => {
|
|
2625
|
+
e.classList.remove("je-is-fullscreen");
|
|
2626
|
+
});
|
|
2498
2627
|
}
|
|
2499
|
-
},
|
|
2628
|
+
}, on = /* @__PURE__ */ new WeakMap(), sn = {
|
|
2500
2629
|
name: "source",
|
|
2501
2630
|
toolbar: {
|
|
2502
2631
|
icon: h.source,
|
|
@@ -2505,13 +2634,13 @@ var Xt = {
|
|
|
2505
2634
|
},
|
|
2506
2635
|
tiptapExtension: null,
|
|
2507
2636
|
init(e, t = {}) {
|
|
2508
|
-
|
|
2637
|
+
on.set(e, t.controller || null);
|
|
2509
2638
|
},
|
|
2510
2639
|
command: (e) => {
|
|
2511
|
-
|
|
2640
|
+
on.get(e)?.toggle();
|
|
2512
2641
|
},
|
|
2513
|
-
isActive: (e) => !!
|
|
2514
|
-
},
|
|
2642
|
+
isActive: (e) => !!on.get(e)?.isActive()
|
|
2643
|
+
}, cn = i.create({
|
|
2515
2644
|
name: "genericDiv",
|
|
2516
2645
|
group: "block",
|
|
2517
2646
|
content: "block*",
|
|
@@ -2555,7 +2684,7 @@ function J(e) {
|
|
|
2555
2684
|
renderHTML: (t) => t[e] ? { [e]: t[e] } : {}
|
|
2556
2685
|
};
|
|
2557
2686
|
}
|
|
2558
|
-
var
|
|
2687
|
+
var ln = n.create({
|
|
2559
2688
|
name: "globalStyle",
|
|
2560
2689
|
addGlobalAttributes() {
|
|
2561
2690
|
return [{
|
|
@@ -2601,24 +2730,24 @@ var en = n.create({
|
|
|
2601
2730
|
});
|
|
2602
2731
|
//#endregion
|
|
2603
2732
|
//#region src/extensions/raw-html-island.js
|
|
2604
|
-
function
|
|
2733
|
+
function un(e = "") {
|
|
2605
2734
|
try {
|
|
2606
2735
|
return decodeURIComponent(e);
|
|
2607
2736
|
} catch {
|
|
2608
2737
|
return e;
|
|
2609
2738
|
}
|
|
2610
2739
|
}
|
|
2611
|
-
function
|
|
2740
|
+
function dn(e = "") {
|
|
2612
2741
|
return e.replace(/\s+/g, " ").trim().slice(0, 180) || "HTML preserved";
|
|
2613
2742
|
}
|
|
2614
2743
|
//#endregion
|
|
2615
2744
|
//#region src/plugins/html-preservation.js
|
|
2616
|
-
var
|
|
2745
|
+
var fn = {
|
|
2617
2746
|
name: "htmlPreservation",
|
|
2618
2747
|
toolbar: {},
|
|
2619
2748
|
tiptapExtension: [
|
|
2620
|
-
|
|
2621
|
-
|
|
2749
|
+
cn,
|
|
2750
|
+
ln,
|
|
2622
2751
|
i.create({
|
|
2623
2752
|
name: "rawHtmlIsland",
|
|
2624
2753
|
group: "block",
|
|
@@ -2630,7 +2759,7 @@ var rn = {
|
|
|
2630
2759
|
return {
|
|
2631
2760
|
rawHTML: {
|
|
2632
2761
|
default: "",
|
|
2633
|
-
parseHTML: (e) =>
|
|
2762
|
+
parseHTML: (e) => un(e.getAttribute("data-raw-html") || ""),
|
|
2634
2763
|
renderHTML: (e) => ({ "data-raw-html": encodeURIComponent(e.rawHTML || "") })
|
|
2635
2764
|
},
|
|
2636
2765
|
class: {
|
|
@@ -2691,7 +2820,7 @@ var rn = {
|
|
|
2691
2820
|
let g = document.createElement("button");
|
|
2692
2821
|
g.type = "button", g.className = "raw-html-island__action", g.textContent = "Cancel", m.append(h, g), f.append(p, m);
|
|
2693
2822
|
let _ = (e) => {
|
|
2694
|
-
r = e, d.textContent =
|
|
2823
|
+
r = e, d.textContent = dn(e.attrs.rawHTML), i || (p.value = e.attrs.rawHTML || "");
|
|
2695
2824
|
}, v = () => {
|
|
2696
2825
|
i = !0, p.value = r.attrs.rawHTML || "", a.classList.add("is-editing"), f.classList.remove("is-hidden"), p.focus(), p.setSelectionRange(p.value.length, p.value.length);
|
|
2697
2826
|
}, y = (e = !1) => {
|
|
@@ -2729,7 +2858,7 @@ var rn = {
|
|
|
2729
2858
|
init(e, t = {}) {
|
|
2730
2859
|
e.storage.rawHtmlIsland && (e.storage.rawHtmlIsland.onOpenSource = t.onOpenSource || null);
|
|
2731
2860
|
}
|
|
2732
|
-
},
|
|
2861
|
+
}, pn = {
|
|
2733
2862
|
name: "rawHtmlBlock",
|
|
2734
2863
|
toolbar: {
|
|
2735
2864
|
icon: h.htmlBlock,
|
|
@@ -2741,18 +2870,18 @@ var rn = {
|
|
|
2741
2870
|
e.chain().focus().insertRawHtmlIsland("<div>\n Raw HTML\n</div>").run();
|
|
2742
2871
|
},
|
|
2743
2872
|
isActive: (e) => e.isActive("rawHtmlIsland")
|
|
2744
|
-
},
|
|
2873
|
+
}, mn = new Set([
|
|
2745
2874
|
"paragraph",
|
|
2746
2875
|
"heading",
|
|
2747
2876
|
"blockquote"
|
|
2748
2877
|
]);
|
|
2749
|
-
function
|
|
2878
|
+
function hn(e, t, n, r, i) {
|
|
2750
2879
|
let a = /* @__PURE__ */ new Set();
|
|
2751
2880
|
return t.nodesBetween(n, r, (t, n) => {
|
|
2752
|
-
!
|
|
2881
|
+
!mn.has(t.type.name) || a.has(n) || (a.add(n), e.setNodeMarkup(n, void 0, i(t)));
|
|
2753
2882
|
}), e;
|
|
2754
2883
|
}
|
|
2755
|
-
var
|
|
2884
|
+
var gn = n.create({
|
|
2756
2885
|
name: "blockStyle",
|
|
2757
2886
|
addGlobalAttributes() {
|
|
2758
2887
|
return [{
|
|
@@ -2778,28 +2907,28 @@ var cn = n.create({
|
|
|
2778
2907
|
addCommands() {
|
|
2779
2908
|
return {
|
|
2780
2909
|
setTextAlign: (e) => ({ state: t, dispatch: n }) => {
|
|
2781
|
-
let { from: r, to: i } = t.selection, a =
|
|
2910
|
+
let { from: r, to: i } = t.selection, a = hn(t.tr, t.doc, r, i, (t) => ({
|
|
2782
2911
|
...t.attrs,
|
|
2783
2912
|
textAlign: e
|
|
2784
2913
|
}));
|
|
2785
2914
|
return n && n(a), !0;
|
|
2786
2915
|
},
|
|
2787
2916
|
unsetTextAlign: () => ({ state: e, dispatch: t }) => {
|
|
2788
|
-
let { from: n, to: r } = e.selection, i =
|
|
2917
|
+
let { from: n, to: r } = e.selection, i = hn(e.tr, e.doc, n, r, (e) => ({
|
|
2789
2918
|
...e.attrs,
|
|
2790
2919
|
textAlign: null
|
|
2791
2920
|
}));
|
|
2792
2921
|
return t && t(i), !0;
|
|
2793
2922
|
},
|
|
2794
2923
|
setLineHeight: (e) => ({ state: t, dispatch: n }) => {
|
|
2795
|
-
let { from: r, to: i } = t.selection, a =
|
|
2924
|
+
let { from: r, to: i } = t.selection, a = hn(t.tr, t.doc, r, i, (t) => ({
|
|
2796
2925
|
...t.attrs,
|
|
2797
2926
|
lineHeight: e
|
|
2798
2927
|
}));
|
|
2799
2928
|
return n && n(a), !0;
|
|
2800
2929
|
},
|
|
2801
2930
|
unsetLineHeight: () => ({ state: e, dispatch: t }) => {
|
|
2802
|
-
let { from: n, to: r } = e.selection, i =
|
|
2931
|
+
let { from: n, to: r } = e.selection, i = hn(e.tr, e.doc, n, r, (e) => ({
|
|
2803
2932
|
...e.attrs,
|
|
2804
2933
|
lineHeight: null
|
|
2805
2934
|
}));
|
|
@@ -2810,7 +2939,7 @@ var cn = n.create({
|
|
|
2810
2939
|
});
|
|
2811
2940
|
//#endregion
|
|
2812
2941
|
//#region src/plugins/shared/popover-factory.js
|
|
2813
|
-
function
|
|
2942
|
+
function _n(e, t, n) {
|
|
2814
2943
|
let r = document.createElement("button");
|
|
2815
2944
|
return r.type = "button", r.className = e, r.textContent = t, r.addEventListener("click", n), r;
|
|
2816
2945
|
}
|
|
@@ -2824,44 +2953,44 @@ function Y(e, t, n = {}) {
|
|
|
2824
2953
|
n.type = "button", n.className = "je-popover-item", e.icon ? n.innerHTML = `${e.icon}<span>${e.label}</span>` : n.textContent = e.label, e.style && Object.assign(n.style, e.style), n.addEventListener("click", () => t(e)), r.appendChild(n);
|
|
2825
2954
|
}), r;
|
|
2826
2955
|
}
|
|
2827
|
-
function
|
|
2956
|
+
function vn({ text: e, textColor: t, empty: n = !1, clear: r = !1 }) {
|
|
2828
2957
|
let i = document.createElement("span");
|
|
2829
2958
|
return i.className = "je-style-preview", r ? (i.classList.add("is-clear"), i.innerHTML = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"m7 21 3-3\"/>\n <path d=\"M16 3 4 15a2.83 2.83 0 0 0 4 4L20 7a2.83 2.83 0 0 0-4-4Z\"/>\n <path d=\"M14 7 17 10\"/>\n <path d=\"M8 21h12\"/>\n </svg>\n ", i) : n ? (i.classList.add("is-empty"), i) : (i.style.color = t || "currentColor", i.textContent = e, i);
|
|
2830
2959
|
}
|
|
2831
|
-
function
|
|
2960
|
+
function yn(e, t) {
|
|
2832
2961
|
let n = document.createElement("div");
|
|
2833
2962
|
n.className = "je-color-section-title", n.textContent = t, e.appendChild(n);
|
|
2834
2963
|
}
|
|
2835
|
-
function
|
|
2964
|
+
function bn(e, t, n) {
|
|
2836
2965
|
let r = document.createElement("div");
|
|
2837
|
-
r.className = "je-color-section",
|
|
2966
|
+
r.className = "je-color-section", yn(r, "最近使用");
|
|
2838
2967
|
let i = document.createElement("div");
|
|
2839
2968
|
i.className = "je-color-grid je-color-grid--recent";
|
|
2840
2969
|
let a = [...t.getRecentStyles(n.editor)];
|
|
2841
2970
|
for (; a.length < 5;) a.push(null);
|
|
2842
2971
|
a.forEach((e) => {
|
|
2843
2972
|
let r = document.createElement("button");
|
|
2844
|
-
r.type = "button", r.className = "je-color-swatch je-color-swatch--combo", e ? (r.style.background = e.backgroundColor || "#fff", r.appendChild(
|
|
2973
|
+
r.type = "button", r.className = "je-color-swatch je-color-swatch--combo", e ? (r.style.background = e.backgroundColor || "#fff", r.appendChild(vn({
|
|
2845
2974
|
text: t.previewText,
|
|
2846
2975
|
textColor: e.textColor
|
|
2847
|
-
})), r.addEventListener("click", () => t.applyStyle(n.editor, e, n))) : (r.disabled = !0, r.classList.add("is-empty"), r.appendChild(
|
|
2976
|
+
})), r.addEventListener("click", () => t.applyStyle(n.editor, e, n))) : (r.disabled = !0, r.classList.add("is-empty"), r.appendChild(vn({
|
|
2848
2977
|
text: t.previewText,
|
|
2849
2978
|
empty: !0
|
|
2850
2979
|
}))), i.appendChild(r);
|
|
2851
2980
|
});
|
|
2852
2981
|
let o = document.createElement("button");
|
|
2853
|
-
o.type = "button", o.className = "je-color-swatch je-color-swatch--combo je-color-swatch--clear", o.appendChild(
|
|
2982
|
+
o.type = "button", o.className = "je-color-swatch je-color-swatch--combo je-color-swatch--clear", o.appendChild(vn({
|
|
2854
2983
|
text: t.previewText,
|
|
2855
2984
|
clear: !0
|
|
2856
2985
|
})), o.addEventListener("click", () => t.clearStyle(n.editor, n)), i.appendChild(o), r.appendChild(i), e.appendChild(r);
|
|
2857
2986
|
}
|
|
2858
|
-
function
|
|
2987
|
+
function xn(e, t, n, r, i, a) {
|
|
2859
2988
|
let o = document.createElement("div");
|
|
2860
|
-
o.className = "je-color-section",
|
|
2989
|
+
o.className = "je-color-section", yn(o, t);
|
|
2861
2990
|
let s = document.createElement("div");
|
|
2862
2991
|
s.className = "je-color-grid", n.forEach((e) => {
|
|
2863
2992
|
let t = document.createElement("button");
|
|
2864
|
-
t.type = "button", t.className = `je-color-swatch ${r === "text" ? "je-color-swatch--text" : "je-color-swatch--filled"}`, r === "text" ? (t.appendChild(
|
|
2993
|
+
t.type = "button", t.className = `je-color-swatch ${r === "text" ? "je-color-swatch--text" : "je-color-swatch--filled"}`, r === "text" ? (t.appendChild(vn({
|
|
2865
2994
|
text: i.previewText,
|
|
2866
2995
|
textColor: e
|
|
2867
2996
|
})), t.style.borderColor = e) : t.style.background = e, t.addEventListener("click", () => i.applyColor(a.editor, r, e, a)), s.appendChild(t);
|
|
@@ -2871,7 +3000,7 @@ function pn(e, t, n, r, i, a) {
|
|
|
2871
3000
|
i.showCustomPanel(o, r, a);
|
|
2872
3001
|
}), s.appendChild(c), o.appendChild(s), e.appendChild(o);
|
|
2873
3002
|
}
|
|
2874
|
-
function
|
|
3003
|
+
function Sn(e, t, n) {
|
|
2875
3004
|
let r = document.createElement("div");
|
|
2876
3005
|
r.className = "je-color-custom-panel is-hidden";
|
|
2877
3006
|
let i = document.createElement("div");
|
|
@@ -2880,24 +3009,24 @@ function mn(e, t, n) {
|
|
|
2880
3009
|
a.type = "color", a.className = "je-color-picker";
|
|
2881
3010
|
let o = document.createElement("div");
|
|
2882
3011
|
o.className = "je-color-actions";
|
|
2883
|
-
let s =
|
|
3012
|
+
let s = _n("je-action-btn is-primary", "确认", () => {
|
|
2884
3013
|
t.applyColor(n.editor, r.dataset.mode, a.value, n);
|
|
2885
|
-
}), c =
|
|
3014
|
+
}), c = _n("je-action-btn", "取消", () => {
|
|
2886
3015
|
r.classList.add("is-hidden");
|
|
2887
3016
|
});
|
|
2888
3017
|
return o.append(s, c), r.append(i, a, o), e.appendChild(r), r;
|
|
2889
3018
|
}
|
|
2890
|
-
function
|
|
3019
|
+
function Cn(e, t) {
|
|
2891
3020
|
let n = document.createElement("div");
|
|
2892
|
-
n.className = "je-popover je-popover-color",
|
|
2893
|
-
let r =
|
|
3021
|
+
n.className = "je-popover je-popover-color", bn(n, e, t), xn(n, "字体颜色", e.textColors, "text", e, t), xn(n, "背景颜色", e.backgroundColors, "background", e, t);
|
|
3022
|
+
let r = Sn(n, e, t);
|
|
2894
3023
|
return e.showCustomPanel = (t, n, i) => {
|
|
2895
3024
|
r.dataset.mode = n, r.classList.remove("is-hidden"), r.querySelector(".je-color-custom-title").textContent = n === "text" ? "自定义字体颜色" : "自定义背景颜色", r.querySelector(".je-color-picker").value = e.getCurrentColor(i.editor, n), t.appendChild(r);
|
|
2896
3025
|
}, n;
|
|
2897
3026
|
}
|
|
2898
3027
|
//#endregion
|
|
2899
3028
|
//#region src/plugins/align.js
|
|
2900
|
-
var
|
|
3029
|
+
var wn = [
|
|
2901
3030
|
{
|
|
2902
3031
|
label: "左对齐",
|
|
2903
3032
|
value: "left",
|
|
@@ -2913,22 +3042,22 @@ var gn = [
|
|
|
2913
3042
|
value: "right",
|
|
2914
3043
|
icon: h.alignRight
|
|
2915
3044
|
}
|
|
2916
|
-
],
|
|
3045
|
+
], Tn = {
|
|
2917
3046
|
name: "align",
|
|
2918
3047
|
toolbar: {
|
|
2919
3048
|
icon: h.align,
|
|
2920
3049
|
title: "对齐",
|
|
2921
3050
|
dropdown: !0
|
|
2922
3051
|
},
|
|
2923
|
-
tiptapExtension:
|
|
3052
|
+
tiptapExtension: gn,
|
|
2924
3053
|
command: (e) => e.chain().focus().setTextAlign("left").run(),
|
|
2925
3054
|
isActive: (e) => !!e.getAttributes("paragraph").textAlign,
|
|
2926
3055
|
renderPopover(e, t) {
|
|
2927
|
-
return Y(
|
|
3056
|
+
return Y(wn, (n) => {
|
|
2928
3057
|
e.chain().focus().setTextAlign(n.value).run(), t.closePopover();
|
|
2929
3058
|
});
|
|
2930
3059
|
}
|
|
2931
|
-
},
|
|
3060
|
+
}, En = [
|
|
2932
3061
|
"1.0",
|
|
2933
3062
|
"1.15",
|
|
2934
3063
|
"1.3",
|
|
@@ -2939,10 +3068,10 @@ var gn = [
|
|
|
2939
3068
|
label: e,
|
|
2940
3069
|
value: e
|
|
2941
3070
|
}));
|
|
2942
|
-
function
|
|
3071
|
+
function Dn(e) {
|
|
2943
3072
|
return e.getAttributes("paragraph").lineHeight || "1.5";
|
|
2944
3073
|
}
|
|
2945
|
-
var
|
|
3074
|
+
var On = {
|
|
2946
3075
|
name: "lineHeight",
|
|
2947
3076
|
toolbar: {
|
|
2948
3077
|
text: "1.5",
|
|
@@ -2952,26 +3081,26 @@ var bn = {
|
|
|
2952
3081
|
tiptapExtension: null,
|
|
2953
3082
|
command: (e) => e.chain().focus().setLineHeight("1.5").run(),
|
|
2954
3083
|
isActive: (e) => !!e.getAttributes("paragraph").lineHeight,
|
|
2955
|
-
getToolbarState: (e) => ({ label:
|
|
3084
|
+
getToolbarState: (e) => ({ label: Dn(e) }),
|
|
2956
3085
|
renderPopover(e, t) {
|
|
2957
|
-
return Y(
|
|
3086
|
+
return Y(En, (n) => {
|
|
2958
3087
|
e.chain().focus().setLineHeight(n.value).run(), t.closePopover();
|
|
2959
3088
|
});
|
|
2960
3089
|
}
|
|
2961
|
-
},
|
|
2962
|
-
function
|
|
3090
|
+
}, kn = /* @__PURE__ */ new WeakMap();
|
|
3091
|
+
function An(e) {
|
|
2963
3092
|
return e ? e.startsWith("<") ? e : window.feather?.icons[e] ? window.feather.icons[e].toSvg({
|
|
2964
3093
|
width: 16,
|
|
2965
3094
|
height: 16
|
|
2966
3095
|
}) : "" : "";
|
|
2967
3096
|
}
|
|
2968
|
-
function
|
|
3097
|
+
function jn(e, t, n, r) {
|
|
2969
3098
|
let i = document.createElement("button");
|
|
2970
3099
|
i.type = "button", i.className = "je-insert-item";
|
|
2971
3100
|
let a = e.toolbar?.dropdown || typeof e.renderPopover == "function", o = e.name === "blockquote" ? "添加引用" : e.toolbar?.text || e.toolbar?.title || e.name;
|
|
2972
3101
|
return i.innerHTML = `
|
|
2973
3102
|
<span class="je-insert-item-main">
|
|
2974
|
-
<span class="je-insert-item-icon">${
|
|
3103
|
+
<span class="je-insert-item-icon">${An(e.toolbar?.icon)}</span>
|
|
2975
3104
|
<span>${o}</span>
|
|
2976
3105
|
</span>
|
|
2977
3106
|
${a ? "<span class=\"je-insert-item-arrow\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 6 15 12 9 18\"></polyline></svg></span>" : ""}
|
|
@@ -2986,7 +3115,7 @@ function Cn(e, t, n, r) {
|
|
|
2986
3115
|
n.closePopover(), e.command?.(t), r?.sync?.();
|
|
2987
3116
|
}), i;
|
|
2988
3117
|
}
|
|
2989
|
-
var
|
|
3118
|
+
var Mn = {
|
|
2990
3119
|
name: "more",
|
|
2991
3120
|
toolbar: {
|
|
2992
3121
|
icon: h.more,
|
|
@@ -2995,18 +3124,18 @@ var wn = {
|
|
|
2995
3124
|
},
|
|
2996
3125
|
tiptapExtension: null,
|
|
2997
3126
|
init(e, t = {}) {
|
|
2998
|
-
|
|
3127
|
+
kn.set(e, t.controller || null);
|
|
2999
3128
|
},
|
|
3000
3129
|
command: () => {},
|
|
3001
3130
|
isActive: () => !1,
|
|
3002
3131
|
renderPopover(e, t) {
|
|
3003
|
-
let n =
|
|
3132
|
+
let n = kn.get(e), r = document.createElement("div");
|
|
3004
3133
|
return r.className = "je-popover je-insert-popover", (n?.getItems?.() || []).forEach((i) => {
|
|
3005
3134
|
let a = n?.pluginManager?.get(i);
|
|
3006
|
-
a && r.appendChild(
|
|
3135
|
+
a && r.appendChild(jn(a, e, t, n));
|
|
3007
3136
|
}), r;
|
|
3008
3137
|
}
|
|
3009
|
-
},
|
|
3138
|
+
}, Nn = [
|
|
3010
3139
|
{
|
|
3011
3140
|
label: "正文",
|
|
3012
3141
|
value: "paragraph"
|
|
@@ -3041,7 +3170,7 @@ var wn = {
|
|
|
3041
3170
|
value: "h6",
|
|
3042
3171
|
level: 6
|
|
3043
3172
|
}
|
|
3044
|
-
],
|
|
3173
|
+
], Pn = [
|
|
3045
3174
|
{
|
|
3046
3175
|
label: "系统默认",
|
|
3047
3176
|
value: null,
|
|
@@ -3087,7 +3216,7 @@ var wn = {
|
|
|
3087
3216
|
value: "\"Courier New\", monospace",
|
|
3088
3217
|
cssValue: "\"Courier New\", monospace"
|
|
3089
3218
|
}
|
|
3090
|
-
],
|
|
3219
|
+
], Fn = [
|
|
3091
3220
|
"9px",
|
|
3092
3221
|
"10px",
|
|
3093
3222
|
"11px",
|
|
@@ -3107,7 +3236,7 @@ var wn = {
|
|
|
3107
3236
|
].map((e) => ({
|
|
3108
3237
|
label: e.replace("px", ""),
|
|
3109
3238
|
value: e
|
|
3110
|
-
})),
|
|
3239
|
+
})), In = [
|
|
3111
3240
|
"#333333",
|
|
3112
3241
|
"#9CA3AF",
|
|
3113
3242
|
"#C4A484",
|
|
@@ -3119,7 +3248,7 @@ var wn = {
|
|
|
3119
3248
|
"#8B5CF6",
|
|
3120
3249
|
"#EC4899",
|
|
3121
3250
|
"#EF4444"
|
|
3122
|
-
],
|
|
3251
|
+
], Ln = [
|
|
3123
3252
|
"#FFFFFF",
|
|
3124
3253
|
"#E5E7EB",
|
|
3125
3254
|
"#E7DCD1",
|
|
@@ -3183,11 +3312,11 @@ var wn = {
|
|
|
3183
3312
|
];
|
|
3184
3313
|
//#endregion
|
|
3185
3314
|
//#region src/plugins/heading.js
|
|
3186
|
-
function
|
|
3315
|
+
function Rn(e) {
|
|
3187
3316
|
let t = e.getAttributes("heading");
|
|
3188
3317
|
return e.isActive("heading") && t.level ? `H${t.level}` : "正文";
|
|
3189
3318
|
}
|
|
3190
|
-
var
|
|
3319
|
+
var zn = {
|
|
3191
3320
|
name: "heading",
|
|
3192
3321
|
toolbar: {
|
|
3193
3322
|
text: "正文",
|
|
@@ -3197,9 +3326,9 @@ var jn = {
|
|
|
3197
3326
|
tiptapExtension: null,
|
|
3198
3327
|
command: (e) => e.chain().focus().setParagraph().run(),
|
|
3199
3328
|
isActive: (e) => e.isActive("heading") || e.isActive("paragraph"),
|
|
3200
|
-
getToolbarState: (e) => ({ label:
|
|
3329
|
+
getToolbarState: (e) => ({ label: Rn(e) }),
|
|
3201
3330
|
renderPopover(e, t) {
|
|
3202
|
-
return Y(
|
|
3331
|
+
return Y(Nn.map((e) => ({
|
|
3203
3332
|
...e,
|
|
3204
3333
|
style: e.level ? { fontWeight: "700" } : null
|
|
3205
3334
|
})), (n) => {
|
|
@@ -3207,7 +3336,7 @@ var jn = {
|
|
|
3207
3336
|
n.value === "paragraph" ? r.setParagraph().run() : r.toggleHeading({ level: n.level }).run(), t.closePopover();
|
|
3208
3337
|
});
|
|
3209
3338
|
}
|
|
3210
|
-
},
|
|
3339
|
+
}, Bn = r.create({
|
|
3211
3340
|
name: "fontFamily",
|
|
3212
3341
|
addAttributes() {
|
|
3213
3342
|
return { fontFamily: {
|
|
@@ -3239,23 +3368,23 @@ var jn = {
|
|
|
3239
3368
|
});
|
|
3240
3369
|
//#endregion
|
|
3241
3370
|
//#region src/plugins/font-family.js
|
|
3242
|
-
function
|
|
3371
|
+
function Vn(e) {
|
|
3243
3372
|
let t = e.getAttributes("fontFamily").fontFamily || null;
|
|
3244
|
-
return
|
|
3373
|
+
return Pn.find((e) => e.value === t) || Pn[0];
|
|
3245
3374
|
}
|
|
3246
|
-
var
|
|
3375
|
+
var Hn = {
|
|
3247
3376
|
name: "fontFamily",
|
|
3248
3377
|
toolbar: {
|
|
3249
3378
|
text: "系统默认",
|
|
3250
3379
|
title: "字体",
|
|
3251
3380
|
dropdown: !0
|
|
3252
3381
|
},
|
|
3253
|
-
tiptapExtension:
|
|
3382
|
+
tiptapExtension: Bn,
|
|
3254
3383
|
command: (e) => e.chain().focus().unsetFontFamily().run(),
|
|
3255
3384
|
isActive: (e) => e.isActive("fontFamily"),
|
|
3256
|
-
getToolbarState: (e) => ({ label:
|
|
3385
|
+
getToolbarState: (e) => ({ label: Vn(e).label }),
|
|
3257
3386
|
renderPopover(e, t) {
|
|
3258
|
-
return Y(
|
|
3387
|
+
return Y(Pn.map((e) => ({
|
|
3259
3388
|
...e,
|
|
3260
3389
|
style: e.cssValue ? { fontFamily: e.cssValue } : null
|
|
3261
3390
|
})), (n) => {
|
|
@@ -3263,7 +3392,7 @@ var Pn = {
|
|
|
3263
3392
|
n.value ? r.setFontFamily(n.value).run() : r.unsetFontFamily().run(), t.closePopover();
|
|
3264
3393
|
}, { className: "je-popover-list--font-family je-popover--font-family" });
|
|
3265
3394
|
}
|
|
3266
|
-
},
|
|
3395
|
+
}, Un = r.create({
|
|
3267
3396
|
name: "textColor",
|
|
3268
3397
|
priority: 1e3,
|
|
3269
3398
|
excludes: "",
|
|
@@ -3300,7 +3429,7 @@ var Pn = {
|
|
|
3300
3429
|
unsetTextColor: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
3301
3430
|
};
|
|
3302
3431
|
}
|
|
3303
|
-
}),
|
|
3432
|
+
}), Wn = r.create({
|
|
3304
3433
|
name: "highlightColor",
|
|
3305
3434
|
excludes: "",
|
|
3306
3435
|
addAttributes() {
|
|
@@ -3339,7 +3468,7 @@ var Pn = {
|
|
|
3339
3468
|
unsetHighlightColor: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
3340
3469
|
};
|
|
3341
3470
|
}
|
|
3342
|
-
}),
|
|
3471
|
+
}), Gn = "#EF4444";
|
|
3343
3472
|
function Z(e, t = null) {
|
|
3344
3473
|
if (!e) return t;
|
|
3345
3474
|
let n = e.trim().toUpperCase();
|
|
@@ -3355,34 +3484,34 @@ function Z(e, t = null) {
|
|
|
3355
3484
|
}
|
|
3356
3485
|
return t;
|
|
3357
3486
|
}
|
|
3358
|
-
function
|
|
3487
|
+
function Kn() {
|
|
3359
3488
|
return {
|
|
3360
3489
|
currentTextColor: null,
|
|
3361
3490
|
currentHighlightColor: null,
|
|
3362
3491
|
recentStyles: []
|
|
3363
3492
|
};
|
|
3364
3493
|
}
|
|
3365
|
-
var
|
|
3366
|
-
function
|
|
3367
|
-
return
|
|
3494
|
+
var qn = /* @__PURE__ */ new WeakMap();
|
|
3495
|
+
function Jn(e) {
|
|
3496
|
+
return qn.has(e) || qn.set(e, Kn()), qn.get(e);
|
|
3368
3497
|
}
|
|
3369
|
-
function
|
|
3498
|
+
function Yn(e, t) {
|
|
3370
3499
|
let n = Z(e.getAttributes("textColor").color, null), r = Z(e.getAttributes("highlightColor").backgroundColor, null), i = n ?? t.currentTextColor ?? null, a = r ?? t.currentHighlightColor ?? null;
|
|
3371
3500
|
return n !== null && (t.currentTextColor = n), r !== null && (t.currentHighlightColor = r), {
|
|
3372
3501
|
textColor: i,
|
|
3373
3502
|
backgroundColor: a
|
|
3374
3503
|
};
|
|
3375
3504
|
}
|
|
3376
|
-
function
|
|
3505
|
+
function Xn(e, t) {
|
|
3377
3506
|
if (!t?.textColor && !t?.backgroundColor) return;
|
|
3378
3507
|
let n = {
|
|
3379
|
-
textColor: Z(t.textColor,
|
|
3508
|
+
textColor: Z(t.textColor, Gn),
|
|
3380
3509
|
backgroundColor: Z(t.backgroundColor, null)
|
|
3381
3510
|
};
|
|
3382
3511
|
e.recentStyles = [n, ...e.recentStyles.filter((e) => e.textColor !== n.textColor || e.backgroundColor !== n.backgroundColor)].slice(0, 5);
|
|
3383
3512
|
}
|
|
3384
|
-
function
|
|
3385
|
-
let r =
|
|
3513
|
+
function Zn(e, t, n = null) {
|
|
3514
|
+
let r = Jn(e), i = e.chain().focus(), a = r.currentTextColor, o = r.currentHighlightColor;
|
|
3386
3515
|
if ("textColor" in t) {
|
|
3387
3516
|
let e = Z(t.textColor, null);
|
|
3388
3517
|
e ? (i.setTextColor(e), a = e, r.currentTextColor = e) : (i.unsetTextColor(), a = null, r.currentTextColor = null);
|
|
@@ -3392,42 +3521,42 @@ function Un(e, t, n = null) {
|
|
|
3392
3521
|
e ? (i.setHighlightColor(e), o = e, r.currentHighlightColor = e) : (i.unsetHighlightColor(), o = null, r.currentHighlightColor = null);
|
|
3393
3522
|
}
|
|
3394
3523
|
i.run();
|
|
3395
|
-
let s =
|
|
3396
|
-
|
|
3524
|
+
let s = Yn(e, r);
|
|
3525
|
+
Xn(r, {
|
|
3397
3526
|
textColor: s.textColor ?? a,
|
|
3398
3527
|
backgroundColor: s.backgroundColor ?? o
|
|
3399
3528
|
}), typeof n == "function" && n();
|
|
3400
3529
|
}
|
|
3401
|
-
function
|
|
3402
|
-
let n =
|
|
3530
|
+
function Qn(e, t = null) {
|
|
3531
|
+
let n = Jn(e);
|
|
3403
3532
|
e.chain().focus().unsetTextColor().unsetHighlightColor().run(), n.currentTextColor = null, n.currentHighlightColor = null, typeof t == "function" && t();
|
|
3404
3533
|
}
|
|
3405
|
-
function
|
|
3406
|
-
let n =
|
|
3407
|
-
return
|
|
3534
|
+
function $n(e, t) {
|
|
3535
|
+
let n = Jn(e);
|
|
3536
|
+
return Cn({
|
|
3408
3537
|
previewText: "A",
|
|
3409
|
-
textColors:
|
|
3410
|
-
backgroundColors:
|
|
3538
|
+
textColors: In,
|
|
3539
|
+
backgroundColors: Ln,
|
|
3411
3540
|
getRecentStyles: () => n.recentStyles,
|
|
3412
3541
|
getCurrentColor: (e, t) => {
|
|
3413
|
-
let r =
|
|
3414
|
-
return t === "background" ? r.backgroundColor || "#FFFFFF" : r.textColor ||
|
|
3542
|
+
let r = Yn(e, n);
|
|
3543
|
+
return t === "background" ? r.backgroundColor || "#FFFFFF" : r.textColor || Gn;
|
|
3415
3544
|
},
|
|
3416
3545
|
applyColor: (e, t, n, r) => {
|
|
3417
|
-
t === "text" ?
|
|
3546
|
+
t === "text" ? Zn(e, { textColor: n }, r.closePopover) : Zn(e, { backgroundColor: n }, r.closePopover);
|
|
3418
3547
|
},
|
|
3419
3548
|
applyStyle: (e, t, n) => {
|
|
3420
|
-
|
|
3549
|
+
Zn(e, t, n.closePopover);
|
|
3421
3550
|
},
|
|
3422
3551
|
clearStyle: (e, t) => {
|
|
3423
|
-
|
|
3552
|
+
Qn(e, t.closePopover);
|
|
3424
3553
|
}
|
|
3425
3554
|
}, {
|
|
3426
3555
|
editor: e,
|
|
3427
3556
|
closePopover: t.closePopover
|
|
3428
3557
|
});
|
|
3429
3558
|
}
|
|
3430
|
-
var
|
|
3559
|
+
var er = {
|
|
3431
3560
|
name: "textColor",
|
|
3432
3561
|
toolbar: {
|
|
3433
3562
|
type: "color",
|
|
@@ -3436,31 +3565,31 @@ var Kn = {
|
|
|
3436
3565
|
textColor: null,
|
|
3437
3566
|
backgroundColor: "transparent"
|
|
3438
3567
|
},
|
|
3439
|
-
tiptapExtension: [
|
|
3568
|
+
tiptapExtension: [Un, Wn],
|
|
3440
3569
|
command: (e) => {
|
|
3441
|
-
let t =
|
|
3442
|
-
|
|
3443
|
-
textColor: t.currentTextColor ||
|
|
3570
|
+
let t = Jn(e);
|
|
3571
|
+
Zn(e, {
|
|
3572
|
+
textColor: t.currentTextColor || Gn,
|
|
3444
3573
|
backgroundColor: t.currentHighlightColor
|
|
3445
3574
|
});
|
|
3446
3575
|
},
|
|
3447
3576
|
isActive: (e) => e.isActive("textColor") || e.isActive("highlightColor"),
|
|
3448
3577
|
getToolbarState: (e) => {
|
|
3449
|
-
let t =
|
|
3578
|
+
let t = Yn(e, Jn(e));
|
|
3450
3579
|
return {
|
|
3451
3580
|
textColor: t.textColor || null,
|
|
3452
3581
|
backgroundColor: t.backgroundColor || "transparent"
|
|
3453
3582
|
};
|
|
3454
3583
|
},
|
|
3455
3584
|
renderPopover(e, t) {
|
|
3456
|
-
return
|
|
3585
|
+
return $n(e, t);
|
|
3457
3586
|
}
|
|
3458
|
-
},
|
|
3459
|
-
function
|
|
3460
|
-
return
|
|
3587
|
+
}, tr = 1500, nr = new Map(X.map((e) => [e.value, e]));
|
|
3588
|
+
function rr(e) {
|
|
3589
|
+
return nr.get(e) || X[0];
|
|
3461
3590
|
}
|
|
3462
|
-
function
|
|
3463
|
-
let t =
|
|
3591
|
+
function ir(e) {
|
|
3592
|
+
let t = rr(e);
|
|
3464
3593
|
return {
|
|
3465
3594
|
type: t.value,
|
|
3466
3595
|
title: t.label,
|
|
@@ -3468,7 +3597,7 @@ function Xn(e) {
|
|
|
3468
3597
|
backgroundColor: t.backgroundColor
|
|
3469
3598
|
};
|
|
3470
3599
|
}
|
|
3471
|
-
function
|
|
3600
|
+
function ar(e) {
|
|
3472
3601
|
for (let t = e.depth; t > 0; --t) if (e.node(t).type.name === "callout") return {
|
|
3473
3602
|
depth: t,
|
|
3474
3603
|
node: e.node(t),
|
|
@@ -3476,7 +3605,7 @@ function Zn(e) {
|
|
|
3476
3605
|
};
|
|
3477
3606
|
return null;
|
|
3478
3607
|
}
|
|
3479
|
-
function
|
|
3608
|
+
function or(e) {
|
|
3480
3609
|
let t = e.textColor, n = {
|
|
3481
3610
|
note: `<svg viewBox="0 0 24 24" fill="none"><path d="M11 19C15.4183 19 19 15.4183 19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19Z" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M21 21L16.65 16.65" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M11 9.5C12.3807 9.5 13.5 8.38071 13.5 7C13.5 5.61929 12.3807 4.5 11 4.5C9.61929 4.5 8.5 5.61929 8.5 7C8.5 8.38071 9.61929 9.5 11 9.5Z" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
|
3482
3611
|
tip: `<svg viewBox="0 0 24 24" fill="none"><path d="M12 22C11.1716 22 10.5 21.3284 10.5 20.5C10.5 19.6716 11.1716 19 12 19C12.8284 19 13.5 19.6716 13.5 20.5C13.5 21.3284 12.8284 22 12 22Z" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M9 11C9 8.79086 10.7909 7 13 7C15.2091 7 17 8.79086 17 11C17 13.2091 15.2091 15 13 15C10.7909 15 9 13.2091 9 11Z" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 7C8 3.68629 10.6863 1 14 1C17.3137 1 20 3.68629 20 7C20 10.3137 17.3137 13 14 13C10.6863 13 8 10.3137 8 7Z" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
|
@@ -3487,7 +3616,7 @@ function Qn(e) {
|
|
|
3487
3616
|
};
|
|
3488
3617
|
return n[e.value] || n.note;
|
|
3489
3618
|
}
|
|
3490
|
-
var
|
|
3619
|
+
var sr = i.create({
|
|
3491
3620
|
name: "callout",
|
|
3492
3621
|
group: "block",
|
|
3493
3622
|
content: "block+",
|
|
@@ -3554,17 +3683,17 @@ var $n = i.create({
|
|
|
3554
3683
|
insertCallout: (e = {}) => ({ commands: t }) => t.insertContent({
|
|
3555
3684
|
type: this.name,
|
|
3556
3685
|
attrs: {
|
|
3557
|
-
...
|
|
3686
|
+
...ir(e.type || "note"),
|
|
3558
3687
|
...e
|
|
3559
3688
|
},
|
|
3560
3689
|
content: [{ type: "paragraph" }]
|
|
3561
3690
|
}),
|
|
3562
3691
|
setCalloutType: (e) => ({ state: t, dispatch: n }) => {
|
|
3563
|
-
let r =
|
|
3692
|
+
let r = ar(t.selection.$from);
|
|
3564
3693
|
if (!r) return !1;
|
|
3565
3694
|
let i = {
|
|
3566
3695
|
...r.node.attrs,
|
|
3567
|
-
...
|
|
3696
|
+
...ir(e)
|
|
3568
3697
|
};
|
|
3569
3698
|
return n && n(t.tr.setNodeMarkup(r.pos, void 0, i)), !0;
|
|
3570
3699
|
}
|
|
@@ -3572,14 +3701,14 @@ var $n = i.create({
|
|
|
3572
3701
|
},
|
|
3573
3702
|
addKeyboardShortcuts() {
|
|
3574
3703
|
return {
|
|
3575
|
-
"Shift-Enter": () =>
|
|
3704
|
+
"Shift-Enter": () => ar(this.editor.state.selection.$from) ? this.editor.commands.enter() : !1,
|
|
3576
3705
|
Enter: () => {
|
|
3577
|
-
let { state: e, view: t } = this.editor, n =
|
|
3706
|
+
let { state: e, view: t } = this.editor, n = ar(e.selection.$from);
|
|
3578
3707
|
if (!n) return !1;
|
|
3579
3708
|
let { $from: r } = e.selection;
|
|
3580
3709
|
if (r.parent.type.name !== "paragraph" || r.parent.content.size > 0 || r.depth !== n.depth + 1) return !1;
|
|
3581
3710
|
let i = e.schema.nodes.paragraph.create(), a = r.before(r.depth), o = r.parent.nodeSize, s = r.after(n.depth) - o, c = e.tr.delete(a, a + o).insert(s, i);
|
|
3582
|
-
return c.setSelection(
|
|
3711
|
+
return c.setSelection(z.create(c.doc, s + 1)), t.dispatch(c.scrollIntoView()), !0;
|
|
3583
3712
|
}
|
|
3584
3713
|
};
|
|
3585
3714
|
},
|
|
@@ -3608,14 +3737,14 @@ var $n = i.create({
|
|
|
3608
3737
|
}, h = () => {
|
|
3609
3738
|
p(), !a.classList.contains("ProseMirror-selectednode") && (i = window.setTimeout(() => {
|
|
3610
3739
|
a.classList.remove("is-handle-visible");
|
|
3611
|
-
},
|
|
3740
|
+
}, tr));
|
|
3612
3741
|
}, g = () => {
|
|
3613
3742
|
r && (r.remove(), r = null, document.removeEventListener("mousedown", _, !0), window.removeEventListener("scroll", g, !0), window.removeEventListener("resize", g, !0));
|
|
3614
3743
|
}, _ = (e) => {
|
|
3615
3744
|
r?.contains(e.target) || l.contains(e.target) || g();
|
|
3616
3745
|
}, v = () => {
|
|
3617
3746
|
let e = n(), { state: r, view: i } = t;
|
|
3618
|
-
i.dispatch(r.tr.setSelection(
|
|
3747
|
+
i.dispatch(r.tr.setSelection(B.create(r.doc, e))), i.focus();
|
|
3619
3748
|
}, y = () => {
|
|
3620
3749
|
g(), r = document.createElement("div"), r.className = "je-popover je-callout-type-popover", X.forEach((e) => {
|
|
3621
3750
|
let n = document.createElement("button");
|
|
@@ -3644,8 +3773,8 @@ var $n = i.create({
|
|
|
3644
3773
|
e.preventDefault(), e.stopPropagation(), y();
|
|
3645
3774
|
}), a.addEventListener("mouseenter", m), a.addEventListener("mouseleave", h);
|
|
3646
3775
|
let b = (e) => {
|
|
3647
|
-
let t =
|
|
3648
|
-
a.style.setProperty("--je-callout-color", e.attrs.textColor), a.style.setProperty("--je-callout-bg", e.attrs.backgroundColor), u.innerHTML =
|
|
3776
|
+
let t = rr(e.attrs.type);
|
|
3777
|
+
a.style.setProperty("--je-callout-color", e.attrs.textColor), a.style.setProperty("--je-callout-bg", e.attrs.backgroundColor), u.innerHTML = or(t), d.textContent = e.attrs.title;
|
|
3649
3778
|
};
|
|
3650
3779
|
return b(e), {
|
|
3651
3780
|
dom: a,
|
|
@@ -3668,20 +3797,20 @@ var $n = i.create({
|
|
|
3668
3797
|
};
|
|
3669
3798
|
};
|
|
3670
3799
|
}
|
|
3671
|
-
}),
|
|
3672
|
-
function
|
|
3800
|
+
}), cr = /* @__PURE__ */ new WeakMap();
|
|
3801
|
+
function lr() {
|
|
3673
3802
|
return X[0];
|
|
3674
3803
|
}
|
|
3675
|
-
function
|
|
3676
|
-
return
|
|
3804
|
+
function ur(e) {
|
|
3805
|
+
return cr.has(e) || cr.set(e, { currentType: lr().value }), cr.get(e);
|
|
3677
3806
|
}
|
|
3678
|
-
function
|
|
3679
|
-
return X.find((t) => t.value === e) ||
|
|
3807
|
+
function dr(e) {
|
|
3808
|
+
return X.find((t) => t.value === e) || lr();
|
|
3680
3809
|
}
|
|
3681
|
-
function
|
|
3682
|
-
return e.isActive("callout") ?
|
|
3810
|
+
function fr(e) {
|
|
3811
|
+
return e.isActive("callout") ? dr(e.getAttributes("callout").type) : dr(ur(e).currentType);
|
|
3683
3812
|
}
|
|
3684
|
-
function
|
|
3813
|
+
function pr(e, t) {
|
|
3685
3814
|
let n = document.createElement("div");
|
|
3686
3815
|
return n.className = "je-popover je-popover-list", X.forEach((r) => {
|
|
3687
3816
|
let i = document.createElement("button");
|
|
@@ -3694,37 +3823,37 @@ function ar(e, t) {
|
|
|
3694
3823
|
s.className = "je-callout-label", s.textContent = r.label;
|
|
3695
3824
|
let c = document.createElement("span");
|
|
3696
3825
|
c.className = "je-callout-short", c.textContent = r.shortLabel, o.append(s, c), i.append(a, o), i.addEventListener("click", () => {
|
|
3697
|
-
let n =
|
|
3826
|
+
let n = ur(e);
|
|
3698
3827
|
n.currentType = r.value, e.isActive("callout") ? e.chain().focus().setCalloutType(r.value).run() : e.chain().focus().insertCallout({ type: r.value }).run(), t.closePopover();
|
|
3699
3828
|
}), n.appendChild(i);
|
|
3700
3829
|
}), n;
|
|
3701
3830
|
}
|
|
3702
|
-
var
|
|
3831
|
+
var mr = {
|
|
3703
3832
|
name: "callout",
|
|
3704
3833
|
toolbar: {
|
|
3705
3834
|
type: "color",
|
|
3706
3835
|
text: "C",
|
|
3707
3836
|
title: "Callout",
|
|
3708
|
-
textColor:
|
|
3709
|
-
backgroundColor:
|
|
3837
|
+
textColor: lr().textColor,
|
|
3838
|
+
backgroundColor: lr().backgroundColor
|
|
3710
3839
|
},
|
|
3711
|
-
tiptapExtension:
|
|
3840
|
+
tiptapExtension: sr,
|
|
3712
3841
|
command: (e) => {
|
|
3713
|
-
let t =
|
|
3842
|
+
let t = dr(ur(e).currentType);
|
|
3714
3843
|
e.chain().focus().insertCallout({ type: t.value }).run();
|
|
3715
3844
|
},
|
|
3716
3845
|
isActive: (e) => e.isActive("callout"),
|
|
3717
3846
|
getToolbarState: (e) => {
|
|
3718
|
-
let t =
|
|
3847
|
+
let t = fr(e);
|
|
3719
3848
|
return {
|
|
3720
3849
|
textColor: t.textColor,
|
|
3721
3850
|
backgroundColor: t.backgroundColor
|
|
3722
3851
|
};
|
|
3723
3852
|
},
|
|
3724
3853
|
renderPopover(e, t) {
|
|
3725
|
-
return
|
|
3854
|
+
return pr(e, t);
|
|
3726
3855
|
}
|
|
3727
|
-
},
|
|
3856
|
+
}, hr = {
|
|
3728
3857
|
name: "bulletList",
|
|
3729
3858
|
toolbar: {
|
|
3730
3859
|
icon: h.bulletList,
|
|
@@ -3733,7 +3862,7 @@ var or = {
|
|
|
3733
3862
|
tiptapExtension: null,
|
|
3734
3863
|
command: (e) => e.chain().focus().toggleBulletList().run(),
|
|
3735
3864
|
isActive: (e) => e.isActive("bulletList")
|
|
3736
|
-
},
|
|
3865
|
+
}, gr = {
|
|
3737
3866
|
name: "orderedList",
|
|
3738
3867
|
toolbar: {
|
|
3739
3868
|
icon: h.orderedList,
|
|
@@ -3742,7 +3871,7 @@ var or = {
|
|
|
3742
3871
|
tiptapExtension: null,
|
|
3743
3872
|
command: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
3744
3873
|
isActive: (e) => e.isActive("orderedList")
|
|
3745
|
-
},
|
|
3874
|
+
}, _r = "margin:0.8em 0;padding:2px 12px 2px 12px;border-left:3px solid #374151;background:#f3f4f6;color:#111827;", vr = i.create({
|
|
3746
3875
|
name: "blockquote",
|
|
3747
3876
|
group: "block",
|
|
3748
3877
|
content: "block+",
|
|
@@ -3766,20 +3895,20 @@ var or = {
|
|
|
3766
3895
|
renderHTML({ HTMLAttributes: e }) {
|
|
3767
3896
|
return [
|
|
3768
3897
|
"blockquote",
|
|
3769
|
-
a(e, { style:
|
|
3898
|
+
a(e, { style: _r }),
|
|
3770
3899
|
0
|
|
3771
3900
|
];
|
|
3772
3901
|
}
|
|
3773
|
-
}),
|
|
3902
|
+
}), yr = {
|
|
3774
3903
|
name: "blockquote",
|
|
3775
3904
|
toolbar: {
|
|
3776
3905
|
icon: h.quote,
|
|
3777
3906
|
title: "引用"
|
|
3778
3907
|
},
|
|
3779
|
-
tiptapExtension:
|
|
3908
|
+
tiptapExtension: vr,
|
|
3780
3909
|
command: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
3781
3910
|
isActive: (e) => e.isActive("blockquote")
|
|
3782
|
-
},
|
|
3911
|
+
}, br = [
|
|
3783
3912
|
"padding:0.14em 0.42em",
|
|
3784
3913
|
"border:1px solid #e8edf3",
|
|
3785
3914
|
"border-radius:6px",
|
|
@@ -3788,7 +3917,7 @@ var or = {
|
|
|
3788
3917
|
"font-weight:700",
|
|
3789
3918
|
"font-family:\"JetBrains Mono\",\"SFMono-Regular\",Consolas,monospace",
|
|
3790
3919
|
"font-size:0.92em"
|
|
3791
|
-
].join(";"),
|
|
3920
|
+
].join(";"), xr = r.create({
|
|
3792
3921
|
name: "code",
|
|
3793
3922
|
excludes: "_",
|
|
3794
3923
|
code: !0,
|
|
@@ -3798,7 +3927,7 @@ var or = {
|
|
|
3798
3927
|
renderHTML({ HTMLAttributes: e }) {
|
|
3799
3928
|
return [
|
|
3800
3929
|
"code",
|
|
3801
|
-
a(e, { style:
|
|
3930
|
+
a(e, { style: br }),
|
|
3802
3931
|
0
|
|
3803
3932
|
];
|
|
3804
3933
|
},
|
|
@@ -3809,19 +3938,19 @@ var or = {
|
|
|
3809
3938
|
unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
3810
3939
|
};
|
|
3811
3940
|
}
|
|
3812
|
-
}),
|
|
3941
|
+
}), Sr = {
|
|
3813
3942
|
name: "inlineCode",
|
|
3814
3943
|
toolbar: {
|
|
3815
3944
|
icon: h.inlineCode,
|
|
3816
3945
|
title: "Inline Code"
|
|
3817
3946
|
},
|
|
3818
|
-
tiptapExtension:
|
|
3947
|
+
tiptapExtension: xr,
|
|
3819
3948
|
command: (e) => e.chain().focus().toggleCode().run(),
|
|
3820
3949
|
isActive: (e) => e.isActive("code")
|
|
3821
3950
|
};
|
|
3822
3951
|
//#endregion
|
|
3823
3952
|
//#region node_modules/highlight.js/es/languages/xml.js
|
|
3824
|
-
function
|
|
3953
|
+
function Cr(e) {
|
|
3825
3954
|
let t = e.regex, n = t.concat(/[\p{L}_]/u, t.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), r = /[\p{L}0-9._:-]+/u, i = {
|
|
3826
3955
|
className: "symbol",
|
|
3827
3956
|
begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
|
|
@@ -3986,7 +4115,7 @@ function hr(e) {
|
|
|
3986
4115
|
}
|
|
3987
4116
|
//#endregion
|
|
3988
4117
|
//#region node_modules/highlight.js/es/languages/css.js
|
|
3989
|
-
var
|
|
4118
|
+
var wr = (e) => ({
|
|
3990
4119
|
IMPORTANT: {
|
|
3991
4120
|
scope: "meta",
|
|
3992
4121
|
begin: "!important"
|
|
@@ -4016,7 +4145,7 @@ var gr = (e) => ({
|
|
|
4016
4145
|
className: "attr",
|
|
4017
4146
|
begin: /--[A-Za-z_][A-Za-z0-9_-]*/
|
|
4018
4147
|
}
|
|
4019
|
-
}),
|
|
4148
|
+
}), Tr = /* @__PURE__ */ "a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video".split("."), Er = /* @__PURE__ */ "defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath".split("."), Dr = [...Tr, ...Er], Or = (/* @__PURE__ */ "any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height".split(".")).sort().reverse(), kr = (/* @__PURE__ */ "active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where".split(".")).sort().reverse(), Ar = [
|
|
4020
4149
|
"after",
|
|
4021
4150
|
"backdrop",
|
|
4022
4151
|
"before",
|
|
@@ -4031,9 +4160,9 @@ var gr = (e) => ({
|
|
|
4031
4160
|
"selection",
|
|
4032
4161
|
"slotted",
|
|
4033
4162
|
"spelling-error"
|
|
4034
|
-
].sort().reverse(),
|
|
4035
|
-
function
|
|
4036
|
-
let t = e.regex, n =
|
|
4163
|
+
].sort().reverse(), jr = (/* @__PURE__ */ "accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom".split(".")).sort().reverse();
|
|
4164
|
+
function Mr(e) {
|
|
4165
|
+
let t = e.regex, n = wr(e), r = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, i = /@-?\w[\w]*(-\w+)*/, a = [e.APOS_STRING_MODE, e.QUOTE_STRING_MODE];
|
|
4037
4166
|
return {
|
|
4038
4167
|
name: "CSS",
|
|
4039
4168
|
case_insensitive: !0,
|
|
@@ -4057,12 +4186,12 @@ function wr(e) {
|
|
|
4057
4186
|
n.ATTRIBUTE_SELECTOR_MODE,
|
|
4058
4187
|
{
|
|
4059
4188
|
className: "selector-pseudo",
|
|
4060
|
-
variants: [{ begin: ":(" +
|
|
4189
|
+
variants: [{ begin: ":(" + kr.join("|") + ")" }, { begin: ":(:)?(" + Ar.join("|") + ")" }]
|
|
4061
4190
|
},
|
|
4062
4191
|
n.CSS_VARIABLE,
|
|
4063
4192
|
{
|
|
4064
4193
|
className: "attribute",
|
|
4065
|
-
begin: "\\b(" +
|
|
4194
|
+
begin: "\\b(" + jr.join("|") + ")\\b"
|
|
4066
4195
|
},
|
|
4067
4196
|
{
|
|
4068
4197
|
begin: /:/,
|
|
@@ -4104,7 +4233,7 @@ function wr(e) {
|
|
|
4104
4233
|
keywords: {
|
|
4105
4234
|
$pattern: /[a-z-]+/,
|
|
4106
4235
|
keyword: "and or not only",
|
|
4107
|
-
attribute:
|
|
4236
|
+
attribute: Or.join(" ")
|
|
4108
4237
|
},
|
|
4109
4238
|
contains: [
|
|
4110
4239
|
{
|
|
@@ -4118,21 +4247,21 @@ function wr(e) {
|
|
|
4118
4247
|
},
|
|
4119
4248
|
{
|
|
4120
4249
|
className: "selector-tag",
|
|
4121
|
-
begin: "\\b(" +
|
|
4250
|
+
begin: "\\b(" + Dr.join("|") + ")\\b"
|
|
4122
4251
|
}
|
|
4123
4252
|
]
|
|
4124
4253
|
};
|
|
4125
4254
|
}
|
|
4126
4255
|
//#endregion
|
|
4127
4256
|
//#region node_modules/highlight.js/es/languages/javascript.js
|
|
4128
|
-
var
|
|
4257
|
+
var Nr = "[A-Za-z$_][0-9A-Za-z$_]*", Pr = /* @__PURE__ */ "as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using".split("."), Fr = [
|
|
4129
4258
|
"true",
|
|
4130
4259
|
"false",
|
|
4131
4260
|
"null",
|
|
4132
4261
|
"undefined",
|
|
4133
4262
|
"NaN",
|
|
4134
4263
|
"Infinity"
|
|
4135
|
-
],
|
|
4264
|
+
], Ir = /* @__PURE__ */ "Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly".split("."), Lr = [
|
|
4136
4265
|
"Error",
|
|
4137
4266
|
"EvalError",
|
|
4138
4267
|
"InternalError",
|
|
@@ -4141,7 +4270,7 @@ var Tr = "[A-Za-z$_][0-9A-Za-z$_]*", Er = /* @__PURE__ */ "as.in.of.if.for.while
|
|
|
4141
4270
|
"SyntaxError",
|
|
4142
4271
|
"TypeError",
|
|
4143
4272
|
"URIError"
|
|
4144
|
-
],
|
|
4273
|
+
], Rr = [
|
|
4145
4274
|
"setInterval",
|
|
4146
4275
|
"setTimeout",
|
|
4147
4276
|
"clearInterval",
|
|
@@ -4159,7 +4288,7 @@ var Tr = "[A-Za-z$_][0-9A-Za-z$_]*", Er = /* @__PURE__ */ "as.in.of.if.for.while
|
|
|
4159
4288
|
"encodeURIComponent",
|
|
4160
4289
|
"escape",
|
|
4161
4290
|
"unescape"
|
|
4162
|
-
],
|
|
4291
|
+
], zr = [
|
|
4163
4292
|
"arguments",
|
|
4164
4293
|
"this",
|
|
4165
4294
|
"super",
|
|
@@ -4170,12 +4299,12 @@ var Tr = "[A-Za-z$_][0-9A-Za-z$_]*", Er = /* @__PURE__ */ "as.in.of.if.for.while
|
|
|
4170
4299
|
"sessionStorage",
|
|
4171
4300
|
"module",
|
|
4172
4301
|
"global"
|
|
4173
|
-
],
|
|
4174
|
-
function
|
|
4302
|
+
], Br = [].concat(Rr, Ir, Lr);
|
|
4303
|
+
function Vr(e) {
|
|
4175
4304
|
let t = e.regex, n = (e, { after: t }) => {
|
|
4176
4305
|
let n = "</" + e[0].slice(1);
|
|
4177
4306
|
return e.input.indexOf(n, t) !== -1;
|
|
4178
|
-
}, r =
|
|
4307
|
+
}, r = Nr, i = {
|
|
4179
4308
|
begin: "<>",
|
|
4180
4309
|
end: "</>"
|
|
4181
4310
|
}, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, o = {
|
|
@@ -4199,11 +4328,11 @@ function Nr(e) {
|
|
|
4199
4328
|
}
|
|
4200
4329
|
}
|
|
4201
4330
|
}, s = {
|
|
4202
|
-
$pattern:
|
|
4203
|
-
keyword:
|
|
4204
|
-
literal:
|
|
4205
|
-
built_in:
|
|
4206
|
-
"variable.language":
|
|
4331
|
+
$pattern: Nr,
|
|
4332
|
+
keyword: Pr,
|
|
4333
|
+
literal: Fr,
|
|
4334
|
+
built_in: Br,
|
|
4335
|
+
"variable.language": zr
|
|
4207
4336
|
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, u = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", d = {
|
|
4208
4337
|
className: "number",
|
|
4209
4338
|
variants: [
|
|
@@ -4350,7 +4479,7 @@ function Nr(e) {
|
|
|
4350
4479
|
relevance: 0,
|
|
4351
4480
|
match: t.either(/\bJSON/, /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/, /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/, /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),
|
|
4352
4481
|
className: "title.class",
|
|
4353
|
-
keywords: { _: [...
|
|
4482
|
+
keywords: { _: [...Ir, ...Lr] }
|
|
4354
4483
|
}, w = {
|
|
4355
4484
|
label: "use_strict",
|
|
4356
4485
|
className: "meta",
|
|
@@ -4380,7 +4509,7 @@ function Nr(e) {
|
|
|
4380
4509
|
}
|
|
4381
4510
|
let O = {
|
|
4382
4511
|
match: t.concat(/\b/, D([
|
|
4383
|
-
...
|
|
4512
|
+
...Rr,
|
|
4384
4513
|
"super",
|
|
4385
4514
|
"import"
|
|
4386
4515
|
].map((e) => `${e}\\s*\\(`)), r, t.lookahead(/\s*\(/)),
|
|
@@ -4560,14 +4689,14 @@ function Nr(e) {
|
|
|
4560
4689
|
}
|
|
4561
4690
|
//#endregion
|
|
4562
4691
|
//#region node_modules/highlight.js/es/languages/typescript.js
|
|
4563
|
-
var
|
|
4692
|
+
var Hr = "[A-Za-z$_][0-9A-Za-z$_]*", Ur = /* @__PURE__ */ "as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using".split("."), Wr = [
|
|
4564
4693
|
"true",
|
|
4565
4694
|
"false",
|
|
4566
4695
|
"null",
|
|
4567
4696
|
"undefined",
|
|
4568
4697
|
"NaN",
|
|
4569
4698
|
"Infinity"
|
|
4570
|
-
],
|
|
4699
|
+
], Gr = /* @__PURE__ */ "Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly".split("."), Kr = [
|
|
4571
4700
|
"Error",
|
|
4572
4701
|
"EvalError",
|
|
4573
4702
|
"InternalError",
|
|
@@ -4576,7 +4705,7 @@ var Pr = "[A-Za-z$_][0-9A-Za-z$_]*", Fr = /* @__PURE__ */ "as.in.of.if.for.while
|
|
|
4576
4705
|
"SyntaxError",
|
|
4577
4706
|
"TypeError",
|
|
4578
4707
|
"URIError"
|
|
4579
|
-
],
|
|
4708
|
+
], qr = [
|
|
4580
4709
|
"setInterval",
|
|
4581
4710
|
"setTimeout",
|
|
4582
4711
|
"clearInterval",
|
|
@@ -4594,7 +4723,7 @@ var Pr = "[A-Za-z$_][0-9A-Za-z$_]*", Fr = /* @__PURE__ */ "as.in.of.if.for.while
|
|
|
4594
4723
|
"encodeURIComponent",
|
|
4595
4724
|
"escape",
|
|
4596
4725
|
"unescape"
|
|
4597
|
-
],
|
|
4726
|
+
], Jr = [
|
|
4598
4727
|
"arguments",
|
|
4599
4728
|
"this",
|
|
4600
4729
|
"super",
|
|
@@ -4605,12 +4734,12 @@ var Pr = "[A-Za-z$_][0-9A-Za-z$_]*", Fr = /* @__PURE__ */ "as.in.of.if.for.while
|
|
|
4605
4734
|
"sessionStorage",
|
|
4606
4735
|
"module",
|
|
4607
4736
|
"global"
|
|
4608
|
-
],
|
|
4609
|
-
function
|
|
4737
|
+
], Yr = [].concat(qr, Gr, Kr);
|
|
4738
|
+
function Xr(e) {
|
|
4610
4739
|
let t = e.regex, n = (e, { after: t }) => {
|
|
4611
4740
|
let n = "</" + e[0].slice(1);
|
|
4612
4741
|
return e.input.indexOf(n, t) !== -1;
|
|
4613
|
-
}, r =
|
|
4742
|
+
}, r = Hr, i = {
|
|
4614
4743
|
begin: "<>",
|
|
4615
4744
|
end: "</>"
|
|
4616
4745
|
}, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, o = {
|
|
@@ -4634,11 +4763,11 @@ function Hr(e) {
|
|
|
4634
4763
|
}
|
|
4635
4764
|
}
|
|
4636
4765
|
}, s = {
|
|
4637
|
-
$pattern:
|
|
4638
|
-
keyword:
|
|
4639
|
-
literal:
|
|
4640
|
-
built_in:
|
|
4641
|
-
"variable.language":
|
|
4766
|
+
$pattern: Hr,
|
|
4767
|
+
keyword: Ur,
|
|
4768
|
+
literal: Wr,
|
|
4769
|
+
built_in: Yr,
|
|
4770
|
+
"variable.language": Jr
|
|
4642
4771
|
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, u = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", d = {
|
|
4643
4772
|
className: "number",
|
|
4644
4773
|
variants: [
|
|
@@ -4785,7 +4914,7 @@ function Hr(e) {
|
|
|
4785
4914
|
relevance: 0,
|
|
4786
4915
|
match: t.either(/\bJSON/, /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/, /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/, /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),
|
|
4787
4916
|
className: "title.class",
|
|
4788
|
-
keywords: { _: [...
|
|
4917
|
+
keywords: { _: [...Gr, ...Kr] }
|
|
4789
4918
|
}, w = {
|
|
4790
4919
|
label: "use_strict",
|
|
4791
4920
|
className: "meta",
|
|
@@ -4815,7 +4944,7 @@ function Hr(e) {
|
|
|
4815
4944
|
}
|
|
4816
4945
|
let O = {
|
|
4817
4946
|
match: t.concat(/\b/, D([
|
|
4818
|
-
...
|
|
4947
|
+
...qr,
|
|
4819
4948
|
"super",
|
|
4820
4949
|
"import"
|
|
4821
4950
|
].map((e) => `${e}\\s*\\(`)), r, t.lookahead(/\s*\(/)),
|
|
@@ -4993,8 +5122,8 @@ function Hr(e) {
|
|
|
4993
5122
|
]
|
|
4994
5123
|
};
|
|
4995
5124
|
}
|
|
4996
|
-
function
|
|
4997
|
-
let t = e.regex, n =
|
|
5125
|
+
function Zr(e) {
|
|
5126
|
+
let t = e.regex, n = Xr(e), r = Hr, i = [
|
|
4998
5127
|
"any",
|
|
4999
5128
|
"void",
|
|
5000
5129
|
"number",
|
|
@@ -5029,8 +5158,8 @@ function Ur(e) {
|
|
|
5029
5158
|
relevance: 10,
|
|
5030
5159
|
begin: /^\s*['"]use strict['"]/
|
|
5031
5160
|
}, c = {
|
|
5032
|
-
$pattern:
|
|
5033
|
-
keyword:
|
|
5161
|
+
$pattern: Hr,
|
|
5162
|
+
keyword: Ur.concat([
|
|
5034
5163
|
"type",
|
|
5035
5164
|
"interface",
|
|
5036
5165
|
"public",
|
|
@@ -5044,9 +5173,9 @@ function Ur(e) {
|
|
|
5044
5173
|
"override",
|
|
5045
5174
|
"satisfies"
|
|
5046
5175
|
]),
|
|
5047
|
-
literal:
|
|
5048
|
-
built_in:
|
|
5049
|
-
"variable.language":
|
|
5176
|
+
literal: Wr,
|
|
5177
|
+
built_in: Yr.concat(i),
|
|
5178
|
+
"variable.language": Jr
|
|
5050
5179
|
}, l = {
|
|
5051
5180
|
className: "meta",
|
|
5052
5181
|
begin: "@" + r
|
|
@@ -5080,7 +5209,7 @@ function Ur(e) {
|
|
|
5080
5209
|
}
|
|
5081
5210
|
//#endregion
|
|
5082
5211
|
//#region node_modules/highlight.js/es/languages/json.js
|
|
5083
|
-
function
|
|
5212
|
+
function Qr(e) {
|
|
5084
5213
|
let t = {
|
|
5085
5214
|
className: "attr",
|
|
5086
5215
|
begin: /"(\\.|[^\\"\r\n])*"(?=\s*:)/,
|
|
@@ -5115,7 +5244,7 @@ function Wr(e) {
|
|
|
5115
5244
|
}
|
|
5116
5245
|
//#endregion
|
|
5117
5246
|
//#region node_modules/highlight.js/es/languages/bash.js
|
|
5118
|
-
function
|
|
5247
|
+
function $r(e) {
|
|
5119
5248
|
let t = e.regex, n = {}, r = {
|
|
5120
5249
|
begin: /\$\{/,
|
|
5121
5250
|
end: /\}/,
|
|
@@ -5283,7 +5412,7 @@ function Gr(e) {
|
|
|
5283
5412
|
}
|
|
5284
5413
|
//#endregion
|
|
5285
5414
|
//#region node_modules/highlight.js/es/languages/python.js
|
|
5286
|
-
function
|
|
5415
|
+
function ei(e) {
|
|
5287
5416
|
let t = e.regex, n = /[\p{XID_Start}_]\p{XID_Continue}*/u, r = /* @__PURE__ */ "and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield".split("."), i = {
|
|
5288
5417
|
$pattern: /[A-Za-z]\w+|__\w+__/,
|
|
5289
5418
|
keyword: r,
|
|
@@ -5520,7 +5649,7 @@ function Kr(e) {
|
|
|
5520
5649
|
}
|
|
5521
5650
|
//#endregion
|
|
5522
5651
|
//#region node_modules/highlight.js/es/languages/plaintext.js
|
|
5523
|
-
function
|
|
5652
|
+
function ti(e) {
|
|
5524
5653
|
return {
|
|
5525
5654
|
name: "Plain text",
|
|
5526
5655
|
aliases: ["text", "txt"],
|
|
@@ -5529,26 +5658,26 @@ function qr(e) {
|
|
|
5529
5658
|
}
|
|
5530
5659
|
//#endregion
|
|
5531
5660
|
//#region node_modules/highlight.js/es/languages/java.js
|
|
5532
|
-
var Q = "[0-9](_*[0-9])*",
|
|
5661
|
+
var Q = "[0-9](_*[0-9])*", ni = `\\.(${Q})`, ri = "[0-9a-fA-F](_*[0-9a-fA-F])*", ii = {
|
|
5533
5662
|
className: "number",
|
|
5534
5663
|
variants: [
|
|
5535
|
-
{ begin: `(\\b(${Q})((${
|
|
5536
|
-
{ begin: `\\b(${Q})((${
|
|
5537
|
-
{ begin: `(${
|
|
5664
|
+
{ begin: `(\\b(${Q})((${ni})|\\.)?|(${ni}))[eE][+-]?(${Q})[fFdD]?\\b` },
|
|
5665
|
+
{ begin: `\\b(${Q})((${ni})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
|
|
5666
|
+
{ begin: `(${ni})[fFdD]?\\b` },
|
|
5538
5667
|
{ begin: `\\b(${Q})[fFdD]\\b` },
|
|
5539
|
-
{ begin: `\\b0[xX]((${
|
|
5668
|
+
{ begin: `\\b0[xX]((${ri})\\.?|(${ri})?\\.(${ri}))[pP][+-]?(${Q})[fFdD]?\\b` },
|
|
5540
5669
|
{ begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
|
|
5541
|
-
{ begin: `\\b0[xX](${
|
|
5670
|
+
{ begin: `\\b0[xX](${ri})[lL]?\\b` },
|
|
5542
5671
|
{ begin: "\\b0(_*[0-7])*[lL]?\\b" },
|
|
5543
5672
|
{ begin: "\\b0[bB][01](_*[01])*[lL]?\\b" }
|
|
5544
5673
|
],
|
|
5545
5674
|
relevance: 0
|
|
5546
5675
|
};
|
|
5547
|
-
function
|
|
5548
|
-
return n === -1 ? "" : e.replace(t, (r) =>
|
|
5676
|
+
function ai(e, t, n) {
|
|
5677
|
+
return n === -1 ? "" : e.replace(t, (r) => ai(e, t, n - 1));
|
|
5549
5678
|
}
|
|
5550
|
-
function
|
|
5551
|
-
let t = e.regex, n = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", r = n +
|
|
5679
|
+
function oi(e) {
|
|
5680
|
+
let t = e.regex, n = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", r = n + ai("(?:<" + n + "~~~(?:\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~)*>)?", /~~~/g, 2), i = {
|
|
5552
5681
|
keyword: /* @__PURE__ */ "synchronized.abstract.private.var.static.if.const .for.while.strictfp.finally.protected.import.native.final.void.enum.else.break.transient.catch.instanceof.volatile.case.assert.package.default.public.try.switch.continue.throws.protected.public.private.module.requires.exports.do.sealed.yield.permits.goto.when".split("."),
|
|
5553
5682
|
literal: [
|
|
5554
5683
|
"false",
|
|
@@ -5682,7 +5811,7 @@ function Qr(e) {
|
|
|
5682
5811
|
a,
|
|
5683
5812
|
e.APOS_STRING_MODE,
|
|
5684
5813
|
e.QUOTE_STRING_MODE,
|
|
5685
|
-
|
|
5814
|
+
ii,
|
|
5686
5815
|
e.C_BLOCK_COMMENT_MODE
|
|
5687
5816
|
]
|
|
5688
5817
|
},
|
|
@@ -5690,14 +5819,14 @@ function Qr(e) {
|
|
|
5690
5819
|
e.C_BLOCK_COMMENT_MODE
|
|
5691
5820
|
]
|
|
5692
5821
|
},
|
|
5693
|
-
|
|
5822
|
+
ii,
|
|
5694
5823
|
a
|
|
5695
5824
|
]
|
|
5696
5825
|
};
|
|
5697
5826
|
}
|
|
5698
5827
|
//#endregion
|
|
5699
5828
|
//#region node_modules/highlight.js/es/languages/c.js
|
|
5700
|
-
function
|
|
5829
|
+
function si(e) {
|
|
5701
5830
|
let t = e.regex, n = e.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), r = "decltype\\(auto\\)", i = "[a-zA-Z_]\\w*::", a = "(" + r + "|" + t.optional(i) + "[a-zA-Z_]\\w*" + t.optional("<[^<>]+>") + ")", o = {
|
|
5702
5831
|
className: "type",
|
|
5703
5832
|
variants: [{ begin: "\\b[a-z\\d_]*_t\\b" }, { match: /\batomic_[a-z]{3,6}\b/ }]
|
|
@@ -5872,7 +6001,7 @@ function $r(e) {
|
|
|
5872
6001
|
}
|
|
5873
6002
|
//#endregion
|
|
5874
6003
|
//#region node_modules/highlight.js/es/languages/cpp.js
|
|
5875
|
-
function
|
|
6004
|
+
function ci(e) {
|
|
5876
6005
|
let t = e.regex, n = e.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), r = "decltype\\(auto\\)", i = "[a-zA-Z_]\\w*::", a = "(?!struct)(" + r + "|" + t.optional(i) + "[a-zA-Z_]\\w*" + t.optional("<[^<>]+>") + ")", o = {
|
|
5877
6006
|
className: "type",
|
|
5878
6007
|
begin: "\\b[a-z\\d_]*_t\\b"
|
|
@@ -6096,7 +6225,7 @@ function ei(e) {
|
|
|
6096
6225
|
}
|
|
6097
6226
|
//#endregion
|
|
6098
6227
|
//#region node_modules/highlight.js/es/languages/go.js
|
|
6099
|
-
function
|
|
6228
|
+
function li(e) {
|
|
6100
6229
|
let t = {
|
|
6101
6230
|
keyword: [
|
|
6102
6231
|
"break",
|
|
@@ -6235,7 +6364,7 @@ function ti(e) {
|
|
|
6235
6364
|
}
|
|
6236
6365
|
//#endregion
|
|
6237
6366
|
//#region node_modules/highlight.js/es/languages/rust.js
|
|
6238
|
-
function
|
|
6367
|
+
function ui(e) {
|
|
6239
6368
|
let t = e.regex, n = /(r#)?/, r = t.concat(n, e.UNDERSCORE_IDENT_RE), i = t.concat(n, e.IDENT_RE), a = {
|
|
6240
6369
|
className: "title.function.invoke",
|
|
6241
6370
|
relevance: 0,
|
|
@@ -6403,7 +6532,7 @@ function ni(e) {
|
|
|
6403
6532
|
}
|
|
6404
6533
|
//#endregion
|
|
6405
6534
|
//#region node_modules/highlight.js/es/languages/sql.js
|
|
6406
|
-
function
|
|
6535
|
+
function di(e) {
|
|
6407
6536
|
let t = e.regex, n = e.COMMENT("--", "$"), r = {
|
|
6408
6537
|
scope: "string",
|
|
6409
6538
|
variants: [{
|
|
@@ -6520,7 +6649,7 @@ function ri(e) {
|
|
|
6520
6649
|
}
|
|
6521
6650
|
//#endregion
|
|
6522
6651
|
//#region node_modules/highlight.js/es/languages/yaml.js
|
|
6523
|
-
function
|
|
6652
|
+
function fi(e) {
|
|
6524
6653
|
let t = "true false yes no null", n = "[\\w#;/?:@&=+$,.~*'()[\\]]+", r = {
|
|
6525
6654
|
className: "attr",
|
|
6526
6655
|
variants: [
|
|
@@ -6663,7 +6792,7 @@ function ii(e) {
|
|
|
6663
6792
|
}
|
|
6664
6793
|
//#endregion
|
|
6665
6794
|
//#region node_modules/highlight.js/es/languages/markdown.js
|
|
6666
|
-
function
|
|
6795
|
+
function pi(e) {
|
|
6667
6796
|
let t = e.regex, n = {
|
|
6668
6797
|
begin: /<\/?[A-Za-z_]/,
|
|
6669
6798
|
end: ">",
|
|
@@ -6843,7 +6972,7 @@ function ai(e) {
|
|
|
6843
6972
|
}
|
|
6844
6973
|
//#endregion
|
|
6845
6974
|
//#region node_modules/highlight.js/es/languages/php.js
|
|
6846
|
-
function
|
|
6975
|
+
function mi(e) {
|
|
6847
6976
|
let t = e.regex, n = /(?![A-Za-z0-9])(?![$])/, r = t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/, n), i = t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/, n), a = t.concat(/[A-Z]+/, n), o = {
|
|
6848
6977
|
scope: "variable",
|
|
6849
6978
|
match: "\\$+" + r
|
|
@@ -7136,7 +7265,7 @@ function oi(e) {
|
|
|
7136
7265
|
}
|
|
7137
7266
|
//#endregion
|
|
7138
7267
|
//#region node_modules/highlight.js/es/languages/dockerfile.js
|
|
7139
|
-
function
|
|
7268
|
+
function hi(e) {
|
|
7140
7269
|
return {
|
|
7141
7270
|
name: "Dockerfile",
|
|
7142
7271
|
aliases: ["docker"],
|
|
@@ -7169,28 +7298,28 @@ function si(e) {
|
|
|
7169
7298
|
}
|
|
7170
7299
|
//#endregion
|
|
7171
7300
|
//#region src/extensions/code-block.js
|
|
7172
|
-
var
|
|
7173
|
-
|
|
7174
|
-
xml:
|
|
7175
|
-
css:
|
|
7176
|
-
javascript:
|
|
7177
|
-
typescript:
|
|
7178
|
-
json:
|
|
7179
|
-
bash:
|
|
7180
|
-
python:
|
|
7181
|
-
plaintext:
|
|
7182
|
-
java:
|
|
7183
|
-
c:
|
|
7184
|
-
cpp:
|
|
7185
|
-
go:
|
|
7186
|
-
rust:
|
|
7187
|
-
sql:
|
|
7188
|
-
yaml:
|
|
7189
|
-
markdown:
|
|
7190
|
-
php:
|
|
7191
|
-
dockerfile:
|
|
7301
|
+
var gi = u();
|
|
7302
|
+
gi.register({
|
|
7303
|
+
xml: Cr,
|
|
7304
|
+
css: Mr,
|
|
7305
|
+
javascript: Vr,
|
|
7306
|
+
typescript: Zr,
|
|
7307
|
+
json: Qr,
|
|
7308
|
+
bash: $r,
|
|
7309
|
+
python: ei,
|
|
7310
|
+
plaintext: ti,
|
|
7311
|
+
java: oi,
|
|
7312
|
+
c: si,
|
|
7313
|
+
cpp: ci,
|
|
7314
|
+
go: li,
|
|
7315
|
+
rust: ui,
|
|
7316
|
+
sql: di,
|
|
7317
|
+
yaml: fi,
|
|
7318
|
+
markdown: pi,
|
|
7319
|
+
php: mi,
|
|
7320
|
+
dockerfile: hi
|
|
7192
7321
|
});
|
|
7193
|
-
var
|
|
7322
|
+
var _i = [
|
|
7194
7323
|
{
|
|
7195
7324
|
label: "Plain Text",
|
|
7196
7325
|
value: "plaintext"
|
|
@@ -7264,11 +7393,11 @@ var li = [
|
|
|
7264
7393
|
value: "dockerfile"
|
|
7265
7394
|
}
|
|
7266
7395
|
];
|
|
7267
|
-
function
|
|
7268
|
-
return
|
|
7396
|
+
function vi(e) {
|
|
7397
|
+
return _i.find((t) => t.value === e)?.label || "Plain Text";
|
|
7269
7398
|
}
|
|
7270
|
-
var
|
|
7271
|
-
lowlight:
|
|
7399
|
+
var yi = l.configure({
|
|
7400
|
+
lowlight: gi,
|
|
7272
7401
|
defaultLanguage: "plaintext",
|
|
7273
7402
|
HTMLAttributes: { class: "je-code-block" }
|
|
7274
7403
|
}).extend({ addNodeView() {
|
|
@@ -7291,7 +7420,7 @@ var di = l.configure({
|
|
|
7291
7420
|
} catch (e) {
|
|
7292
7421
|
console.error("[JEditor] Failed to copy code block", e);
|
|
7293
7422
|
}
|
|
7294
|
-
}),
|
|
7423
|
+
}), _i.forEach((e) => {
|
|
7295
7424
|
let t = document.createElement("option");
|
|
7296
7425
|
t.value = e.value, t.textContent = e.label, s.appendChild(t);
|
|
7297
7426
|
});
|
|
@@ -7299,7 +7428,7 @@ var di = l.configure({
|
|
|
7299
7428
|
d.appendChild(f), u.appendChild(d), o.append(s, c, l), a.append(o, u);
|
|
7300
7429
|
let p = (e) => {
|
|
7301
7430
|
let t = e.attrs.language || "plaintext";
|
|
7302
|
-
s.value = t, a.dataset.language =
|
|
7431
|
+
s.value = t, a.dataset.language = vi(t), d.className = `je-code-block language-${t}`;
|
|
7303
7432
|
};
|
|
7304
7433
|
return s.addEventListener("change", () => {
|
|
7305
7434
|
let e = n(), { state: i, view: a } = t, o = i.tr.setNodeMarkup(e, void 0, {
|
|
@@ -7318,16 +7447,16 @@ var di = l.configure({
|
|
|
7318
7447
|
}
|
|
7319
7448
|
};
|
|
7320
7449
|
};
|
|
7321
|
-
} }),
|
|
7450
|
+
} }), bi = {
|
|
7322
7451
|
name: "codeBlock",
|
|
7323
7452
|
toolbar: {
|
|
7324
7453
|
icon: h.codeBlock,
|
|
7325
7454
|
title: "Code Block"
|
|
7326
7455
|
},
|
|
7327
|
-
tiptapExtension:
|
|
7456
|
+
tiptapExtension: yi,
|
|
7328
7457
|
command: (e) => e.chain().focus().toggleCodeBlock({ language: "plaintext" }).run(),
|
|
7329
7458
|
isActive: (e) => e.isActive("codeBlock")
|
|
7330
|
-
},
|
|
7459
|
+
}, xi = r.create({
|
|
7331
7460
|
name: "fontSize",
|
|
7332
7461
|
addAttributes() {
|
|
7333
7462
|
return { size: {
|
|
@@ -7359,31 +7488,31 @@ var di = l.configure({
|
|
|
7359
7488
|
});
|
|
7360
7489
|
//#endregion
|
|
7361
7490
|
//#region src/plugins/font-size.js
|
|
7362
|
-
function
|
|
7491
|
+
function Si(e) {
|
|
7363
7492
|
let t = e.getAttributes("fontSize").size || null;
|
|
7364
|
-
return
|
|
7493
|
+
return Fn.find((e) => e.value === t) || {
|
|
7365
7494
|
label: "字号",
|
|
7366
7495
|
value: null
|
|
7367
7496
|
};
|
|
7368
7497
|
}
|
|
7369
|
-
var
|
|
7498
|
+
var Ci = {
|
|
7370
7499
|
name: "fontSize",
|
|
7371
7500
|
toolbar: {
|
|
7372
7501
|
text: "字号",
|
|
7373
7502
|
title: "字号",
|
|
7374
7503
|
dropdown: !0
|
|
7375
7504
|
},
|
|
7376
|
-
tiptapExtension:
|
|
7505
|
+
tiptapExtension: xi,
|
|
7377
7506
|
command: (e) => e.chain().focus().unsetFontSize().run(),
|
|
7378
7507
|
isActive: (e) => !!e.getAttributes("fontSize").size,
|
|
7379
|
-
getToolbarState: (e) => ({ label:
|
|
7508
|
+
getToolbarState: (e) => ({ label: Si(e).label }),
|
|
7380
7509
|
renderPopover(e, t) {
|
|
7381
|
-
return Y(
|
|
7510
|
+
return Y(Fn, (n) => {
|
|
7382
7511
|
let r = e.chain().focus();
|
|
7383
7512
|
n.value ? r.setFontSize(n.value).run() : r.unsetFontSize().run(), t.closePopover();
|
|
7384
7513
|
}, { className: "je-popover-list--scroll je-popover--font-size" });
|
|
7385
7514
|
}
|
|
7386
|
-
},
|
|
7515
|
+
}, wi = [
|
|
7387
7516
|
"display:block",
|
|
7388
7517
|
"height:1px",
|
|
7389
7518
|
"margin:1.1em 0",
|
|
@@ -7406,14 +7535,14 @@ var hi = {
|
|
|
7406
7535
|
"border-image-outset:initial",
|
|
7407
7536
|
"border-image-repeat:initial",
|
|
7408
7537
|
"box-sizing:border-box"
|
|
7409
|
-
].join(";"),
|
|
7538
|
+
].join(";"), Ti = i.create({
|
|
7410
7539
|
name: "horizontalRule",
|
|
7411
7540
|
group: "block",
|
|
7412
7541
|
parseHTML() {
|
|
7413
7542
|
return [{ tag: "hr" }];
|
|
7414
7543
|
},
|
|
7415
7544
|
renderHTML({ HTMLAttributes: e }) {
|
|
7416
|
-
return ["hr", a(e, { style:
|
|
7545
|
+
return ["hr", a(e, { style: wi })];
|
|
7417
7546
|
},
|
|
7418
7547
|
addKeyboardShortcuts() {
|
|
7419
7548
|
return { Enter: () => {
|
|
@@ -7429,19 +7558,19 @@ var hi = {
|
|
|
7429
7558
|
addCommands() {
|
|
7430
7559
|
return { setHorizontalRule: () => ({ commands: e }) => e.insertContent({ type: this.name }) };
|
|
7431
7560
|
}
|
|
7432
|
-
}),
|
|
7561
|
+
}), Ei = {
|
|
7433
7562
|
name: "horizontalRule",
|
|
7434
7563
|
toolbar: {
|
|
7435
7564
|
icon: h.divider,
|
|
7436
7565
|
title: "分隔符"
|
|
7437
7566
|
},
|
|
7438
|
-
tiptapExtension:
|
|
7567
|
+
tiptapExtension: Ti,
|
|
7439
7568
|
command: (e) => e.chain().focus().setHorizontalRule().run(),
|
|
7440
7569
|
isActive: () => !1
|
|
7441
7570
|
};
|
|
7442
7571
|
//#endregion
|
|
7443
7572
|
//#region src/plugins/placeholders.js
|
|
7444
|
-
function
|
|
7573
|
+
function Di(e, t) {
|
|
7445
7574
|
return {
|
|
7446
7575
|
name: e,
|
|
7447
7576
|
toolbar: t,
|
|
@@ -7453,42 +7582,42 @@ function yi(e, t) {
|
|
|
7453
7582
|
}
|
|
7454
7583
|
//#endregion
|
|
7455
7584
|
//#region src/plugins/index.js
|
|
7456
|
-
var
|
|
7457
|
-
|
|
7458
|
-
|
|
7585
|
+
var Oi = [
|
|
7586
|
+
fn,
|
|
7587
|
+
Ei,
|
|
7459
7588
|
b,
|
|
7460
7589
|
x,
|
|
7461
|
-
|
|
7590
|
+
yt,
|
|
7462
7591
|
S,
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7592
|
+
tn,
|
|
7593
|
+
Mn,
|
|
7594
|
+
an,
|
|
7595
|
+
sn,
|
|
7596
|
+
zn,
|
|
7597
|
+
Hn,
|
|
7598
|
+
Ci,
|
|
7470
7599
|
g,
|
|
7471
7600
|
_,
|
|
7472
7601
|
v,
|
|
7473
7602
|
y,
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
or,
|
|
7477
|
-
sr,
|
|
7478
|
-
cr,
|
|
7479
|
-
_n,
|
|
7480
|
-
bn,
|
|
7481
|
-
dr,
|
|
7603
|
+
er,
|
|
7604
|
+
pn,
|
|
7482
7605
|
mr,
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7606
|
+
hr,
|
|
7607
|
+
gr,
|
|
7608
|
+
Tn,
|
|
7609
|
+
On,
|
|
7610
|
+
yr,
|
|
7611
|
+
Sr,
|
|
7612
|
+
bi,
|
|
7613
|
+
Rt,
|
|
7614
|
+
Yt,
|
|
7615
|
+
Et,
|
|
7616
|
+
...[Di("attachment", {
|
|
7488
7617
|
icon: "paperclip",
|
|
7489
7618
|
title: "附件",
|
|
7490
7619
|
className: "is-muted"
|
|
7491
|
-
}),
|
|
7620
|
+
}), Di("mention", {
|
|
7492
7621
|
icon: "at-sign",
|
|
7493
7622
|
title: "提及",
|
|
7494
7623
|
className: "is-muted"
|
|
@@ -7496,7 +7625,7 @@ var bi = [
|
|
|
7496
7625
|
];
|
|
7497
7626
|
//#endregion
|
|
7498
7627
|
//#region src/editor/index.js
|
|
7499
|
-
function
|
|
7628
|
+
function ki(e, n = [], r = {}) {
|
|
7500
7629
|
return new t({
|
|
7501
7630
|
element: e,
|
|
7502
7631
|
extensions: [d.configure({
|
|
@@ -7514,14 +7643,14 @@ function xi(e, n = [], r = {}) {
|
|
|
7514
7643
|
}
|
|
7515
7644
|
//#endregion
|
|
7516
7645
|
//#region src/toolbar/ui.js
|
|
7517
|
-
var
|
|
7518
|
-
function
|
|
7646
|
+
var Ai = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 9 12 15 18 9\"></polyline></svg>", ji = ["je-toolbar-row je-toolbar-row--primary", "je-toolbar-row je-toolbar-row--secondary"];
|
|
7647
|
+
function Mi(e) {
|
|
7519
7648
|
return e ? e.startsWith("<") ? e : window.feather?.icons[e] ? window.feather.icons[e].toSvg({
|
|
7520
7649
|
width: 20,
|
|
7521
7650
|
height: 20
|
|
7522
7651
|
}) : null : null;
|
|
7523
7652
|
}
|
|
7524
|
-
function
|
|
7653
|
+
function Ni(e) {
|
|
7525
7654
|
let t = document.createElement("div");
|
|
7526
7655
|
t.className = "je-color-group", t.dataset.commandGroup = e.name, t.dataset.pluginName = e.name;
|
|
7527
7656
|
let n = document.createElement("button");
|
|
@@ -7533,82 +7662,82 @@ function Ti(e) {
|
|
|
7533
7662
|
</span>
|
|
7534
7663
|
`;
|
|
7535
7664
|
let r = document.createElement("button");
|
|
7536
|
-
return r.type = "button", r.className = "tool-btn-arrow-down", r.dataset.commandToggle = e.name, r.innerHTML =
|
|
7665
|
+
return r.type = "button", r.className = "tool-btn-arrow-down", r.dataset.commandToggle = e.name, r.innerHTML = Ai, t.append(n, r), t;
|
|
7537
7666
|
}
|
|
7538
|
-
function
|
|
7667
|
+
function Pi(e) {
|
|
7539
7668
|
let t = document.createElement("button");
|
|
7540
7669
|
t.type = "button";
|
|
7541
7670
|
let n = !!e.toolbar.icon, r = !!e.toolbar.text;
|
|
7542
7671
|
t.className = n && r ? "tool-btn-text tool-btn-text--icon" : n ? "tool-btn" : "tool-btn-text", t.dataset.commandToggle = e.name, t.dataset.pluginName = e.name, t.title = e.toolbar.title || "";
|
|
7543
|
-
let i =
|
|
7544
|
-
return i && r ? t.innerHTML = `${i}<span>${e.toolbar.text}</span>` : i ? t.innerHTML = i : t.innerHTML = `${e.toolbar.text || ""} ${
|
|
7672
|
+
let i = Mi(e.toolbar.icon);
|
|
7673
|
+
return i && r ? t.innerHTML = `${i}<span>${e.toolbar.text}</span>` : i ? t.innerHTML = i : t.innerHTML = `${e.toolbar.text || ""} ${Ai}`, t;
|
|
7545
7674
|
}
|
|
7546
|
-
function
|
|
7675
|
+
function Fi(e) {
|
|
7547
7676
|
let t = !!e.toolbar.icon, n = !!e.toolbar.text, r = document.createElement("button");
|
|
7548
7677
|
r.type = "button", r.className = t && n ? "tool-btn-text tool-btn-text--icon" : "tool-btn", e.toolbar.className && (r.className += ` ${e.toolbar.className}`), r.dataset.command = e.name, r.dataset.pluginName = e.name, r.title = e.toolbar.shortcut ? `${e.toolbar.title} (${e.toolbar.shortcut})` : e.toolbar.title || "";
|
|
7549
|
-
let i =
|
|
7678
|
+
let i = Mi(e.toolbar.icon);
|
|
7550
7679
|
return i && n ? r.innerHTML = `${i}<span>${e.toolbar.text}</span>` : i ? r.innerHTML = i : r.textContent = e.toolbar.text || "", r;
|
|
7551
7680
|
}
|
|
7552
|
-
function
|
|
7553
|
-
return e.toolbar.type === "color" ?
|
|
7681
|
+
function Ii(e) {
|
|
7682
|
+
return e.toolbar.type === "color" ? Ni(e) : e.toolbar.dropdown ? Pi(e) : Fi(e);
|
|
7554
7683
|
}
|
|
7555
|
-
function
|
|
7684
|
+
function Li() {
|
|
7556
7685
|
let e = document.createElement("div");
|
|
7557
7686
|
return e.className = "v-divider", e.dataset.role = "separator", e;
|
|
7558
7687
|
}
|
|
7559
|
-
function
|
|
7688
|
+
function Ri() {
|
|
7560
7689
|
let e = document.createElement("div");
|
|
7561
7690
|
return e.className = "je-spacer", e.dataset.role = "spacer", e;
|
|
7562
7691
|
}
|
|
7563
|
-
function
|
|
7692
|
+
function zi(e, t, n = "bottom") {
|
|
7564
7693
|
let r = t.getBoundingClientRect(), i = e.getBoundingClientRect(), a = n === "right" ? r.top + window.scrollY : r.bottom + window.scrollY + 8, o = n === "right" ? r.right + window.scrollX + 8 : Math.max(12, r.left + window.scrollX);
|
|
7565
7694
|
e.style.top = `${a}px`, e.style.left = `${Math.min(o, window.scrollX + window.innerWidth - i.width - 12)}px`;
|
|
7566
7695
|
}
|
|
7567
|
-
function
|
|
7696
|
+
function Bi(e, t, n, r) {
|
|
7568
7697
|
let i = e.querySelector(`[data-command-toggle="${t}"]`);
|
|
7569
|
-
i && i.classList.contains("tool-btn-text") && (i.innerHTML = `${n?.label || r || ""} ${
|
|
7698
|
+
i && i.classList.contains("tool-btn-text") && (i.innerHTML = `${n?.label || r || ""} ${Ai}`);
|
|
7570
7699
|
}
|
|
7571
|
-
function
|
|
7700
|
+
function Vi(e, t, n, r) {
|
|
7572
7701
|
let i = e.querySelector(`[data-command-group="${t}"]`);
|
|
7573
7702
|
if (!i) return;
|
|
7574
7703
|
let a = i.querySelector(".je-color-chip"), o = i.querySelector(".je-color-char");
|
|
7575
7704
|
a && (a.style.background = n?.backgroundColor || r?.backgroundColor || "transparent"), o && (o.style.color = n?.textColor || r?.textColor || "#111827");
|
|
7576
7705
|
}
|
|
7577
|
-
function
|
|
7706
|
+
function Hi(e, t, n) {
|
|
7578
7707
|
if (!n?.icon && !n?.text && !n?.title) return;
|
|
7579
7708
|
let r = e.querySelector(`[data-command="${t.name}"], [data-command-toggle="${t.name}"]`);
|
|
7580
7709
|
if (!r) return;
|
|
7581
|
-
let i = n.icon || t.toolbar.icon, a = n.text ?? t.toolbar.text, o = n.title ?? t.toolbar.title ?? "", s =
|
|
7710
|
+
let i = n.icon || t.toolbar.icon, a = n.text ?? t.toolbar.text, o = n.title ?? t.toolbar.title ?? "", s = Mi(i), c = !!a;
|
|
7582
7711
|
if (r.title = o, r.classList.contains("tool-btn-text")) {
|
|
7583
7712
|
s && c ? r.innerHTML = `${s}<span>${a}</span>` : s ? r.innerHTML = s : r.textContent = a || "";
|
|
7584
7713
|
return;
|
|
7585
7714
|
}
|
|
7586
7715
|
s && (r.innerHTML = s);
|
|
7587
7716
|
}
|
|
7588
|
-
function
|
|
7717
|
+
function Ui(e) {
|
|
7589
7718
|
if (!e || e.classList.contains("is-overflow-hidden")) return 0;
|
|
7590
7719
|
let t = window.getComputedStyle(e);
|
|
7591
7720
|
return t.display === "none" ? 0 : e.getBoundingClientRect().width + parseFloat(t.marginLeft || "0") + parseFloat(t.marginRight || "0");
|
|
7592
7721
|
}
|
|
7593
|
-
function
|
|
7594
|
-
let n = document.
|
|
7595
|
-
return e.toolbar.forEach((e, r) => {
|
|
7722
|
+
function Wi(e, t) {
|
|
7723
|
+
let n = document.createElement("div");
|
|
7724
|
+
return n.className = "je-toolbar-shell", e.toolbar.forEach((e, r) => {
|
|
7596
7725
|
let i = document.createElement("div");
|
|
7597
|
-
i.className =
|
|
7726
|
+
i.className = ji[r] || ji[0], i.dataset.rowIndex = String(r), e.forEach((e) => {
|
|
7598
7727
|
if (e === "|") {
|
|
7599
|
-
i.appendChild(
|
|
7728
|
+
i.appendChild(Li());
|
|
7600
7729
|
return;
|
|
7601
7730
|
}
|
|
7602
7731
|
if (e === "->") {
|
|
7603
|
-
i.appendChild(
|
|
7732
|
+
i.appendChild(Ri());
|
|
7604
7733
|
return;
|
|
7605
7734
|
}
|
|
7606
7735
|
let n = t.get(e);
|
|
7607
|
-
n && i.appendChild(
|
|
7736
|
+
n && i.appendChild(Ii(n));
|
|
7608
7737
|
}), n.appendChild(i);
|
|
7609
7738
|
}), n;
|
|
7610
7739
|
}
|
|
7611
|
-
function
|
|
7740
|
+
function Gi(e, t, n, r = {}) {
|
|
7612
7741
|
let i = [], a = n.getAll(), o = null, s = null, c, l = r.moreController || null;
|
|
7613
7742
|
function u() {
|
|
7614
7743
|
s &&= (s.remove(), null);
|
|
@@ -7617,7 +7746,7 @@ function Li(e, t, n, r = {}) {
|
|
|
7617
7746
|
u(), o &&= (o.remove(), null);
|
|
7618
7747
|
}
|
|
7619
7748
|
function f(e, t) {
|
|
7620
|
-
u(), s = e, document.body.appendChild(e),
|
|
7749
|
+
u(), s = e, document.body.appendChild(e), zi(e, t, "right");
|
|
7621
7750
|
}
|
|
7622
7751
|
function p(e, r) {
|
|
7623
7752
|
e === "more" && c();
|
|
@@ -7633,7 +7762,7 @@ function Li(e, t, n, r = {}) {
|
|
|
7633
7762
|
closeNestedPopover: u,
|
|
7634
7763
|
openNestedPopover: f
|
|
7635
7764
|
});
|
|
7636
|
-
a && (a.dataset.pluginName = e, document.body.appendChild(a),
|
|
7765
|
+
a && (a.dataset.pluginName = e, document.body.appendChild(a), zi(a, r), o = a);
|
|
7637
7766
|
}
|
|
7638
7767
|
let m = e.querySelector(".je-toolbar-row--secondary"), h = m?.querySelector("[data-plugin-name=\"more\"]"), g = [
|
|
7639
7768
|
"codeBlock",
|
|
@@ -7664,7 +7793,7 @@ function Li(e, t, n, r = {}) {
|
|
|
7664
7793
|
});
|
|
7665
7794
|
let e = l.staticItems?.length || 0;
|
|
7666
7795
|
l.hiddenItems = [], h.style.display = e > 0 ? "" : "none";
|
|
7667
|
-
let t = () => Array.from(m.children).reduce((e, t) => t.dataset.role === "spacer" ? e : e +
|
|
7796
|
+
let t = () => Array.from(m.children).reduce((e, t) => t.dataset.role === "spacer" ? e : e + Ui(t), 0), n = m.clientWidth, r = [];
|
|
7668
7797
|
for (let e of g) {
|
|
7669
7798
|
if (t() <= n) break;
|
|
7670
7799
|
let i = m.querySelector(`[data-plugin-name="${e}"], [data-command-group="${e}"]`);
|
|
@@ -7703,7 +7832,7 @@ function Li(e, t, n, r = {}) {
|
|
|
7703
7832
|
}
|
|
7704
7833
|
if (typeof n.getToolbarState == "function") {
|
|
7705
7834
|
let r = n.getToolbarState(t);
|
|
7706
|
-
n.toolbar.dropdown &&
|
|
7835
|
+
n.toolbar.dropdown && Bi(e, n.name, r, n.toolbar.text), n.toolbar.type === "color" && Vi(e, n.name, r, n.toolbar.colorBar), Hi(e, n, r);
|
|
7707
7836
|
}
|
|
7708
7837
|
}), requestAnimationFrame(_);
|
|
7709
7838
|
}, t.on("selectionUpdate", c), t.on("update", c), i.push(() => t.off("selectionUpdate", c)), i.push(() => t.off("update", c)), c();
|
|
@@ -7714,22 +7843,22 @@ function Li(e, t, n, r = {}) {
|
|
|
7714
7843
|
}
|
|
7715
7844
|
//#endregion
|
|
7716
7845
|
//#region src/core/html-preservation.js
|
|
7717
|
-
var
|
|
7718
|
-
function
|
|
7846
|
+
var Ki = new Set(/* @__PURE__ */ "a.b.blockquote.br.code.div.em.h1.h2.h3.h4.h5.h6.hr.i.img.li.mark.ol.p.pre.raw-html.s.span.strike.strong.table.tbody.td.th.thead.tr.u.ul".split("."));
|
|
7847
|
+
function qi(e) {
|
|
7719
7848
|
let t = e.parentNode;
|
|
7720
7849
|
if (t) {
|
|
7721
7850
|
for (; e.firstChild;) t.insertBefore(e.firstChild, e);
|
|
7722
7851
|
t.removeChild(e);
|
|
7723
7852
|
}
|
|
7724
7853
|
}
|
|
7725
|
-
function
|
|
7854
|
+
function Ji(e) {
|
|
7726
7855
|
e.querySelectorAll(".je-table-move-handle, .je-table-resize-handle").forEach((e) => {
|
|
7727
7856
|
e.remove();
|
|
7728
7857
|
}), e.querySelectorAll("div.tableWrapper, div.je-table-wrap").forEach((e) => {
|
|
7729
|
-
Array.from(e.childNodes).every((e) => e.nodeType === Node.TEXT_NODE ? !e.textContent.trim() : e.nodeType === Node.ELEMENT_NODE ? e.tagName.toLowerCase() === "table" : !1) &&
|
|
7858
|
+
Array.from(e.childNodes).every((e) => e.nodeType === Node.TEXT_NODE ? !e.textContent.trim() : e.nodeType === Node.ELEMENT_NODE ? e.tagName.toLowerCase() === "table" : !1) && qi(e);
|
|
7730
7859
|
});
|
|
7731
7860
|
}
|
|
7732
|
-
var
|
|
7861
|
+
var Yi = new Set([
|
|
7733
7862
|
"area",
|
|
7734
7863
|
"base",
|
|
7735
7864
|
"br",
|
|
@@ -7745,18 +7874,18 @@ var Vi = new Set([
|
|
|
7745
7874
|
"track",
|
|
7746
7875
|
"wbr"
|
|
7747
7876
|
]);
|
|
7748
|
-
function
|
|
7877
|
+
function Xi(e) {
|
|
7749
7878
|
return /^<([a-zA-Z][^\s/>]*)[^>]*>$/.test(e);
|
|
7750
7879
|
}
|
|
7751
|
-
function
|
|
7880
|
+
function Zi(e) {
|
|
7752
7881
|
return /^<\/[a-zA-Z][^>]*>$/.test(e);
|
|
7753
7882
|
}
|
|
7754
|
-
function
|
|
7883
|
+
function Qi(e) {
|
|
7755
7884
|
if (/^<!/.test(e)) return !0;
|
|
7756
7885
|
let t = e.match(/^<([a-zA-Z][^\s/>]*)/);
|
|
7757
|
-
return t ? /\/>$/.test(e) ||
|
|
7886
|
+
return t ? /\/>$/.test(e) || Yi.has(t[1].toLowerCase()) : !1;
|
|
7758
7887
|
}
|
|
7759
|
-
function
|
|
7888
|
+
function $i(e = "") {
|
|
7760
7889
|
let t = e.trim();
|
|
7761
7890
|
if (!t) return e;
|
|
7762
7891
|
let n = t.match(/<!--[\s\S]*?-->|<!DOCTYPE[^>]*>|<\/?[^>]+>|[^<]+/gi);
|
|
@@ -7765,65 +7894,65 @@ function Gi(e = "") {
|
|
|
7765
7894
|
return n.forEach((e) => {
|
|
7766
7895
|
let t = e.trim();
|
|
7767
7896
|
if (!t) return;
|
|
7768
|
-
|
|
7897
|
+
Zi(t) && (r = Math.max(0, r - 1));
|
|
7769
7898
|
let n = " ".repeat(r);
|
|
7770
|
-
t.startsWith("<"), i.push(`${n}${t}`),
|
|
7899
|
+
t.startsWith("<"), i.push(`${n}${t}`), Xi(t) && !Qi(t) && (r += 1);
|
|
7771
7900
|
}), i.join("\n");
|
|
7772
7901
|
}
|
|
7773
|
-
function
|
|
7902
|
+
function ea(e) {
|
|
7774
7903
|
return encodeURIComponent(e);
|
|
7775
7904
|
}
|
|
7776
|
-
function
|
|
7905
|
+
function ta(e) {
|
|
7777
7906
|
try {
|
|
7778
7907
|
return decodeURIComponent(e);
|
|
7779
7908
|
} catch {
|
|
7780
7909
|
return e;
|
|
7781
7910
|
}
|
|
7782
7911
|
}
|
|
7783
|
-
function
|
|
7912
|
+
function na(e, t) {
|
|
7784
7913
|
let n = e.createElement("raw-html");
|
|
7785
|
-
return n.setAttribute("data-raw-html",
|
|
7914
|
+
return n.setAttribute("data-raw-html", ea(t)), n;
|
|
7786
7915
|
}
|
|
7787
|
-
function
|
|
7788
|
-
return
|
|
7916
|
+
function ra(e) {
|
|
7917
|
+
return Ki.has(e.tagName.toLowerCase());
|
|
7789
7918
|
}
|
|
7790
|
-
function
|
|
7919
|
+
function ia(e) {
|
|
7791
7920
|
Array.from(e.childNodes).forEach((t) => {
|
|
7792
7921
|
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
7793
|
-
if (!
|
|
7794
|
-
t.replaceWith(
|
|
7922
|
+
if (!ra(t)) {
|
|
7923
|
+
t.replaceWith(na(e.ownerDocument, t.outerHTML));
|
|
7795
7924
|
return;
|
|
7796
7925
|
}
|
|
7797
|
-
t.tagName.toLowerCase() !== "raw-html" &&
|
|
7926
|
+
t.tagName.toLowerCase() !== "raw-html" && ia(t);
|
|
7798
7927
|
}
|
|
7799
7928
|
});
|
|
7800
7929
|
}
|
|
7801
|
-
function
|
|
7930
|
+
function aa(e = "") {
|
|
7802
7931
|
if (!e || typeof DOMParser > "u") return e;
|
|
7803
7932
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
7804
|
-
return
|
|
7933
|
+
return Ji(t), ia(t.body), t.body.innerHTML;
|
|
7805
7934
|
}
|
|
7806
|
-
function
|
|
7935
|
+
function oa(e = "") {
|
|
7807
7936
|
if (!e || typeof DOMParser > "u") return e;
|
|
7808
7937
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
7809
|
-
return
|
|
7938
|
+
return Ji(t), t.querySelectorAll("raw-html[data-raw-html]").forEach((e) => {
|
|
7810
7939
|
let n = e.getAttribute("data-raw-html");
|
|
7811
7940
|
if (!n) return;
|
|
7812
|
-
let r = t.createRange().createContextualFragment(
|
|
7941
|
+
let r = t.createRange().createContextualFragment(ta(n));
|
|
7813
7942
|
e.replaceWith(r);
|
|
7814
|
-
}),
|
|
7943
|
+
}), Ji(t), t.body.innerHTML;
|
|
7815
7944
|
}
|
|
7816
7945
|
//#endregion
|
|
7817
7946
|
//#region src/jeditor.js
|
|
7818
|
-
function
|
|
7947
|
+
function sa(e) {
|
|
7819
7948
|
let t = typeof e == "string" ? document.querySelector(e) : e;
|
|
7820
7949
|
if (!t) throw Error(`[JEditor] Container not found: ${e}`);
|
|
7821
7950
|
return t;
|
|
7822
7951
|
}
|
|
7823
|
-
function
|
|
7952
|
+
function ca(e, t) {
|
|
7824
7953
|
return t.content == null ? e instanceof HTMLTextAreaElement ? e.value.trim() || null : e.innerHTML.trim() || null : t.content;
|
|
7825
7954
|
}
|
|
7826
|
-
function
|
|
7955
|
+
function la(e) {
|
|
7827
7956
|
if (e instanceof HTMLTextAreaElement) {
|
|
7828
7957
|
let t = document.createElement("div");
|
|
7829
7958
|
return t.className = e.className, e.insertAdjacentElement("afterend", t), e.style.display = "none", t;
|
|
@@ -7833,27 +7962,27 @@ function ta(e) {
|
|
|
7833
7962
|
function $(e = "") {
|
|
7834
7963
|
return /<!DOCTYPE\s+html/i.test(e) || /<html[\s>]/i.test(e);
|
|
7835
7964
|
}
|
|
7836
|
-
var
|
|
7837
|
-
function
|
|
7965
|
+
var ua = "\nbody {\n margin: 0;\n padding: 32px 60px;\n color: #333;\n font-size: 14px;\n line-height: 1.7;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"PingFang SC\", \"Microsoft YaHei\", sans-serif;\n box-sizing: border-box;\n overflow-wrap: anywhere;\n word-break: break-word;\n}\nbody * {\n box-sizing: border-box;\n}\nh1 { font-size: 2em; font-weight: bold; margin-bottom: 0.5em; }\nh2 { font-size: 1.5em; font-weight: bold; margin-bottom: 0.5em; }\nh3 { font-size: 1.25em; font-weight: bold; margin-bottom: 0.5em; }\np { margin-bottom: 0.8em; line-height: 1.7; }\nblockquote {\n margin: 0.8em 0;\n padding: 8px 16px 8px 18px;\n border-left: 3px solid #374151;\n background: #f3f4f6;\n color: #111827;\n}\nblockquote,\nh1, h2, h3, h4, h5, h6,\np, li {\n max-width: 100%;\n overflow-wrap: anywhere;\n word-break: break-word;\n}\nul { list-style-type: disc; padding-left: 1.7em; margin-bottom: 0.8em; }\nul li::marker { color: #1C81D9; }\nol {\n list-style-type: none;\n padding-left: 3.2em;\n margin-bottom: 0.8em;\n counter-reset: je-ol;\n}\nol > li {\n position: relative;\n counter-increment: je-ol;\n}\nol > li::before {\n content: counter(je-ol) '.';\n position: absolute;\n left: -3.2em;\n width: 2.6em;\n color: #1C81D9;\n white-space: nowrap;\n text-align: right;\n font-variant-numeric: tabular-nums;\n}\nol ol {\n counter-reset: je-sub-ol;\n padding-left: 3.8em;\n}\nol ol > li {\n counter-increment: je-sub-ol;\n}\nol ol > li::before {\n content: counter(je-ol) '.' counter(je-sub-ol);\n left: -3.8em;\n width: 3.2em;\n}\nol ol ol {\n counter-reset: je-sub-sub-ol;\n padding-left: 4.8em;\n}\nol ol ol > li {\n counter-increment: je-sub-sub-ol;\n}\nol ol ol > li::before {\n content: counter(je-ol) '.' counter(je-sub-ol) '.' counter(je-sub-sub-ol);\n left: -4.8em;\n width: 4.2em;\n}\nli > p { margin-bottom: 0.35em; }\nhr {\n margin: 1.1em 0;\n height: 1px;\n border: none;\n background: #e5e7eb;\n}\na {\n color: #2563eb;\n text-decoration: underline;\n text-decoration-thickness: 1px;\n text-underline-offset: 2px;\n}\ncode {\n padding: 0.14em 0.42em;\n border: 1px solid #e8edf3;\n border-radius: 6px;\n background: #f7f9fc;\n color: #c2410c;\n font-weight: 700;\n font-family: \"JetBrains Mono\", \"SFMono-Regular\", Consolas, monospace;\n font-size: 0.92em;\n}\npre {\n margin: 1em 0;\n overflow-x: auto;\n}\npre code.je-code-block {\n display: block;\n padding: 12px 16px 16px;\n border: none;\n border-radius: 0;\n background: transparent;\n color: #24292e;\n font-weight: 400;\n font-family: \"JetBrains Mono\", \"SFMono-Regular\", Consolas, monospace;\n font-size: 13px;\n box-shadow: none;\n}\npre code.je-code-block .hljs-comment,\npre code.je-code-block .hljs-quote {\n color: #6a737d;\n font-style: italic;\n}\npre code.je-code-block .hljs-keyword,\npre code.je-code-block .hljs-doctag,\npre code.je-code-block .hljs-selector-tag,\npre code.je-code-block .hljs-literal,\npre code.je-code-block .hljs-type {\n color: #d73a49;\n}\npre code.je-code-block .hljs-string,\npre code.je-code-block .hljs-attr,\npre code.je-code-block .hljs-template-tag {\n color: #032f62;\n}\npre code.je-code-block .hljs-number,\npre code.je-code-block .hljs-built_in,\npre code.je-code-block .hljs-title.class_,\npre code.je-code-block .hljs-symbol {\n color: #005cc5;\n}\npre code.je-code-block .hljs-function,\npre code.je-code-block .hljs-title.function_ {\n color: #6f42c1;\n}\ntable {\n width: auto;\n margin: 1em 0;\n border-collapse: collapse;\n table-layout: fixed;\n background: #fff;\n}\nth, td {\n width: 8px;\n min-width: 8px;\n height: 4px;\n padding: 4px 8px;\n border: 1px solid #e5e7eb;\n vertical-align: top;\n}\nth {\n background: #f8fafc;\n font-weight: 600;\n color: #374151;\n}\n";
|
|
7966
|
+
function da(e = "") {
|
|
7838
7967
|
return `<!DOCTYPE html>
|
|
7839
7968
|
<html lang="zh-CN">
|
|
7840
7969
|
<head>
|
|
7841
7970
|
<meta charset="UTF-8" />
|
|
7842
7971
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7843
7972
|
<title>JEditor Source Preview</title>
|
|
7844
|
-
<style>${
|
|
7973
|
+
<style>${ua}</style>
|
|
7845
7974
|
</head>
|
|
7846
7975
|
<body>
|
|
7847
7976
|
${e}
|
|
7848
7977
|
</body>
|
|
7849
7978
|
</html>`;
|
|
7850
7979
|
}
|
|
7851
|
-
function
|
|
7980
|
+
function fa(e = "") {
|
|
7852
7981
|
return $(e) ? new DOMParser().parseFromString(e, "text/html").body?.innerHTML?.trim() || "<p></p>" : e;
|
|
7853
7982
|
}
|
|
7854
|
-
var
|
|
7983
|
+
var pa = class e {
|
|
7855
7984
|
static create(t, n = {}) {
|
|
7856
|
-
return new e(
|
|
7985
|
+
return new e(sa(t), n);
|
|
7857
7986
|
}
|
|
7858
7987
|
static fromHTML(t, n, r = {}) {
|
|
7859
7988
|
return e.create(t, {
|
|
@@ -7870,17 +7999,17 @@ var aa = class e {
|
|
|
7870
7999
|
this._sourceTextarea.focus(), t >= 0 && this._sourceTextarea.setSelectionRange(t, t + e.length);
|
|
7871
8000
|
}
|
|
7872
8001
|
_normalizeVisualContent(e) {
|
|
7873
|
-
return
|
|
8002
|
+
return aa(fa(e ?? ""));
|
|
7874
8003
|
}
|
|
7875
8004
|
_getVisualHTML() {
|
|
7876
|
-
return
|
|
8005
|
+
return oa(this._editor.getHTML());
|
|
7877
8006
|
}
|
|
7878
8007
|
_getSourceDisplayHTML(e) {
|
|
7879
|
-
return this._sourceDocumentMode && !this._visualDirtySinceSource && e ? e :
|
|
8008
|
+
return this._sourceDocumentMode && !this._visualDirtySinceSource && e ? e : $i(e || "");
|
|
7880
8009
|
}
|
|
7881
8010
|
_bootstrap() {
|
|
7882
|
-
this._pm.registerAll(
|
|
7883
|
-
let e =
|
|
8011
|
+
this._pm.registerAll(Oi);
|
|
8012
|
+
let e = ca(this._sourceElement, this._config), t = la(this._sourceElement), n = {
|
|
7884
8013
|
pluginManager: this._pm,
|
|
7885
8014
|
staticItems: ["blockquote", "horizontalRule"],
|
|
7886
8015
|
hiddenItems: [],
|
|
@@ -7906,7 +8035,7 @@ var aa = class e {
|
|
|
7906
8035
|
controller: n
|
|
7907
8036
|
}
|
|
7908
8037
|
};
|
|
7909
|
-
this._sourceDocumentHTML = e ?? this._config.content ?? null, this._sourceDocumentMode = $(this._sourceDocumentHTML || ""), t.classList.add("je-container"), t.appendChild(
|
|
8038
|
+
this._sourceDocumentHTML = e ?? this._config.content ?? null, this._sourceDocumentMode = $(this._sourceDocumentHTML || ""), t.classList.add("je-container"), t.appendChild(Wi(r, this._pm));
|
|
7910
8039
|
let i = document.createElement("div");
|
|
7911
8040
|
i.className = "je-editor-area", t.appendChild(i);
|
|
7912
8041
|
let a = document.createElement("div");
|
|
@@ -7918,7 +8047,7 @@ var aa = class e {
|
|
|
7918
8047
|
let c = document.createElement("textarea");
|
|
7919
8048
|
c.className = "je-source-textarea", c.spellcheck = !1, c.placeholder = "<!DOCTYPE html>";
|
|
7920
8049
|
let l = document.createElement("iframe");
|
|
7921
|
-
l.className = "je-source-preview", l.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms allow-popups"), s.append(c, l), i.appendChild(s), this._editor =
|
|
8050
|
+
l.className = "je-source-preview", l.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms allow-popups"), s.append(c, l), i.appendChild(s), this._editor = ki(a, this._pm.getTiptapExtensions(), r), this._pm.initAll(this._editor, r), this._toolbarCleanup = Gi(t, this._editor, this._pm, { moreController: n }), this._mountElement = t, this._editorArea = i, this._visualHost = a, this._documentPreview = o, this._sourcePane = s, this._sourceTextarea = c, this._sourcePreview = l, this._sourceTextarea.addEventListener("input", () => {
|
|
7922
8051
|
this._renderSourcePreview(this._sourceTextarea.value);
|
|
7923
8052
|
}), this._editor.on("update", () => {
|
|
7924
8053
|
this._suspendVisualSync || this._sourceMode || (this._visualDirtySinceSource = !0, this._sourceDocumentMode || (this._sourceDocumentHTML = this._getVisualHTML()), this._syncTextareaValue());
|
|
@@ -7937,10 +8066,10 @@ var aa = class e {
|
|
|
7937
8066
|
!this._sourceElement || !this._editor || this._sourceElement instanceof HTMLTextAreaElement && (this._sourceElement.value = this.getHTML());
|
|
7938
8067
|
}
|
|
7939
8068
|
_renderSourcePreview(e) {
|
|
7940
|
-
this._sourcePreview && (this._sourcePreview.srcdoc = $(e) ? e :
|
|
8069
|
+
this._sourcePreview && (this._sourcePreview.srcdoc = $(e) ? e : da(e));
|
|
7941
8070
|
}
|
|
7942
8071
|
_renderDocumentPreview(e) {
|
|
7943
|
-
this._documentPreview && (this._documentPreview.srcdoc = $(e) ? e :
|
|
8072
|
+
this._documentPreview && (this._documentPreview.srcdoc = $(e) ? e : da(e));
|
|
7944
8073
|
}
|
|
7945
8074
|
_setToolbarSourceState(e) {
|
|
7946
8075
|
if (!this._mountElement) return;
|
|
@@ -8005,4 +8134,4 @@ var aa = class e {
|
|
|
8005
8134
|
}
|
|
8006
8135
|
};
|
|
8007
8136
|
//#endregion
|
|
8008
|
-
export {
|
|
8137
|
+
export { pa as JEditor };
|