@hamster-note/notes 3.5.1 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +25 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +745 -746
- package/dist/index.js.map +1 -1
- package/dist/lib/editor/NoteDocumentProvider.d.ts.map +1 -1
- package/dist/lib/editor/ViewToolbar.d.ts +1 -1
- package/dist/lib/editor/ViewToolbar.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9167,28 +9167,28 @@ function i9(t, e, n, r, i) {
|
|
|
9167
9167
|
return M(t, as(13, "Enter"));
|
|
9168
9168
|
});
|
|
9169
9169
|
}, 20));
|
|
9170
|
-
let k = p.start,
|
|
9171
|
-
let I = M || t.state.tr.replace(k,
|
|
9170
|
+
let k = p.start, T = p.endA, x = (M) => {
|
|
9171
|
+
let I = M || t.state.tr.replace(k, T, c.doc.slice(p.start - c.from, p.endB - c.from));
|
|
9172
9172
|
if (c.sel) {
|
|
9173
9173
|
let O = Ey(t, I.doc, c.sel);
|
|
9174
|
-
O && !(Mn && t.composing && O.empty && (p.start != p.endB || t.input.lastChromeDelete < Date.now() - 100) && (O.head == k || O.head == I.mapping.map(
|
|
9174
|
+
O && !(Mn && t.composing && O.empty && (p.start != p.endB || t.input.lastChromeDelete < Date.now() - 100) && (O.head == k || O.head == I.mapping.map(T) - 1) || sr && O.empty && O.head == k) && I.setSelection(O);
|
|
9175
9175
|
}
|
|
9176
9176
|
return o && I.setMeta("composition", o), I.scrollIntoView();
|
|
9177
9177
|
}, S;
|
|
9178
9178
|
if (w)
|
|
9179
9179
|
if (m.pos == g.pos) {
|
|
9180
9180
|
sr && Ao <= 11 && m.parentOffset == 0 && (t.domObserver.suppressSelectionUpdates(), setTimeout(() => ji(t), 20));
|
|
9181
|
-
let M = x(t.state.tr.delete(k,
|
|
9181
|
+
let M = x(t.state.tr.delete(k, T)), I = u.resolve(p.start).marksAcross(u.resolve(p.endA));
|
|
9182
9182
|
I && M.ensureMarks(I), t.dispatch(M);
|
|
9183
9183
|
} else if (
|
|
9184
9184
|
// Adding or removing a mark
|
|
9185
9185
|
p.endA == p.endB && (S = o9(m.parent.content.cut(m.parentOffset, g.parentOffset), y.parent.content.cut(y.parentOffset, p.endA - y.start())))
|
|
9186
9186
|
) {
|
|
9187
9187
|
let M = x(t.state.tr);
|
|
9188
|
-
S.type == "add" ? M.addMark(k,
|
|
9188
|
+
S.type == "add" ? M.addMark(k, T, S.mark) : M.removeMark(k, T, S.mark), t.dispatch(M);
|
|
9189
9189
|
} else if (m.parent.child(m.index()).isText && m.index() == g.index() - (g.textOffset ? 0 : 1)) {
|
|
9190
|
-
let M = m.parent.textBetween(m.parentOffset, g.parentOffset), I = () => x(t.state.tr.insertText(M, k,
|
|
9191
|
-
t.someProp("handleTextInput", (O) => O(t, k,
|
|
9190
|
+
let M = m.parent.textBetween(m.parentOffset, g.parentOffset), I = () => x(t.state.tr.insertText(M, k, T));
|
|
9191
|
+
t.someProp("handleTextInput", (O) => O(t, k, T, M, I)) || t.dispatch(I());
|
|
9192
9192
|
} else
|
|
9193
9193
|
t.dispatch(x());
|
|
9194
9194
|
else
|
|
@@ -10224,8 +10224,8 @@ const $9 = (t, e, n) => ({ tr: r, dispatch: i, editor: o }) => {
|
|
|
10224
10224
|
}).join("") : typeof e == "object" && e && e.text ? m = e.text : m = e, r.insertText(m, u, d);
|
|
10225
10225
|
else {
|
|
10226
10226
|
m = Q.from(p);
|
|
10227
|
-
const g = r.doc.resolve(u), y = g.node(), w = g.parentOffset === 0, k = y.isText || y.isTextblock,
|
|
10228
|
-
w && k &&
|
|
10227
|
+
const g = r.doc.resolve(u), y = g.node(), w = g.parentOffset === 0, k = y.isText || y.isTextblock, T = y.content.size > 0;
|
|
10228
|
+
w && k && T && h && (u = Math.max(0, u - 1)), r.replaceWith(u, d, p);
|
|
10229
10229
|
}
|
|
10230
10230
|
n.updateSelection && Q3(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
|
|
10231
10231
|
from: u,
|
|
@@ -11071,10 +11071,10 @@ const zC = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, edit
|
|
|
11071
11071
|
let y = Q.empty;
|
|
11072
11072
|
const w = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
|
|
11073
11073
|
for (let I = a.depth - w; I >= a.depth - 3; I -= 1) y = Q.from(a.node(I).copy(y));
|
|
11074
|
-
const k = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3,
|
|
11074
|
+
const k = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, T = {
|
|
11075
11075
|
...Iu(d, a.node().type.name, a.node().attrs),
|
|
11076
11076
|
...e
|
|
11077
|
-
}, x = ((f = s.contentMatch.defaultType) === null || f === void 0 ? void 0 : f.createAndFill(
|
|
11077
|
+
}, x = ((f = s.contentMatch.defaultType) === null || f === void 0 ? void 0 : f.createAndFill(T)) || void 0;
|
|
11078
11078
|
y = y.append(Q.from(s.createAndFill(null, x) || void 0));
|
|
11079
11079
|
const S = a.before(a.depth - (w - 1));
|
|
11080
11080
|
n.replace(S, a.after(-k), new we(y, 4 - w, 0));
|
|
@@ -11106,9 +11106,9 @@ const zC = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, edit
|
|
|
11106
11106
|
}];
|
|
11107
11107
|
if (!Xr(n.doc, a.pos, 2)) return !1;
|
|
11108
11108
|
if (i) {
|
|
11109
|
-
const { selection: y, storedMarks: w } = r, { splittableMarks: k } = o.extensionManager,
|
|
11110
|
-
if (n.split(a.pos, 2, g).scrollIntoView(), !
|
|
11111
|
-
const x =
|
|
11109
|
+
const { selection: y, storedMarks: w } = r, { splittableMarks: k } = o.extensionManager, T = w || y.$to.parentOffset && y.$from.marks();
|
|
11110
|
+
if (n.split(a.pos, 2, g).scrollIntoView(), !T || !i) return !0;
|
|
11111
|
+
const x = T.filter((S) => k.includes(S.type.name));
|
|
11112
11112
|
n.ensureMarks(x);
|
|
11113
11113
|
}
|
|
11114
11114
|
return !0;
|
|
@@ -11141,22 +11141,22 @@ function FC(t) {
|
|
|
11141
11141
|
return Se.between(r, i);
|
|
11142
11142
|
}
|
|
11143
11143
|
const $C = (t, e, n, r = {}) => ({ editor: i, tr: o, state: s, dispatch: a, chain: l, commands: c, can: u }) => {
|
|
11144
|
-
const { extensions: d, splittableMarks: f } = i.extensionManager, h = bn(t, s.schema), p = bn(e, s.schema), { selection: m, storedMarks: g } = s, { $from: y, $to: w } = m, k = y.blockRange(w),
|
|
11144
|
+
const { extensions: d, splittableMarks: f } = i.extensionManager, h = bn(t, s.schema), p = bn(e, s.schema), { selection: m, storedMarks: g } = s, { $from: y, $to: w } = m, k = y.blockRange(w), T = g || m.$to.parentOffset && m.$from.marks();
|
|
11145
11145
|
if (!k) return !1;
|
|
11146
11146
|
const x = nf((L) => c0(L.type.name, d))(m), S = m.from === 0 && m.to === s.doc.content.size, M = s.doc.content.content, I = M.length === 1 ? M[0] : null, O = S && I && c0(I.type.name, d) ? {
|
|
11147
11147
|
node: I,
|
|
11148
11148
|
pos: 0
|
|
11149
|
-
} : null, D = x ?? O,
|
|
11150
|
-
if ((
|
|
11149
|
+
} : null, D = x ?? O, A = !!x && k.depth >= 1 && k.depth - x.depth <= 1, E = !!O;
|
|
11150
|
+
if ((A || E) && D) {
|
|
11151
11151
|
if (D.node.type === h)
|
|
11152
|
-
return S &&
|
|
11152
|
+
return S && E ? l().command(({ tr: L, dispatch: $ }) => {
|
|
11153
11153
|
const H = FC(L);
|
|
11154
11154
|
return H ? (L.setSelection(H), $ && $(L), !0) : !1;
|
|
11155
11155
|
}).liftListItem(p).run() : c.liftListItem(p);
|
|
11156
11156
|
if (c0(D.node.type.name, d) && h.validContent(D.node.content)) return l().command(() => (o.setNodeMarkup(D.pos, h), !0)).command(() => u0(o, h)).command(() => d0(o, h)).run();
|
|
11157
11157
|
}
|
|
11158
|
-
return !n || !
|
|
11159
|
-
const L = u().wrapInList(h, r), $ =
|
|
11158
|
+
return !n || !T || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() => u0(o, h)).command(() => d0(o, h)).run() : l().command(() => {
|
|
11159
|
+
const L = u().wrapInList(h, r), $ = T.filter((H) => f.includes(H.type.name));
|
|
11160
11160
|
return o.ensureMarks($), L ? !0 : c.clearNodes();
|
|
11161
11161
|
}).wrapInList(h, r).command(() => u0(o, h)).command(() => d0(o, h)).run();
|
|
11162
11162
|
}, HC = (t, e = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
@@ -11238,8 +11238,8 @@ const $C = (t, e, n, r = {}) => ({ editor: i, tr: o, state: s, dispatch: a, chai
|
|
|
11238
11238
|
...e
|
|
11239
11239
|
})), s && g.marks.length && g.marks.forEach((w) => {
|
|
11240
11240
|
if (s === w.type && (l = !0, i)) {
|
|
11241
|
-
const k = Math.max(y, u),
|
|
11242
|
-
n.addMark(k,
|
|
11241
|
+
const k = Math.max(y, u), T = Math.min(y + g.nodeSize, d);
|
|
11242
|
+
n.addMark(k, T, s.create({
|
|
11243
11243
|
...w.attrs,
|
|
11244
11244
|
...e
|
|
11245
11245
|
}));
|
|
@@ -11804,9 +11804,9 @@ function Vy(t, e, n) {
|
|
|
11804
11804
|
const k = r[s];
|
|
11805
11805
|
if (k.trim() === "") {
|
|
11806
11806
|
var c;
|
|
11807
|
-
const
|
|
11808
|
-
if (
|
|
11809
|
-
if ((((c = r[s + 1 +
|
|
11807
|
+
const T = r.slice(s + 1).findIndex((x) => x.trim() !== "");
|
|
11808
|
+
if (T === -1) break;
|
|
11809
|
+
if ((((c = r[s + 1 + T].match(/^(\s*)/)) === null || c === void 0 || (c = c[1]) === null || c === void 0 ? void 0 : c.length) || 0) > h) {
|
|
11810
11810
|
m.push(k), o = `${o}${k}
|
|
11811
11811
|
`, s += 1;
|
|
11812
11812
|
continue;
|
|
@@ -11820,7 +11820,7 @@ function Vy(t, e, n) {
|
|
|
11820
11820
|
let g;
|
|
11821
11821
|
const y = m.slice(1);
|
|
11822
11822
|
if (y.length > 0) {
|
|
11823
|
-
const k = y.map((
|
|
11823
|
+
const k = y.map((T) => T.slice(h + a)).join(`
|
|
11824
11824
|
`);
|
|
11825
11825
|
k.trim() && (e.customNestedParser ? g = e.customNestedParser(k) : g = n.blockTokens(k));
|
|
11826
11826
|
}
|
|
@@ -11924,7 +11924,7 @@ function Bc(t) {
|
|
|
11924
11924
|
}), y = {
|
|
11925
11925
|
from: r - (h[0].length - o.length),
|
|
11926
11926
|
to: i
|
|
11927
|
-
}, { commands: w, chain: k, can:
|
|
11927
|
+
}, { commands: w, chain: k, can: T } = new ba({
|
|
11928
11928
|
editor: n,
|
|
11929
11929
|
state: g
|
|
11930
11930
|
});
|
|
@@ -11934,7 +11934,7 @@ function Bc(t) {
|
|
|
11934
11934
|
match: h,
|
|
11935
11935
|
commands: w,
|
|
11936
11936
|
chain: k,
|
|
11937
|
-
can:
|
|
11937
|
+
can: T
|
|
11938
11938
|
}) === null || !m.steps.length || (f.undoable && m.setMeta(a, {
|
|
11939
11939
|
transform: m,
|
|
11940
11940
|
from: r,
|
|
@@ -12088,9 +12088,9 @@ function xE(t) {
|
|
|
12088
12088
|
return n.doc.nodesBetween(r, i, (f, h) => {
|
|
12089
12089
|
var p, m, g, y;
|
|
12090
12090
|
if (!((p = f.type) === null || p === void 0 || (p = p.spec) === null || p === void 0) && p.code || !(f.isText || f.isTextblock || f.isInline)) return;
|
|
12091
|
-
const w = (m = (g = (y = f.content) === null || y === void 0 ? void 0 : y.size) !== null && g !== void 0 ? g : f.nodeSize) !== null && m !== void 0 ? m : 0, k = Math.max(r, h),
|
|
12092
|
-
if (k >=
|
|
12093
|
-
const x = f.isText ? f.text || "" : f.textBetween(k - h,
|
|
12091
|
+
const w = (m = (g = (y = f.content) === null || y === void 0 ? void 0 : y.size) !== null && g !== void 0 ? g : f.nodeSize) !== null && m !== void 0 ? m : 0, k = Math.max(r, h), T = Math.min(i, h + w);
|
|
12092
|
+
if (k >= T) return;
|
|
12093
|
+
const x = f.isText ? f.text || "" : f.textBetween(k - h, T - h, void 0, "");
|
|
12094
12094
|
wE(x, o.find, s).forEach((S) => {
|
|
12095
12095
|
if (S.index === void 0) return;
|
|
12096
12096
|
const M = k + S.index + 1, I = M + S[0].length, O = {
|
|
@@ -12182,9 +12182,9 @@ function SE(t) {
|
|
|
12182
12182
|
const h = u[0], p = h.getMeta("uiEvent") === "paste" && !i, m = h.getMeta("uiEvent") === "drop" && !o, g = h.getMeta("applyPasteRules"), y = !!g;
|
|
12183
12183
|
if (!p && !m && !y) return;
|
|
12184
12184
|
if (y) {
|
|
12185
|
-
let { text:
|
|
12186
|
-
typeof
|
|
12187
|
-
const { from: x } = g, S = x +
|
|
12185
|
+
let { text: T } = g;
|
|
12186
|
+
typeof T == "string" ? T = T : T = Bm(Q.from(T), f.schema);
|
|
12187
|
+
const { from: x } = g, S = x + T.length, M = kE(T);
|
|
12188
12188
|
return l({
|
|
12189
12189
|
rule: c,
|
|
12190
12190
|
state: f,
|
|
@@ -12554,7 +12554,7 @@ const CE = xt.create({
|
|
|
12554
12554
|
l.steps.forEach((u, d) => {
|
|
12555
12555
|
if (u instanceof Gr) {
|
|
12556
12556
|
var f, h;
|
|
12557
|
-
const p = c.slice(d).map(u.from, -1), m = c.slice(d).map(u.to), g = c.invert().map(p, -1), y = c.invert().map(m), w = p > 0 ? (f = l.doc.nodeAt(p - 1)) === null || f === void 0 ? void 0 : f.marks.some((
|
|
12557
|
+
const p = c.slice(d).map(u.from, -1), m = c.slice(d).map(u.to), g = c.invert().map(p, -1), y = c.invert().map(m), w = p > 0 ? (f = l.doc.nodeAt(p - 1)) === null || f === void 0 ? void 0 : f.marks.some((T) => T.eq(u.mark)) : !1, k = (h = l.doc.nodeAt(m)) === null || h === void 0 ? void 0 : h.marks.some((T) => T.eq(u.mark));
|
|
12558
12558
|
this.editor.emit("delete", {
|
|
12559
12559
|
type: "mark",
|
|
12560
12560
|
mark: u.mark,
|
|
@@ -13495,15 +13495,15 @@ function $E() {
|
|
|
13495
13495
|
if (w = !0, k = S, S = f(S), h !== void 0 && m.hasValue) {
|
|
13496
13496
|
var M = m.value;
|
|
13497
13497
|
if (h(M, S))
|
|
13498
|
-
return
|
|
13498
|
+
return T = M;
|
|
13499
13499
|
}
|
|
13500
|
-
return
|
|
13500
|
+
return T = S;
|
|
13501
13501
|
}
|
|
13502
|
-
if (M =
|
|
13502
|
+
if (M = T, r(k, S)) return M;
|
|
13503
13503
|
var I = f(S);
|
|
13504
|
-
return h !== void 0 && h(M, I) ? (k = S, M) : (k = S,
|
|
13504
|
+
return h !== void 0 && h(M, I) ? (k = S, M) : (k = S, T = I);
|
|
13505
13505
|
}
|
|
13506
|
-
var w = !1, k,
|
|
13506
|
+
var w = !1, k, T, x = d === void 0 ? null : d;
|
|
13507
13507
|
return [
|
|
13508
13508
|
function() {
|
|
13509
13509
|
return y(u());
|
|
@@ -13546,16 +13546,16 @@ function HE() {
|
|
|
13546
13546
|
if (w = !0, k = S, S = f(S), h !== void 0 && m.hasValue) {
|
|
13547
13547
|
var M = m.value;
|
|
13548
13548
|
if (h(M, S))
|
|
13549
|
-
return
|
|
13549
|
+
return T = M;
|
|
13550
13550
|
}
|
|
13551
|
-
return
|
|
13551
|
+
return T = S;
|
|
13552
13552
|
}
|
|
13553
|
-
if (M =
|
|
13553
|
+
if (M = T, r(k, S))
|
|
13554
13554
|
return M;
|
|
13555
13555
|
var I = f(S);
|
|
13556
|
-
return h !== void 0 && h(M, I) ? (k = S, M) : (k = S,
|
|
13556
|
+
return h !== void 0 && h(M, I) ? (k = S, M) : (k = S, T = I);
|
|
13557
13557
|
}
|
|
13558
|
-
var w = !1, k,
|
|
13558
|
+
var w = !1, k, T, x = d === void 0 ? null : d;
|
|
13559
13559
|
return [
|
|
13560
13560
|
function() {
|
|
13561
13561
|
return y(u());
|
|
@@ -13832,9 +13832,9 @@ function XE(t) {
|
|
|
13832
13832
|
});
|
|
13833
13833
|
break;
|
|
13834
13834
|
}
|
|
13835
|
-
const
|
|
13835
|
+
const T = i + k * e;
|
|
13836
13836
|
for (let x = 0; x < g; x++) {
|
|
13837
|
-
r[
|
|
13837
|
+
r[T + x] == 0 ? r[T + x] = u : (o || (o = [])).push({
|
|
13838
13838
|
type: "collision",
|
|
13839
13839
|
row: c,
|
|
13840
13840
|
pos: u,
|
|
@@ -13842,7 +13842,7 @@ function XE(t) {
|
|
|
13842
13842
|
});
|
|
13843
13843
|
const S = w && w[x];
|
|
13844
13844
|
if (S) {
|
|
13845
|
-
const M = (
|
|
13845
|
+
const M = (T + x) % e * 2, I = s[M];
|
|
13846
13846
|
I == null || I != S && s[M + 1] == 1 ? (s[M] = S, s[M + 1] = 1) : I == S && s[M + 1]++;
|
|
13847
13847
|
}
|
|
13848
13848
|
}
|
|
@@ -15977,10 +15977,10 @@ function fT({
|
|
|
15977
15977
|
ct(g, t.tld, y), ct(g, t.utld, y), ct(y, t.domain, s), ct(y, r, o), he(y, oi, g), he(y, Tr, m), he(y, mo, c);
|
|
15978
15978
|
const w = he(y, ms), k = Er(Wc);
|
|
15979
15979
|
ct(w, t.numeric, k);
|
|
15980
|
-
const
|
|
15981
|
-
ct(
|
|
15980
|
+
const T = Er(Wc), x = Er();
|
|
15981
|
+
ct(T, e, T), ct(T, n, x), ct(x, e, T), ct(x, n, x), he(y, si, T), he(k, si, T);
|
|
15982
15982
|
const S = he(a, ms), M = he(l, ms), I = he(M, si), O = he(I, si);
|
|
15983
|
-
ct(a, t.domain, s), he(a, oi, g), he(a, Tr, m), ct(l, t.domain, s), he(l, oi, g), he(l, Tr, m), ct(S, t.domain,
|
|
15983
|
+
ct(a, t.domain, s), he(a, oi, g), he(a, Tr, m), ct(l, t.domain, s), he(l, oi, g), he(l, Tr, m), ct(S, t.domain, T), he(S, si, T), he(S, Tl, T), ct(O, t.domain, T), ct(O, e, T), he(O, si, T);
|
|
15984
15984
|
const D = [
|
|
15985
15985
|
[Cl, El],
|
|
15986
15986
|
// {}
|
|
@@ -15999,13 +15999,13 @@ function fT({
|
|
|
15999
15999
|
[fd, hd]
|
|
16000
16000
|
// <>
|
|
16001
16001
|
];
|
|
16002
|
-
for (let
|
|
16003
|
-
const [
|
|
16004
|
-
he(x,
|
|
16002
|
+
for (let A = 0; A < D.length; A++) {
|
|
16003
|
+
const [E, L] = D[A], $ = he(T, E);
|
|
16004
|
+
he(x, E, $);
|
|
16005
16005
|
const H = Er(Wc);
|
|
16006
16006
|
ct($, e, H);
|
|
16007
16007
|
const B = Er();
|
|
16008
|
-
ct($, n, B), he($, L,
|
|
16008
|
+
ct($, n, B), he($, L, T), ct(H, e, H), ct(H, n, B), ct(B, e, H), ct(B, n, B), he(H, L, T), he(B, L, T);
|
|
16009
16009
|
}
|
|
16010
16010
|
return he(i, Yl, y), he(i, Um, dT), {
|
|
16011
16011
|
start: i,
|
|
@@ -17164,8 +17164,8 @@ function eM(t, e) {
|
|
|
17164
17164
|
nodeId: null,
|
|
17165
17165
|
...e.node.type.name === "orderedList" ? { start: Number(e.node.attrs.start) + e.end } : {}
|
|
17166
17166
|
}, Wr(e.node).slice(e.end))), f.length) {
|
|
17167
|
-
const
|
|
17168
|
-
d[d.length - 1] =
|
|
17167
|
+
const T = d[d.length - 1];
|
|
17168
|
+
d[d.length - 1] = T.copy(T.content.append(Q.fromArray(f)));
|
|
17169
17169
|
}
|
|
17170
17170
|
const h = e.node.type.create({
|
|
17171
17171
|
...e.node.attrs,
|
|
@@ -17351,7 +17351,7 @@ const oM = xt.create({
|
|
|
17351
17351
|
i();
|
|
17352
17352
|
return;
|
|
17353
17353
|
}
|
|
17354
|
-
const k = n.menu,
|
|
17354
|
+
const k = n.menu, T = g + w - 8 - h.bottom - 4, x = h.top - g - 8 - 4, M = (k.scrollHeight || k.getBoundingClientRect().height) <= T || T >= x, I = Math.max(0, M ? T : x);
|
|
17355
17355
|
if (I < 32) {
|
|
17356
17356
|
i();
|
|
17357
17357
|
return;
|
|
@@ -17367,7 +17367,7 @@ const oM = xt.create({
|
|
|
17367
17367
|
t.view.dom.setAttribute("data-hnn-slash-open", ""), m.dispatchEvent(new CustomEvent("hn-editor-popover-open", { detail: "slash", bubbles: !0 }));
|
|
17368
17368
|
const g = wb.map((y, w) => {
|
|
17369
17369
|
const k = document.createElement("button");
|
|
17370
|
-
return k.type = "button", k.id = `${p.id}-${w}`, k.setAttribute("role", "option"), k.tabIndex = -1, k.textContent = y.label, k.disabled = !xb(t, y), k.disabled && (k.title = "当前类型、父结构、格式或容量不支持此转换", k.setAttribute("aria-description", k.title)), k.addEventListener("mousedown", (
|
|
17370
|
+
return k.type = "button", k.id = `${p.id}-${w}`, k.setAttribute("role", "option"), k.tabIndex = -1, k.textContent = y.label, k.disabled = !xb(t, y), k.disabled && (k.title = "当前类型、父结构、格式或容量不支持此转换", k.setAttribute("aria-description", k.title)), k.addEventListener("mousedown", (T) => T.preventDefault()), k.addEventListener("click", () => {
|
|
17371
17371
|
n?.menu === p && a(w);
|
|
17372
17372
|
}), p.append(k), k;
|
|
17373
17373
|
});
|
|
@@ -17407,7 +17407,7 @@ const oM = xt.create({
|
|
|
17407
17407
|
return i(), !0;
|
|
17408
17408
|
if (p.key === "Enter")
|
|
17409
17409
|
return a(n.index), !0;
|
|
17410
|
-
const g = n.buttons.map((k,
|
|
17410
|
+
const g = n.buttons.map((k, T) => k.disabled ? -1 : T).filter((k) => k >= 0), y = g.indexOf(n.index), w = p.key === "Home" ? g[0] : p.key === "End" ? g.at(-1) : g[(y + (p.key === "ArrowDown" ? 1 : -1) + g.length) % g.length];
|
|
17411
17411
|
return w !== void 0 && s(w), !0;
|
|
17412
17412
|
}
|
|
17413
17413
|
},
|
|
@@ -17435,11 +17435,11 @@ function sM(t) {
|
|
|
17435
17435
|
const o = r.parent, s = o.content.cut(0, r.parentOffset), a = o.content.cut(r.parentOffset);
|
|
17436
17436
|
let l = s.size ? [o.copy(s)] : [], c = [];
|
|
17437
17437
|
for (let m = r.depth - 1; m >= i; m--) {
|
|
17438
|
-
const g = r.node(m), y = r.index(m), w = Array.from({ length: g.childCount }, (x, S) => g.child(S)), k = [...w.slice(0, y), ...l],
|
|
17439
|
-
l = k.length ? [g.copy(Q.fromArray(k))] : [], c =
|
|
17438
|
+
const g = r.node(m), y = r.index(m), w = Array.from({ length: g.childCount }, (x, S) => g.child(S)), k = [...w.slice(0, y), ...l], T = [...c, ...w.slice(y + 1)];
|
|
17439
|
+
l = k.length ? [g.copy(Q.fromArray(k))] : [], c = T.length ? [g.type.create({
|
|
17440
17440
|
...g.attrs,
|
|
17441
17441
|
nodeId: k.length ? null : g.attrs.nodeId
|
|
17442
|
-
},
|
|
17442
|
+
}, T)] : [];
|
|
17443
17443
|
}
|
|
17444
17444
|
const u = t.schema.nodes.paragraph.create(null, a), d = r.before(i), f = d + r.node(i).nodeSize, h = Q.fromArray([...l, u, ...c]), p = n.doc.resolve(d);
|
|
17445
17445
|
return p.parent.canReplace(p.index(), p.index() + 1, h) ? (n.replaceWith(d, f, h), n.setSelection(Se.create(n.doc, d + l.reduce((m, g) => m + g.nodeSize, 0) + 1)), n.scrollIntoView()) : null;
|
|
@@ -21606,8 +21606,8 @@ var xp = {
|
|
|
21606
21606
|
if (ff(o, g, i).metrics)
|
|
21607
21607
|
return _n(o, g, i, n, s.concat(y));
|
|
21608
21608
|
if (gw.hasOwnProperty(o) && g.slice(0, 10) === "Typewriter") {
|
|
21609
|
-
for (var k = [],
|
|
21610
|
-
k.push(_n(o[
|
|
21609
|
+
for (var k = [], T = 0; T < o.length; T++)
|
|
21610
|
+
k.push(_n(o[T], g, i, n, s.concat(y)));
|
|
21611
21611
|
return eo(k);
|
|
21612
21612
|
}
|
|
21613
21613
|
}
|
|
@@ -21730,16 +21730,16 @@ var xp = {
|
|
|
21730
21730
|
}
|
|
21731
21731
|
d = Math.min(d, h), f = Math.max(f, h);
|
|
21732
21732
|
}
|
|
21733
|
-
var
|
|
21734
|
-
|
|
21733
|
+
var T = ce(["vlist"], u);
|
|
21734
|
+
T.style.height = ye(f);
|
|
21735
21735
|
var x;
|
|
21736
21736
|
if (d < 0) {
|
|
21737
21737
|
var S = ce([], []), M = ce(["vlist"], [S]);
|
|
21738
21738
|
M.style.height = ye(-d);
|
|
21739
21739
|
var I = ce(["vlist-s"], [new br("")]);
|
|
21740
|
-
x = [ce(["vlist-r"], [
|
|
21740
|
+
x = [ce(["vlist-r"], [T, I]), ce(["vlist-r"], [M])];
|
|
21741
21741
|
} else
|
|
21742
|
-
x = [ce(["vlist-r"], [
|
|
21742
|
+
x = [ce(["vlist-r"], [T])];
|
|
21743
21743
|
var O = ce(["vlist-t"], x);
|
|
21744
21744
|
return x.length === 2 && O.classes.push("vlist-t2"), O.height = f, O.depth = -d, O;
|
|
21745
21745
|
}, bw = (t, e) => {
|
|
@@ -21975,9 +21975,9 @@ var Dd = function(e) {
|
|
|
21975
21975
|
}, {
|
|
21976
21976
|
node: d
|
|
21977
21977
|
}, f, h), Ap(o, (p, m) => {
|
|
21978
|
-
var g, y, w = Mp(m), k = Mp(p),
|
|
21979
|
-
if (
|
|
21980
|
-
return bw(
|
|
21978
|
+
var g, y, w = Mp(m), k = Mp(p), T = w && k ? p.hasClass("mtight") ? (g = ZM[w]) == null ? void 0 : g[k] : (y = JM[w]) == null ? void 0 : y[k] : null;
|
|
21979
|
+
if (T)
|
|
21980
|
+
return bw(T, c);
|
|
21981
21981
|
}, {
|
|
21982
21982
|
node: d
|
|
21983
21983
|
}, f, h), o;
|
|
@@ -22641,7 +22641,7 @@ var Ew = function(e) {
|
|
|
22641
22641
|
var g = [], y = uI[l];
|
|
22642
22642
|
if (!y)
|
|
22643
22643
|
throw new Error('No SVG data for "' + l + '".');
|
|
22644
|
-
var [w, k,
|
|
22644
|
+
var [w, k, T] = y, x = T / 1e3, S = w.length, M, I;
|
|
22645
22645
|
if (S === 1) {
|
|
22646
22646
|
if (y.length !== 4)
|
|
22647
22647
|
throw new Error('Expected 4-tuple for single-path SVG data "' + l + '".');
|
|
@@ -22654,19 +22654,19 @@ var Ew = function(e) {
|
|
|
22654
22654
|
throw new Error(`Correct katexImagesData or update code here to support
|
|
22655
22655
|
` + S + " children.");
|
|
22656
22656
|
for (var O = 0; O < S; O++) {
|
|
22657
|
-
var D = new Bo(w[O]),
|
|
22657
|
+
var D = new Bo(w[O]), A = new Ki([D], {
|
|
22658
22658
|
width: "400em",
|
|
22659
22659
|
height: ye(x),
|
|
22660
|
-
viewBox: "0 0 " + a + " " +
|
|
22660
|
+
viewBox: "0 0 " + a + " " + T,
|
|
22661
22661
|
preserveAspectRatio: I[O] + " slice"
|
|
22662
|
-
}),
|
|
22662
|
+
}), E = Fo([M[O]], [A], n);
|
|
22663
22663
|
if (S === 1)
|
|
22664
22664
|
return {
|
|
22665
|
-
span:
|
|
22665
|
+
span: E,
|
|
22666
22666
|
minWidth: k,
|
|
22667
22667
|
height: x
|
|
22668
22668
|
};
|
|
22669
|
-
|
|
22669
|
+
E.style.height = ye(x), g.push(E);
|
|
22670
22670
|
}
|
|
22671
22671
|
return {
|
|
22672
22672
|
span: ce(["stretchy"], g, n),
|
|
@@ -23565,38 +23565,38 @@ var fl = function(e, n, r) {
|
|
|
23565
23565
|
a = c = u = e, l = null;
|
|
23566
23566
|
var h = "Size1-Regular";
|
|
23567
23567
|
e === "\\uparrow" ? c = u = "⏐" : e === "\\Uparrow" ? c = u = "‖" : e === "\\downarrow" ? a = c = "⏐" : e === "\\Downarrow" ? a = c = "‖" : e === "\\updownarrow" ? (a = "\\uparrow", c = "⏐", u = "\\downarrow") : e === "\\Updownarrow" ? (a = "\\Uparrow", c = "‖", u = "\\Downarrow") : II.has(e) ? (c = "∣", d = "vert", f = 333) : DI.has(e) ? (c = "∥", d = "doublevert", f = 556) : e === "[" || e === "\\lbrack" ? (a = "⎡", c = "⎢", u = "⎣", h = "Size4-Regular", d = "lbrack", f = 667) : e === "]" || e === "\\rbrack" ? (a = "⎤", c = "⎥", u = "⎦", h = "Size4-Regular", d = "rbrack", f = 667) : e === "\\lfloor" || e === "⌊" ? (c = a = "⎢", u = "⎣", h = "Size4-Regular", d = "lfloor", f = 667) : e === "\\lceil" || e === "⌈" ? (a = "⎡", c = u = "⎢", h = "Size4-Regular", d = "lceil", f = 667) : e === "\\rfloor" || e === "⌋" ? (c = a = "⎥", u = "⎦", h = "Size4-Regular", d = "rfloor", f = 667) : e === "\\rceil" || e === "⌉" ? (a = "⎤", c = u = "⎥", h = "Size4-Regular", d = "rceil", f = 667) : e === "(" || e === "\\lparen" ? (a = "⎛", c = "⎜", u = "⎝", h = "Size4-Regular", d = "lparen", f = 875) : e === ")" || e === "\\rparen" ? (a = "⎞", c = "⎟", u = "⎠", h = "Size4-Regular", d = "rparen", f = 875) : e === "\\{" || e === "\\lbrace" ? (a = "⎧", l = "⎨", u = "⎩", c = "⎪", h = "Size4-Regular") : e === "\\}" || e === "\\rbrace" ? (a = "⎫", l = "⎬", u = "⎭", c = "⎪", h = "Size4-Regular") : e === "\\lgroup" || e === "⟮" ? (a = "⎧", u = "⎩", c = "⎪", h = "Size4-Regular") : e === "\\rgroup" || e === "⟯" ? (a = "⎫", u = "⎭", c = "⎪", h = "Size4-Regular") : e === "\\lmoustache" || e === "⎰" ? (a = "⎧", u = "⎭", c = "⎪", h = "Size4-Regular") : (e === "\\rmoustache" || e === "⎱") && (a = "⎫", u = "⎩", c = "⎪", h = "Size4-Regular");
|
|
23568
|
-
var p = fl(a, h, o), m = p.height + p.depth, g = fl(c, h, o), y = g.height + g.depth, w = fl(u, h, o), k = w.height + w.depth,
|
|
23568
|
+
var p = fl(a, h, o), m = p.height + p.depth, g = fl(c, h, o), y = g.height + g.depth, w = fl(u, h, o), k = w.height + w.depth, T = 0, x = 1;
|
|
23569
23569
|
if (l !== null) {
|
|
23570
23570
|
var S = fl(l, h, o);
|
|
23571
|
-
|
|
23571
|
+
T = S.height + S.depth, x = 2;
|
|
23572
23572
|
}
|
|
23573
|
-
var M = m + k +
|
|
23573
|
+
var M = m + k + T, I = Math.max(0, Math.ceil((n - M) / (x * y))), O = M + I * x * y, D = i.fontMetrics().axisHeight;
|
|
23574
23574
|
r && (D *= i.sizeMultiplier);
|
|
23575
|
-
var
|
|
23575
|
+
var A = O / 2 - D, E = [];
|
|
23576
23576
|
if (d.length > 0) {
|
|
23577
23577
|
var L = O - m - k, $ = Math.round(O * 1e3), H = LM(d, Math.round(L * 1e3)), B = new Bo(d, H), R = ye(f / 1e3), j = ye($ / 1e3), q = new Ki([B], {
|
|
23578
23578
|
width: R,
|
|
23579
23579
|
height: j,
|
|
23580
23580
|
viewBox: "0 0 " + f + " " + $
|
|
23581
23581
|
}), P = Fo([], [q], i);
|
|
23582
|
-
P.height = $ / 1e3, P.style.width = R, P.style.height = j,
|
|
23582
|
+
P.height = $ / 1e3, P.style.width = R, P.style.height = j, E.push({
|
|
23583
23583
|
type: "elem",
|
|
23584
23584
|
elem: P
|
|
23585
23585
|
});
|
|
23586
23586
|
} else {
|
|
23587
|
-
if (
|
|
23587
|
+
if (E.push(I0(u, h, o)), E.push(Zc), l === null) {
|
|
23588
23588
|
var Z = O - m - k + 2 * Np;
|
|
23589
|
-
|
|
23589
|
+
E.push(D0(c, Z, i));
|
|
23590
23590
|
} else {
|
|
23591
|
-
var Ce = (O - m - k -
|
|
23592
|
-
|
|
23591
|
+
var Ce = (O - m - k - T) / 2 + 2 * Np;
|
|
23592
|
+
E.push(D0(c, Ce, i)), E.push(Zc), E.push(I0(l, h, o)), E.push(Zc), E.push(D0(c, Ce, i));
|
|
23593
23593
|
}
|
|
23594
|
-
|
|
23594
|
+
E.push(Zc), E.push(I0(a, h, o));
|
|
23595
23595
|
}
|
|
23596
23596
|
var z = i.havingBaseStyle(tt.TEXT), oe = St({
|
|
23597
23597
|
positionType: "bottom",
|
|
23598
|
-
positionData:
|
|
23599
|
-
children:
|
|
23598
|
+
positionData: A,
|
|
23599
|
+
children: E
|
|
23600
23600
|
});
|
|
23601
23601
|
return h1(ce(["delimsizing", "mult"], [oe], z), tt.TEXT, i, s);
|
|
23602
23602
|
}, N0 = 80, P0 = 0.08, L0 = function(e, n, r, i, o) {
|
|
@@ -24251,7 +24251,7 @@ function Wo(t, e, n) {
|
|
|
24251
24251
|
function k() {
|
|
24252
24252
|
l && t.gullet.macros.set("\\@eqnsw", "1", !0);
|
|
24253
24253
|
}
|
|
24254
|
-
function
|
|
24254
|
+
function T() {
|
|
24255
24255
|
w && (t.gullet.macros.get("\\df@tag") ? (w.push(t.subparse([new gr("\\df@tag")])), t.gullet.macros.set("\\df@tag", void 0, !0)) : w.push(!!l && t.gullet.macros.get("\\@eqnsw") === "1"));
|
|
24256
24256
|
}
|
|
24257
24257
|
for (k(), y.push(qb(t)); ; ) {
|
|
@@ -24278,12 +24278,12 @@ function Wo(t, e, n) {
|
|
|
24278
24278
|
}
|
|
24279
24279
|
t.consume();
|
|
24280
24280
|
} else if (M === "\\end") {
|
|
24281
|
-
|
|
24281
|
+
T(), p.length === 1 && S.type === "styling" && S.body.length === 1 && S.body[0].type === "ordgroup" && S.body[0].body.length === 0 && (m.length > 1 || !u) && m.pop(), y.length < m.length + 1 && y.push([]);
|
|
24282
24282
|
break;
|
|
24283
24283
|
} else if (M === "\\\\") {
|
|
24284
24284
|
t.consume();
|
|
24285
24285
|
var I = void 0;
|
|
24286
|
-
t.gullet.future().text !== " " && (I = t.parseSizeGroup(!0)), g.push(I ? I.value : null),
|
|
24286
|
+
t.gullet.future().text !== " " && (I = t.parseSizeGroup(!0)), g.push(I ? I.value : null), T(), y.push(qb(t)), p = [], m.push(p), k();
|
|
24287
24287
|
} else
|
|
24288
24288
|
throw new pe("Expected & or \\\\ or \\cr or \\end", t.nextToken);
|
|
24289
24289
|
}
|
|
@@ -24319,14 +24319,14 @@ var xi = function(e, n) {
|
|
|
24319
24319
|
number: 3,
|
|
24320
24320
|
unit: "ex"
|
|
24321
24321
|
}, n) : 12 * d, m = 3 * d, g = e.arraystretch * p, y = 0.7 * g, w = 0.3 * g, k = 0;
|
|
24322
|
-
function
|
|
24322
|
+
function T(be) {
|
|
24323
24323
|
for (var Pe = 0; Pe < be.length; ++Pe)
|
|
24324
24324
|
Pe > 0 && (k += 0.25), c.push({
|
|
24325
24325
|
pos: k,
|
|
24326
24326
|
isDashed: be[Pe]
|
|
24327
24327
|
});
|
|
24328
24328
|
}
|
|
24329
|
-
for (
|
|
24329
|
+
for (T(s[0]), r = 0; r < e.body.length; ++r) {
|
|
24330
24330
|
var x = e.body[r], S = y, M = w;
|
|
24331
24331
|
a < x.length && (a = x.length);
|
|
24332
24332
|
var I = {
|
|
@@ -24339,13 +24339,13 @@ var xi = function(e, n) {
|
|
|
24339
24339
|
var O = Ct(x[i], n);
|
|
24340
24340
|
M < O.depth && (M = O.depth), S < O.height && (S = O.height), I.cells[i] = O;
|
|
24341
24341
|
}
|
|
24342
|
-
var D = e.rowGaps[r],
|
|
24343
|
-
D && (
|
|
24342
|
+
var D = e.rowGaps[r], A = 0;
|
|
24343
|
+
D && (A = Zt(D, n), A > 0 && (A += w, M < A && (M = A), A = 0)), e.addJot && r < e.body.length - 1 && (M += m), I.height = S, I.depth = M, k += S, I.pos = k, k += M + A, l[r] = I, T(s[r + 1]);
|
|
24344
24344
|
}
|
|
24345
|
-
var
|
|
24345
|
+
var E = k / 2 + n.fontMetrics().axisHeight, L = e.cols || [], $ = [], H, B, R = [];
|
|
24346
24346
|
if (e.tags && e.tags.some((be) => be))
|
|
24347
24347
|
for (r = 0; r < o; ++r) {
|
|
24348
|
-
var j = l[r], q = j.pos -
|
|
24348
|
+
var j = l[r], q = j.pos - E, P = e.tags[r], Z = void 0;
|
|
24349
24349
|
P === !0 ? Z = ce(["eqn-num"], [], n) : P === !1 ? Z = ce([], [], n) : Z = ce([], vn(P, n, !0), n), Z.depth = j.depth, Z.height = j.height, R.push({
|
|
24350
24350
|
type: "elem",
|
|
24351
24351
|
elem: Z,
|
|
@@ -24364,7 +24364,7 @@ var xi = function(e, n) {
|
|
|
24364
24364
|
if (oe || (H = ce(["arraycolsep"], []), H.style.width = ye(n.fontMetrics().doubleRuleSep), $.push(H)), z.separator === "|" || z.separator === ":") {
|
|
24365
24365
|
var xe = z.separator === "|" ? "solid" : "dashed", Ae = ce(["vertical-separator"], [], n);
|
|
24366
24366
|
Ae.style.height = ye(k), Ae.style.borderRightWidth = ye(u), Ae.style.borderRightStyle = xe, Ae.style.margin = "0 " + ye(-u / 2);
|
|
24367
|
-
var ze = k -
|
|
24367
|
+
var ze = k - E;
|
|
24368
24368
|
ze && (Ae.style.verticalAlign = ye(-ze)), $.push(Ae);
|
|
24369
24369
|
} else
|
|
24370
24370
|
throw new pe("Invalid separator type: " + z.separator);
|
|
@@ -24380,7 +24380,7 @@ var xi = function(e, n) {
|
|
|
24380
24380
|
for (r = 0; r < o; ++r) {
|
|
24381
24381
|
var At = l[r], re = At.cells[i];
|
|
24382
24382
|
if (re) {
|
|
24383
|
-
var G = At.pos -
|
|
24383
|
+
var G = At.pos - E;
|
|
24384
24384
|
re.depth = At.depth, re.height = At.height, Et.push({
|
|
24385
24385
|
type: "elem",
|
|
24386
24386
|
elem: re,
|
|
@@ -24405,7 +24405,7 @@ var xi = function(e, n) {
|
|
|
24405
24405
|
elem: ve,
|
|
24406
24406
|
shift: 0
|
|
24407
24407
|
}]; c.length > 0; ) {
|
|
24408
|
-
var J = c.pop(), ee = J.pos -
|
|
24408
|
+
var J = c.pop(), ee = J.pos - E;
|
|
24409
24409
|
J.isDashed ? W.push({
|
|
24410
24410
|
type: "elem",
|
|
24411
24411
|
elem: ke,
|
|
@@ -24445,8 +24445,8 @@ var xi = function(e, n) {
|
|
|
24445
24445
|
var p = e.cols, m = "", g = !1, y = 0, w = p.length;
|
|
24446
24446
|
p[0].type === "separator" && (f += "top ", y = 1), p[p.length - 1].type === "separator" && (f += "bottom ", w -= 1);
|
|
24447
24447
|
for (var k = y; k < w; k++) {
|
|
24448
|
-
var
|
|
24449
|
-
|
|
24448
|
+
var T = p[k];
|
|
24449
|
+
T.type === "align" ? (h += HI[T.align], g && (m += "none "), g = !0) : T.type === "separator" && g && (m += T.separator === "|" ? "solid " : "dashed ", g = !1);
|
|
24450
24450
|
}
|
|
24451
24451
|
u.setAttribute("columnalign", h.trim()), /[sd]/.test(m) && u.setAttribute("columnlines", m.trim());
|
|
24452
24452
|
}
|
|
@@ -24491,9 +24491,9 @@ var xi = function(e, n) {
|
|
|
24491
24491
|
if (f)
|
|
24492
24492
|
a < g.length && (a = g.length);
|
|
24493
24493
|
else {
|
|
24494
|
-
var
|
|
24495
|
-
if (s <
|
|
24496
|
-
throw new pe("Too many math in a row: " + ("expected " + s + ", but got " +
|
|
24494
|
+
var T = g.length / 2;
|
|
24495
|
+
if (s < T)
|
|
24496
|
+
throw new pe("Too many math in a row: " + ("expected " + s + ", but got " + T), g[0]);
|
|
24497
24497
|
}
|
|
24498
24498
|
});
|
|
24499
24499
|
for (var h = 0; h < a; ++h) {
|
|
@@ -24950,10 +24950,10 @@ var qI = (t, e) => {
|
|
|
24950
24950
|
});
|
|
24951
24951
|
}
|
|
24952
24952
|
o = e.havingStyle(n), g.height *= o.sizeMultiplier / e.sizeMultiplier, g.depth *= o.sizeMultiplier / e.sizeMultiplier;
|
|
24953
|
-
var
|
|
24954
|
-
n.size === tt.DISPLAY.size ?
|
|
24953
|
+
var T;
|
|
24954
|
+
n.size === tt.DISPLAY.size ? T = e.fontMetrics().delim1 : n.size === tt.SCRIPTSCRIPT.size ? T = e.havingStyle(tt.SCRIPT).fontMetrics().delim2 : T = e.fontMetrics().delim2;
|
|
24955
24955
|
var x, S;
|
|
24956
|
-
return t.leftDelim == null ? x = ec(e, ["mopen"]) : x = Pp(t.leftDelim,
|
|
24956
|
+
return t.leftDelim == null ? x = ec(e, ["mopen"]) : x = Pp(t.leftDelim, T, !0, e.havingStyle(n), t.mode, ["mopen"]), t.continued ? S = ce([]) : t.rightDelim == null ? S = ec(e, ["mclose"]) : S = Pp(t.rightDelim, T, !0, e.havingStyle(n), t.mode, ["mclose"]), ce(["mord"].concat(o.sizingClasses(e)), [x, ce(["mfrac"], [g]), S], e);
|
|
24957
24957
|
}, VI = (t, e) => {
|
|
24958
24958
|
var n = new me("mfrac", [Ft(t.numer, e), Ft(t.denom, e)]);
|
|
24959
24959
|
if (!t.hasBarLine)
|
|
@@ -26438,8 +26438,8 @@ Fs({
|
|
|
26438
26438
|
if (l) {
|
|
26439
26439
|
var k = t.base && t.base.type === "op" && t.base.name && (t.base.name === "\\oiint" || t.base.name === "\\oiiint");
|
|
26440
26440
|
if (s instanceof br || k) {
|
|
26441
|
-
var
|
|
26442
|
-
w = ye(-((
|
|
26441
|
+
var T;
|
|
26442
|
+
w = ye(-((T = s.italic) != null ? T : 0));
|
|
26443
26443
|
}
|
|
26444
26444
|
}
|
|
26445
26445
|
var x;
|
|
@@ -26492,8 +26492,8 @@ Fs({
|
|
|
26492
26492
|
});
|
|
26493
26493
|
else
|
|
26494
26494
|
throw new Error("supsub must have either sup or sub.");
|
|
26495
|
-
var
|
|
26496
|
-
return ce([
|
|
26495
|
+
var A = Mp(s, "right") || "mord";
|
|
26496
|
+
return ce([A], [s, ce(["msupsub"], [x])], e);
|
|
26497
26497
|
},
|
|
26498
26498
|
mathmlBuilder(t, e) {
|
|
26499
26499
|
var n = !1, r, i;
|
|
@@ -29462,8 +29462,8 @@ function FD(t) {
|
|
|
29462
29462
|
if (w.trim() === "")
|
|
29463
29463
|
g.push(w), p.push(""), y = !0, m += 1;
|
|
29464
29464
|
else if (w.match(LD)) {
|
|
29465
|
-
const k = w.length - w.trimStart().length,
|
|
29466
|
-
g.push(w), p.push(w.slice(Math.min(k,
|
|
29465
|
+
const k = w.length - w.trimStart().length, T = u + a.length + 1;
|
|
29466
|
+
g.push(w), p.push(w.slice(Math.min(k, T))), m += 1;
|
|
29467
29467
|
} else {
|
|
29468
29468
|
if (y || zD(w)) break;
|
|
29469
29469
|
g.push(w), p.push(w), m += 1;
|
|
@@ -30172,13 +30172,13 @@ function h4(t, e, n, r, i, o) {
|
|
|
30172
30172
|
const y = i === h ? o : m && m[g], w = y ? `${y}px` : "";
|
|
30173
30173
|
if (s += y || r, y || (a = !1), l) {
|
|
30174
30174
|
if (l.style.width !== w) {
|
|
30175
|
-
const [k,
|
|
30176
|
-
l.style.setProperty(k,
|
|
30175
|
+
const [k, T] = zp(r, y);
|
|
30176
|
+
l.style.setProperty(k, T);
|
|
30177
30177
|
}
|
|
30178
30178
|
l = l.nextSibling;
|
|
30179
30179
|
} else {
|
|
30180
|
-
const k = document.createElement("col"), [
|
|
30181
|
-
k.style.setProperty(
|
|
30180
|
+
const k = document.createElement("col"), [T, x] = zp(r, y);
|
|
30181
|
+
k.style.setProperty(T, x), e.appendChild(k);
|
|
30182
30182
|
}
|
|
30183
30183
|
}
|
|
30184
30184
|
}
|
|
@@ -30324,11 +30324,11 @@ function cN(t, e, n = {}) {
|
|
|
30324
30324
|
let y = "";
|
|
30325
30325
|
g.content && Array.isArray(g.content) && g.content.length > 1 ? y = g.content.map((x) => e.renderChildren(x)).join(i) : y = g.content ? e.renderChildren(g.content) : "";
|
|
30326
30326
|
const w = lN(y.split(i).join(`
|
|
30327
|
-
`).replace(/[ \t]*\r?\n[ \t]*/g, "<br>")), k = g.type === "tableHeader",
|
|
30327
|
+
`).replace(/[ \t]*\r?\n[ \t]*/g, "<br>")), k = g.type === "tableHeader", T = YD(g.attrs);
|
|
30328
30328
|
m.push({
|
|
30329
30329
|
text: w,
|
|
30330
30330
|
isHeader: k,
|
|
30331
|
-
align:
|
|
30331
|
+
align: T
|
|
30332
30332
|
});
|
|
30333
30333
|
}), o.push(m);
|
|
30334
30334
|
});
|
|
@@ -32396,38 +32396,38 @@ function AP() {
|
|
|
32396
32396
|
return c(m) || d.apply(this, arguments);
|
|
32397
32397
|
}
|
|
32398
32398
|
function h(m, g) {
|
|
32399
|
-
var y = this, w, k,
|
|
32399
|
+
var y = this, w, k, T, x = "loglevel";
|
|
32400
32400
|
typeof m == "string" ? x += ":" + m : typeof m == "symbol" && (x = void 0);
|
|
32401
|
-
function S(
|
|
32402
|
-
var
|
|
32401
|
+
function S(A) {
|
|
32402
|
+
var E = (i[A] || "silent").toUpperCase();
|
|
32403
32403
|
if (!(typeof window === n || !x)) {
|
|
32404
32404
|
try {
|
|
32405
|
-
window.localStorage[x] =
|
|
32405
|
+
window.localStorage[x] = E;
|
|
32406
32406
|
return;
|
|
32407
32407
|
} catch {
|
|
32408
32408
|
}
|
|
32409
32409
|
try {
|
|
32410
|
-
window.document.cookie = encodeURIComponent(x) + "=" +
|
|
32410
|
+
window.document.cookie = encodeURIComponent(x) + "=" + E + ";";
|
|
32411
32411
|
} catch {
|
|
32412
32412
|
}
|
|
32413
32413
|
}
|
|
32414
32414
|
}
|
|
32415
32415
|
function M() {
|
|
32416
|
-
var
|
|
32416
|
+
var A;
|
|
32417
32417
|
if (!(typeof window === n || !x)) {
|
|
32418
32418
|
try {
|
|
32419
|
-
|
|
32419
|
+
A = window.localStorage[x];
|
|
32420
32420
|
} catch {
|
|
32421
32421
|
}
|
|
32422
|
-
if (typeof
|
|
32422
|
+
if (typeof A === n)
|
|
32423
32423
|
try {
|
|
32424
|
-
var
|
|
32425
|
-
$ !== -1 && (
|
|
32426
|
-
|
|
32424
|
+
var E = window.document.cookie, L = encodeURIComponent(x), $ = E.indexOf(L + "=");
|
|
32425
|
+
$ !== -1 && (A = /^([^;]+)/.exec(
|
|
32426
|
+
E.slice($ + L.length + 1)
|
|
32427
32427
|
)[1]);
|
|
32428
32428
|
} catch {
|
|
32429
32429
|
}
|
|
32430
|
-
return y.levels[
|
|
32430
|
+
return y.levels[A] === void 0 && (A = void 0), A;
|
|
32431
32431
|
}
|
|
32432
32432
|
}
|
|
32433
32433
|
function I() {
|
|
@@ -32442,11 +32442,11 @@ function AP() {
|
|
|
32442
32442
|
}
|
|
32443
32443
|
}
|
|
32444
32444
|
}
|
|
32445
|
-
function O(
|
|
32446
|
-
var
|
|
32447
|
-
if (typeof
|
|
32448
|
-
return
|
|
32449
|
-
throw new TypeError("log.setLevel() called with invalid level: " +
|
|
32445
|
+
function O(A) {
|
|
32446
|
+
var E = A;
|
|
32447
|
+
if (typeof E == "string" && y.levels[E.toUpperCase()] !== void 0 && (E = y.levels[E.toUpperCase()]), typeof E == "number" && E >= 0 && E <= y.levels.SILENT)
|
|
32448
|
+
return E;
|
|
32449
|
+
throw new TypeError("log.setLevel() called with invalid level: " + A);
|
|
32450
32450
|
}
|
|
32451
32451
|
y.name = m, y.levels = {
|
|
32452
32452
|
TRACE: 0,
|
|
@@ -32456,26 +32456,26 @@ function AP() {
|
|
|
32456
32456
|
ERROR: 4,
|
|
32457
32457
|
SILENT: 5
|
|
32458
32458
|
}, y.methodFactory = g || f, y.getLevel = function() {
|
|
32459
|
-
return
|
|
32460
|
-
}, y.setLevel = function(
|
|
32461
|
-
return
|
|
32462
|
-
}, y.setDefaultLevel = function(
|
|
32463
|
-
k = O(
|
|
32459
|
+
return T ?? k ?? w;
|
|
32460
|
+
}, y.setLevel = function(A, E) {
|
|
32461
|
+
return T = O(A), E !== !1 && S(T), u.call(y);
|
|
32462
|
+
}, y.setDefaultLevel = function(A) {
|
|
32463
|
+
k = O(A), M() || y.setLevel(A, !1);
|
|
32464
32464
|
}, y.resetLevel = function() {
|
|
32465
|
-
|
|
32466
|
-
}, y.enableAll = function(
|
|
32467
|
-
y.setLevel(y.levels.TRACE,
|
|
32468
|
-
}, y.disableAll = function(
|
|
32469
|
-
y.setLevel(y.levels.SILENT,
|
|
32465
|
+
T = null, I(), u.call(y);
|
|
32466
|
+
}, y.enableAll = function(A) {
|
|
32467
|
+
y.setLevel(y.levels.TRACE, A);
|
|
32468
|
+
}, y.disableAll = function(A) {
|
|
32469
|
+
y.setLevel(y.levels.SILENT, A);
|
|
32470
32470
|
}, y.rebuild = function() {
|
|
32471
32471
|
if (s !== y && (w = O(s.getLevel())), u.call(y), s === y)
|
|
32472
|
-
for (var
|
|
32473
|
-
o[
|
|
32472
|
+
for (var A in o)
|
|
32473
|
+
o[A].rebuild();
|
|
32474
32474
|
}, w = O(
|
|
32475
32475
|
s ? s.getLevel() : "WARN"
|
|
32476
32476
|
);
|
|
32477
32477
|
var D = M();
|
|
32478
|
-
D != null && (
|
|
32478
|
+
D != null && (T = O(D)), u.call(y);
|
|
32479
32479
|
}
|
|
32480
32480
|
s = new h(), s.getLogger = function(g) {
|
|
32481
32481
|
if (typeof g != "symbol" && typeof g != "string" || g === "")
|
|
@@ -33655,23 +33655,23 @@ function AL(t = {}) {
|
|
|
33655
33655
|
r?.(k(e ?? EL));
|
|
33656
33656
|
return;
|
|
33657
33657
|
}
|
|
33658
|
-
const
|
|
33658
|
+
const T = k({
|
|
33659
33659
|
strokes: a.current
|
|
33660
33660
|
});
|
|
33661
|
-
a.current =
|
|
33661
|
+
a.current = T.strokes, s(T.strokes), r?.(T);
|
|
33662
33662
|
}, [i, r, e]), f = Ve((k) => {
|
|
33663
|
-
d((
|
|
33663
|
+
d((T) => mL(T, k));
|
|
33664
33664
|
}, [d]), h = Ve((k) => {
|
|
33665
|
-
d((
|
|
33665
|
+
d((T) => gL(T, k));
|
|
33666
33666
|
}, [d]), p = Ve((k) => {
|
|
33667
|
-
d((
|
|
33667
|
+
d((T) => yL(T, k));
|
|
33668
33668
|
}, [d]), m = Ve((k) => {
|
|
33669
|
-
d((
|
|
33669
|
+
d((T) => bL(T, k));
|
|
33670
33670
|
}, [d]), g = Ve((k) => {
|
|
33671
|
-
d((
|
|
33671
|
+
d((T) => vL(T, k));
|
|
33672
33672
|
}, [d]), y = Ve(() => {
|
|
33673
33673
|
d(kL);
|
|
33674
|
-
}, [d]), w = Ve((k,
|
|
33674
|
+
}, [d]), w = Ve((k, T) => SL(k, u, T), [u]);
|
|
33675
33675
|
return {
|
|
33676
33676
|
strokes: u,
|
|
33677
33677
|
activeStroke: l,
|
|
@@ -34774,10 +34774,10 @@ var BO = /* @__PURE__ */ MO((/* @__PURE__ */ AO(((t, e) => {
|
|
|
34774
34774
|
return u(g) || f.apply(this, arguments);
|
|
34775
34775
|
}
|
|
34776
34776
|
function p(g, y) {
|
|
34777
|
-
var w = this, k,
|
|
34777
|
+
var w = this, k, T, x, S = "loglevel";
|
|
34778
34778
|
typeof g == "string" ? S += ":" + g : typeof g == "symbol" && (S = void 0);
|
|
34779
|
-
function M(
|
|
34780
|
-
var L = (o[
|
|
34779
|
+
function M(E) {
|
|
34780
|
+
var L = (o[E] || "silent").toUpperCase();
|
|
34781
34781
|
if (!(typeof window === r || !S)) {
|
|
34782
34782
|
try {
|
|
34783
34783
|
window.localStorage[S] = L;
|
|
@@ -34791,18 +34791,18 @@ var BO = /* @__PURE__ */ MO((/* @__PURE__ */ AO(((t, e) => {
|
|
|
34791
34791
|
}
|
|
34792
34792
|
}
|
|
34793
34793
|
function I() {
|
|
34794
|
-
var
|
|
34794
|
+
var E;
|
|
34795
34795
|
if (!(typeof window === r || !S)) {
|
|
34796
34796
|
try {
|
|
34797
|
-
|
|
34797
|
+
E = window.localStorage[S];
|
|
34798
34798
|
} catch {
|
|
34799
34799
|
}
|
|
34800
|
-
if (typeof
|
|
34800
|
+
if (typeof E === r) try {
|
|
34801
34801
|
var L = window.document.cookie, $ = encodeURIComponent(S), H = L.indexOf($ + "=");
|
|
34802
|
-
H !== -1 && (
|
|
34802
|
+
H !== -1 && (E = /^([^;]+)/.exec(L.slice(H + $.length + 1))[1]);
|
|
34803
34803
|
} catch {
|
|
34804
34804
|
}
|
|
34805
|
-
return w.levels[
|
|
34805
|
+
return w.levels[E] === void 0 && (E = void 0), E;
|
|
34806
34806
|
}
|
|
34807
34807
|
}
|
|
34808
34808
|
function O() {
|
|
@@ -34817,10 +34817,10 @@ var BO = /* @__PURE__ */ MO((/* @__PURE__ */ AO(((t, e) => {
|
|
|
34817
34817
|
}
|
|
34818
34818
|
}
|
|
34819
34819
|
}
|
|
34820
|
-
function D(
|
|
34821
|
-
var L =
|
|
34820
|
+
function D(E) {
|
|
34821
|
+
var L = E;
|
|
34822
34822
|
if (typeof L == "string" && w.levels[L.toUpperCase()] !== void 0 && (L = w.levels[L.toUpperCase()]), typeof L == "number" && L >= 0 && L <= w.levels.SILENT) return L;
|
|
34823
|
-
throw TypeError("log.setLevel() called with invalid level: " +
|
|
34823
|
+
throw TypeError("log.setLevel() called with invalid level: " + E);
|
|
34824
34824
|
}
|
|
34825
34825
|
w.name = g, w.levels = {
|
|
34826
34826
|
TRACE: 0,
|
|
@@ -34830,22 +34830,22 @@ var BO = /* @__PURE__ */ MO((/* @__PURE__ */ AO(((t, e) => {
|
|
|
34830
34830
|
ERROR: 4,
|
|
34831
34831
|
SILENT: 5
|
|
34832
34832
|
}, w.methodFactory = y || h, w.getLevel = function() {
|
|
34833
|
-
return x ??
|
|
34834
|
-
}, w.setLevel = function(
|
|
34835
|
-
return x = D(
|
|
34836
|
-
}, w.setDefaultLevel = function(
|
|
34837
|
-
|
|
34833
|
+
return x ?? T ?? k;
|
|
34834
|
+
}, w.setLevel = function(E, L) {
|
|
34835
|
+
return x = D(E), L !== !1 && M(x), d.call(w);
|
|
34836
|
+
}, w.setDefaultLevel = function(E) {
|
|
34837
|
+
T = D(E), I() || w.setLevel(E, !1);
|
|
34838
34838
|
}, w.resetLevel = function() {
|
|
34839
34839
|
x = null, O(), d.call(w);
|
|
34840
|
-
}, w.enableAll = function(
|
|
34841
|
-
w.setLevel(w.levels.TRACE,
|
|
34842
|
-
}, w.disableAll = function(
|
|
34843
|
-
w.setLevel(w.levels.SILENT,
|
|
34840
|
+
}, w.enableAll = function(E) {
|
|
34841
|
+
w.setLevel(w.levels.TRACE, E);
|
|
34842
|
+
}, w.disableAll = function(E) {
|
|
34843
|
+
w.setLevel(w.levels.SILENT, E);
|
|
34844
34844
|
}, w.rebuild = function() {
|
|
34845
|
-
if (a !== w && (k = D(a.getLevel())), d.call(w), a === w) for (var
|
|
34845
|
+
if (a !== w && (k = D(a.getLevel())), d.call(w), a === w) for (var E in s) s[E].rebuild();
|
|
34846
34846
|
}, k = D(a ? a.getLevel() : "WARN");
|
|
34847
|
-
var
|
|
34848
|
-
|
|
34847
|
+
var A = I();
|
|
34848
|
+
A != null && (x = D(A)), d.call(w);
|
|
34849
34849
|
}
|
|
34850
34850
|
a = new p(), a.getLogger = function(g) {
|
|
34851
34851
|
if (typeof g != "symbol" && typeof g != "string" || g === "") throw TypeError("You must supply a name when creating a logger.");
|
|
@@ -35454,14 +35454,14 @@ var nR = class extends tR {
|
|
|
35454
35454
|
} : null;
|
|
35455
35455
|
};
|
|
35456
35456
|
function pR(t) {
|
|
35457
|
-
let { wrapperRef: e, containerRef: n, transform: r, enabledInteractions: i, minScale: o, maxScale: s, contentSize: a, beginTransform: l, updateTransform: c, endTransform: u, isReaderMode: d, containMode: f, edgeElasticScroll: h = !1, incrementElasticActive: p, decrementElasticActive: m, readerModeZoomDebounceMs: g } = t, y = te(r), w = te(o), k = te(s),
|
|
35458
|
-
y.current = r, w.current = o, k.current = s,
|
|
35457
|
+
let { wrapperRef: e, containerRef: n, transform: r, enabledInteractions: i, minScale: o, maxScale: s, contentSize: a, beginTransform: l, updateTransform: c, endTransform: u, isReaderMode: d, containMode: f, edgeElasticScroll: h = !1, incrementElasticActive: p, decrementElasticActive: m, readerModeZoomDebounceMs: g } = t, y = te(r), w = te(o), k = te(s), T = te(a), x = te(l), S = te(c), M = te(u), I = te(d), O = te(f), D = te(h), A = te(p), E = te(m), L = te(g), $ = te(null), H = te(null), B = te(null), R = te(null), j = te(null), q = te(!1), P = te(!1);
|
|
35458
|
+
y.current = r, w.current = o, k.current = s, T.current = a, x.current = l, S.current = c, M.current = u, I.current = d, O.current = f, D.current = h, A.current = p, E.current = m, L.current = g;
|
|
35459
35459
|
let Z = aR(i), { setElasticActive: Ce, cancelSettleAnimation: z, transformsMatch: oe, settleElasticTransform: Me } = rr(() => s6({
|
|
35460
35460
|
settleCancelRef: H,
|
|
35461
35461
|
updateTransformRef: S,
|
|
35462
35462
|
endTransformRef: M,
|
|
35463
|
-
incrementElasticActive: () =>
|
|
35464
|
-
decrementElasticActive: () =>
|
|
35463
|
+
incrementElasticActive: () => A.current?.(),
|
|
35464
|
+
decrementElasticActive: () => E.current?.()
|
|
35465
35465
|
}), []);
|
|
35466
35466
|
Nt(() => {
|
|
35467
35467
|
(!f || !h || d) && z();
|
|
@@ -35521,7 +35521,7 @@ function pR(t) {
|
|
|
35521
35521
|
scale: Y
|
|
35522
35522
|
};
|
|
35523
35523
|
}
|
|
35524
|
-
I.current &&
|
|
35524
|
+
I.current && T.current && e.current && (Xe = Tf(Xe, T.current, e.current.clientWidth, e.current.clientHeight));
|
|
35525
35525
|
let at = null;
|
|
35526
35526
|
if (O.current && !I.current && e.current && n.current) if (D.current) {
|
|
35527
35527
|
let wt = L1(e.current, n.current, Xe.scale);
|
|
@@ -35676,13 +35676,13 @@ function bR(t) {
|
|
|
35676
35676
|
}
|
|
35677
35677
|
n.current = window.setTimeout(p, k);
|
|
35678
35678
|
}, [p]), g = Ve((y) => {
|
|
35679
|
-
let { wrapperRef: w, containerRef: k, contentSize:
|
|
35679
|
+
let { wrapperRef: w, containerRef: k, contentSize: T, transform: x, enabledInteractions: S, minScale: M, maxScale: I, updateTransform: O, isReaderMode: D, containMode: A, edgeElasticScroll: E, readerModeZoomDebounceMs: L } = e.current, $ = w.current, H = (j) => S.includes(j);
|
|
35680
35680
|
if (D && !y.ctrlKey && !y.metaKey) return;
|
|
35681
35681
|
let B = null, R = null;
|
|
35682
|
-
if (y.ctrlKey || y.metaKey ? H(yt.MouseWheelCtrlZoom) && $ && (R = yt.MouseWheelCtrlZoom, B = D &&
|
|
35682
|
+
if (y.ctrlKey || y.metaKey ? H(yt.MouseWheelCtrlZoom) && $ && (R = yt.MouseWheelCtrlZoom, B = D && T ? yR({
|
|
35683
35683
|
event: y,
|
|
35684
35684
|
wrapper: $,
|
|
35685
|
-
contentSize:
|
|
35685
|
+
contentSize: T,
|
|
35686
35686
|
current: x,
|
|
35687
35687
|
minScale: M,
|
|
35688
35688
|
maxScale: I
|
|
@@ -35691,7 +35691,7 @@ function bR(t) {
|
|
|
35691
35691
|
y: x.y - y.deltaY,
|
|
35692
35692
|
scale: x.scale
|
|
35693
35693
|
}) : H(yt.MouseWheelZoom) && $ && (R = yt.MouseWheelZoom, B = G4(y, $, x, M, I)), !(!R || !B)) {
|
|
35694
|
-
if (D &&
|
|
35694
|
+
if (D && T && $ && (B = Tf(B, T, $.clientWidth, $.clientHeight)), d(), A && !D && $ && k.current) if (E) {
|
|
35695
35695
|
let j = L1($, k.current, B.scale);
|
|
35696
35696
|
if (j) {
|
|
35697
35697
|
let q = n6({
|
|
@@ -35724,13 +35724,13 @@ function bR(t) {
|
|
|
35724
35724
|
};
|
|
35725
35725
|
}, [d, g]);
|
|
35726
35726
|
}
|
|
35727
|
-
var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR = ({ children: t, enabledInteractions: e = IO, initialPlacement: n = Fd.Center, renderMode: r, readerMode: i, containMode: o = !1, edgeElasticScroll: s = !1, readerModeZoomDebounceMs: a, lazyWillChange: l = 0, contentSize: c, transform: u, defaultTransform: d, minScale: f = 0.25, maxScale: h = 4, onTransformChange: p, onTransformChangeEnd: m, className: g, style: y, containerClassName: w, containerStyle: k, wrapperProps:
|
|
35728
|
-
let S = te(null), M = te(null), I = te(!1), O = te(null), D = u !== void 0,
|
|
35727
|
+
var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR = ({ children: t, enabledInteractions: e = IO, initialPlacement: n = Fd.Center, renderMode: r, readerMode: i, containMode: o = !1, edgeElasticScroll: s = !1, readerModeZoomDebounceMs: a, lazyWillChange: l = 0, contentSize: c, transform: u, defaultTransform: d, minScale: f = 0.25, maxScale: h = 4, onTransformChange: p, onTransformChangeEnd: m, className: g, style: y, containerClassName: w, containerStyle: k, wrapperProps: T, containerProps: x }) => {
|
|
35728
|
+
let S = te(null), M = te(null), I = te(!1), O = te(null), D = u !== void 0, A = i ?? r === Qx.Scroll, E = o === !0 && !A, L = e.includes(yt.MouseDragPan), $ = c?.width, H = c?.height, [B, R] = Ue(() => L4({
|
|
35729
35729
|
x: 0,
|
|
35730
35730
|
y: 0,
|
|
35731
35731
|
scale: 1
|
|
35732
|
-
}, d, f, h)), [j, q] = Ue(0), [P, Z] = Ue(null), [Ce, z] = Ue(0), oe = Ce > 0, [Me, xe] = Ue(!1), Ae = te(
|
|
35733
|
-
Ae.current =
|
|
35732
|
+
}, d, f, h)), [j, q] = Ue(0), [P, Z] = Ue(null), [Ce, z] = Ue(0), oe = Ce > 0, [Me, xe] = Ue(!1), Ae = te(A), ze = te(l), Fe = te(null);
|
|
35733
|
+
Ae.current = A, ze.current = l;
|
|
35734
35734
|
let qe = Ve(() => {
|
|
35735
35735
|
Fe.current !== null && (window.clearTimeout(Fe.current), Fe.current = null);
|
|
35736
35736
|
}, []), Ne = Ve(() => {
|
|
@@ -35738,10 +35738,10 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35738
35738
|
}, []), Et = Ve(() => {
|
|
35739
35739
|
z((Oe) => Math.max(0, Oe - 1));
|
|
35740
35740
|
}, []), At = Ve((Oe) => {
|
|
35741
|
-
if (!
|
|
35741
|
+
if (!E) return Oe;
|
|
35742
35742
|
let Ke = S.current, pt = M.current;
|
|
35743
35743
|
return !Ke || !pt ? Oe : O1(Oe, Ke, pt);
|
|
35744
|
-
}, [
|
|
35744
|
+
}, [E]);
|
|
35745
35745
|
Pt(() => {
|
|
35746
35746
|
if (D) return;
|
|
35747
35747
|
let Oe = S.current, Ke = M.current;
|
|
@@ -35759,16 +35759,16 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35759
35759
|
phase: "change"
|
|
35760
35760
|
});
|
|
35761
35761
|
}, []);
|
|
35762
|
-
let re = D ? u : B, G = rr(() =>
|
|
35762
|
+
let re = D ? u : B, G = rr(() => E && s && oe ? re : E ? At(re) : re, [
|
|
35763
35763
|
j,
|
|
35764
35764
|
s,
|
|
35765
|
-
|
|
35765
|
+
E,
|
|
35766
35766
|
At,
|
|
35767
35767
|
re,
|
|
35768
35768
|
oe
|
|
35769
35769
|
]);
|
|
35770
35770
|
Pt(() => {
|
|
35771
|
-
if (!
|
|
35771
|
+
if (!E || A) return;
|
|
35772
35772
|
let Oe = S.current, Ke = M.current;
|
|
35773
35773
|
if (!Oe || !Ke) return;
|
|
35774
35774
|
let pt = () => {
|
|
@@ -35779,7 +35779,7 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35779
35779
|
return rt.observe(Oe), rt.observe(Ke), pt(), () => rt.disconnect();
|
|
35780
35780
|
}
|
|
35781
35781
|
return pt(), window.addEventListener("resize", pt), () => window.removeEventListener("resize", pt);
|
|
35782
|
-
}, [
|
|
35782
|
+
}, [E, A]);
|
|
35783
35783
|
let ue = Ve((Oe, Ke) => {
|
|
35784
35784
|
D || R(Oe), p && p(Oe, Ke), !Ae.current && du(ze.current) && (qe(), xe(!0));
|
|
35785
35785
|
}, [
|
|
@@ -35803,17 +35803,17 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35803
35803
|
return $ !== void 0 && H !== void 0 ? {
|
|
35804
35804
|
width: $,
|
|
35805
35805
|
height: H
|
|
35806
|
-
} : (
|
|
35806
|
+
} : (A && !I.current && (I.current = !0, console.warn("VirtualPaper: readerMode requires contentSize to compute native scroll geometry. Falling back to wrapper dimensions; scaling and scrolling may not behave as expected.")), {
|
|
35807
35807
|
width: Oe?.clientWidth ?? 0,
|
|
35808
35808
|
height: Oe?.clientHeight ?? 0
|
|
35809
35809
|
});
|
|
35810
35810
|
}, [
|
|
35811
35811
|
H,
|
|
35812
35812
|
$,
|
|
35813
|
-
|
|
35813
|
+
A
|
|
35814
35814
|
]);
|
|
35815
35815
|
Pt(() => {
|
|
35816
|
-
if (!
|
|
35816
|
+
if (!A) return;
|
|
35817
35817
|
let Oe = S.current;
|
|
35818
35818
|
if (!Oe) return;
|
|
35819
35819
|
let Ke = Oe.clientWidth, pt = Oe.clientHeight;
|
|
@@ -35821,8 +35821,8 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35821
35821
|
width: Ke,
|
|
35822
35822
|
height: pt
|
|
35823
35823
|
});
|
|
35824
|
-
}, [
|
|
35825
|
-
if (!
|
|
35824
|
+
}, [A]), Pt(() => {
|
|
35825
|
+
if (!A) return;
|
|
35826
35826
|
let Oe = S.current;
|
|
35827
35827
|
if (!Oe) return;
|
|
35828
35828
|
let Ke = Oe.clientWidth, pt = Oe.clientHeight, rt = LO(re, ve(), Ke, pt), Rt = Math.max(0, Math.round(rt.scrollLeft)), Ht = Math.max(0, Math.round(rt.scrollTop));
|
|
@@ -35832,14 +35832,14 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35832
35832
|
}), Oe.scrollLeft !== Rt && (Oe.scrollLeft = Rt), Oe.scrollTop !== Ht && (Oe.scrollTop = Ht);
|
|
35833
35833
|
}, [
|
|
35834
35834
|
ve,
|
|
35835
|
-
|
|
35835
|
+
A,
|
|
35836
35836
|
re
|
|
35837
35837
|
]);
|
|
35838
35838
|
let ge = te(re);
|
|
35839
35839
|
Pt(() => {
|
|
35840
35840
|
ge.current = re;
|
|
35841
35841
|
}, [re]), Nt(() => {
|
|
35842
|
-
if (!
|
|
35842
|
+
if (!A) return;
|
|
35843
35843
|
let Oe = S.current;
|
|
35844
35844
|
if (!Oe) return;
|
|
35845
35845
|
let Ke = () => {
|
|
@@ -35855,12 +35855,12 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35855
35855
|
return Oe.addEventListener("scroll", Ke, { passive: !0 }), () => Oe.removeEventListener("scroll", Ke);
|
|
35856
35856
|
}, [
|
|
35857
35857
|
ve,
|
|
35858
|
-
|
|
35858
|
+
A,
|
|
35859
35859
|
ue
|
|
35860
35860
|
]), Nt(() => () => qe(), [qe]), Nt(() => {
|
|
35861
|
-
!
|
|
35861
|
+
!A && du(l) || (qe(), xe(!1));
|
|
35862
35862
|
}, [
|
|
35863
|
-
|
|
35863
|
+
A,
|
|
35864
35864
|
l,
|
|
35865
35865
|
qe
|
|
35866
35866
|
]);
|
|
@@ -35873,7 +35873,7 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35873
35873
|
position: "absolute",
|
|
35874
35874
|
transformOrigin: "0 0",
|
|
35875
35875
|
touchAction: "none"
|
|
35876
|
-
}, { className: J, style: ee, ...U } =
|
|
35876
|
+
}, { className: J, style: ee, ...U } = T ?? {}, { className: Y, style: be, ...Pe } = x ?? {}, Le = T?.["data-testid"] ?? "virtual-paper-wrapper", Ze = x?.["data-testid"] ?? "virtual-paper-container", Xe = [
|
|
35877
35877
|
"virtual-paper-wrapper",
|
|
35878
35878
|
g,
|
|
35879
35879
|
J
|
|
@@ -35906,8 +35906,8 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35906
35906
|
beginTransform: fe,
|
|
35907
35907
|
updateTransform: ue,
|
|
35908
35908
|
endTransform: ne,
|
|
35909
|
-
isReaderMode:
|
|
35910
|
-
containMode:
|
|
35909
|
+
isReaderMode: A,
|
|
35910
|
+
containMode: E,
|
|
35911
35911
|
edgeElasticScroll: s,
|
|
35912
35912
|
incrementElasticActive: Ne,
|
|
35913
35913
|
decrementElasticActive: Et,
|
|
@@ -35923,13 +35923,13 @@ var Y4 = 1, du = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, vR
|
|
|
35923
35923
|
beginTransform: fe,
|
|
35924
35924
|
updateTransform: ue,
|
|
35925
35925
|
endTransform: ne,
|
|
35926
|
-
isReaderMode:
|
|
35927
|
-
containMode:
|
|
35926
|
+
isReaderMode: A,
|
|
35927
|
+
containMode: E,
|
|
35928
35928
|
edgeElasticScroll: s,
|
|
35929
35929
|
incrementElasticActive: Ne,
|
|
35930
35930
|
decrementElasticActive: Et,
|
|
35931
35931
|
readerModeZoomDebounceMs: a
|
|
35932
|
-
}),
|
|
35932
|
+
}), A) {
|
|
35933
35933
|
let Oe = S.current, Ke = P?.width ?? Oe?.clientWidth ?? 0, pt = P?.height ?? Oe?.clientHeight ?? 0, rt = nc(ve(), re.scale, Ke, pt, re), Rt = {
|
|
35934
35934
|
...ke,
|
|
35935
35935
|
overflow: "auto",
|
|
@@ -36259,22 +36259,22 @@ const UR = /* @__PURE__ */ fm(function(e, n) {
|
|
|
36259
36259
|
cursor: y,
|
|
36260
36260
|
snap: w,
|
|
36261
36261
|
pressureMultiplier: k,
|
|
36262
|
-
eraserCommitMode:
|
|
36262
|
+
eraserCommitMode: T,
|
|
36263
36263
|
eraserTrajectory: x,
|
|
36264
36264
|
testID: S,
|
|
36265
36265
|
eventTarget: M,
|
|
36266
36266
|
overflow: I,
|
|
36267
36267
|
selectedStrokeIds: O,
|
|
36268
36268
|
defaultSelectedStrokeIds: D,
|
|
36269
|
-
onSelectionChange:
|
|
36270
|
-
ruler:
|
|
36269
|
+
onSelectionChange: A,
|
|
36270
|
+
ruler: E,
|
|
36271
36271
|
onRulerChange: L,
|
|
36272
36272
|
virtualPaper: $
|
|
36273
36273
|
} = e, H = te(null), B = te(M), R = te(null), j = te(TR()), [q, P] = Ue(() => bO()), Z = te(q);
|
|
36274
36274
|
Z.current = q;
|
|
36275
36275
|
const Ce = Ve((ie) => {
|
|
36276
36276
|
P(ie);
|
|
36277
|
-
}, []), z = te(null), [oe, Me] = Ue(0), [, xe] = Ue(0), Ae =
|
|
36277
|
+
}, []), z = te(null), [oe, Me] = Ue(0), [, xe] = Ue(0), Ae = E !== !1 && E !== void 0 && (E.enabled ?? !0), ze = typeof E == "object" ? E : {}, Fe = kR($), qe = typeof $ == "object" ? $ : {};
|
|
36278
36278
|
let Ne = null;
|
|
36279
36279
|
if (Ae)
|
|
36280
36280
|
if (ze.state)
|
|
@@ -36445,7 +36445,7 @@ const UR = /* @__PURE__ */ fm(function(e, n) {
|
|
|
36445
36445
|
}, [Ae, Fe, qe.enabledInteractions]);
|
|
36446
36446
|
const G = J4(r) ? r : "pen", ue = r === void 0 || J4(r);
|
|
36447
36447
|
B.current = M;
|
|
36448
|
-
const fe = a && a.trim() !== "" ? a : "black", ne = typeof l == "number" && Number.isFinite(l) && l >= 1 ? l : 2, le = typeof l == "number" && Number.isFinite(l) && l >= 0 ? l : 1, ve = c ? [...c] : void 0, ge = typeof u == "number" && Number.isFinite(u) ? u : void 0, ke = typeof f == "number" && Number.isFinite(f) ? f : void 0, W = typeof g == "number" && Number.isFinite(g) && g > 0 ? g : 0, J = qR(w), ee = typeof k == "number" && Number.isFinite(k) && k > 0 ? k : 1, U =
|
|
36448
|
+
const fe = a && a.trim() !== "" ? a : "black", ne = typeof l == "number" && Number.isFinite(l) && l >= 1 ? l : 2, le = typeof l == "number" && Number.isFinite(l) && l >= 0 ? l : 1, ve = c ? [...c] : void 0, ge = typeof u == "number" && Number.isFinite(u) ? u : void 0, ke = typeof f == "number" && Number.isFinite(f) ? f : void 0, W = typeof g == "number" && Number.isFinite(g) && g > 0 ? g : 0, J = qR(w), ee = typeof k == "number" && Number.isFinite(k) && k > 0 ? k : 1, U = T === "on-release" ? "on-release" : "while-sliding", Y = rr(() => {
|
|
36449
36449
|
const ie = x?.visible ?? !1, Ee = x?.color, Ie = typeof Ee == "string" && Ee.trim().length > 0 ? Ee : "#ccc", it = x?.opacity, ut = typeof it == "number" && Number.isFinite(it) ? Math.max(0, Math.min(1, it)) : 0.5, bt = x?.lineWidth, Yt = typeof bt == "number" && Number.isFinite(bt) && bt > 0 ? bt : ne;
|
|
36450
36450
|
return {
|
|
36451
36451
|
visible: ie,
|
|
@@ -36477,12 +36477,12 @@ const UR = /* @__PURE__ */ fm(function(e, n) {
|
|
|
36477
36477
|
value: i,
|
|
36478
36478
|
onChange: s,
|
|
36479
36479
|
defaultValue: Pe.current
|
|
36480
|
-
}), [Oe, Ke] = Ue(() => Z0(D ?? [])), pt = O !== void 0, rt = rr(() => Z0(pt ? O : Oe), [Oe, pt, O]), Rt = rr(() => wL(Le, rt), [Le, rt]), Ht = te(rt), bc = te(Rt), Hs = te(
|
|
36480
|
+
}), [Oe, Ke] = Ue(() => Z0(D ?? [])), pt = O !== void 0, rt = rr(() => Z0(pt ? O : Oe), [Oe, pt, O]), Rt = rr(() => wL(Le, rt), [Le, rt]), Ht = te(rt), bc = te(Rt), Hs = te(A), Rf = rr(() => new Set(rt), [rt]);
|
|
36481
36481
|
Nt(() => {
|
|
36482
36482
|
Ht.current = rt;
|
|
36483
36483
|
}, [rt]), Nt(() => {
|
|
36484
36484
|
bc.current = Rt;
|
|
36485
|
-
}, [Rt]), Hs.current =
|
|
36485
|
+
}, [Rt]), Hs.current = A;
|
|
36486
36486
|
const kr = Ve((ie) => {
|
|
36487
36487
|
const Ee = Z0(ie), Ie = Ht.current;
|
|
36488
36488
|
$R(Ie, Ee) || (Ht.current = Ee, pt || Ke(Ee), Hs.current?.(Ee));
|
|
@@ -37583,8 +37583,8 @@ function cz(t) {
|
|
|
37583
37583
|
if (!(Array.isArray(f) && f.length <= r2)) return Xt("invalid-value", `${l}/points`, `points 必须是最多 ${r2} 项的数组`);
|
|
37584
37584
|
const h = f;
|
|
37585
37585
|
if (i += h.length, i > i2) return Xt("invalid-value", "/strokes", `全部 points 不得超过 ${i2} 项`);
|
|
37586
|
-
for (let
|
|
37587
|
-
const x = h[
|
|
37586
|
+
for (let T = 0; T < h.length; T += 1) {
|
|
37587
|
+
const x = h[T], S = `${l}/points/${T}`;
|
|
37588
37588
|
if (!eh(x)) return Xt("invalid-shape", S, "point 必须是对象");
|
|
37589
37589
|
const M = th(x, az, S);
|
|
37590
37590
|
if (!M.ok) return M;
|
|
@@ -37601,7 +37601,7 @@ function cz(t) {
|
|
|
37601
37601
|
const y = a.dashOffset;
|
|
37602
37602
|
if (y !== void 0 && !nh(y, pu)) return Xt("invalid-value", `${l}/dashOffset`, "dashOffset 必须是有界有限数");
|
|
37603
37603
|
const w = a.dashArray;
|
|
37604
|
-
if (w !== void 0 && !(Array.isArray(w) && w.length <= nz && w.every((
|
|
37604
|
+
if (w !== void 0 && !(Array.isArray(w) && w.length <= nz && w.every((T) => typeof T == "number" && Number.isFinite(T) && T >= 0 && T <= pu))) return Xt("invalid-value", `${l}/dashArray`, "dashArray 必须是有界非负有限数数组");
|
|
37605
37605
|
const k = a.fillOpacity;
|
|
37606
37606
|
if (k !== void 0 && !(typeof k == "number" && Number.isFinite(k) && k >= 0 && k <= 1)) return Xt("invalid-value", `${l}/fillOpacity`, "fillOpacity 必须在 0 到 1 之间");
|
|
37607
37607
|
}
|
|
@@ -37655,7 +37655,7 @@ function F1(t) {
|
|
|
37655
37655
|
...z,
|
|
37656
37656
|
...z.children ? { children: z.children.map(Ce) } : {},
|
|
37657
37657
|
onActivate: () => {
|
|
37658
|
-
|
|
37658
|
+
A(!1), z.onActivate?.();
|
|
37659
37659
|
}
|
|
37660
37660
|
};
|
|
37661
37661
|
c = F1({
|
|
@@ -37669,7 +37669,7 @@ function F1(t) {
|
|
|
37669
37669
|
},
|
|
37670
37670
|
onHoverLeave: () => p(R),
|
|
37671
37671
|
onTab: () => {
|
|
37672
|
-
|
|
37672
|
+
A(!1), t.onTab?.();
|
|
37673
37673
|
},
|
|
37674
37674
|
onClose: () => {
|
|
37675
37675
|
h(), c = null, u = null, Z.setAttribute("aria-expanded", "false"), Z.removeAttribute("aria-controls");
|
|
@@ -37711,7 +37711,7 @@ function F1(t) {
|
|
|
37711
37711
|
y(), l = R, s[R].textContent = j.confirmLabel, s[R].classList.add("is-confirming");
|
|
37712
37712
|
return;
|
|
37713
37713
|
}
|
|
37714
|
-
y(),
|
|
37714
|
+
y(), A(!1), j.onActivate?.();
|
|
37715
37715
|
}
|
|
37716
37716
|
};
|
|
37717
37717
|
n.forEach((R) => {
|
|
@@ -37733,8 +37733,8 @@ function F1(t) {
|
|
|
37733
37733
|
}), o.addEventListener("pointerleave", (R) => {
|
|
37734
37734
|
R.pointerType === "mouse" && t.onHoverLeave?.();
|
|
37735
37735
|
});
|
|
37736
|
-
const
|
|
37737
|
-
t.placement !== "submenu" &&
|
|
37736
|
+
const T = e.closest(".hn-editor") ?? document.body;
|
|
37737
|
+
t.placement !== "submenu" && T.dispatchEvent(new CustomEvent("hn-editor-popover-open", { detail: "menu", bubbles: !0 })), T.appendChild(o);
|
|
37738
37738
|
const x = e.getBoundingClientRect(), S = window.innerWidth, M = window.innerHeight, I = o.offsetWidth, O = o.offsetHeight;
|
|
37739
37739
|
if (t.placement === "submenu") {
|
|
37740
37740
|
const R = x.right + Zs, j = R + I <= S - $n ? R : Math.max($n, x.left - Zs - I);
|
|
@@ -37756,12 +37756,12 @@ function F1(t) {
|
|
|
37756
37756
|
o.style.top = `${oe}px`;
|
|
37757
37757
|
}
|
|
37758
37758
|
let D = !1;
|
|
37759
|
-
const
|
|
37760
|
-
D || (D = !0, h(), c?.close(!1), o.removeEventListener("keydown", L), document.removeEventListener("pointerdown", $, !0), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", H),
|
|
37761
|
-
},
|
|
37762
|
-
R.detail === "slash" &&
|
|
37759
|
+
const A = (R = !1) => {
|
|
37760
|
+
D || (D = !0, h(), c?.close(!1), o.removeEventListener("keydown", L), document.removeEventListener("pointerdown", $, !0), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", H), T.removeEventListener("hn-editor-popover-open", E), o.remove(), R && e.focus({ preventScroll: !0 }), i?.());
|
|
37761
|
+
}, E = (R) => {
|
|
37762
|
+
R.detail === "slash" && A(!1);
|
|
37763
37763
|
};
|
|
37764
|
-
|
|
37764
|
+
T.addEventListener("hn-editor-popover-open", E);
|
|
37765
37765
|
const L = (R) => {
|
|
37766
37766
|
const j = s.findIndex((q) => q === document.activeElement);
|
|
37767
37767
|
switch (R.key) {
|
|
@@ -37769,7 +37769,7 @@ function F1(t) {
|
|
|
37769
37769
|
a[j]?.children && (R.preventDefault(), m(j));
|
|
37770
37770
|
return;
|
|
37771
37771
|
case "ArrowLeft":
|
|
37772
|
-
t.placement === "submenu" && (R.preventDefault(), R.stopPropagation(),
|
|
37772
|
+
t.placement === "submenu" && (R.preventDefault(), R.stopPropagation(), A(!0));
|
|
37773
37773
|
return;
|
|
37774
37774
|
case "ArrowDown":
|
|
37775
37775
|
R.preventDefault(), w(j, 1);
|
|
@@ -37784,18 +37784,18 @@ function F1(t) {
|
|
|
37784
37784
|
R.preventDefault(), w(0, -1);
|
|
37785
37785
|
return;
|
|
37786
37786
|
case "Escape":
|
|
37787
|
-
R.preventDefault(), R.stopPropagation(),
|
|
37787
|
+
R.preventDefault(), R.stopPropagation(), A(!0);
|
|
37788
37788
|
return;
|
|
37789
37789
|
case "Tab":
|
|
37790
|
-
|
|
37790
|
+
A(!1), t.onTab?.();
|
|
37791
37791
|
return;
|
|
37792
37792
|
}
|
|
37793
37793
|
}, $ = (R) => {
|
|
37794
|
-
R.target instanceof window.Node && (o.contains(R.target) || c?.element.contains(R.target) || e.contains(R.target) ||
|
|
37795
|
-
}, H = () =>
|
|
37796
|
-
R.target instanceof window.Node && (o.contains(R.target) || c?.element.contains(R.target)) ||
|
|
37794
|
+
R.target instanceof window.Node && (o.contains(R.target) || c?.element.contains(R.target) || e.contains(R.target) || A(!1));
|
|
37795
|
+
}, H = () => A(!1), B = (R) => {
|
|
37796
|
+
R.target instanceof window.Node && (o.contains(R.target) || c?.element.contains(R.target)) || A(!1);
|
|
37797
37797
|
};
|
|
37798
|
-
return o.addEventListener("keydown", L), document.addEventListener("pointerdown", $, !0), window.addEventListener("scroll", B, !0), window.addEventListener("resize", H), t.focusOnOpen !== !1 && w(-1, 1), { close:
|
|
37798
|
+
return o.addEventListener("keydown", L), document.addEventListener("pointerdown", $, !0), window.addEventListener("scroll", B, !0), window.addEventListener("resize", H), t.focusOnOpen !== !1 && w(-1, 1), { close: A, element: o, focusFirst: () => w(-1, 1) };
|
|
37799
37799
|
}
|
|
37800
37800
|
function hz(t) {
|
|
37801
37801
|
const { sourceIndex: e, targetIndex: n, itemCount: r, pointerOffset: i, targetSize: o } = t;
|
|
@@ -37923,14 +37923,14 @@ function gz(t) {
|
|
|
37923
37923
|
ve = ke;
|
|
37924
37924
|
}, e.view) || !ve ? !1 : Ln(e, ve);
|
|
37925
37925
|
};
|
|
37926
|
-
let
|
|
37926
|
+
let T = null;
|
|
37927
37927
|
const x = {}, S = () => n.getBoundingClientRect(), M = (re, G, ue) => {
|
|
37928
37928
|
re.style.left = `${G}px`, re.style.top = `${ue}px`, re.classList.add(gu);
|
|
37929
37929
|
}, I = () => {
|
|
37930
37930
|
for (const J of Object.keys(d))
|
|
37931
37931
|
d[J].classList.remove(gu), delete x[J];
|
|
37932
37932
|
if (!e.isEditable) return;
|
|
37933
|
-
const re =
|
|
37933
|
+
const re = T ?? c()?.start ?? null;
|
|
37934
37934
|
if (re === null) return;
|
|
37935
37935
|
const G = a();
|
|
37936
37936
|
if (!G) return;
|
|
@@ -37951,16 +37951,16 @@ function gz(t) {
|
|
|
37951
37951
|
const ue = G.closest("td, th");
|
|
37952
37952
|
if (!ue || ue.closest("table") !== r) return;
|
|
37953
37953
|
const fe = l().find((ne) => ne.dom === ue);
|
|
37954
|
-
!fe || fe.start ===
|
|
37954
|
+
!fe || fe.start === T || (T = fe.start, I());
|
|
37955
37955
|
}, D = () => {
|
|
37956
|
-
|
|
37956
|
+
T = null, I();
|
|
37957
37957
|
};
|
|
37958
37958
|
i.addEventListener("pointerover", O), n.addEventListener("pointerleave", D);
|
|
37959
|
-
let
|
|
37959
|
+
let A = null, E = null, L = null;
|
|
37960
37960
|
const $ = () => {
|
|
37961
|
-
|
|
37961
|
+
A?.close(!1);
|
|
37962
37962
|
}, H = (re, G) => {
|
|
37963
|
-
if (
|
|
37963
|
+
if (A && E === G) {
|
|
37964
37964
|
$();
|
|
37965
37965
|
return;
|
|
37966
37966
|
}
|
|
@@ -37995,12 +37995,12 @@ function gz(t) {
|
|
|
37995
37995
|
disabledReason: `表格至少保留一${ve}`,
|
|
37996
37996
|
onActivate: () => w(re)
|
|
37997
37997
|
};
|
|
37998
|
-
G.classList.add(l2),
|
|
37998
|
+
G.classList.add(l2), E = G, L = ue.start, A = F1({
|
|
37999
37999
|
anchor: G,
|
|
38000
38000
|
items: [...W, "divider", J],
|
|
38001
38001
|
ariaLabel: `${ve}操作菜单`,
|
|
38002
38002
|
onClose: () => {
|
|
38003
|
-
|
|
38003
|
+
A = null, E = null, L = null, G.classList.remove(l2);
|
|
38004
38004
|
}
|
|
38005
38005
|
});
|
|
38006
38006
|
};
|
|
@@ -38137,7 +38137,7 @@ function gz(t) {
|
|
|
38137
38137
|
M(h, ge.left - ue.left + ge.width / 2, ge.top - ue.top);
|
|
38138
38138
|
}
|
|
38139
38139
|
}, Ne = () => {
|
|
38140
|
-
|
|
38140
|
+
A && c()?.start !== L && $(), qe(), I();
|
|
38141
38141
|
};
|
|
38142
38142
|
Ne();
|
|
38143
38143
|
const Et = ({ transaction: re }) => {
|
|
@@ -38195,8 +38195,8 @@ const vz = xt.create({
|
|
|
38195
38195
|
const { view: u, doc: d, node: f, block: h, before: p, after: m } = c;
|
|
38196
38196
|
if (!u.editable || d !== u.state.doc || u.dom.contains(h))
|
|
38197
38197
|
return t = null, super.parse(a, l);
|
|
38198
|
-
const g = Array.from(a.childNodes), y = p.length, w = g.length - m.length, k = l.from ?? 0,
|
|
38199
|
-
if (y < k || w >
|
|
38198
|
+
const g = Array.from(a.childNodes), y = p.length, w = g.length - m.length, k = l.from ?? 0, T = l.to ?? g.length;
|
|
38199
|
+
if (y < k || w > T) return super.parse(a, l);
|
|
38200
38200
|
if (t = null, w <= y || !p.every((H, B) => g[B] === H) || !m.every((H, B) => g[w + B] === H)) return super.parse(a, l);
|
|
38201
38201
|
const x = g.slice(y, w), S = x.length === 1 && /^(P|H[1-6])$/.test(x[0].nodeName) ? x[0] : a;
|
|
38202
38202
|
if (S === a && x.some((H) => H.nodeType !== 3 && !/^(BR|SPAN|STRONG|EM|B|I|U|S|A|CODE)$/.test(H.nodeName))) return super.parse(a, l);
|
|
@@ -38214,12 +38214,12 @@ const vz = xt.create({
|
|
|
38214
38214
|
from: S === a ? y : 0,
|
|
38215
38215
|
to: S === a ? w : S.childNodes.length,
|
|
38216
38216
|
ruleFromNode: (H) => S === a && H === x[x.length - 1] && H.nodeName === "BR" ? { ignore: !0 } : l.ruleFromNode?.(H) ?? null
|
|
38217
|
-
},
|
|
38217
|
+
}, A = I(S, D), E = O.parsed.content.append(Q.from(A.parsed)), L = (l.topMatch ?? O.parsed.type.contentMatch).matchFragment(E);
|
|
38218
38218
|
if (!L) return super.parse(a, l);
|
|
38219
38219
|
const $ = I(a, { ...l, from: w, topMatch: L });
|
|
38220
|
-
for (const [H, B] of [[O, 0], [$,
|
|
38220
|
+
for (const [H, B] of [[O, 0], [$, E.size], [A, O.parsed.content.size + 1]])
|
|
38221
38221
|
for (let R = 0; R < H.find.length; R++) H.find[R].pos != null && (M[R].pos = H.find[R].pos + B);
|
|
38222
|
-
return O.parsed.copy(
|
|
38222
|
+
return O.parsed.copy(E.append($.parsed.content));
|
|
38223
38223
|
}
|
|
38224
38224
|
}
|
|
38225
38225
|
const i = new r(this.editor.schema, vs.fromSchema(this.editor.schema).rules), o = (s, a) => {
|
|
@@ -38343,10 +38343,10 @@ function kz(t) {
|
|
|
38343
38343
|
k();
|
|
38344
38344
|
} catch {
|
|
38345
38345
|
}
|
|
38346
|
-
}, h = (k,
|
|
38347
|
-
n.removeAttribute("src"), n.hidden = !0, r.hidden = !1, i.textContent = k, o.hidden = !
|
|
38348
|
-
}, p = (k,
|
|
38349
|
-
d =
|
|
38346
|
+
}, h = (k, T) => {
|
|
38347
|
+
n.removeAttribute("src"), n.hidden = !0, r.hidden = !1, i.textContent = k, o.hidden = !T;
|
|
38348
|
+
}, p = (k, T) => {
|
|
38349
|
+
d = T, n.getAttribute("src") !== k && n.setAttribute("src", k), n.hidden = !1, r.hidden = !0;
|
|
38350
38350
|
}, m = () => {
|
|
38351
38351
|
if (s) return;
|
|
38352
38352
|
if (f(), !Uo(a)) {
|
|
@@ -38362,12 +38362,12 @@ function kz(t) {
|
|
|
38362
38362
|
h("缺少图片解析能力", !0);
|
|
38363
38363
|
return;
|
|
38364
38364
|
}
|
|
38365
|
-
const
|
|
38366
|
-
c =
|
|
38365
|
+
const T = new AbortController(), x = Symbol(a);
|
|
38366
|
+
c = T, u = x, h("图片加载中…", !1);
|
|
38367
38367
|
let S;
|
|
38368
38368
|
try {
|
|
38369
38369
|
S = k(a, {
|
|
38370
|
-
signal:
|
|
38370
|
+
signal: T.signal,
|
|
38371
38371
|
documentId: t.documentId,
|
|
38372
38372
|
loadKey: t.loadKey
|
|
38373
38373
|
});
|
|
@@ -38376,7 +38376,7 @@ function kz(t) {
|
|
|
38376
38376
|
return;
|
|
38377
38377
|
}
|
|
38378
38378
|
Promise.resolve(S).then((M) => {
|
|
38379
|
-
if (!(!s && !e.isDestroyed && u === x && !
|
|
38379
|
+
if (!(!s && !e.isDestroyed && u === x && !T.signal.aborted)) {
|
|
38380
38380
|
try {
|
|
38381
38381
|
M?.dispose?.();
|
|
38382
38382
|
} catch {
|
|
@@ -38393,14 +38393,14 @@ function kz(t) {
|
|
|
38393
38393
|
}
|
|
38394
38394
|
p(M.url, M.dispose);
|
|
38395
38395
|
}, () => {
|
|
38396
|
-
!s && u === x && !
|
|
38396
|
+
!s && u === x && !T.signal.aborted && h("图片加载失败", !0);
|
|
38397
38397
|
});
|
|
38398
38398
|
}, g = (k) => {
|
|
38399
38399
|
k.preventDefault(), k.stopPropagation(), m();
|
|
38400
38400
|
}, y = () => m(), w = h6(e);
|
|
38401
38401
|
return o.addEventListener("click", g), w.addEventListener(qp, y), {
|
|
38402
|
-
update(k,
|
|
38403
|
-
n.alt =
|
|
38402
|
+
update(k, T) {
|
|
38403
|
+
n.alt = T;
|
|
38404
38404
|
const x = !l || a !== k;
|
|
38405
38405
|
a = k, l = !0, x && m();
|
|
38406
38406
|
},
|
|
@@ -38689,22 +38689,22 @@ function g6(t, e) {
|
|
|
38689
38689
|
qr(O, S), O.classList.add("hn-editor-code-card");
|
|
38690
38690
|
const D = document.createElement("div");
|
|
38691
38691
|
D.className = "hn-editor-code-surface";
|
|
38692
|
-
const
|
|
38693
|
-
|
|
38694
|
-
const
|
|
38695
|
-
|
|
38692
|
+
const A = document.createElement("div");
|
|
38693
|
+
A.className = "hn-editor-code-meta";
|
|
38694
|
+
const E = document.createElement("select");
|
|
38695
|
+
E.className = "hn-editor-code-lang", E.setAttribute("aria-label", "代码语言");
|
|
38696
38696
|
for (const z of zz) {
|
|
38697
38697
|
const oe = document.createElement("option");
|
|
38698
|
-
oe.value = z, oe.textContent = z,
|
|
38698
|
+
oe.value = z, oe.textContent = z, E.append(oe);
|
|
38699
38699
|
}
|
|
38700
38700
|
const L = (z) => {
|
|
38701
|
-
if ([...
|
|
38701
|
+
if ([...E.options].some((Me) => Me.value === z)) return;
|
|
38702
38702
|
const oe = document.createElement("option");
|
|
38703
|
-
oe.value = z, oe.textContent = z,
|
|
38703
|
+
oe.value = z, oe.textContent = z, E.append(oe);
|
|
38704
38704
|
}, $ = document.createElement("input");
|
|
38705
38705
|
$.type = "text", $.className = "hn-editor-code-filename", $.setAttribute("aria-label", "代码文件名"), $.placeholder = "untitled";
|
|
38706
38706
|
const H = document.createElement("span");
|
|
38707
|
-
H.className = "hn-editor-field-error", H.setAttribute("role", "alert"),
|
|
38707
|
+
H.className = "hn-editor-field-error", H.setAttribute("role", "alert"), A.append(E, $, H);
|
|
38708
38708
|
const B = document.createElement("div");
|
|
38709
38709
|
B.className = "hn-editor-code-editing";
|
|
38710
38710
|
const R = document.createElement("pre");
|
|
@@ -38714,16 +38714,16 @@ function g6(t, e) {
|
|
|
38714
38714
|
const q = document.createElement("pre");
|
|
38715
38715
|
q.className = "hn-editor-code-editor";
|
|
38716
38716
|
const P = document.createElement("code");
|
|
38717
|
-
q.append(P), B.append(R, q), D.append(
|
|
38717
|
+
q.append(P), B.append(R, q), D.append(A, B), O.append(D);
|
|
38718
38718
|
const Z = (z) => {
|
|
38719
38719
|
const oe = String(z.attrs.language ?? "plaintext");
|
|
38720
|
-
L(oe),
|
|
38720
|
+
L(oe), E.value !== oe && (E.value = oe);
|
|
38721
38721
|
const Me = String(z.attrs.filename ?? "");
|
|
38722
38722
|
$.value !== Me && ($.value = Me), j.textContent !== z.textContent && $z(j, z.textContent);
|
|
38723
38723
|
};
|
|
38724
38724
|
let Ce = x;
|
|
38725
|
-
return Z(Ce),
|
|
38726
|
-
co(I, M, { language:
|
|
38725
|
+
return Z(Ce), E.addEventListener("change", () => {
|
|
38726
|
+
co(I, M, { language: E.value });
|
|
38727
38727
|
}), $.addEventListener("input", () => {
|
|
38728
38728
|
H.textContent = "";
|
|
38729
38729
|
}), $.addEventListener("change", () => {
|
|
@@ -38739,7 +38739,7 @@ function g6(t, e) {
|
|
|
38739
38739
|
update(z) {
|
|
38740
38740
|
return z.type !== x.type ? !1 : (Ce = z, Z(z), !0);
|
|
38741
38741
|
},
|
|
38742
|
-
stopEvent: (z) => ri(
|
|
38742
|
+
stopEvent: (z) => ri(A, z),
|
|
38743
38743
|
ignoreMutation: (z) => !P.contains(z.target)
|
|
38744
38744
|
};
|
|
38745
38745
|
};
|
|
@@ -38777,14 +38777,14 @@ function g6(t, e) {
|
|
|
38777
38777
|
qr(O, S), O.setAttribute("data-hnn-node", "callout"), O.classList.add("hn-editor-callout");
|
|
38778
38778
|
const D = document.createElement("div");
|
|
38779
38779
|
D.className = "hn-editor-callout-header";
|
|
38780
|
-
const
|
|
38781
|
-
|
|
38780
|
+
const A = document.createElement("select");
|
|
38781
|
+
A.className = "hn-editor-callout-tone", A.setAttribute("aria-label", "提示类型");
|
|
38782
38782
|
for (const R of Fu) {
|
|
38783
38783
|
const j = document.createElement("option");
|
|
38784
|
-
j.value = R, j.textContent = i[R],
|
|
38784
|
+
j.value = R, j.textContent = i[R], A.append(j);
|
|
38785
38785
|
}
|
|
38786
|
-
const
|
|
38787
|
-
|
|
38786
|
+
const E = document.createElement("input");
|
|
38787
|
+
E.type = "text", E.className = "hn-editor-callout-title", E.setAttribute("aria-label", "提示标题"), E.placeholder = "提示标题", D.append(A, E);
|
|
38788
38788
|
const L = document.createElement("span");
|
|
38789
38789
|
L.className = "hn-editor-field-error", L.setAttribute("role", "alert");
|
|
38790
38790
|
const $ = document.createElement("div");
|
|
@@ -38793,16 +38793,16 @@ function g6(t, e) {
|
|
|
38793
38793
|
const B = (R) => {
|
|
38794
38794
|
const j = String(R.attrs.tone ?? "info"), q = Fu.includes(j) ? j : "info";
|
|
38795
38795
|
for (const Z of Fu) O.classList.toggle(`hn-editor-callout--${Z}`, Z === q);
|
|
38796
|
-
|
|
38796
|
+
A.value !== q && (A.value = q);
|
|
38797
38797
|
const P = ur(R.attrs.title, "");
|
|
38798
|
-
|
|
38798
|
+
E.value !== P && (E.value = P);
|
|
38799
38799
|
};
|
|
38800
|
-
return B(H),
|
|
38801
|
-
co(I, M, { tone:
|
|
38802
|
-
}),
|
|
38800
|
+
return B(H), A.addEventListener("change", () => {
|
|
38801
|
+
co(I, M, { tone: A.value });
|
|
38802
|
+
}), E.addEventListener("input", () => {
|
|
38803
38803
|
L.textContent = "";
|
|
38804
|
-
}),
|
|
38805
|
-
const R =
|
|
38804
|
+
}), E.addEventListener("change", () => {
|
|
38805
|
+
const R = E.value.trim();
|
|
38806
38806
|
if (R === "") {
|
|
38807
38807
|
L.textContent = "提示标题不得为空", B(H);
|
|
38808
38808
|
return;
|
|
@@ -38853,12 +38853,12 @@ function g6(t, e) {
|
|
|
38853
38853
|
qr(O, S), O.setAttribute("data-hnn-node", "collapsible"), O.classList.add("hn-editor-collapsible");
|
|
38854
38854
|
const D = document.createElement("div");
|
|
38855
38855
|
D.className = "hn-editor-collapsible-header";
|
|
38856
|
-
const
|
|
38857
|
-
|
|
38858
|
-
const
|
|
38859
|
-
|
|
38856
|
+
const A = document.createElement("button");
|
|
38857
|
+
A.type = "button", A.className = "hn-editor-collapsible-toggle", A.setAttribute("aria-label", "展开或折叠内容");
|
|
38858
|
+
const E = document.createElement("span");
|
|
38859
|
+
E.className = "hn-editor-collapsible-caret", E.setAttribute("aria-hidden", "true"), E.textContent = "▶", A.append(E);
|
|
38860
38860
|
const L = document.createElement("input");
|
|
38861
|
-
L.type = "text", L.className = "hn-editor-collapsible-title", L.setAttribute("aria-label", "折叠块标题"), L.placeholder = "折叠块标题", D.append(
|
|
38861
|
+
L.type = "text", L.className = "hn-editor-collapsible-title", L.setAttribute("aria-label", "折叠块标题"), L.placeholder = "折叠块标题", D.append(A, L);
|
|
38862
38862
|
const $ = document.createElement("span");
|
|
38863
38863
|
$.className = "hn-editor-field-error", $.setAttribute("role", "alert");
|
|
38864
38864
|
const H = document.createElement("div");
|
|
@@ -38866,11 +38866,11 @@ function g6(t, e) {
|
|
|
38866
38866
|
let B = x;
|
|
38867
38867
|
const R = (j) => {
|
|
38868
38868
|
const q = j.attrs.collapsed === !0;
|
|
38869
|
-
O.classList.toggle("is-collapsed", q),
|
|
38869
|
+
O.classList.toggle("is-collapsed", q), A.setAttribute("aria-expanded", String(!q));
|
|
38870
38870
|
const P = ur(j.attrs.title, "");
|
|
38871
38871
|
L.value !== P && (L.value = P);
|
|
38872
38872
|
};
|
|
38873
|
-
return R(B),
|
|
38873
|
+
return R(B), A.addEventListener("click", () => {
|
|
38874
38874
|
co(I, M, { collapsed: B.attrs.collapsed !== !0 });
|
|
38875
38875
|
}), L.addEventListener("input", () => {
|
|
38876
38876
|
$.textContent = "";
|
|
@@ -38897,22 +38897,22 @@ function g6(t, e) {
|
|
|
38897
38897
|
};
|
|
38898
38898
|
};
|
|
38899
38899
|
}
|
|
38900
|
-
}), a = (x, S, M) => ({ node: I, HTMLAttributes: O, getPos: D, editor:
|
|
38901
|
-
const
|
|
38902
|
-
x || (
|
|
38903
|
-
const L = x ? document.createElement("button") :
|
|
38900
|
+
}), a = (x, S, M) => ({ node: I, HTMLAttributes: O, getPos: D, editor: A }) => {
|
|
38901
|
+
const E = document.createElement(x ? "div" : "button");
|
|
38902
|
+
x || (E.type = "button"), qr(E, O), E.setAttribute("data-hnn-node", I.type.name), E.classList.add(x ? "hn-editor-formula" : "hn-editor-inline-formula"), E.setAttribute("contenteditable", "false");
|
|
38903
|
+
const L = x ? document.createElement("button") : E;
|
|
38904
38904
|
x && (L.type = "button", L.classList.add("hn-editor-formula-preview")), L.setAttribute("aria-label", S);
|
|
38905
38905
|
const $ = document.createElement("span");
|
|
38906
38906
|
$.className = M, L.append($);
|
|
38907
38907
|
const H = document.createElement("span");
|
|
38908
|
-
H.className = "hn-editor-field-error", H.setAttribute("role", "alert"), x ?
|
|
38908
|
+
H.className = "hn-editor-field-error", H.setAttribute("role", "alert"), x ? E.append(L, H) : E.append(H);
|
|
38909
38909
|
let B = ur(I.attrs.latex, "0");
|
|
38910
38910
|
const R = (q) => Lz($, q, x);
|
|
38911
38911
|
R(B);
|
|
38912
38912
|
let j = null;
|
|
38913
38913
|
return L.addEventListener("click", () => {
|
|
38914
38914
|
j === null && (H.textContent = "", j = Rz({
|
|
38915
|
-
editor:
|
|
38915
|
+
editor: A,
|
|
38916
38916
|
anchor: L,
|
|
38917
38917
|
label: "LaTeX 源码",
|
|
38918
38918
|
value: B,
|
|
@@ -38926,7 +38926,7 @@ function g6(t, e) {
|
|
|
38926
38926
|
H.textContent = "公式源码不得为空", R(B);
|
|
38927
38927
|
return;
|
|
38928
38928
|
}
|
|
38929
|
-
H.textContent = "", co(
|
|
38929
|
+
H.textContent = "", co(A, D, { latex: P });
|
|
38930
38930
|
},
|
|
38931
38931
|
onInvalid: (q) => {
|
|
38932
38932
|
H.textContent = q, R(B);
|
|
@@ -38936,12 +38936,12 @@ function g6(t, e) {
|
|
|
38936
38936
|
}
|
|
38937
38937
|
}));
|
|
38938
38938
|
}), {
|
|
38939
|
-
dom:
|
|
38939
|
+
dom: E,
|
|
38940
38940
|
update(q) {
|
|
38941
38941
|
return q.type !== I.type ? !1 : (B = ur(q.attrs.latex, "0"), R(B), !0);
|
|
38942
38942
|
},
|
|
38943
38943
|
// 预览按钮的点击只打开编辑器,不交给 PM;其余区域(块级容器)保持默认。
|
|
38944
|
-
stopEvent: (q) => x && q.target ===
|
|
38944
|
+
stopEvent: (q) => x && q.target === E ? !1 : ri(L, q),
|
|
38945
38945
|
ignoreMutation: () => !0,
|
|
38946
38946
|
destroy() {
|
|
38947
38947
|
j?.();
|
|
@@ -39028,20 +39028,20 @@ function g6(t, e) {
|
|
|
39028
39028
|
qr(O, S), O.setAttribute("data-hnn-node", "picture"), O.classList.add("hn-editor-picture"), O.setAttribute("contenteditable", "false");
|
|
39029
39029
|
const D = document.createElement("div");
|
|
39030
39030
|
D.className = "hn-editor-picture-frame";
|
|
39031
|
-
const
|
|
39032
|
-
|
|
39033
|
-
const
|
|
39034
|
-
|
|
39031
|
+
const A = document.createElement("img");
|
|
39032
|
+
A.className = "hn-editor-picture-img";
|
|
39033
|
+
const E = document.createElement("div");
|
|
39034
|
+
E.className = "hn-editor-picture-placeholder", E.setAttribute("role", "status");
|
|
39035
39035
|
const L = document.createElement("span"), $ = document.createElement("button");
|
|
39036
|
-
$.type = "button", $.className = "hn-editor-picture-retry", $.textContent = "重试加载图片", $.hidden = !0,
|
|
39036
|
+
$.type = "button", $.className = "hn-editor-picture-retry", $.textContent = "重试加载图片", $.hidden = !0, E.append(L, $), D.append(A, E);
|
|
39037
39037
|
const H = document.createElement("input");
|
|
39038
39038
|
H.type = "text", H.className = "hn-editor-picture-alt", H.setAttribute("aria-label", "图片描述"), H.placeholder = "描述这张图片";
|
|
39039
39039
|
const B = document.createElement("span");
|
|
39040
39040
|
B.className = "hn-editor-field-error", B.setAttribute("role", "alert"), O.append(D, H, B);
|
|
39041
39041
|
const R = kz({
|
|
39042
39042
|
editor: I,
|
|
39043
|
-
image:
|
|
39044
|
-
placeholder:
|
|
39043
|
+
image: A,
|
|
39044
|
+
placeholder: E,
|
|
39045
39045
|
message: L,
|
|
39046
39046
|
retryButton: $,
|
|
39047
39047
|
documentId: e?.documentId ?? "",
|
|
@@ -39072,7 +39072,7 @@ function g6(t, e) {
|
|
|
39072
39072
|
update(P) {
|
|
39073
39073
|
return P.type !== x.type ? !1 : (j = P, q(P), !0);
|
|
39074
39074
|
},
|
|
39075
|
-
stopEvent: (P) => ri(H, P) || ri(
|
|
39075
|
+
stopEvent: (P) => ri(H, P) || ri(E, P),
|
|
39076
39076
|
ignoreMutation: () => !0,
|
|
39077
39077
|
destroy: () => R.destroy()
|
|
39078
39078
|
};
|
|
@@ -39116,9 +39116,9 @@ function g6(t, e) {
|
|
|
39116
39116
|
},
|
|
39117
39117
|
addNodeView() {
|
|
39118
39118
|
const S = d[x], M = h[x];
|
|
39119
|
-
return ({ node: I, HTMLAttributes: O, getPos: D, editor:
|
|
39120
|
-
const
|
|
39121
|
-
qr(
|
|
39119
|
+
return ({ node: I, HTMLAttributes: O, getPos: D, editor: A }) => {
|
|
39120
|
+
const E = document.createElement("div");
|
|
39121
|
+
qr(E, O), E.setAttribute("data-hnn-node", x), E.classList.add("hn-editor-data-block", `hn-editor-data-block--${x}`), E.setAttribute("contenteditable", "false");
|
|
39122
39122
|
const L = document.createElement("button");
|
|
39123
39123
|
L.type = "button", L.className = "hn-editor-data-preview", L.setAttribute("aria-label", S.editLabel), L.setAttribute("aria-haspopup", "dialog");
|
|
39124
39124
|
const $ = document.createElement("span");
|
|
@@ -39126,10 +39126,10 @@ function g6(t, e) {
|
|
|
39126
39126
|
const H = document.createElement("span");
|
|
39127
39127
|
H.className = "hn-editor-data-meta";
|
|
39128
39128
|
const B = document.createElement("span");
|
|
39129
|
-
B.className = "hn-editor-data-hint", B.textContent = "点击编辑", L.append($, H, B),
|
|
39129
|
+
B.className = "hn-editor-data-hint", B.textContent = "点击编辑", L.append($, H, B), E.append(L);
|
|
39130
39130
|
let R = ur(I.attrs.data, f[x]);
|
|
39131
39131
|
return H.textContent = M(R), L.addEventListener("click", () => {
|
|
39132
|
-
const j = $u.get(
|
|
39132
|
+
const j = $u.get(A);
|
|
39133
39133
|
j && (L.setAttribute("aria-expanded", "true"), j.open({
|
|
39134
39134
|
kind: x,
|
|
39135
39135
|
data: R,
|
|
@@ -39138,18 +39138,18 @@ function g6(t, e) {
|
|
|
39138
39138
|
if (typeof D != "function") return { ok: !1, message: "块位置不可用,未保存更改" };
|
|
39139
39139
|
const P = D();
|
|
39140
39140
|
if (typeof P != "number") return { ok: !1, message: "块位置不可用,未保存更改" };
|
|
39141
|
-
const Z =
|
|
39141
|
+
const Z = A.state.doc.nodeAt(P);
|
|
39142
39142
|
if (!Z) return { ok: !1, message: "块已不存在,未保存更改" };
|
|
39143
39143
|
if (ur(Z.attrs.data, f[x]) === q) return { ok: !0 };
|
|
39144
|
-
const z =
|
|
39144
|
+
const z = A.state.tr.setNodeMarkup(P, void 0, { ...Z.attrs, data: q });
|
|
39145
39145
|
Pn(z);
|
|
39146
39146
|
const oe = j.validateCandidate(z.doc);
|
|
39147
|
-
return oe !== null ? { ok: !1, message: oe } : (
|
|
39147
|
+
return oe !== null ? { ok: !1, message: oe } : (A.view.dispatch(z), A.state.doc.eq(z.doc) ? { ok: !0 } : { ok: !1, message: "提交被拒绝,未保存更改,请重试" });
|
|
39148
39148
|
},
|
|
39149
39149
|
onClosed: () => L.setAttribute("aria-expanded", "false")
|
|
39150
39150
|
}));
|
|
39151
39151
|
}), {
|
|
39152
|
-
dom:
|
|
39152
|
+
dom: E,
|
|
39153
39153
|
update(j) {
|
|
39154
39154
|
return j.type !== I.type ? !1 : (R = ur(j.attrs.data, f[x]), H.textContent = M(R), !0);
|
|
39155
39155
|
},
|
|
@@ -39188,28 +39188,28 @@ function g6(t, e) {
|
|
|
39188
39188
|
O.className = "hn-editor-directory-title", O.textContent = "目录";
|
|
39189
39189
|
const D = document.createElement("span");
|
|
39190
39190
|
D.className = "hn-editor-directory-config";
|
|
39191
|
-
const
|
|
39192
|
-
|
|
39193
|
-
let
|
|
39191
|
+
const A = document.createElement("ul");
|
|
39192
|
+
A.className = "hn-editor-directory-list", A.setAttribute("aria-label", "标题条目"), I.append(O, D, A);
|
|
39193
|
+
let E = null, L = null;
|
|
39194
39194
|
const $ = () => {
|
|
39195
|
-
L !== null && (clearTimeout(L), L = null),
|
|
39195
|
+
L !== null && (clearTimeout(L), L = null), E && (E.classList.remove("hn-editor-directory-target"), E = null);
|
|
39196
39196
|
}, H = (q) => {
|
|
39197
39197
|
const P = x4(M.state.doc).find((Ce) => Ce.nodeId === q);
|
|
39198
39198
|
if (!P) return;
|
|
39199
39199
|
const Z = M.view.nodeDOM(P.position);
|
|
39200
|
-
Z instanceof HTMLElement && ($(), Z.scrollIntoView?.({ block: "start" }), Z.classList.add("hn-editor-directory-target"),
|
|
39200
|
+
Z instanceof HTMLElement && ($(), Z.scrollIntoView?.({ block: "start" }), Z.classList.add("hn-editor-directory-target"), E = Z, L = setTimeout($, 1500));
|
|
39201
39201
|
}, B = () => {
|
|
39202
39202
|
const q = x4(M.state.doc);
|
|
39203
|
-
if (
|
|
39203
|
+
if (A.replaceChildren(), q.length === 0) {
|
|
39204
39204
|
const P = document.createElement("li");
|
|
39205
|
-
P.className = "hn-editor-directory-empty", P.textContent = "暂无标题",
|
|
39205
|
+
P.className = "hn-editor-directory-empty", P.textContent = "暂无标题", A.append(P);
|
|
39206
39206
|
return;
|
|
39207
39207
|
}
|
|
39208
39208
|
for (const P of q) {
|
|
39209
39209
|
const Z = document.createElement("li");
|
|
39210
39210
|
Z.className = "hn-editor-directory-item", Z.setAttribute("data-level", String(P.level));
|
|
39211
39211
|
const Ce = document.createElement("button");
|
|
39212
|
-
Ce.type = "button", Ce.className = "hn-editor-directory-entry", Ce.textContent = P.text, Ce.addEventListener("click", () => H(P.nodeId)), Z.append(Ce),
|
|
39212
|
+
Ce.type = "button", Ce.className = "hn-editor-directory-entry", Ce.textContent = P.text, Ce.addEventListener("click", () => H(P.nodeId)), Z.append(Ce), A.append(Z);
|
|
39213
39213
|
}
|
|
39214
39214
|
}, R = (q) => {
|
|
39215
39215
|
D.textContent = `配置:${String(q.attrs.config ?? "headings")}`;
|
|
@@ -39224,7 +39224,7 @@ function g6(t, e) {
|
|
|
39224
39224
|
return q.type !== x.type ? !1 : (R(q), !0);
|
|
39225
39225
|
},
|
|
39226
39226
|
// 条目按钮事件自管;点击块体其余部分交给 PM 产生 NodeSelection。
|
|
39227
|
-
stopEvent: (q) => ri(
|
|
39227
|
+
stopEvent: (q) => ri(A, q),
|
|
39228
39228
|
ignoreMutation: () => !0,
|
|
39229
39229
|
destroy() {
|
|
39230
39230
|
M.off("update", j), $();
|
|
@@ -39262,15 +39262,15 @@ function g6(t, e) {
|
|
|
39262
39262
|
return ({ node: I, HTMLAttributes: O }) => {
|
|
39263
39263
|
const D = document.createElement("span");
|
|
39264
39264
|
qr(D, O), D.setAttribute("data-hnn-node", x), D.classList.add(S), D.setAttribute("contenteditable", "false");
|
|
39265
|
-
const
|
|
39266
|
-
D.textContent = M(
|
|
39265
|
+
const A = (E) => {
|
|
39266
|
+
D.textContent = M(E.attrs);
|
|
39267
39267
|
const L = x === "mention" ? "data-note-link-id" : "data-resource-id";
|
|
39268
|
-
D.setAttribute(L, String(
|
|
39268
|
+
D.setAttribute(L, String(E.attrs.resourceId ?? ""));
|
|
39269
39269
|
};
|
|
39270
|
-
return
|
|
39270
|
+
return A(I), {
|
|
39271
39271
|
dom: D,
|
|
39272
|
-
update(
|
|
39273
|
-
return
|
|
39272
|
+
update(E) {
|
|
39273
|
+
return E.type !== I.type ? !1 : (A(E), !0);
|
|
39274
39274
|
},
|
|
39275
39275
|
ignoreMutation: () => !0
|
|
39276
39276
|
};
|
|
@@ -39368,32 +39368,32 @@ function g6(t, e) {
|
|
|
39368
39368
|
return ({ node: x, HTMLAttributes: S, getPos: M, editor: I }) => {
|
|
39369
39369
|
const O = document.createElement("div");
|
|
39370
39370
|
qr(O, S), O.classList.add("hn-editor-table-wrapper");
|
|
39371
|
-
const D = document.createElement("table"),
|
|
39372
|
-
D.append(
|
|
39373
|
-
const
|
|
39371
|
+
const D = document.createElement("table"), A = document.createElement("tbody");
|
|
39372
|
+
D.append(A), O.append(D);
|
|
39373
|
+
const E = gz({
|
|
39374
39374
|
editor: I,
|
|
39375
39375
|
wrapper: O,
|
|
39376
39376
|
table: D,
|
|
39377
|
-
tbody:
|
|
39377
|
+
tbody: A,
|
|
39378
39378
|
getPos: () => typeof M == "function" ? M() : void 0,
|
|
39379
39379
|
tableNodeType: x.type
|
|
39380
39380
|
});
|
|
39381
39381
|
return {
|
|
39382
39382
|
dom: O,
|
|
39383
|
-
contentDOM:
|
|
39383
|
+
contentDOM: A,
|
|
39384
39384
|
update(L) {
|
|
39385
|
-
return L.type !== x.type ? !1 : (
|
|
39385
|
+
return L.type !== x.type ? !1 : (E.refresh(), !0);
|
|
39386
39386
|
},
|
|
39387
39387
|
// 控件 DOM 事件不交给 ProseMirror;单元格正文事件保持默认处理。
|
|
39388
|
-
stopEvent: (L) => ri(O, L) && !ri(
|
|
39389
|
-
ignoreMutation: (L) => !
|
|
39388
|
+
stopEvent: (L) => ri(O, L) && !ri(A, L),
|
|
39389
|
+
ignoreMutation: (L) => !A.contains(L.target),
|
|
39390
39390
|
destroy() {
|
|
39391
|
-
|
|
39391
|
+
E.destroy();
|
|
39392
39392
|
}
|
|
39393
39393
|
};
|
|
39394
39394
|
};
|
|
39395
39395
|
}
|
|
39396
|
-
}).configure({ resizable: !1 }),
|
|
39396
|
+
}).configure({ resizable: !1 }), T = xt.create({
|
|
39397
39397
|
name: "hnnNodeIds",
|
|
39398
39398
|
priority: 1e4,
|
|
39399
39399
|
addGlobalAttributes() {
|
|
@@ -39451,7 +39451,7 @@ function g6(t, e) {
|
|
|
39451
39451
|
g("mention", "hn-editor-mention", (x) => `@${ur(x.name, "")}`),
|
|
39452
39452
|
g("resource", "hn-editor-resource", (x) => ur(x.name, "")),
|
|
39453
39453
|
y,
|
|
39454
|
-
|
|
39454
|
+
T
|
|
39455
39455
|
];
|
|
39456
39456
|
}
|
|
39457
39457
|
function Hz() {
|
|
@@ -39574,15 +39574,15 @@ function Uz(t) {
|
|
|
39574
39574
|
for (let w = 0; w < g; w += 1) {
|
|
39575
39575
|
o(p);
|
|
39576
39576
|
const k = `${p}/${w}`;
|
|
39577
|
-
let
|
|
39577
|
+
let T;
|
|
39578
39578
|
try {
|
|
39579
|
-
|
|
39579
|
+
T = Object.getOwnPropertyDescriptor(h, String(w));
|
|
39580
39580
|
} catch {
|
|
39581
39581
|
throw Re(k, "unsafe-pm-attrs", "无法安全读取 ProseMirror attr 数组项");
|
|
39582
39582
|
}
|
|
39583
|
-
if (!
|
|
39583
|
+
if (!T || "get" in T || "set" in T) throw Re(k, "unsafe-pm-attrs", "ProseMirror attr 数组项必须是数据属性");
|
|
39584
39584
|
w > 0 && (y += 1);
|
|
39585
|
-
const x =
|
|
39585
|
+
const x = T.value;
|
|
39586
39586
|
if (x === null || typeof x == "boolean" || typeof x == "number" && Number.isFinite(x) || typeof x == "string") {
|
|
39587
39587
|
const S = typeof x == "string" ? l(x, k, K.maxAttrBytes) : rc(x);
|
|
39588
39588
|
if (S === void 0) throw Re(k, "unsafe-pm-attrs", "无法计算 ProseMirror attr 数组项大小");
|
|
@@ -39606,8 +39606,8 @@ function Uz(t) {
|
|
|
39606
39606
|
if (o(m), !Object.hasOwn(h, w) || !(w in p)) throw Re(`${m}/${w}`, "unsafe-pm-attrs", "ProseMirror attrs 包含未知或继承字段");
|
|
39607
39607
|
const k = Object.getOwnPropertyDescriptor(h, w);
|
|
39608
39608
|
if (!k || "get" in k || "set" in k || !k.enumerable) throw Re(`${m}/${w}`, "unsafe-pm-attrs", "ProseMirror attr 必须是可枚举数据属性");
|
|
39609
|
-
const
|
|
39610
|
-
g += (y > 0 ? 1 : 0) + ln(w) + 1 +
|
|
39609
|
+
const T = c(k.value, `${m}/${w}`);
|
|
39610
|
+
g += (y > 0 ? 1 : 0) + ln(w) + 1 + T, y += 1;
|
|
39611
39611
|
}
|
|
39612
39612
|
} catch (w) {
|
|
39613
39613
|
throw w instanceof _o ? w : Re(m, "unsafe-pm-attrs", "无法安全读取 ProseMirror attrs");
|
|
@@ -39636,13 +39636,13 @@ function Uz(t) {
|
|
|
39636
39636
|
if (!Number.isSafeInteger(k) || k < 0) throw Re(`${p}/content`, "unsafe-pm-node", "ProseMirror childCount 必须是非负安全整数");
|
|
39637
39637
|
if (k > K.maxNodes - n) throw Re(`${p}/content`, "node-limit", `节点总数超过 ${K.maxNodes}`);
|
|
39638
39638
|
k > 0 && (y += 1 + ln("content") + 1 + 2 + k - 1);
|
|
39639
|
-
const
|
|
39640
|
-
if (!Array.isArray(
|
|
39641
|
-
if (
|
|
39642
|
-
if (
|
|
39643
|
-
let x = 2 +
|
|
39644
|
-
for (let S = 0; S <
|
|
39645
|
-
if (o(`${p}/marks/${S}`), x += d(
|
|
39639
|
+
const T = h.marks;
|
|
39640
|
+
if (!Array.isArray(T) || !Number.isSafeInteger(T.length) || T.length < 0) throw Re(`${p}/marks`, "unsafe-pm-node", "ProseMirror marks 必须是数组");
|
|
39641
|
+
if (T.length > 0) {
|
|
39642
|
+
if (T.length > Math.floor((K.maxShellBytes - i) / 12)) throw Re(`${p}/marks`, "shell-too-large", `HNN 外壳超过 ${K.maxShellBytes} UTF-8 字节`);
|
|
39643
|
+
let x = 2 + T.length - 1;
|
|
39644
|
+
for (let S = 0; S < T.length; S += 1)
|
|
39645
|
+
if (o(`${p}/marks/${S}`), x += d(T[S], `${p}/marks/${S}`), x > K.maxShellBytes - i) throw Re(`${p}/marks`, "shell-too-large", `HNN 外壳超过 ${K.maxShellBytes} UTF-8 字节`);
|
|
39646
39646
|
y += 1 + ln("marks") + 1 + x;
|
|
39647
39647
|
}
|
|
39648
39648
|
return s(p, y), { node: h, path: p, depth: m, nextChildIndex: 0, childCount: k };
|
|
@@ -39705,8 +39705,8 @@ function Gz(t) {
|
|
|
39705
39705
|
const m = Object.getOwnPropertyDescriptor(h, "constructor"), g = m && "value" in m ? m.value : void 0, y = f ? "Array" : "Object", w = typeof g == "function" ? Object.getOwnPropertyDescriptor(g, "name") : void 0;
|
|
39706
39706
|
if ((w && "value" in w ? w.value : void 0) !== y)
|
|
39707
39707
|
throw Re(c, "unsafe-input", `${f ? "数组" : "对象"}必须使用 ${y} 或 null 原型`);
|
|
39708
|
-
const
|
|
39709
|
-
if (f ? !x :
|
|
39708
|
+
const T = Object.getPrototypeOf(h), x = typeof T == "object" && T !== null && Object.getPrototypeOf(T) === null;
|
|
39709
|
+
if (f ? !x : T !== null)
|
|
39710
39710
|
throw Re(c, "unsafe-input", `${f ? "数组" : "对象"}不得使用自定义原型`);
|
|
39711
39711
|
}
|
|
39712
39712
|
const p = f ? [] : /* @__PURE__ */ Object.create(null);
|
|
@@ -40154,7 +40154,7 @@ function x6(t, e = {}) {
|
|
|
40154
40154
|
W.push({ top: be?.top ?? 0, bottom: be?.bottom ?? 0, dom: Y });
|
|
40155
40155
|
}), W;
|
|
40156
40156
|
}, k = new It("hnnBlockReorderDrag");
|
|
40157
|
-
let
|
|
40157
|
+
let T = null;
|
|
40158
40158
|
const x = (W) => {
|
|
40159
40159
|
const J = n.state.doc, ee = ss(J), U = [], Y = ee[W.fromIndex];
|
|
40160
40160
|
if (Y && U.push(
|
|
@@ -40169,9 +40169,9 @@ function x6(t, e = {}) {
|
|
|
40169
40169
|
}
|
|
40170
40170
|
return nt.create(J, U);
|
|
40171
40171
|
}, S = (W) => {
|
|
40172
|
-
if (W === null &&
|
|
40172
|
+
if (W === null && T === null || a || t.isDestroyed || W !== null && T !== null && W.fromIndex === T.fromIndex && W.boundary === T.boundary)
|
|
40173
40173
|
return;
|
|
40174
|
-
|
|
40174
|
+
T = W;
|
|
40175
40175
|
const J = W ? x(W) : nt.empty;
|
|
40176
40176
|
n.dispatch(n.state.tr.setMeta(k, J));
|
|
40177
40177
|
}, M = (W, J) => {
|
|
@@ -40195,26 +40195,26 @@ function x6(t, e = {}) {
|
|
|
40195
40195
|
typeof ee.clientY == "number" && M(J, ee.clientY), Z(!0);
|
|
40196
40196
|
}, D = (W) => {
|
|
40197
40197
|
W.target instanceof window.Node && n.dom.contains(W.target) && W.preventDefault();
|
|
40198
|
-
},
|
|
40198
|
+
}, A = () => {
|
|
40199
40199
|
const W = window.getSelection();
|
|
40200
40200
|
W && !W.isCollapsed && (W.anchorNode && n.dom.contains(W.anchorNode) || W.focusNode && n.dom.contains(W.focusNode)) && W.removeAllRanges();
|
|
40201
|
-
},
|
|
40201
|
+
}, E = () => {
|
|
40202
40202
|
const W = document.activeElement;
|
|
40203
40203
|
W instanceof HTMLElement && n.dom.contains(W) && W.blur();
|
|
40204
40204
|
}, L = (W) => {
|
|
40205
|
-
W.target instanceof window.Node && n.dom.contains(W.target) &&
|
|
40205
|
+
W.target instanceof window.Node && n.dom.contains(W.target) && E();
|
|
40206
40206
|
};
|
|
40207
40207
|
let $ = null;
|
|
40208
40208
|
const H = () => {
|
|
40209
40209
|
if ($) return;
|
|
40210
40210
|
const W = ["user-select", "-webkit-user-select", "-webkit-touch-callout"], J = W.map((ee) => [ee, n.dom.style.getPropertyValue(ee), n.dom.style.getPropertyPriority(ee)]);
|
|
40211
40211
|
for (const ee of W) n.dom.style.setProperty(ee, "none", "important");
|
|
40212
|
-
document.addEventListener("selectstart", D, !0), document.addEventListener("selectionchange",
|
|
40213
|
-
document.removeEventListener("selectstart", D, !0), document.removeEventListener("selectionchange",
|
|
40212
|
+
document.addEventListener("selectstart", D, !0), document.addEventListener("selectionchange", A), document.addEventListener("focusin", L, !0), $ = () => {
|
|
40213
|
+
document.removeEventListener("selectstart", D, !0), document.removeEventListener("selectionchange", A), document.removeEventListener("focusin", L, !0);
|
|
40214
40214
|
for (const [ee, U, Y] of J)
|
|
40215
40215
|
U ? n.dom.style.setProperty(ee, U, Y) : n.dom.style.removeProperty(ee);
|
|
40216
40216
|
$ = null;
|
|
40217
|
-
},
|
|
40217
|
+
}, A(), E();
|
|
40218
40218
|
}, B = (W) => {
|
|
40219
40219
|
o?.kind === "pointer" && W.preventDefault();
|
|
40220
40220
|
}, R = () => {
|
|
@@ -40502,17 +40502,17 @@ function lB(t, e, n) {
|
|
|
40502
40502
|
const g = () => {
|
|
40503
40503
|
t.isDestroyed || (n.isConnected ? n.focus() : t.view.focus());
|
|
40504
40504
|
}, y = (I = !0) => {
|
|
40505
|
-
h || (h = !0, M.disconnect(), t.off("transaction", k), t.off("destroy",
|
|
40505
|
+
h || (h = !0, M.disconnect(), t.off("transaction", k), t.off("destroy", T), t.view.dom.removeEventListener("compositionstart", x), t.view.dom.removeEventListener("compositionend", S), o.remove(), I && g());
|
|
40506
40506
|
}, w = () => {
|
|
40507
40507
|
p = !0, c.textContent = "内容已变化,请重新打开删除确认", d.disabled = !0;
|
|
40508
40508
|
}, k = () => {
|
|
40509
40509
|
!t.view.editable || !No(t) ? y(!1) : t.state.doc !== r && w();
|
|
40510
|
-
},
|
|
40510
|
+
}, T = () => y(!1), x = () => {
|
|
40511
40511
|
m = !0;
|
|
40512
40512
|
}, S = () => {
|
|
40513
40513
|
m = !1;
|
|
40514
40514
|
}, M = new MutationObserver(k);
|
|
40515
|
-
M.observe(t.view.dom, { attributes: !0, attributeFilter: ["contenteditable"] }), t.on("transaction", k), t.on("destroy",
|
|
40515
|
+
M.observe(t.view.dom, { attributes: !0, attributeFilter: ["contenteditable"] }), t.on("transaction", k), t.on("destroy", T), t.view.dom.addEventListener("compositionstart", x), t.view.dom.addEventListener("compositionend", S), u.onclick = () => y(), o.addEventListener("click", (I) => {
|
|
40516
40516
|
I.target === o && y();
|
|
40517
40517
|
}), s.addEventListener("keydown", (I) => {
|
|
40518
40518
|
if (I.key === "Escape" && (I.preventDefault(), I.stopPropagation(), y()), I.key === "Tab") {
|
|
@@ -40527,8 +40527,8 @@ function lB(t, e, n) {
|
|
|
40527
40527
|
return;
|
|
40528
40528
|
}
|
|
40529
40529
|
let I;
|
|
40530
|
-
if (t.state.doc.forEach((
|
|
40531
|
-
|
|
40530
|
+
if (t.state.doc.forEach((A, E) => {
|
|
40531
|
+
A.attrs.nodeId === e && (I = E);
|
|
40532
40532
|
}), I === void 0) {
|
|
40533
40533
|
w();
|
|
40534
40534
|
return;
|
|
@@ -40557,8 +40557,8 @@ function k6(t, e, n, r) {
|
|
|
40557
40557
|
const m = t.state.doc, g = m.nodeAt(p);
|
|
40558
40558
|
if (!g) return null;
|
|
40559
40559
|
let y = -1, w = 0;
|
|
40560
|
-
return m.forEach((k,
|
|
40561
|
-
|
|
40560
|
+
return m.forEach((k, T) => {
|
|
40561
|
+
T === p && (y = w), w += 1;
|
|
40562
40562
|
}), y < 0 ? null : { pos: p, index: y, count: m.childCount, node: g };
|
|
40563
40563
|
};
|
|
40564
40564
|
const o = i();
|
|
@@ -40589,7 +40589,7 @@ function k6(t, e, n, r) {
|
|
|
40589
40589
|
}
|
|
40590
40590
|
}
|
|
40591
40591
|
], c = uw(t, () => i()?.pos), u = tw.map((p) => {
|
|
40592
|
-
if (p.type === "paragraph" && Ds(o.node)) return c.find((
|
|
40592
|
+
if (p.type === "paragraph" && Ds(o.node)) return c.find((T) => T.label === "转换为正文");
|
|
40593
40593
|
const m = cp.has(o.node.type.name), g = t.schema.nodes[p.type], y = g !== void 0 && y2(o.node, g), w = g !== void 0 && (m || !o.node.isLeaf) && up(o.node, g), k = o.node.type.name === p.type && (p.type !== "heading" || o.node.attrs.level === p.attrs?.level);
|
|
40594
40594
|
return {
|
|
40595
40595
|
label: `转换为${p.label}`,
|
|
@@ -40597,29 +40597,29 @@ function k6(t, e, n, r) {
|
|
|
40597
40597
|
...y ? { description: p.type === "heading" ? "仅保留正文第一行纯文本;丢弃其余行、嵌套结构、标记和块属性" : "正文按换行合并为纯文本;丢弃嵌套结构、标记和块属性" } : {},
|
|
40598
40598
|
disabledReason: m ? w ? "当前已是该类型" : "该块包含标记或内联元素,转换会丢失内容" : "该块包含复合结构,转换会丢失内容",
|
|
40599
40599
|
onActivate: () => {
|
|
40600
|
-
const
|
|
40601
|
-
if (!
|
|
40600
|
+
const T = i();
|
|
40601
|
+
if (!T || !t.view.editable) return;
|
|
40602
40602
|
const x = t.schema.nodes[p.type];
|
|
40603
40603
|
if (!x) return;
|
|
40604
|
-
const S = y2(
|
|
40605
|
-
if (S !== y || !S && !up(
|
|
40606
|
-
const { pos: M, node: I } =
|
|
40604
|
+
const S = y2(T.node, x);
|
|
40605
|
+
if (S !== y || !S && !up(T.node, x)) return;
|
|
40606
|
+
const { pos: M, node: I } = T, O = va(
|
|
40607
40607
|
t,
|
|
40608
|
-
(D) => D.command(({ tr:
|
|
40608
|
+
(D) => D.command(({ tr: A }) => {
|
|
40609
40609
|
if (S) {
|
|
40610
|
-
const
|
|
40611
|
-
`, 1)[0] :
|
|
40610
|
+
const E = cB(I), L = x.name === "heading" ? E.split(`
|
|
40611
|
+
`, 1)[0] : E, $ = x.create(
|
|
40612
40612
|
{ nodeId: I.attrs.nodeId, ...p.attrs },
|
|
40613
40613
|
L ? t.schema.text(L) : null
|
|
40614
40614
|
);
|
|
40615
|
-
return
|
|
40615
|
+
return A.replaceWith(M, M + I.nodeSize, $), !0;
|
|
40616
40616
|
}
|
|
40617
40617
|
if (x.name === "blockquote") {
|
|
40618
|
-
const
|
|
40619
|
-
return
|
|
40618
|
+
const E = A.doc.resolve(M).blockRange(A.doc.resolve(M + I.nodeSize));
|
|
40619
|
+
return E ? (A.wrap(E, [{ type: x }]), !0) : !1;
|
|
40620
40620
|
}
|
|
40621
|
-
return
|
|
40622
|
-
...
|
|
40621
|
+
return A.setBlockType(M, M + I.nodeSize, x, (E) => ({
|
|
40622
|
+
...E.attrs,
|
|
40623
40623
|
...p.attrs
|
|
40624
40624
|
})), !0;
|
|
40625
40625
|
})
|
|
@@ -40790,14 +40790,14 @@ function fB(t, e, n) {
|
|
|
40790
40790
|
i || (i = !0, t.off("transaction", g), t.off("destroy", w), document.removeEventListener("pointerdown", k, !0), window.removeEventListener("resize", S), window.visualViewport?.removeEventListener("resize", S), window.visualViewport?.removeEventListener("scroll", S), l.remove(), n(), M && !t.isDestroyed && t.view.dom.isConnected && t.view.focus());
|
|
40791
40791
|
}, w = () => y(!1), k = (M) => {
|
|
40792
40792
|
M.target instanceof globalThis.Node && !l.contains(M.target) && y(!1);
|
|
40793
|
-
},
|
|
40793
|
+
}, T = (M = !1) => {
|
|
40794
40794
|
if (a) return;
|
|
40795
40795
|
s = !0;
|
|
40796
40796
|
const I = dB(t, r, u.value, d.value, o, M);
|
|
40797
40797
|
s = !1, I.ok ? y() : (h.textContent = I.message, h.hidden = !1);
|
|
40798
40798
|
};
|
|
40799
|
-
m("保存", () =>
|
|
40800
|
-
M.preventDefault(),
|
|
40799
|
+
m("保存", () => T()), r.href !== null && m("移除链接", () => T(!0)), m("取消", () => y()), l.addEventListener("submit", (M) => {
|
|
40800
|
+
M.preventDefault(), T();
|
|
40801
40801
|
}), l.addEventListener("compositionstart", () => {
|
|
40802
40802
|
a = !0;
|
|
40803
40803
|
}), l.addEventListener("compositionend", () => {
|
|
@@ -40811,10 +40811,10 @@ function fB(t, e, n) {
|
|
|
40811
40811
|
const x = e.getBoundingClientRect();
|
|
40812
40812
|
(t.view.dom.closest(".hn-editor") ?? t.view.dom.parentElement ?? document.body).append(l);
|
|
40813
40813
|
const S = () => {
|
|
40814
|
-
const M = window.visualViewport, I = (M?.offsetLeft ?? 0) + 8, O = (M?.offsetTop ?? 0) + 8, D = Math.max(0, (M?.width ?? window.innerWidth) - 16),
|
|
40815
|
-
l.style.width = `${Math.min(360, D)}px`, l.style.maxHeight = `${
|
|
40816
|
-
const
|
|
40817
|
-
l.style.left = `${Math.max(I, Math.min(x.left, I + D -
|
|
40814
|
+
const M = window.visualViewport, I = (M?.offsetLeft ?? 0) + 8, O = (M?.offsetTop ?? 0) + 8, D = Math.max(0, (M?.width ?? window.innerWidth) - 16), A = Math.max(0, (M?.height ?? window.innerHeight) - 16);
|
|
40815
|
+
l.style.width = `${Math.min(360, D)}px`, l.style.maxHeight = `${A}px`;
|
|
40816
|
+
const E = l.getBoundingClientRect();
|
|
40817
|
+
l.style.left = `${Math.max(I, Math.min(x.left, I + D - E.width))}px`, l.style.top = `${Math.max(O, Math.min(x.bottom + 4, O + A - E.height))}px`;
|
|
40818
40818
|
};
|
|
40819
40819
|
return S(), window.addEventListener("resize", S), window.visualViewport?.addEventListener("resize", S), window.visualViewport?.addEventListener("scroll", S), t.on("transaction", g), t.on("destroy", w), document.addEventListener("pointerdown", k, !0), u.focus(), () => y(!1);
|
|
40820
40820
|
}
|
|
@@ -40822,7 +40822,7 @@ function E6(t, e) {
|
|
|
40822
40822
|
const n = t.view, r = w6(), i = new It("hnnInteractionToolbar"), o = document.createElement("div");
|
|
40823
40823
|
o.className = "hn-editor-interaction-toolbar", o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "文字与块操作"), o.hidden = !0;
|
|
40824
40824
|
let s = !1, a = !1, l = !1, c = !1, u = !1, d = !1, f = null, h = n.state.selection, p, m = n.state.doc, g = null, y = null, w = null, k = null;
|
|
40825
|
-
const
|
|
40825
|
+
const T = () => n.hasFocus() || o.contains(document.activeElement), x = () => {
|
|
40826
40826
|
o.hidden = !0;
|
|
40827
40827
|
}, S = (oe = !1) => {
|
|
40828
40828
|
a = !0, l = oe, f = null, x();
|
|
@@ -40886,12 +40886,12 @@ function E6(t, e) {
|
|
|
40886
40886
|
o.style.left = `${Math.max(Et, Math.min(xe.left, At - ue.width))}px`, o.style.top = `${le ? xe.top - ge - 4 : xe.bottom + 4}px`, o.dataset.placement = le ? "above" : "below";
|
|
40887
40887
|
}, D = () => {
|
|
40888
40888
|
!s && w === null && (w = window.requestAnimationFrame(() => {
|
|
40889
|
-
w = null,
|
|
40889
|
+
w = null, E();
|
|
40890
40890
|
}));
|
|
40891
|
-
},
|
|
40891
|
+
}, A = (oe, Me) => {
|
|
40892
40892
|
const xe = o.contains(document.activeElement), Ae = xe ? document.activeElement?.textContent : null;
|
|
40893
40893
|
o.replaceChildren();
|
|
40894
|
-
const ze = n.state, Fe = () => !s && !t.isDestroyed && n.editable && !n.composing && !d &&
|
|
40894
|
+
const ze = n.state, Fe = () => !s && !t.isDestroyed && n.editable && !n.composing && !d && T() && ze.doc === n.state.doc && ze.selection.eq(n.state.selection), qe = document.createElement("div");
|
|
40895
40895
|
qe.className = "hn-editor-toolbar-row", o.appendChild(qe);
|
|
40896
40896
|
const Ne = (ne, le, ve, ge = !0) => {
|
|
40897
40897
|
const ke = document.createElement("button");
|
|
@@ -40900,7 +40900,7 @@ function E6(t, e) {
|
|
|
40900
40900
|
S();
|
|
40901
40901
|
return;
|
|
40902
40902
|
}
|
|
40903
|
-
le.onActivate?.(), !s && !t.isDestroyed && n.editable && (ge && n.focus(),
|
|
40903
|
+
le.onActivate?.(), !s && !t.isDestroyed && n.editable && (ge && n.focus(), E(!0));
|
|
40904
40904
|
}), ne.appendChild(ke);
|
|
40905
40905
|
}, Et = Me.node.attrs.nodeId, At = k6(t, () => {
|
|
40906
40906
|
const ne = M();
|
|
@@ -40962,14 +40962,14 @@ function E6(t, e) {
|
|
|
40962
40962
|
const ue = Array.from(o.querySelectorAll("button:not(:disabled)")), fe = ue.find((ne) => ne.textContent === Ae) ?? ue[0];
|
|
40963
40963
|
fe && (fe.tabIndex = 0), xe && fe?.focus({ preventScroll: !0 });
|
|
40964
40964
|
};
|
|
40965
|
-
function
|
|
40965
|
+
function E(oe = !1) {
|
|
40966
40966
|
if (s || t.isDestroyed) return;
|
|
40967
40967
|
const Me = M(), xe = n.state.selection, Ae = Me?.node.attrs.nodeId;
|
|
40968
40968
|
(!xe.eq(h) || Ae !== p) && (a = !1, l = !1, f = null), m !== n.state.doc && o.contains(document.activeElement) && S(), h = xe, p = Ae, m = n.state.doc;
|
|
40969
40969
|
const ze = r.isMobile(), Fe = xe instanceof Se && !xe.empty && b2.some((Et) => !Up(t, Et.name).disabled), qe = Ia(t);
|
|
40970
|
-
if (!
|
|
40970
|
+
if (!T()) {
|
|
40971
40971
|
queueMicrotask(() => {
|
|
40972
|
-
!s && !
|
|
40972
|
+
!s && !T() && x();
|
|
40973
40973
|
});
|
|
40974
40974
|
return;
|
|
40975
40975
|
}
|
|
@@ -40978,7 +40978,7 @@ function E6(t, e) {
|
|
|
40978
40978
|
return;
|
|
40979
40979
|
}
|
|
40980
40980
|
const Ne = n.dom.closest(".hn-editor") ?? n.dom.parentElement;
|
|
40981
|
-
Ne && o.parentElement !== Ne && Ne.appendChild(o), (oe || g !== n.state || y !== ze || o.childElementCount === 0) && (
|
|
40981
|
+
Ne && o.parentElement !== Ne && Ne.appendChild(o), (oe || g !== n.state || y !== ze || o.childElementCount === 0) && (A(ze, Me), g = n.state, y = ze), o.hidden = !1, O();
|
|
40982
40982
|
}
|
|
40983
40983
|
const L = (oe) => {
|
|
40984
40984
|
if (!o.contains(oe.target)) {
|
|
@@ -40998,7 +40998,7 @@ function E6(t, e) {
|
|
|
40998
40998
|
d = !1, D();
|
|
40999
40999
|
}, j = () => {
|
|
41000
41000
|
queueMicrotask(() => {
|
|
41001
|
-
!s && n.hasFocus() && !l && (a = !1),
|
|
41001
|
+
!s && n.hasFocus() && !l && (a = !1), E();
|
|
41002
41002
|
});
|
|
41003
41003
|
}, q = (oe) => {
|
|
41004
41004
|
if (oe.key === "Escape" && !o.hidden) {
|
|
@@ -41025,11 +41025,11 @@ function E6(t, e) {
|
|
|
41025
41025
|
};
|
|
41026
41026
|
document.addEventListener("hn-editor-popover-open", P), document.addEventListener("hn-editor-popover-close", Z);
|
|
41027
41027
|
const Ce = r.subscribe(() => {
|
|
41028
|
-
x(), f = null, c = !1, u = !1, y = null,
|
|
41028
|
+
x(), f = null, c = !1, u = !1, y = null, E(!0);
|
|
41029
41029
|
});
|
|
41030
41030
|
document.addEventListener("pointerdown", L, !0), document.addEventListener("pointerup", $), document.addEventListener("pointercancel", $), document.addEventListener("focusin", j), document.addEventListener("focusout", j), n.dom.addEventListener("hnn-reorder-start", H), n.dom.addEventListener("compositionstart", B), n.dom.addEventListener("compositionend", R), n.dom.addEventListener("keydown", q, !0), o.addEventListener("keydown", q), window.addEventListener("scroll", D, !0), window.addEventListener("resize", D), window.visualViewport?.addEventListener("resize", D), window.visualViewport?.addEventListener("scroll", D);
|
|
41031
41031
|
const z = typeof ResizeObserver > "u" ? null : new ResizeObserver(D);
|
|
41032
|
-
return z?.observe(n.dom), t.registerPlugin(new lt({ key: i, view: () => ({ update: () =>
|
|
41032
|
+
return z?.observe(n.dom), t.registerPlugin(new lt({ key: i, view: () => ({ update: () => E() }) })), () => {
|
|
41033
41033
|
document.removeEventListener("hn-editor-popover-open", P), document.removeEventListener("hn-editor-popover-close", Z), s = !0, k?.(), w !== null && window.cancelAnimationFrame(w), Ce(), z?.disconnect(), document.removeEventListener("pointerdown", L, !0), document.removeEventListener("pointerup", $), document.removeEventListener("pointercancel", $), document.removeEventListener("focusin", j), document.removeEventListener("focusout", j), n.dom.removeEventListener("hnn-reorder-start", H), n.dom.removeEventListener("compositionstart", B), n.dom.removeEventListener("compositionend", R), n.dom.removeEventListener("keydown", q, !0), o.removeEventListener("keydown", q), window.removeEventListener("scroll", D, !0), window.removeEventListener("resize", D), window.visualViewport?.removeEventListener("resize", D), window.visualViewport?.removeEventListener("scroll", D), o.remove(), t.isDestroyed || t.unregisterPlugin(i);
|
|
41034
41034
|
};
|
|
41035
41035
|
}
|
|
@@ -41268,7 +41268,7 @@ function I6(t, e) {
|
|
|
41268
41268
|
r || !L.active || L.token !== $ || (L.status = "error", L.error = q, w());
|
|
41269
41269
|
}
|
|
41270
41270
|
);
|
|
41271
|
-
},
|
|
41271
|
+
}, T = (L) => {
|
|
41272
41272
|
if (r || t.isDestroyed || L && !T6(L)) return;
|
|
41273
41273
|
const H = [...p.values()].filter((B) => !L || B.kind === L.kind && B.resourceId === L.resourceId).map((B) => {
|
|
41274
41274
|
const R = /* @__PURE__ */ Symbol("host-invalidation");
|
|
@@ -41351,19 +41351,19 @@ function I6(t, e) {
|
|
|
41351
41351
|
I.delete(H);
|
|
41352
41352
|
}
|
|
41353
41353
|
);
|
|
41354
|
-
},
|
|
41354
|
+
}, A = () => {
|
|
41355
41355
|
if (!r) {
|
|
41356
41356
|
r = !0, a?.abort(), a = null, s = null;
|
|
41357
41357
|
for (const L of p.values())
|
|
41358
41358
|
L.active = !1, L.controller.abort();
|
|
41359
41359
|
p.clear();
|
|
41360
41360
|
for (const L of I) L.abort();
|
|
41361
|
-
I.clear(), i.clear(), h.clear(), t.off("transaction", S), t.off("destroy",
|
|
41361
|
+
I.clear(), i.clear(), h.clear(), t.off("transaction", S), t.off("destroy", E);
|
|
41362
41362
|
}
|
|
41363
|
-
},
|
|
41364
|
-
|
|
41363
|
+
}, E = () => {
|
|
41364
|
+
A();
|
|
41365
41365
|
};
|
|
41366
|
-
return t.on("transaction", S), t.on("destroy",
|
|
41366
|
+
return t.on("transaction", S), t.on("destroy", E), x(), {
|
|
41367
41367
|
hasActivate: typeof e.activate == "function",
|
|
41368
41368
|
requestCandidates: u,
|
|
41369
41369
|
cancelCandidates: d,
|
|
@@ -41373,8 +41373,8 @@ function I6(t, e) {
|
|
|
41373
41373
|
activate: D,
|
|
41374
41374
|
getReferenceState: g,
|
|
41375
41375
|
subscribeReferences: M,
|
|
41376
|
-
invalidate:
|
|
41377
|
-
destroy:
|
|
41376
|
+
invalidate: T,
|
|
41377
|
+
destroy: A
|
|
41378
41378
|
};
|
|
41379
41379
|
}
|
|
41380
41380
|
const ns = new It("pictureUpload");
|
|
@@ -41424,94 +41424,94 @@ function P6(t, e) {
|
|
|
41424
41424
|
let i = !1, o = 0;
|
|
41425
41425
|
const s = () => ({
|
|
41426
41426
|
// 文件、uploadId、attempt 只存在于内存桥;绝无内容进入文档/HNN。
|
|
41427
|
-
items: [...n.values()].map((
|
|
41428
|
-
uploadId:
|
|
41429
|
-
fileName:
|
|
41430
|
-
attempt:
|
|
41431
|
-
status:
|
|
41432
|
-
...
|
|
41427
|
+
items: [...n.values()].map((A) => ({
|
|
41428
|
+
uploadId: A.uploadId,
|
|
41429
|
+
fileName: A.file.name,
|
|
41430
|
+
attempt: A.attempt,
|
|
41431
|
+
status: A.status,
|
|
41432
|
+
...A.error === void 0 ? {} : { error: A.error }
|
|
41433
41433
|
}))
|
|
41434
41434
|
}), a = () => {
|
|
41435
41435
|
if (i) return;
|
|
41436
|
-
const
|
|
41437
|
-
e.onStateChange?.(
|
|
41438
|
-
for (const
|
|
41436
|
+
const A = s();
|
|
41437
|
+
e.onStateChange?.(A);
|
|
41438
|
+
for (const E of r) E(A);
|
|
41439
41439
|
};
|
|
41440
41440
|
let l = !1;
|
|
41441
41441
|
const c = () => {
|
|
41442
41442
|
i || l || (l = !0, queueMicrotask(() => {
|
|
41443
41443
|
l = !1, a();
|
|
41444
41444
|
}));
|
|
41445
|
-
}, u = (
|
|
41446
|
-
const
|
|
41447
|
-
if (!
|
|
41448
|
-
const L =
|
|
41445
|
+
}, u = (A) => {
|
|
41446
|
+
const E = ns.getState(t.state);
|
|
41447
|
+
if (!E) return null;
|
|
41448
|
+
const L = E.decorations.find(void 0, void 0, ($) => $.uploadId === A)[0];
|
|
41449
41449
|
return L ? L.from : null;
|
|
41450
|
-
}, d = (
|
|
41451
|
-
|
|
41452
|
-
}, p = (
|
|
41453
|
-
i || t.isDestroyed || !
|
|
41454
|
-
}, m = (
|
|
41455
|
-
if (i || t.isDestroyed || !
|
|
41450
|
+
}, d = (A) => i || t.isDestroyed ? !1 : e.dispatch ? e.dispatch(A) : (t.view.dispatch(A), !0), f = (A) => d(t.state.tr.setMeta(ns, A)), h = (A) => {
|
|
41451
|
+
A.active = !1, n.delete(A.uploadId);
|
|
41452
|
+
}, p = (A, E, L) => {
|
|
41453
|
+
i || t.isDestroyed || !A.active || A.token !== E || (A.status = "failed", A.error = L, vu(A.dom, A), a());
|
|
41454
|
+
}, m = (A, E, L, $) => {
|
|
41455
|
+
if (i || t.isDestroyed || !A.active || A.token !== E) return;
|
|
41456
41456
|
if (e.canCommit && !e.canCommit()) {
|
|
41457
|
-
|
|
41457
|
+
A.completion = { token: E, src: L, alt: $ };
|
|
41458
41458
|
return;
|
|
41459
41459
|
}
|
|
41460
|
-
delete
|
|
41461
|
-
const H = u(
|
|
41460
|
+
delete A.completion;
|
|
41461
|
+
const H = u(A.uploadId), B = t.state.doc.type.schema.nodes.picture;
|
|
41462
41462
|
if (H === null || !B) {
|
|
41463
|
-
p(
|
|
41463
|
+
p(A, E, new Error("图片占位锚点已不存在"));
|
|
41464
41464
|
return;
|
|
41465
41465
|
}
|
|
41466
41466
|
const R = B.create({ nodeId: Do(), src: L, alt: $ }), j = t.state.tr.insert(H, R);
|
|
41467
|
-
Pn(j), j.setMeta(ns, { kind: "complete", uploadId:
|
|
41467
|
+
Pn(j), j.setMeta(ns, { kind: "complete", uploadId: A.uploadId, order: A.order, pos: H });
|
|
41468
41468
|
try {
|
|
41469
41469
|
Wn(j.doc);
|
|
41470
41470
|
} catch (q) {
|
|
41471
|
-
p(
|
|
41471
|
+
p(A, E, q);
|
|
41472
41472
|
return;
|
|
41473
41473
|
}
|
|
41474
41474
|
if (!d(j)) {
|
|
41475
|
-
p(
|
|
41475
|
+
p(A, E, new Error("图片提交未被当前会话接受"));
|
|
41476
41476
|
return;
|
|
41477
41477
|
}
|
|
41478
|
-
h(
|
|
41479
|
-
}, g = (
|
|
41480
|
-
if (i || t.isDestroyed || !
|
|
41478
|
+
h(A), !i && !t.isDestroyed && d(Pn(t.state.tr)), a();
|
|
41479
|
+
}, g = (A, E, L) => {
|
|
41480
|
+
if (i || t.isDestroyed || !A.active || A.token !== E) return;
|
|
41481
41481
|
const $ = L?.src;
|
|
41482
41482
|
if (!wB($) || !xB($)) {
|
|
41483
|
-
p(
|
|
41483
|
+
p(A, E, new Error("宿主返回的图片地址不安全或超出预算"));
|
|
41484
41484
|
return;
|
|
41485
41485
|
}
|
|
41486
|
-
const H = L?.alt, B =
|
|
41486
|
+
const H = L?.alt, B = A.file.name.trim() !== "" ? A.file.name.trim() : "图片", R = typeof H == "string" && H.trim() !== "" ? H.trim() : B;
|
|
41487
41487
|
if (!kB(R)) {
|
|
41488
|
-
p(
|
|
41488
|
+
p(A, E, new Error("图片描述超出预算"));
|
|
41489
41489
|
return;
|
|
41490
41490
|
}
|
|
41491
|
-
m(
|
|
41492
|
-
}, y = (
|
|
41493
|
-
if (i || t.isDestroyed || !
|
|
41494
|
-
const
|
|
41495
|
-
|
|
41496
|
-
if (i || t.isDestroyed || !
|
|
41491
|
+
m(A, E, $, R);
|
|
41492
|
+
}, y = (A) => {
|
|
41493
|
+
if (i || t.isDestroyed || !A.active) return;
|
|
41494
|
+
const E = new AbortController(), L = Symbol(A.uploadId);
|
|
41495
|
+
A.controller = E, A.token = L, A.status = "uploading", A.error = void 0, vu(A.dom, A), a(), N6(A.file, e.maxFileBytes ?? Hu).then(() => {
|
|
41496
|
+
if (i || t.isDestroyed || !A.active || A.token !== L || E.signal.aborted) return;
|
|
41497
41497
|
let $;
|
|
41498
41498
|
try {
|
|
41499
|
-
$ = e.upload(
|
|
41499
|
+
$ = e.upload(A.file, { uploadId: A.uploadId, attempt: A.attempt, signal: E.signal });
|
|
41500
41500
|
} catch (H) {
|
|
41501
|
-
p(
|
|
41501
|
+
p(A, L, H);
|
|
41502
41502
|
return;
|
|
41503
41503
|
}
|
|
41504
41504
|
Promise.resolve($).then(
|
|
41505
|
-
(H) => g(
|
|
41506
|
-
(H) => p(
|
|
41505
|
+
(H) => g(A, L, H),
|
|
41506
|
+
(H) => p(A, L, H)
|
|
41507
41507
|
);
|
|
41508
|
-
}, ($) => p(
|
|
41509
|
-
}, w = (
|
|
41508
|
+
}, ($) => p(A, L, $));
|
|
41509
|
+
}, w = (A, E) => {
|
|
41510
41510
|
if (i || t.isDestroyed || e.canStart && !e.canStart()) return [];
|
|
41511
|
-
const L =
|
|
41511
|
+
const L = E === null ? null : k2(t.state.doc, E);
|
|
41512
41512
|
if (L === null) return [];
|
|
41513
41513
|
const $ = e.maxFileBytes ?? Hu, H = [];
|
|
41514
|
-
for (const B of
|
|
41514
|
+
for (const B of A) {
|
|
41515
41515
|
if (i || t.isDestroyed || e.canStart && !e.canStart()) break;
|
|
41516
41516
|
if (B.size > $) {
|
|
41517
41517
|
const P = Do(), Z = document.createElement("div"), Ce = { uploadId: P, order: ++o, file: B, attempt: 1, status: "failed", error: new Error("图片文件不能超过 100 MiB"), controller: new AbortController(), token: Symbol(P), dom: Z, active: !0 };
|
|
@@ -41530,43 +41530,43 @@ function P6(t, e) {
|
|
|
41530
41530
|
H.push(R), y(q);
|
|
41531
41531
|
}
|
|
41532
41532
|
return H;
|
|
41533
|
-
}, k = (
|
|
41534
|
-
const L = Array.from(
|
|
41533
|
+
}, k = (A, E) => {
|
|
41534
|
+
const L = Array.from(A).filter(D6);
|
|
41535
41535
|
if (L.length === 0) return [];
|
|
41536
|
-
const $ =
|
|
41536
|
+
const $ = E ?? t.state.selection.from;
|
|
41537
41537
|
return w(L, $);
|
|
41538
|
-
},
|
|
41539
|
-
const
|
|
41540
|
-
if (typeof
|
|
41541
|
-
const L = n.get(
|
|
41542
|
-
!L || !L.active || (L.active = !1, L.controller.abort(), n.delete(
|
|
41538
|
+
}, T = (A) => {
|
|
41539
|
+
const E = A.uploadId;
|
|
41540
|
+
if (typeof E != "string") return;
|
|
41541
|
+
const L = n.get(E);
|
|
41542
|
+
!L || !L.active || (L.active = !1, L.controller.abort(), n.delete(E), c());
|
|
41543
41543
|
}, x = new lt({
|
|
41544
41544
|
key: ns,
|
|
41545
41545
|
state: {
|
|
41546
41546
|
init: () => ({ decorations: nt.empty }),
|
|
41547
|
-
apply: (
|
|
41548
|
-
let L =
|
|
41549
|
-
const $ =
|
|
41550
|
-
if (H.length > 0 && (L = L.remove(H)),
|
|
41547
|
+
apply: (A, E) => {
|
|
41548
|
+
let L = E.decorations;
|
|
41549
|
+
const $ = A.getMeta(ns), H = $?.kind === "complete" ? L.find($.pos, $.pos, (B) => (B.side ?? 0) < $.order) : [];
|
|
41550
|
+
if (H.length > 0 && (L = L.remove(H)), A.docChanged) {
|
|
41551
41551
|
const B = L.find().flatMap((R) => {
|
|
41552
|
-
const j =
|
|
41553
|
-
return !j.deleted || j.deletedAcross || j.deletedBefore ? [] :
|
|
41552
|
+
const j = A.mapping.mapResult(R.from, 1);
|
|
41553
|
+
return !j.deleted || j.deletedAcross || j.deletedBefore ? [] : A.doc.resolve(j.pos).depth !== 0 || k2(A.doc, j.pos) !== j.pos ? [] : [{ span: R, pos: j.pos }];
|
|
41554
41554
|
});
|
|
41555
|
-
B.length > 0 && (L = L.remove(B.map(({ span: R }) => R))), L = L.map(
|
|
41555
|
+
B.length > 0 && (L = L.remove(B.map(({ span: R }) => R))), L = L.map(A.mapping, A.doc, { onRemove: T }), L = L.add(A.doc, B.flatMap(({ span: R, pos: j }) => {
|
|
41556
41556
|
const q = n.get(R.spec.uploadId);
|
|
41557
41557
|
return q ? [Bt.widget(j, q.dom, R.spec)] : [];
|
|
41558
41558
|
}));
|
|
41559
41559
|
}
|
|
41560
41560
|
if ($?.kind === "complete" && H.length > 0) {
|
|
41561
|
-
const B =
|
|
41562
|
-
L = L.add(
|
|
41561
|
+
const B = A.mapping.map($.pos, -1);
|
|
41562
|
+
L = L.add(A.doc, H.flatMap((R) => {
|
|
41563
41563
|
const j = n.get(R.spec.uploadId);
|
|
41564
41564
|
return j ? [Bt.widget(B, j.dom, R.spec)] : [];
|
|
41565
41565
|
}));
|
|
41566
41566
|
}
|
|
41567
41567
|
if ($?.kind === "add") {
|
|
41568
41568
|
const B = { side: $.order, key: $.uploadId, uploadId: $.uploadId };
|
|
41569
|
-
L = L.add(
|
|
41569
|
+
L = L.add(A.doc, [Bt.widget($.pos, $.dom, B)]);
|
|
41570
41570
|
} else if ($?.kind === "remove" || $?.kind === "complete") {
|
|
41571
41571
|
const B = L.find(void 0, void 0, (R) => R.uploadId === $.uploadId);
|
|
41572
41572
|
B.length > 0 && (L = L.remove(B));
|
|
@@ -41575,41 +41575,41 @@ function P6(t, e) {
|
|
|
41575
41575
|
}
|
|
41576
41576
|
},
|
|
41577
41577
|
props: {
|
|
41578
|
-
decorations: (
|
|
41579
|
-
handlePaste: (
|
|
41578
|
+
decorations: (A) => ns.getState(A)?.decorations ?? null,
|
|
41579
|
+
handlePaste: (A, E) => {
|
|
41580
41580
|
if (i) return !1;
|
|
41581
|
-
const L = ch(
|
|
41581
|
+
const L = ch(E.clipboardData?.files);
|
|
41582
41582
|
return L.length === 0 ? !1 : w(L, t.state.selection.from).length > 0;
|
|
41583
41583
|
},
|
|
41584
|
-
handleDrop: (
|
|
41585
|
-
if (i || $ ||
|
|
41586
|
-
const H = ch(
|
|
41584
|
+
handleDrop: (A, E, L, $) => {
|
|
41585
|
+
if (i || $ || A.dragging) return !1;
|
|
41586
|
+
const H = ch(E.dataTransfer?.files);
|
|
41587
41587
|
if (H.length === 0) return !1;
|
|
41588
|
-
const B =
|
|
41588
|
+
const B = A.posAtCoords({ left: E.clientX, top: E.clientY });
|
|
41589
41589
|
return B ? w(H, B.pos).length > 0 : !1;
|
|
41590
41590
|
},
|
|
41591
41591
|
handleDOMEvents: {
|
|
41592
|
-
drop: (
|
|
41592
|
+
drop: (A, E) => i || A.dragging || ch(E.dataTransfer?.files).length === 0 || A.posAtCoords({ left: E.clientX, top: E.clientY }) ? !1 : (E.preventDefault(), !0)
|
|
41593
41593
|
}
|
|
41594
41594
|
}
|
|
41595
41595
|
});
|
|
41596
|
-
return t.registerPlugin(x), { enqueue: k, retry: (
|
|
41596
|
+
return t.registerPlugin(x), { enqueue: k, retry: (A) => {
|
|
41597
41597
|
if (i || t.isDestroyed || e.canStart && !e.canStart()) return !1;
|
|
41598
|
-
const
|
|
41599
|
-
return !
|
|
41600
|
-
}, cancel: (
|
|
41601
|
-
const
|
|
41602
|
-
return
|
|
41603
|
-
}, getState: s, subscribe: (
|
|
41604
|
-
for (const
|
|
41605
|
-
const
|
|
41606
|
-
|
|
41598
|
+
const E = n.get(A);
|
|
41599
|
+
return !E || !E.active || E.status === "uploading" || E.file.size > (e.maxFileBytes ?? Hu) ? !1 : (E.attempt += 1, y(E), !0);
|
|
41600
|
+
}, cancel: (A) => {
|
|
41601
|
+
const E = n.get(A);
|
|
41602
|
+
return E ? (E.active = !1, E.controller.abort(), n.delete(A), f({ kind: "remove", uploadId: A }), a(), !0) : !1;
|
|
41603
|
+
}, getState: s, subscribe: (A) => (r.add(A), () => r.delete(A)), flushCompletions: () => {
|
|
41604
|
+
for (const A of [...n.values()]) {
|
|
41605
|
+
const E = A.completion;
|
|
41606
|
+
E && m(A, E.token, E.src, E.alt);
|
|
41607
41607
|
}
|
|
41608
41608
|
}, destroy: () => {
|
|
41609
41609
|
if (!i) {
|
|
41610
41610
|
i = !0;
|
|
41611
|
-
for (const
|
|
41612
|
-
|
|
41611
|
+
for (const A of n.values())
|
|
41612
|
+
A.active = !1, A.controller.abort();
|
|
41613
41613
|
n.clear(), r.clear();
|
|
41614
41614
|
try {
|
|
41615
41615
|
t.unregisterPlugin(ns);
|
|
@@ -42235,14 +42235,14 @@ function EB({ open: t, onClose: e, closeOnEsc: n = !0, closeOnBackdrop: r = !0,
|
|
|
42235
42235
|
if (p === "entering") {
|
|
42236
42236
|
let k = document.activeElement;
|
|
42237
42237
|
k instanceof HTMLElement && (c.current = k), d.current ||= (u.current = document.body.style.overflow, document.body.style.overflow = "hidden", !0);
|
|
42238
|
-
let
|
|
42238
|
+
let T = requestAnimationFrame(() => {
|
|
42239
42239
|
let x = a.current;
|
|
42240
42240
|
if (x === null) return;
|
|
42241
42241
|
let S = E2(x);
|
|
42242
42242
|
S.length > 0 ? S[0]?.focus() : x.focus();
|
|
42243
42243
|
});
|
|
42244
42244
|
return () => {
|
|
42245
|
-
cancelAnimationFrame(
|
|
42245
|
+
cancelAnimationFrame(T);
|
|
42246
42246
|
};
|
|
42247
42247
|
}
|
|
42248
42248
|
let w = c.current;
|
|
@@ -42269,12 +42269,12 @@ function EB({ open: t, onClose: e, closeOnEsc: n = !0, closeOnBackdrop: r = !0,
|
|
|
42269
42269
|
if (w.key !== "Tab") return;
|
|
42270
42270
|
let k = a.current;
|
|
42271
42271
|
if (k === null) return;
|
|
42272
|
-
let
|
|
42273
|
-
if (
|
|
42272
|
+
let T = E2(k);
|
|
42273
|
+
if (T.length === 0) {
|
|
42274
42274
|
w.preventDefault(), k.focus();
|
|
42275
42275
|
return;
|
|
42276
42276
|
}
|
|
42277
|
-
let x =
|
|
42277
|
+
let x = T[0], S = T[T.length - 1];
|
|
42278
42278
|
if (x === void 0 || S === void 0) return;
|
|
42279
42279
|
let M = document.activeElement;
|
|
42280
42280
|
w.shiftKey ? (M === x || M === k || !k.contains(M)) && (w.preventDefault(), S.focus()) : (M === S || !k.contains(M)) && (w.preventDefault(), x.focus());
|
|
@@ -42285,7 +42285,7 @@ function EB({ open: t, onClose: e, closeOnEsc: n = !0, closeOnBackdrop: r = !0,
|
|
|
42285
42285
|
};
|
|
42286
42286
|
}
|
|
42287
42287
|
function L6({ children: t, className: e, title: n, description: r, open: i, onClose: o, placement: s = "right", size: a, closeOnEsc: l = !0, closeOnBackdrop: c = !0, ref: u, style: d, ...f }) {
|
|
42288
|
-
let { dataState: h, mounted: p, backdropRef: m, panelRef: g, titleId: y, descriptionId: w, handlePanelKeyDown: k, handleBackdropPointerDown:
|
|
42288
|
+
let { dataState: h, mounted: p, backdropRef: m, panelRef: g, titleId: y, descriptionId: w, handlePanelKeyDown: k, handleBackdropPointerDown: T } = EB({
|
|
42289
42289
|
open: i,
|
|
42290
42290
|
onClose: o,
|
|
42291
42291
|
closeOnEsc: l,
|
|
@@ -42303,7 +42303,7 @@ function L6({ children: t, className: e, title: n, description: r, open: i, onCl
|
|
|
42303
42303
|
return dv(/* @__PURE__ */ He(mi, { children: [/* @__PURE__ */ X("div", {
|
|
42304
42304
|
className: "hn-drawer__backdrop",
|
|
42305
42305
|
"data-state": h,
|
|
42306
|
-
onPointerDown:
|
|
42306
|
+
onPointerDown: T,
|
|
42307
42307
|
ref: m
|
|
42308
42308
|
}), /* @__PURE__ */ He("div", {
|
|
42309
42309
|
...f,
|
|
@@ -42371,8 +42371,8 @@ const MB = {
|
|
|
42371
42371
|
function O6({ editor: t, theme: e, coordinator: n, inputFrozen: r = !1 }) {
|
|
42372
42372
|
const [i, o] = Ue(() => n?.read() ?? null), s = Ve((O) => {
|
|
42373
42373
|
o((D) => {
|
|
42374
|
-
const
|
|
42375
|
-
return n?.write(
|
|
42374
|
+
const A = typeof O == "function" ? O(D) : O;
|
|
42375
|
+
return n?.write(A), A;
|
|
42376
42376
|
});
|
|
42377
42377
|
}, [n]), [a, l] = Ue(() => n?.read() !== null && n !== void 0), [c, u] = Ue(null), [d, f] = Ue("pen"), h = Ve((O) => {
|
|
42378
42378
|
if (!(n && !n.open(O.kind))) {
|
|
@@ -42410,46 +42410,46 @@ function O6({ editor: t, theme: e, coordinator: n, inputFrozen: r = !1 }) {
|
|
|
42410
42410
|
}, [i, n]), g = Ve(() => {
|
|
42411
42411
|
if (!i || i.draft.readOnly || n && !n.canInput()) return;
|
|
42412
42412
|
n?.validating();
|
|
42413
|
-
const { request: O, draft: D } = i,
|
|
42414
|
-
if (!
|
|
42415
|
-
n?.invalid(), u(`${
|
|
42413
|
+
const { request: O, draft: D } = i, A = D.kind === "card" ? CP({ schemaVersion: Pl, cards: D.cards }) : dz(D.value);
|
|
42414
|
+
if (!A.result.ok) {
|
|
42415
|
+
n?.invalid(), u(`${A.result.error.path}:${A.result.error.message}`);
|
|
42416
42416
|
return;
|
|
42417
42417
|
}
|
|
42418
|
-
let
|
|
42419
|
-
const L =
|
|
42420
|
-
if (n ? n.commit($) : $(), !
|
|
42421
|
-
n?.invalid(), u(
|
|
42418
|
+
let E = { ok: !1, message: "Commit rejected" };
|
|
42419
|
+
const L = A.result.value, $ = () => (E = O.commit(L), E.ok);
|
|
42420
|
+
if (n ? n.commit($) : $(), !E.ok) {
|
|
42421
|
+
n?.invalid(), u(E.message);
|
|
42422
42422
|
return;
|
|
42423
42423
|
}
|
|
42424
42424
|
m();
|
|
42425
42425
|
}, [i, m, n]), y = Ve((O, D) => {
|
|
42426
|
-
n && !n.canInput() || (n?.change(), s((
|
|
42427
|
-
...
|
|
42426
|
+
n && !n.canInput() || (n?.change(), s((A) => A?.draft.kind !== "card" || A.draft.readOnly ? A : {
|
|
42427
|
+
...A,
|
|
42428
42428
|
draft: {
|
|
42429
|
-
...
|
|
42430
|
-
cards:
|
|
42429
|
+
...A.draft,
|
|
42430
|
+
cards: A.draft.cards.map((E) => E.id === O ? { ...E, ...D } : E)
|
|
42431
42431
|
}
|
|
42432
42432
|
}));
|
|
42433
42433
|
}, [n, s]), w = Ve(() => {
|
|
42434
42434
|
n && !n.canInput() || (n?.change(), s((O) => {
|
|
42435
42435
|
if (O?.draft.kind !== "card" || O.draft.readOnly) return O;
|
|
42436
|
-
const D = TB(O.draft.cards),
|
|
42437
|
-
return { ...O, draft: { ...O.draft, cards: [...O.draft.cards,
|
|
42436
|
+
const D = TB(O.draft.cards), A = 24 + O.draft.cards.length * 16, E = { id: D, title: "新卡片", content: "", x: A, y: A, width: 240, height: 160 };
|
|
42437
|
+
return { ...O, draft: { ...O.draft, cards: [...O.draft.cards, E] } };
|
|
42438
42438
|
}));
|
|
42439
42439
|
}, [n, s]), k = Ve((O) => {
|
|
42440
42440
|
n && !n.canInput() || (n?.change(), s((D) => {
|
|
42441
42441
|
if (D?.draft.kind !== "card" || D.draft.readOnly) return D;
|
|
42442
|
-
const
|
|
42443
|
-
const L = { ...
|
|
42442
|
+
const A = D.draft.cards.filter((E) => E.id !== O).map((E) => {
|
|
42443
|
+
const L = { ...E };
|
|
42444
42444
|
if (L.parentId === O && delete L.parentId, L.linkedCardIds !== void 0) {
|
|
42445
42445
|
const $ = L.linkedCardIds.filter((H) => H !== O);
|
|
42446
42446
|
$.length > 0 ? L.linkedCardIds = $ : delete L.linkedCardIds;
|
|
42447
42447
|
}
|
|
42448
42448
|
return L;
|
|
42449
42449
|
});
|
|
42450
|
-
return { ...D, draft: { ...D.draft, cards:
|
|
42450
|
+
return { ...D, draft: { ...D.draft, cards: A } };
|
|
42451
42451
|
}));
|
|
42452
|
-
}, [n, s]),
|
|
42452
|
+
}, [n, s]), T = Ve((O) => {
|
|
42453
42453
|
n && !n.canInput() || (n?.change(), s(
|
|
42454
42454
|
(D) => D?.draft.kind === "drawing" && !D.draft.readOnly ? { ...D, draft: { ...D.draft, value: O } } : D
|
|
42455
42455
|
));
|
|
@@ -42535,7 +42535,7 @@ function O6({ editor: t, theme: e, coordinator: n, inputFrozen: r = !1 }) {
|
|
|
42535
42535
|
},
|
|
42536
42536
|
O.tool
|
|
42537
42537
|
)) }),
|
|
42538
|
-
/* @__PURE__ */ X("div", { className: "hn-editor-drawing-canvas", children: /* @__PURE__ */ X(UR, { tool: d, value: I.value, onChange:
|
|
42538
|
+
/* @__PURE__ */ X("div", { className: "hn-editor-drawing-canvas", children: /* @__PURE__ */ X(UR, { tool: d, value: I.value, onChange: T }) })
|
|
42539
42539
|
] }),
|
|
42540
42540
|
/* @__PURE__ */ He("footer", { className: "hn-editor-data-drawer-footer", children: [
|
|
42541
42541
|
x && /* @__PURE__ */ He(
|
|
@@ -42713,8 +42713,8 @@ function BB(t, e) {
|
|
|
42713
42713
|
P && e.activate(P);
|
|
42714
42714
|
}, k = (B) => {
|
|
42715
42715
|
r || t.isDestroyed || !(B.target instanceof Element) || y(B.target) && B.preventDefault();
|
|
42716
|
-
},
|
|
42717
|
-
!e.hasActivate ||
|
|
42716
|
+
}, T = /* @__PURE__ */ new Set(), x = (B) => {
|
|
42717
|
+
!e.hasActivate || T.has(B) || (B.setAttribute("tabindex", "0"), B.setAttribute("role", "link"), T.add(B));
|
|
42718
42718
|
}, S = () => {
|
|
42719
42719
|
if (r || t.isDestroyed) return;
|
|
42720
42720
|
const B = new Map(e.getReferenceState().entries.map((R) => [`${R.kind}\0${R.resourceId}`, R]));
|
|
@@ -42740,28 +42740,28 @@ function BB(t, e) {
|
|
|
42740
42740
|
o = !1, f();
|
|
42741
42741
|
}, D = () => {
|
|
42742
42742
|
i = !0, f();
|
|
42743
|
-
},
|
|
42743
|
+
}, A = () => {
|
|
42744
42744
|
i = !1, h();
|
|
42745
42745
|
};
|
|
42746
|
-
let
|
|
42746
|
+
let E = () => {
|
|
42747
42747
|
}, L = () => {
|
|
42748
42748
|
};
|
|
42749
42749
|
const $ = () => {
|
|
42750
42750
|
if (r) return;
|
|
42751
|
-
r = !0,
|
|
42751
|
+
r = !0, E(), L(), t.off("transaction", M), t.off("focus", I), t.off("blur", O), t.off("destroy", $);
|
|
42752
42752
|
const B = t.view.dom;
|
|
42753
|
-
if (B.removeEventListener("click", w), B.removeEventListener("auxclick", k), B.removeEventListener("compositionstart", D), B.removeEventListener("compositionend",
|
|
42753
|
+
if (B.removeEventListener("click", w), B.removeEventListener("auxclick", k), B.removeEventListener("compositionstart", D), B.removeEventListener("compositionend", A), B.ownerDocument.removeEventListener("keydown", m, !0), e.cancelCandidates(), !t.isDestroyed) {
|
|
42754
42754
|
B.removeAttribute("aria-expanded"), B.removeAttribute("aria-controls"), B.removeAttribute("aria-activedescendant");
|
|
42755
42755
|
for (const R of B.querySelectorAll(xu))
|
|
42756
42756
|
R instanceof HTMLElement && (R.removeAttribute("data-hnn-resolve-status"), R.removeAttribute("title"));
|
|
42757
|
-
for (const R of
|
|
42757
|
+
for (const R of T)
|
|
42758
42758
|
R.removeAttribute("tabindex"), R.removeAttribute("role");
|
|
42759
42759
|
}
|
|
42760
|
-
|
|
42760
|
+
T.clear(), s = uh, a.clear();
|
|
42761
42761
|
};
|
|
42762
42762
|
t.on("transaction", M), t.on("focus", I), t.on("blur", O), t.on("destroy", $);
|
|
42763
42763
|
const H = t.view.dom;
|
|
42764
|
-
return H.addEventListener("click", w), H.addEventListener("auxclick", k), H.addEventListener("compositionstart", D), H.addEventListener("compositionend",
|
|
42764
|
+
return H.addEventListener("click", w), H.addEventListener("auxclick", k), H.addEventListener("compositionstart", D), H.addEventListener("compositionend", A), H.ownerDocument.addEventListener("keydown", m, !0), E = e.subscribeReferences(S), L = e.subscribeCandidates(d), S(), h(), {
|
|
42765
42765
|
getState: () => s,
|
|
42766
42766
|
subscribe(B) {
|
|
42767
42767
|
return a.add(B), () => a.delete(B);
|
|
@@ -42851,7 +42851,7 @@ function z6(t) {
|
|
|
42851
42851
|
const O = I.offsetTop, D = O + I.offsetHeight;
|
|
42852
42852
|
O < M.scrollTop ? M.scrollTop = O : D > M.scrollTop + M.clientHeight && (M.scrollTop = D - M.clientHeight);
|
|
42853
42853
|
}, [r, g, m.length]), !r || !p) return null;
|
|
42854
|
-
const
|
|
42854
|
+
const T = $B(e, p.from), x = w ? { left: w.left, top: w.top, maxHeight: w.maxHeight } : { left: T.left, top: T.top }, S = t.className ? `hn-reference-menu ${t.className}` : "hn-reference-menu";
|
|
42855
42855
|
return dv(
|
|
42856
42856
|
// 点击候选 preserve 编辑器 caret:阻止 pointer/mouse 默认行为,编辑器不 blur、选区不动。
|
|
42857
42857
|
/* @__PURE__ */ X(
|
|
@@ -43088,16 +43088,16 @@ function eF(t, e, n) {
|
|
|
43088
43088
|
f.lastIndex = 0;
|
|
43089
43089
|
let k = f.exec(c.value);
|
|
43090
43090
|
for (; k; ) {
|
|
43091
|
-
const
|
|
43091
|
+
const T = k.index, x = {
|
|
43092
43092
|
index: k.index,
|
|
43093
43093
|
input: k.input,
|
|
43094
43094
|
stack: [...u, c]
|
|
43095
43095
|
};
|
|
43096
43096
|
let S = h(...k, x);
|
|
43097
|
-
if (typeof S == "string" && (S = S.length > 0 ? { type: "text", value: S } : void 0), S === !1 ? f.lastIndex =
|
|
43097
|
+
if (typeof S == "string" && (S = S.length > 0 ? { type: "text", value: S } : void 0), S === !1 ? f.lastIndex = T + 1 : (p !== T && w.push({
|
|
43098
43098
|
type: "text",
|
|
43099
|
-
value: c.value.slice(p,
|
|
43100
|
-
}), Array.isArray(S) ? w.push(...S) : S && w.push(S), p =
|
|
43099
|
+
value: c.value.slice(p, T)
|
|
43100
|
+
}), Array.isArray(S) ? w.push(...S) : S && w.push(S), p = T + k[0].length, y = !0), !f.global)
|
|
43101
43101
|
break;
|
|
43102
43102
|
k = f.exec(c.value);
|
|
43103
43103
|
}
|
|
@@ -43433,14 +43433,14 @@ function RF(t, e) {
|
|
|
43433
43433
|
const y = [];
|
|
43434
43434
|
for (; ++d < c; ) {
|
|
43435
43435
|
const w = m[d] || "";
|
|
43436
|
-
let k = "",
|
|
43436
|
+
let k = "", T = "";
|
|
43437
43437
|
if (n.alignDelimiters !== !1) {
|
|
43438
43438
|
const x = l[d] - (g[d] || 0), S = o[d];
|
|
43439
|
-
S === 114 ? k = " ".repeat(x) : S === 99 ? x % 2 ? (k = " ".repeat(x / 2 + 0.5),
|
|
43439
|
+
S === 114 ? k = " ".repeat(x) : S === 99 ? x % 2 ? (k = " ".repeat(x / 2 + 0.5), T = " ".repeat(x / 2 - 0.5)) : (k = " ".repeat(x / 2), T = k) : T = " ".repeat(x);
|
|
43440
43440
|
}
|
|
43441
43441
|
n.delimiterStart !== !1 && !d && y.push("|"), n.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
|
|
43442
43442
|
// empty: there will be a closing space.
|
|
43443
|
-
!(n.alignDelimiters === !1 && w === "") && (n.delimiterStart !== !1 || d) && y.push(" "), n.alignDelimiters !== !1 && y.push(k), y.push(w), n.alignDelimiters !== !1 && y.push(
|
|
43443
|
+
!(n.alignDelimiters === !1 && w === "") && (n.delimiterStart !== !1 || d) && y.push(" "), n.alignDelimiters !== !1 && y.push(k), y.push(w), n.alignDelimiters !== !1 && y.push(T), n.padding !== !1 && y.push(" "), (n.delimiterEnd !== !1 || d !== c - 1) && y.push("|");
|
|
43444
43444
|
}
|
|
43445
43445
|
p.push(
|
|
43446
43446
|
n.delimiterEnd === !1 ? y.join("").replace(/ +$/, "") : y.join("")
|
|
@@ -45216,7 +45216,7 @@ function kH(t, e, n) {
|
|
|
45216
45216
|
return S === a ? (s++, t.consume(S), u) : s < 3 ? n(S) : (t.exit("codeFencedFenceSequence"), ft(S) ? vt(t, d, "whitespace")(S) : d(S));
|
|
45217
45217
|
}
|
|
45218
45218
|
function d(S) {
|
|
45219
|
-
return S === null || je(S) ? (t.exit("codeFencedFence"), r.interrupt ? e(S) : t.check(_2, m,
|
|
45219
|
+
return S === null || je(S) ? (t.exit("codeFencedFence"), r.interrupt ? e(S) : t.check(_2, m, T)(S)) : (t.enter("codeFencedFenceInfo"), t.enter("chunkString", {
|
|
45220
45220
|
contentType: "string"
|
|
45221
45221
|
}), f(S));
|
|
45222
45222
|
}
|
|
@@ -45232,7 +45232,7 @@ function kH(t, e, n) {
|
|
|
45232
45232
|
return S === null || je(S) ? (t.exit("chunkString"), t.exit("codeFencedFenceMeta"), d(S)) : S === 96 && S === a ? n(S) : (t.consume(S), p);
|
|
45233
45233
|
}
|
|
45234
45234
|
function m(S) {
|
|
45235
|
-
return t.attempt(i,
|
|
45235
|
+
return t.attempt(i, T, g)(S);
|
|
45236
45236
|
}
|
|
45237
45237
|
function g(S) {
|
|
45238
45238
|
return t.enter("lineEnding"), t.consume(S), t.exit("lineEnding"), y;
|
|
@@ -45241,24 +45241,24 @@ function kH(t, e, n) {
|
|
|
45241
45241
|
return o > 0 && ft(S) ? vt(t, w, "linePrefix", o + 1)(S) : w(S);
|
|
45242
45242
|
}
|
|
45243
45243
|
function w(S) {
|
|
45244
|
-
return S === null || je(S) ? t.check(_2, m,
|
|
45244
|
+
return S === null || je(S) ? t.check(_2, m, T)(S) : (t.enter("codeFlowValue"), k(S));
|
|
45245
45245
|
}
|
|
45246
45246
|
function k(S) {
|
|
45247
45247
|
return S === null || je(S) ? (t.exit("codeFlowValue"), w(S)) : (t.consume(S), k);
|
|
45248
45248
|
}
|
|
45249
|
-
function
|
|
45249
|
+
function T(S) {
|
|
45250
45250
|
return t.exit("codeFenced"), e(S);
|
|
45251
45251
|
}
|
|
45252
45252
|
function x(S, M, I) {
|
|
45253
45253
|
let O = 0;
|
|
45254
45254
|
return D;
|
|
45255
45255
|
function D(H) {
|
|
45256
|
-
return S.enter("lineEnding"), S.consume(H), S.exit("lineEnding"),
|
|
45257
|
-
}
|
|
45258
|
-
function T(H) {
|
|
45259
|
-
return S.enter("codeFencedFence"), ft(H) ? vt(S, A, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(H) : A(H);
|
|
45256
|
+
return S.enter("lineEnding"), S.consume(H), S.exit("lineEnding"), A;
|
|
45260
45257
|
}
|
|
45261
45258
|
function A(H) {
|
|
45259
|
+
return S.enter("codeFencedFence"), ft(H) ? vt(S, E, "linePrefix", r.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(H) : E(H);
|
|
45260
|
+
}
|
|
45261
|
+
function E(H) {
|
|
45262
45262
|
return H === a ? (S.enter("codeFencedFenceSequence"), L(H)) : I(H);
|
|
45263
45263
|
}
|
|
45264
45264
|
function L(H) {
|
|
@@ -45927,7 +45927,7 @@ function ZH(t, e, n) {
|
|
|
45927
45927
|
}
|
|
45928
45928
|
function p(z) {
|
|
45929
45929
|
const oe = "CDATA[";
|
|
45930
|
-
return z === oe.charCodeAt(a++) ? (t.consume(z), a === oe.length ? r.interrupt ? e :
|
|
45930
|
+
return z === oe.charCodeAt(a++) ? (t.consume(z), a === oe.length ? r.interrupt ? e : E : p) : n(z);
|
|
45931
45931
|
}
|
|
45932
45932
|
function m(z) {
|
|
45933
45933
|
return jn(z) ? (t.consume(z), s = String.fromCharCode(z), g) : n(z);
|
|
@@ -45935,21 +45935,21 @@ function ZH(t, e, n) {
|
|
|
45935
45935
|
function g(z) {
|
|
45936
45936
|
if (z === null || z === 47 || z === 62 || $t(z)) {
|
|
45937
45937
|
const oe = z === 47, Me = s.toLowerCase();
|
|
45938
|
-
return !oe && !o && q2.includes(Me) ? (i = 1, r.interrupt ? e(z) :
|
|
45938
|
+
return !oe && !o && q2.includes(Me) ? (i = 1, r.interrupt ? e(z) : E(z)) : KH.includes(s.toLowerCase()) ? (i = 6, oe ? (t.consume(z), y) : r.interrupt ? e(z) : E(z)) : (i = 7, r.interrupt && !r.parser.lazy[r.now().line] ? n(z) : o ? w(z) : k(z));
|
|
45939
45939
|
}
|
|
45940
45940
|
return z === 45 || or(z) ? (t.consume(z), s += String.fromCharCode(z), g) : n(z);
|
|
45941
45941
|
}
|
|
45942
45942
|
function y(z) {
|
|
45943
|
-
return z === 62 ? (t.consume(z), r.interrupt ? e :
|
|
45943
|
+
return z === 62 ? (t.consume(z), r.interrupt ? e : E) : n(z);
|
|
45944
45944
|
}
|
|
45945
45945
|
function w(z) {
|
|
45946
45946
|
return ft(z) ? (t.consume(z), w) : D(z);
|
|
45947
45947
|
}
|
|
45948
45948
|
function k(z) {
|
|
45949
|
-
return z === 47 ? (t.consume(z), D) : z === 58 || z === 95 || jn(z) ? (t.consume(z),
|
|
45949
|
+
return z === 47 ? (t.consume(z), D) : z === 58 || z === 95 || jn(z) ? (t.consume(z), T) : ft(z) ? (t.consume(z), k) : D(z);
|
|
45950
45950
|
}
|
|
45951
|
-
function
|
|
45952
|
-
return z === 45 || z === 46 || z === 58 || z === 95 || or(z) ? (t.consume(z),
|
|
45951
|
+
function T(z) {
|
|
45952
|
+
return z === 45 || z === 46 || z === 58 || z === 95 || or(z) ? (t.consume(z), T) : x(z);
|
|
45953
45953
|
}
|
|
45954
45954
|
function x(z) {
|
|
45955
45955
|
return z === 61 ? (t.consume(z), S) : ft(z) ? (t.consume(z), x) : k(z);
|
|
@@ -45967,13 +45967,13 @@ function ZH(t, e, n) {
|
|
|
45967
45967
|
return z === 47 || z === 62 || ft(z) ? k(z) : n(z);
|
|
45968
45968
|
}
|
|
45969
45969
|
function D(z) {
|
|
45970
|
-
return z === 62 ? (t.consume(z),
|
|
45971
|
-
}
|
|
45972
|
-
function T(z) {
|
|
45973
|
-
return z === null || je(z) ? A(z) : ft(z) ? (t.consume(z), T) : n(z);
|
|
45970
|
+
return z === 62 ? (t.consume(z), A) : n(z);
|
|
45974
45971
|
}
|
|
45975
45972
|
function A(z) {
|
|
45976
|
-
return z ===
|
|
45973
|
+
return z === null || je(z) ? E(z) : ft(z) ? (t.consume(z), A) : n(z);
|
|
45974
|
+
}
|
|
45975
|
+
function E(z) {
|
|
45976
|
+
return z === 45 && i === 2 ? (t.consume(z), B) : z === 60 && i === 1 ? (t.consume(z), R) : z === 62 && i === 4 ? (t.consume(z), Z) : z === 63 && i === 3 ? (t.consume(z), P) : z === 93 && i === 5 ? (t.consume(z), q) : je(z) && (i === 6 || i === 7) ? (t.exit("htmlFlowData"), t.check(YH, Ce, L)(z)) : z === null || je(z) ? (t.exit("htmlFlowData"), L(z)) : (t.consume(z), E);
|
|
45977
45977
|
}
|
|
45978
45978
|
function L(z) {
|
|
45979
45979
|
return t.check(XH, $, Ce)(z);
|
|
@@ -45982,26 +45982,26 @@ function ZH(t, e, n) {
|
|
|
45982
45982
|
return t.enter("lineEnding"), t.consume(z), t.exit("lineEnding"), H;
|
|
45983
45983
|
}
|
|
45984
45984
|
function H(z) {
|
|
45985
|
-
return z === null || je(z) ? L(z) : (t.enter("htmlFlowData"),
|
|
45985
|
+
return z === null || je(z) ? L(z) : (t.enter("htmlFlowData"), E(z));
|
|
45986
45986
|
}
|
|
45987
45987
|
function B(z) {
|
|
45988
|
-
return z === 45 ? (t.consume(z), P) :
|
|
45988
|
+
return z === 45 ? (t.consume(z), P) : E(z);
|
|
45989
45989
|
}
|
|
45990
45990
|
function R(z) {
|
|
45991
|
-
return z === 47 ? (t.consume(z), s = "", j) :
|
|
45991
|
+
return z === 47 ? (t.consume(z), s = "", j) : E(z);
|
|
45992
45992
|
}
|
|
45993
45993
|
function j(z) {
|
|
45994
45994
|
if (z === 62) {
|
|
45995
45995
|
const oe = s.toLowerCase();
|
|
45996
|
-
return q2.includes(oe) ? (t.consume(z), Z) :
|
|
45996
|
+
return q2.includes(oe) ? (t.consume(z), Z) : E(z);
|
|
45997
45997
|
}
|
|
45998
|
-
return jn(z) && s.length < 8 ? (t.consume(z), s += String.fromCharCode(z), j) :
|
|
45998
|
+
return jn(z) && s.length < 8 ? (t.consume(z), s += String.fromCharCode(z), j) : E(z);
|
|
45999
45999
|
}
|
|
46000
46000
|
function q(z) {
|
|
46001
|
-
return z === 93 ? (t.consume(z), P) :
|
|
46001
|
+
return z === 93 ? (t.consume(z), P) : E(z);
|
|
46002
46002
|
}
|
|
46003
46003
|
function P(z) {
|
|
46004
|
-
return z === 62 ? (t.consume(z), Z) : z === 45 && i === 2 ? (t.consume(z), P) :
|
|
46004
|
+
return z === 62 ? (t.consume(z), Z) : z === 45 && i === 2 ? (t.consume(z), P) : E(z);
|
|
46005
46005
|
}
|
|
46006
46006
|
function Z(z) {
|
|
46007
46007
|
return z === null || je(z) ? (t.exit("htmlFlowData"), Ce(z)) : (t.consume(z), Z);
|
|
@@ -46072,9 +46072,9 @@ function n_(t, e, n) {
|
|
|
46072
46072
|
return P === null || P === 62 ? B(P) : je(P) ? (s = w, R(P)) : (t.consume(P), w);
|
|
46073
46073
|
}
|
|
46074
46074
|
function k(P) {
|
|
46075
|
-
return P === null ? n(P) : P === 63 ? (t.consume(P),
|
|
46075
|
+
return P === null ? n(P) : P === 63 ? (t.consume(P), T) : je(P) ? (s = k, R(P)) : (t.consume(P), k);
|
|
46076
46076
|
}
|
|
46077
|
-
function
|
|
46077
|
+
function T(P) {
|
|
46078
46078
|
return P === 62 ? B(P) : k(P);
|
|
46079
46079
|
}
|
|
46080
46080
|
function x(P) {
|
|
@@ -46093,13 +46093,13 @@ function n_(t, e, n) {
|
|
|
46093
46093
|
return P === 47 ? (t.consume(P), B) : P === 58 || P === 95 || jn(P) ? (t.consume(P), D) : je(P) ? (s = O, R(P)) : ft(P) ? (t.consume(P), O) : B(P);
|
|
46094
46094
|
}
|
|
46095
46095
|
function D(P) {
|
|
46096
|
-
return P === 45 || P === 46 || P === 58 || P === 95 || or(P) ? (t.consume(P), D) :
|
|
46097
|
-
}
|
|
46098
|
-
function T(P) {
|
|
46099
|
-
return P === 61 ? (t.consume(P), A) : je(P) ? (s = T, R(P)) : ft(P) ? (t.consume(P), T) : O(P);
|
|
46096
|
+
return P === 45 || P === 46 || P === 58 || P === 95 || or(P) ? (t.consume(P), D) : A(P);
|
|
46100
46097
|
}
|
|
46101
46098
|
function A(P) {
|
|
46102
|
-
return P ===
|
|
46099
|
+
return P === 61 ? (t.consume(P), E) : je(P) ? (s = A, R(P)) : ft(P) ? (t.consume(P), A) : O(P);
|
|
46100
|
+
}
|
|
46101
|
+
function E(P) {
|
|
46102
|
+
return P === null || P === 60 || P === 61 || P === 62 || P === 96 ? n(P) : P === 34 || P === 39 ? (t.consume(P), i = P, L) : je(P) ? (s = E, R(P)) : ft(P) ? (t.consume(P), E) : (t.consume(P), $);
|
|
46103
46103
|
}
|
|
46104
46104
|
function L(P) {
|
|
46105
46105
|
return P === i ? (t.consume(P), i = void 0, H) : P === null ? n(P) : je(P) ? (s = L, R(P)) : (t.consume(P), L);
|
|
@@ -46812,14 +46812,14 @@ function __(t, e, n) {
|
|
|
46812
46812
|
let i = 0, o = 0, s;
|
|
46813
46813
|
return a;
|
|
46814
46814
|
function a(D) {
|
|
46815
|
-
let
|
|
46816
|
-
for (;
|
|
46817
|
-
const $ = r.events[
|
|
46815
|
+
let A = r.events.length - 1;
|
|
46816
|
+
for (; A > -1; ) {
|
|
46817
|
+
const $ = r.events[A][1].type;
|
|
46818
46818
|
if ($ === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
|
|
46819
|
-
$ === "linePrefix")
|
|
46819
|
+
$ === "linePrefix") A--;
|
|
46820
46820
|
else break;
|
|
46821
46821
|
}
|
|
46822
|
-
const
|
|
46822
|
+
const E = A > -1 ? r.events[A][1].type : null, L = E === "tableHead" || E === "tableRow" ? S : l;
|
|
46823
46823
|
return L === S && r.parser.lazy[r.now().line] ? n(D) : L(D);
|
|
46824
46824
|
}
|
|
46825
46825
|
function l(D) {
|
|
@@ -46847,7 +46847,7 @@ function __(t, e, n) {
|
|
|
46847
46847
|
return ft(D) ? vt(t, g, "whitespace")(D) : g(D);
|
|
46848
46848
|
}
|
|
46849
46849
|
function g(D) {
|
|
46850
|
-
return D === 58 ? (o += 1, s = !0, t.enter("tableDelimiterMarker"), t.consume(D), t.exit("tableDelimiterMarker"), y) : D === 45 ? (o += 1, y(D)) : D === null || je(D) ?
|
|
46850
|
+
return D === 58 ? (o += 1, s = !0, t.enter("tableDelimiterMarker"), t.consume(D), t.exit("tableDelimiterMarker"), y) : D === 45 ? (o += 1, y(D)) : D === null || je(D) ? T(D) : x(D);
|
|
46851
46851
|
}
|
|
46852
46852
|
function y(D) {
|
|
46853
46853
|
return D === 45 ? (t.enter("tableDelimiterFiller"), w(D)) : x(D);
|
|
@@ -46856,9 +46856,9 @@ function __(t, e, n) {
|
|
|
46856
46856
|
return D === 45 ? (t.consume(D), w) : D === 58 ? (s = !0, t.exit("tableDelimiterFiller"), t.enter("tableDelimiterMarker"), t.consume(D), t.exit("tableDelimiterMarker"), k) : (t.exit("tableDelimiterFiller"), k(D));
|
|
46857
46857
|
}
|
|
46858
46858
|
function k(D) {
|
|
46859
|
-
return ft(D) ? vt(t,
|
|
46859
|
+
return ft(D) ? vt(t, T, "whitespace")(D) : T(D);
|
|
46860
46860
|
}
|
|
46861
|
-
function
|
|
46861
|
+
function T(D) {
|
|
46862
46862
|
return D === 124 ? p(D) : D === null || je(D) ? !s || i !== o ? x(D) : (t.exit("tableDelimiterRow"), t.exit("tableHead"), e(D)) : x(D);
|
|
46863
46863
|
}
|
|
46864
46864
|
function x(D) {
|
|
@@ -47034,28 +47034,28 @@ function Z_(t) {
|
|
|
47034
47034
|
return a;
|
|
47035
47035
|
function a(k) {
|
|
47036
47036
|
if (r < n.length) {
|
|
47037
|
-
const
|
|
47038
|
-
return e.containerState =
|
|
47037
|
+
const T = n[r];
|
|
47038
|
+
return e.containerState = T[1], t.attempt(T[0].continuation, l, c)(k);
|
|
47039
47039
|
}
|
|
47040
47040
|
return c(k);
|
|
47041
47041
|
}
|
|
47042
47042
|
function l(k) {
|
|
47043
47043
|
if (r++, e.containerState._closeFlow) {
|
|
47044
47044
|
e.containerState._closeFlow = void 0, i && w();
|
|
47045
|
-
const
|
|
47046
|
-
let x =
|
|
47045
|
+
const T = e.events.length;
|
|
47046
|
+
let x = T, S;
|
|
47047
47047
|
for (; x--; )
|
|
47048
47048
|
if (e.events[x][0] === "exit" && e.events[x][1].type === "chunkFlow") {
|
|
47049
47049
|
S = e.events[x][1].end;
|
|
47050
47050
|
break;
|
|
47051
47051
|
}
|
|
47052
47052
|
y(r);
|
|
47053
|
-
let M =
|
|
47053
|
+
let M = T;
|
|
47054
47054
|
for (; M < e.events.length; )
|
|
47055
47055
|
e.events[M][1].end = {
|
|
47056
47056
|
...S
|
|
47057
47057
|
}, M++;
|
|
47058
|
-
return yr(e.events, x + 1, 0, e.events.slice(
|
|
47058
|
+
return yr(e.events, x + 1, 0, e.events.slice(T)), e.events.length = M, c(k);
|
|
47059
47059
|
}
|
|
47060
47060
|
return a(k);
|
|
47061
47061
|
}
|
|
@@ -47099,9 +47099,9 @@ function Z_(t) {
|
|
|
47099
47099
|
}
|
|
47100
47100
|
return je(k) ? (t.consume(k), g(t.exit("chunkFlow")), r = 0, e.interrupt = void 0, a) : (t.consume(k), m);
|
|
47101
47101
|
}
|
|
47102
|
-
function g(k,
|
|
47102
|
+
function g(k, T) {
|
|
47103
47103
|
const x = e.sliceStream(k);
|
|
47104
|
-
if (
|
|
47104
|
+
if (T && x.push(null), k.previous = o, o && (o.next = k), o = k, i.defineSkip(k.start), i.write(x), e.parser.lazy[k.start.line]) {
|
|
47105
47105
|
let S = i.events.length;
|
|
47106
47106
|
for (; S--; )
|
|
47107
47107
|
if (
|
|
@@ -47129,9 +47129,9 @@ function Z_(t) {
|
|
|
47129
47129
|
}
|
|
47130
47130
|
}
|
|
47131
47131
|
function y(k) {
|
|
47132
|
-
let
|
|
47133
|
-
for (;
|
|
47134
|
-
const x = n[
|
|
47132
|
+
let T = n.length;
|
|
47133
|
+
for (; T-- > k; ) {
|
|
47134
|
+
const x = n[T];
|
|
47135
47135
|
e.containerState = x[1], x[0].exit.call(e, t);
|
|
47136
47136
|
}
|
|
47137
47137
|
n.length = k;
|
|
@@ -47339,7 +47339,7 @@ function gj(t, e, n) {
|
|
|
47339
47339
|
check: M(S),
|
|
47340
47340
|
consume: w,
|
|
47341
47341
|
enter: k,
|
|
47342
|
-
exit:
|
|
47342
|
+
exit: T,
|
|
47343
47343
|
interrupt: M(S, {
|
|
47344
47344
|
interrupt: !0
|
|
47345
47345
|
})
|
|
@@ -47357,69 +47357,69 @@ function gj(t, e, n) {
|
|
|
47357
47357
|
};
|
|
47358
47358
|
let u = e.tokenize.call(c, l);
|
|
47359
47359
|
return e.resolveAll && o.push(e), c;
|
|
47360
|
-
function d(
|
|
47361
|
-
return s = Nr(s,
|
|
47360
|
+
function d(A) {
|
|
47361
|
+
return s = Nr(s, A), g(), s[s.length - 1] !== null ? [] : (I(e, 0), c.events = Pf(o, c.events, c), c.events);
|
|
47362
47362
|
}
|
|
47363
|
-
function f(
|
|
47364
|
-
return bj(h(
|
|
47363
|
+
function f(A, E) {
|
|
47364
|
+
return bj(h(A), E);
|
|
47365
47365
|
}
|
|
47366
|
-
function h(
|
|
47367
|
-
return yj(s,
|
|
47366
|
+
function h(A) {
|
|
47367
|
+
return yj(s, A);
|
|
47368
47368
|
}
|
|
47369
47369
|
function p() {
|
|
47370
47370
|
const {
|
|
47371
|
-
_bufferIndex:
|
|
47372
|
-
_index:
|
|
47371
|
+
_bufferIndex: A,
|
|
47372
|
+
_index: E,
|
|
47373
47373
|
line: L,
|
|
47374
47374
|
column: $,
|
|
47375
47375
|
offset: H
|
|
47376
47376
|
} = r;
|
|
47377
47377
|
return {
|
|
47378
|
-
_bufferIndex:
|
|
47379
|
-
_index:
|
|
47378
|
+
_bufferIndex: A,
|
|
47379
|
+
_index: E,
|
|
47380
47380
|
line: L,
|
|
47381
47381
|
column: $,
|
|
47382
47382
|
offset: H
|
|
47383
47383
|
};
|
|
47384
47384
|
}
|
|
47385
|
-
function m(
|
|
47386
|
-
i[
|
|
47385
|
+
function m(A) {
|
|
47386
|
+
i[A.line] = A.column, D();
|
|
47387
47387
|
}
|
|
47388
47388
|
function g() {
|
|
47389
|
-
let
|
|
47389
|
+
let A;
|
|
47390
47390
|
for (; r._index < s.length; ) {
|
|
47391
|
-
const
|
|
47392
|
-
if (typeof
|
|
47393
|
-
for (
|
|
47394
|
-
y(
|
|
47391
|
+
const E = s[r._index];
|
|
47392
|
+
if (typeof E == "string")
|
|
47393
|
+
for (A = r._index, r._bufferIndex < 0 && (r._bufferIndex = 0); r._index === A && r._bufferIndex < E.length; )
|
|
47394
|
+
y(E.charCodeAt(r._bufferIndex));
|
|
47395
47395
|
else
|
|
47396
|
-
y(
|
|
47396
|
+
y(E);
|
|
47397
47397
|
}
|
|
47398
47398
|
}
|
|
47399
|
-
function y(
|
|
47400
|
-
u = u(
|
|
47399
|
+
function y(A) {
|
|
47400
|
+
u = u(A);
|
|
47401
47401
|
}
|
|
47402
|
-
function w(
|
|
47403
|
-
je(
|
|
47402
|
+
function w(A) {
|
|
47403
|
+
je(A) ? (r.line++, r.column = 1, r.offset += A === -3 ? 2 : 1, D()) : A !== -1 && (r.column++, r.offset++), r._bufferIndex < 0 ? r._index++ : (r._bufferIndex++, r._bufferIndex === // Points w/ non-negative `_bufferIndex` reference
|
|
47404
47404
|
// strings.
|
|
47405
47405
|
/** @type {string} */
|
|
47406
|
-
s[r._index].length && (r._bufferIndex = -1, r._index++)), c.previous =
|
|
47406
|
+
s[r._index].length && (r._bufferIndex = -1, r._index++)), c.previous = A;
|
|
47407
47407
|
}
|
|
47408
|
-
function k(
|
|
47409
|
-
const L =
|
|
47410
|
-
return L.type =
|
|
47408
|
+
function k(A, E) {
|
|
47409
|
+
const L = E || {};
|
|
47410
|
+
return L.type = A, L.start = p(), c.events.push(["enter", L, c]), a.push(L), L;
|
|
47411
47411
|
}
|
|
47412
|
-
function
|
|
47413
|
-
const
|
|
47414
|
-
return
|
|
47412
|
+
function T(A) {
|
|
47413
|
+
const E = a.pop();
|
|
47414
|
+
return E.end = p(), c.events.push(["exit", E, c]), E;
|
|
47415
47415
|
}
|
|
47416
|
-
function x(
|
|
47417
|
-
I(
|
|
47416
|
+
function x(A, E) {
|
|
47417
|
+
I(A, E.from);
|
|
47418
47418
|
}
|
|
47419
|
-
function S(
|
|
47420
|
-
|
|
47419
|
+
function S(A, E) {
|
|
47420
|
+
E.restore();
|
|
47421
47421
|
}
|
|
47422
|
-
function M(
|
|
47422
|
+
function M(A, E) {
|
|
47423
47423
|
return L;
|
|
47424
47424
|
function L($, H, B) {
|
|
47425
47425
|
let R, j, q, P;
|
|
@@ -47455,7 +47455,7 @@ function gj(t, e, n) {
|
|
|
47455
47455
|
// If we do have fields, create an object w/ `context` as its
|
|
47456
47456
|
// prototype.
|
|
47457
47457
|
// This allows a “live binding”, which is needed for `interrupt`.
|
|
47458
|
-
|
|
47458
|
+
E ? Object.assign(Object.create(c), E) : c,
|
|
47459
47459
|
l,
|
|
47460
47460
|
oe,
|
|
47461
47461
|
Me
|
|
@@ -47463,24 +47463,24 @@ function gj(t, e, n) {
|
|
|
47463
47463
|
}
|
|
47464
47464
|
}
|
|
47465
47465
|
function oe(xe) {
|
|
47466
|
-
return
|
|
47466
|
+
return A(q, P), H;
|
|
47467
47467
|
}
|
|
47468
47468
|
function Me(xe) {
|
|
47469
47469
|
return P.restore(), ++j < R.length ? z(R[j]) : B;
|
|
47470
47470
|
}
|
|
47471
47471
|
}
|
|
47472
47472
|
}
|
|
47473
|
-
function I(
|
|
47474
|
-
|
|
47473
|
+
function I(A, E) {
|
|
47474
|
+
A.resolveAll && !o.includes(A) && o.push(A), A.resolve && yr(c.events, E, c.events.length - E, A.resolve(c.events.slice(E), c)), A.resolveTo && (c.events = A.resolveTo(c.events, c));
|
|
47475
47475
|
}
|
|
47476
47476
|
function O() {
|
|
47477
|
-
const
|
|
47477
|
+
const A = p(), E = c.previous, L = c.currentConstruct, $ = c.events.length, H = Array.from(a);
|
|
47478
47478
|
return {
|
|
47479
47479
|
from: $,
|
|
47480
47480
|
restore: B
|
|
47481
47481
|
};
|
|
47482
47482
|
function B() {
|
|
47483
|
-
r =
|
|
47483
|
+
r = A, c.previous = E, c.currentConstruct = L, c.events.length = $, a = H, D();
|
|
47484
47484
|
}
|
|
47485
47485
|
}
|
|
47486
47486
|
function D() {
|
|
@@ -47689,12 +47689,12 @@ function Sj(t) {
|
|
|
47689
47689
|
codeTextData: D,
|
|
47690
47690
|
data: D,
|
|
47691
47691
|
definition: l(),
|
|
47692
|
-
definitionDestinationString:
|
|
47692
|
+
definitionDestinationString: T,
|
|
47693
47693
|
definitionLabelString: w,
|
|
47694
47694
|
definitionTitleString: k,
|
|
47695
47695
|
emphasis: l(),
|
|
47696
|
-
hardBreakEscape: l(
|
|
47697
|
-
hardBreakTrailing: l(
|
|
47696
|
+
hardBreakEscape: l(E),
|
|
47697
|
+
hardBreakTrailing: l(E),
|
|
47698
47698
|
htmlFlow: l(L),
|
|
47699
47699
|
htmlFlowData: D,
|
|
47700
47700
|
htmlText: l($),
|
|
@@ -47702,7 +47702,7 @@ function Sj(t) {
|
|
|
47702
47702
|
image: l(R),
|
|
47703
47703
|
label: q,
|
|
47704
47704
|
labelText: j,
|
|
47705
|
-
lineEnding:
|
|
47705
|
+
lineEnding: A,
|
|
47706
47706
|
link: l(B),
|
|
47707
47707
|
listItem: l(),
|
|
47708
47708
|
listOrdered: l(),
|
|
@@ -47895,7 +47895,7 @@ function Sj(t) {
|
|
|
47895
47895
|
const U = this.resume(), Y = this.stack[this.stack.length - 1];
|
|
47896
47896
|
Y.title = U;
|
|
47897
47897
|
}
|
|
47898
|
-
function
|
|
47898
|
+
function T() {
|
|
47899
47899
|
const U = this.resume(), Y = this.stack[this.stack.length - 1];
|
|
47900
47900
|
Y.url = U;
|
|
47901
47901
|
}
|
|
@@ -47929,7 +47929,7 @@ function Sj(t) {
|
|
|
47929
47929
|
const Y = this.stack.pop();
|
|
47930
47930
|
Y.value += this.sliceSerialize(U), Y.position.end = uo(U.end);
|
|
47931
47931
|
}
|
|
47932
|
-
function
|
|
47932
|
+
function A(U) {
|
|
47933
47933
|
const Y = this.stack[this.stack.length - 1];
|
|
47934
47934
|
if (this.data.atHardBreak) {
|
|
47935
47935
|
const be = Y.children[Y.children.length - 1];
|
|
@@ -47938,7 +47938,7 @@ function Sj(t) {
|
|
|
47938
47938
|
}
|
|
47939
47939
|
!this.data.setextHeadingSlurpLineEnding && e.canContainEols.includes(Y.type) && (O.call(this, U), D.call(this, U));
|
|
47940
47940
|
}
|
|
47941
|
-
function
|
|
47941
|
+
function E() {
|
|
47942
47942
|
this.data.atHardBreak = !0;
|
|
47943
47943
|
}
|
|
47944
47944
|
function L() {
|
|
@@ -51204,17 +51204,17 @@ function J1(t, e, n, r, i, o = !0) {
|
|
|
51204
51204
|
), g;
|
|
51205
51205
|
for (; ; ) {
|
|
51206
51206
|
const y = Pq(m), w = i?.snapshot(), k = { ...r };
|
|
51207
|
-
let
|
|
51207
|
+
let T;
|
|
51208
51208
|
try {
|
|
51209
51209
|
g = i && o ? i.add(m) : void 0;
|
|
51210
51210
|
} catch (O) {
|
|
51211
51211
|
if (!(O instanceof Wi)) throw O;
|
|
51212
|
-
|
|
51212
|
+
T = O.planNode, g = {
|
|
51213
51213
|
bytes: K.maxShellBytes + 1,
|
|
51214
51214
|
nodes: Yi + 1
|
|
51215
51215
|
};
|
|
51216
51216
|
}
|
|
51217
|
-
const x = !g && i && o ? Lq(r, y) : void 0, S = x ?? zq(y,
|
|
51217
|
+
const x = !g && i && o ? Lq(r, y) : void 0, S = x ?? zq(y, T ?? g?.node);
|
|
51218
51218
|
if (!g && !x) break;
|
|
51219
51219
|
if (S) {
|
|
51220
51220
|
w && i && i.restore(w), B7(r, k), I7(e, S.plan.diagnostics);
|
|
@@ -51230,12 +51230,12 @@ function J1(t, e, n, r, i, o = !0) {
|
|
|
51230
51230
|
wo(S.plan.fence),
|
|
51231
51231
|
e,
|
|
51232
51232
|
S.plan.fence
|
|
51233
|
-
),
|
|
51234
|
-
for (const
|
|
51233
|
+
), A = e.slice(O);
|
|
51234
|
+
for (const E of Rq(
|
|
51235
51235
|
y,
|
|
51236
51236
|
S.node
|
|
51237
51237
|
))
|
|
51238
|
-
|
|
51238
|
+
E.plan.diagnostics.push(...A);
|
|
51239
51239
|
p = e.slice(f), m = Rs(
|
|
51240
51240
|
Oq(m, S.node, D).map(
|
|
51241
51241
|
Wd
|
|
@@ -51725,8 +51725,8 @@ function Kq(t) {
|
|
|
51725
51725
|
x.diagnostics.length > 0 ? (h.current?.focus(), i(x)) : g(x);
|
|
51726
51726
|
}, [r, e, g]), w = Ve(() => {
|
|
51727
51727
|
r && g(r);
|
|
51728
|
-
}, [r, g]), k = t.theme === "dark" ? "hn-markdown-export--dark" : t.theme === "light" ? "hn-markdown-export--light" : "",
|
|
51729
|
-
return /* @__PURE__ */ He("div", { className:
|
|
51728
|
+
}, [r, g]), k = t.theme === "dark" ? "hn-markdown-export--dark" : t.theme === "light" ? "hn-markdown-export--light" : "", T = ["hn-markdown-export", k, t.className ?? ""].filter(Boolean).join(" ");
|
|
51729
|
+
return /* @__PURE__ */ He("div", { className: T, children: [
|
|
51730
51730
|
/* @__PURE__ */ X(
|
|
51731
51731
|
"button",
|
|
51732
51732
|
{
|
|
@@ -51823,46 +51823,46 @@ function lv(t) {
|
|
|
51823
51823
|
return t instanceof Error && t.message ? t.message : "图片上传失败";
|
|
51824
51824
|
}
|
|
51825
51825
|
function H7(t) {
|
|
51826
|
-
const { installer: e, uploadId: n } = t, [r, i] = Ue(null), [o, s] = Ue(null), [a, l] = Ue(!1), [c, u] = Ue(!1), [d, f] = Ue(null), [h, p] = Ue(() => e.getState()), [m, g] = Ue(null), y = te(null), w = te(null), k = te(null),
|
|
51826
|
+
const { installer: e, uploadId: n } = t, [r, i] = Ue(null), [o, s] = Ue(null), [a, l] = Ue(!1), [c, u] = Ue(!1), [d, f] = Ue(null), [h, p] = Ue(() => e.getState()), [m, g] = Ue(null), y = te(null), w = te(null), k = te(null), T = te(t.onClose), x = te(!1);
|
|
51827
51827
|
Pt(() => {
|
|
51828
|
-
|
|
51828
|
+
T.current = t.onClose;
|
|
51829
51829
|
}), Pt(() => (p(e.getState()), e.subscribe(p)), [e]), Nt(() => {
|
|
51830
|
-
let
|
|
51830
|
+
let E = !0, L = null;
|
|
51831
51831
|
return s(null), u(!1), f(null), g(null), r ? (l(!0), N6(r).then(() => {
|
|
51832
|
-
|
|
51832
|
+
E && (L = URL.createObjectURL(r), s(L), u(!0), l(!1));
|
|
51833
51833
|
}, ($) => {
|
|
51834
|
-
|
|
51834
|
+
E && (f(lv($)), l(!1));
|
|
51835
51835
|
}), () => {
|
|
51836
|
-
|
|
51836
|
+
E = !1, L && URL.revokeObjectURL(L);
|
|
51837
51837
|
}) : (l(!1), () => {
|
|
51838
|
-
|
|
51838
|
+
E = !1;
|
|
51839
51839
|
});
|
|
51840
51840
|
}, [r]);
|
|
51841
|
-
const S = n ? h.items.find((
|
|
51841
|
+
const S = n ? h.items.find((E) => E.uploadId === n) : void 0;
|
|
51842
51842
|
Nt(() => {
|
|
51843
|
-
n && S && (x.current = !0), n && x.current && !S && (x.current = !1,
|
|
51843
|
+
n && S && (x.current = !0), n && x.current && !S && (x.current = !1, T.current());
|
|
51844
51844
|
}, [n, S]), Nt(() => {
|
|
51845
|
-
const
|
|
51845
|
+
const E = t.anchor ?? (document.activeElement instanceof HTMLElement ? document.activeElement : null);
|
|
51846
51846
|
return w.current?.focus(), () => {
|
|
51847
|
-
|
|
51847
|
+
E?.isConnected && E.focus({ preventScroll: !0 });
|
|
51848
51848
|
};
|
|
51849
51849
|
}, [t.anchor]);
|
|
51850
|
-
const M = (
|
|
51851
|
-
|
|
51850
|
+
const M = (E) => {
|
|
51851
|
+
E && !n && i(E);
|
|
51852
51852
|
}, I = () => {
|
|
51853
51853
|
if (!r || !c || a || n) return;
|
|
51854
51854
|
t.onConfirm(r) || g("目标块已不存在或当前不可插图");
|
|
51855
|
-
}, O = (
|
|
51856
|
-
if (
|
|
51857
|
-
|
|
51855
|
+
}, O = (E) => {
|
|
51856
|
+
if (E.key === "Escape") {
|
|
51857
|
+
E.preventDefault(), E.stopPropagation(), t.onClose();
|
|
51858
51858
|
return;
|
|
51859
51859
|
}
|
|
51860
|
-
if (
|
|
51860
|
+
if (E.key !== "Tab") return;
|
|
51861
51861
|
const L = Array.from(y.current?.querySelectorAll("button:not(:disabled), input:not(:disabled)") ?? []).filter((B) => !B.hidden && B.getAttribute("aria-hidden") !== "true"), $ = L[0], H = L[L.length - 1];
|
|
51862
|
-
!$ || !H || (
|
|
51863
|
-
}, D = (
|
|
51864
|
-
|
|
51865
|
-
},
|
|
51862
|
+
!$ || !H || (E.shiftKey && document.activeElement === $ ? (E.preventDefault(), H.focus()) : !E.shiftKey && document.activeElement === H && (E.preventDefault(), $.focus()));
|
|
51863
|
+
}, D = (E) => {
|
|
51864
|
+
E.preventDefault(), M(E.dataTransfer.files[0]);
|
|
51865
|
+
}, A = S?.status === "failed";
|
|
51866
51866
|
return /* @__PURE__ */ X("div", { className: "hn-picture-dialog-backdrop", children: /* @__PURE__ */ He(
|
|
51867
51867
|
"div",
|
|
51868
51868
|
{
|
|
@@ -51883,7 +51883,7 @@ function H7(t) {
|
|
|
51883
51883
|
className: "hn-picture-dialog__dropzone",
|
|
51884
51884
|
disabled: !!n,
|
|
51885
51885
|
onClick: () => k.current?.click(),
|
|
51886
|
-
onDragOver: (
|
|
51886
|
+
onDragOver: (E) => E.preventDefault(),
|
|
51887
51887
|
onDrop: D,
|
|
51888
51888
|
children: r ? r.name : "点击选择或拖入一张图片"
|
|
51889
51889
|
}
|
|
@@ -51897,8 +51897,8 @@ function H7(t) {
|
|
|
51897
51897
|
hidden: !0,
|
|
51898
51898
|
tabIndex: -1,
|
|
51899
51899
|
"aria-hidden": "true",
|
|
51900
|
-
onChange: (
|
|
51901
|
-
M(
|
|
51900
|
+
onChange: (E) => {
|
|
51901
|
+
M(E.currentTarget.files?.[0]), E.currentTarget.value = "";
|
|
51902
51902
|
}
|
|
51903
51903
|
}
|
|
51904
51904
|
),
|
|
@@ -51911,7 +51911,7 @@ function H7(t) {
|
|
|
51911
51911
|
S.attempt,
|
|
51912
51912
|
" 次尝试)…"
|
|
51913
51913
|
] }) : /* @__PURE__ */ X("p", { className: "hn-picture-dialog__error", role: "alert", children: lv(S.error) }),
|
|
51914
|
-
|
|
51914
|
+
A && /* @__PURE__ */ X("button", { type: "button", onClick: () => e.retry(S.uploadId), children: "重试上传" })
|
|
51915
51915
|
] }),
|
|
51916
51916
|
/* @__PURE__ */ He("div", { className: "hn-picture-dialog__actions", children: [
|
|
51917
51917
|
/* @__PURE__ */ X("button", { type: "button", onClick: t.onClose, children: "取消" }),
|
|
@@ -52319,8 +52319,8 @@ function rV(t) {
|
|
|
52319
52319
|
onChange: void 0,
|
|
52320
52320
|
onPictureUpload: void 0,
|
|
52321
52321
|
onExportMarkdown: void 0
|
|
52322
|
-
}), [n, r] = Ue(null), [i, o] = Ue(null), [s, a] = Ue(null), [l, c] = Ue(!1), [u, d] = Ue(!1), [f, h] = Ue(null), p = Qq(t.documentId, t.loadKey), m = Ve((
|
|
52323
|
-
r((x) => x?.sessionKey ===
|
|
52322
|
+
}), [n, r] = Ue(null), [i, o] = Ue(null), [s, a] = Ue(null), [l, c] = Ue(!1), [u, d] = Ue(!1), [f, h] = Ue(null), p = Qq(t.documentId, t.loadKey), m = Ve((T) => {
|
|
52323
|
+
r((x) => x?.sessionKey === T.sessionKey ? x : T);
|
|
52324
52324
|
}, []);
|
|
52325
52325
|
Pt(() => (a(i?.session.pictureDialog ?? null), i?.session.subscribePictureDialog(() => a(i.session.pictureDialog ?? null))), [i]), Pt(() => {
|
|
52326
52326
|
n?.sessionKey === p && (e.current = {
|
|
@@ -52337,7 +52337,7 @@ function rV(t) {
|
|
|
52337
52337
|
onPictureUpload: n.onPictureUpload,
|
|
52338
52338
|
onExportMarkdown: n.onExportMarkdown
|
|
52339
52339
|
};
|
|
52340
|
-
const
|
|
52340
|
+
const T = Zq({
|
|
52341
52341
|
documentId: n.documentId,
|
|
52342
52342
|
loadKey: n.loadKey,
|
|
52343
52343
|
initialDocument: n.document,
|
|
@@ -52349,12 +52349,12 @@ function rV(t) {
|
|
|
52349
52349
|
},
|
|
52350
52350
|
onChange: (x) => e.current.onChange?.(x)
|
|
52351
52351
|
});
|
|
52352
|
-
return
|
|
52352
|
+
return T.configurePictureUpload(n.onPictureUpload), T.configureHostReferences({
|
|
52353
52353
|
...n.onReferenceCandidates === void 0 ? {} : { candidates: n.onReferenceCandidates },
|
|
52354
52354
|
...n.onReferenceActivate === void 0 ? {} : { activate: n.onReferenceActivate },
|
|
52355
52355
|
...n.onReferenceResolve === void 0 ? {} : { resolve: n.onReferenceResolve }
|
|
52356
|
-
}), o({ sessionKey: n.sessionKey, session:
|
|
52357
|
-
|
|
52356
|
+
}), o({ sessionKey: n.sessionKey, session: T }), c(n.onPictureUpload !== void 0), d(n.onExportMarkdown !== void 0), h(T.hostReferences ?? null), () => {
|
|
52357
|
+
T.destroy();
|
|
52358
52358
|
};
|
|
52359
52359
|
}, [n?.sessionKey]), Pt(() => {
|
|
52360
52360
|
!i || i.sessionKey !== p || n?.sessionKey === p && (i.session.configurePictureUpload(t.onPictureUpload), i.session.configurePictureResolver(t.onPictureResolve), i.session.configureHostReferences({
|
|
@@ -52374,19 +52374,19 @@ function rV(t) {
|
|
|
52374
52374
|
p
|
|
52375
52375
|
]);
|
|
52376
52376
|
const g = Ve(
|
|
52377
|
-
(
|
|
52377
|
+
(T, x) => {
|
|
52378
52378
|
const S = e.current.onExportMarkdown;
|
|
52379
52379
|
if (!S) throw new Error("当前会话未启用 Markdown 导出");
|
|
52380
|
-
return S(
|
|
52380
|
+
return S(T, x);
|
|
52381
52381
|
},
|
|
52382
52382
|
[]
|
|
52383
|
-
), y = t.theme === "dark" ? "dark" : "light", w = (
|
|
52383
|
+
), y = t.theme === "dark" ? "dark" : "light", w = (T) => {
|
|
52384
52384
|
const x = i?.session.editor;
|
|
52385
|
-
if (!x || x.isDestroyed || !(
|
|
52386
|
-
const S =
|
|
52385
|
+
if (!x || x.isDestroyed || !(T.target instanceof Element)) return !1;
|
|
52386
|
+
const S = T.target.closest("a[href]");
|
|
52387
52387
|
if (!S || !x.view.dom.contains(S)) return !1;
|
|
52388
52388
|
const M = S.getAttribute("href");
|
|
52389
|
-
return !M?.startsWith("hnmagic:") || !xr(M) ? !1 : (
|
|
52389
|
+
return !M?.startsWith("hnmagic:") || !xr(M) ? !1 : (T.preventDefault(), !0);
|
|
52390
52390
|
}, k = n?.sessionKey !== p;
|
|
52391
52391
|
return /* @__PURE__ */ He(mi, { children: [
|
|
52392
52392
|
k && /* @__PURE__ */ X(
|
|
@@ -52423,8 +52423,8 @@ function rV(t) {
|
|
|
52423
52423
|
className: y === "dark" ? "hn-editor hn-editor--dark" : "hn-editor hn-editor--light",
|
|
52424
52424
|
onClickCapture: w,
|
|
52425
52425
|
onAuxClickCapture: w,
|
|
52426
|
-
onKeyDownCapture: (
|
|
52427
|
-
|
|
52426
|
+
onKeyDownCapture: (T) => {
|
|
52427
|
+
T.key !== "Enter" && T.key !== " " || w(T) && (f?.hasActivate || T.stopPropagation());
|
|
52428
52428
|
},
|
|
52429
52429
|
children: [
|
|
52430
52430
|
/* @__PURE__ */ X(jm, { editor: i?.session.editor ?? null }),
|
|
@@ -52442,7 +52442,7 @@ function rV(t) {
|
|
|
52442
52442
|
installer: i.session.pictureUpload,
|
|
52443
52443
|
anchor: s.anchor,
|
|
52444
52444
|
...s.uploadId ? { uploadId: s.uploadId } : {},
|
|
52445
|
-
onConfirm: (
|
|
52445
|
+
onConfirm: (T) => i.session.confirmPictureDialog(T),
|
|
52446
52446
|
onClose: () => i.session.closePictureDialog()
|
|
52447
52447
|
}
|
|
52448
52448
|
),
|
|
@@ -52518,7 +52518,7 @@ const q7 = `
|
|
|
52518
52518
|
const g = f.current;
|
|
52519
52519
|
if (!g || !u) return;
|
|
52520
52520
|
const y = g.ownerDocument.defaultView, w = () => {
|
|
52521
|
-
const
|
|
52521
|
+
const T = parseFloat(y.getComputedStyle(g)[p]), x = Number.isFinite(T) ? T : 16 + m, S = o === "floating" ? g.getBoundingClientRect().height + x : g.getBoundingClientRect().height, M = {
|
|
52522
52522
|
top: p === "top" ? S : 0,
|
|
52523
52523
|
bottom: p === "bottom" ? S : 0
|
|
52524
52524
|
};
|
|
@@ -52614,11 +52614,11 @@ function iV({
|
|
|
52614
52614
|
const f = c.current, h = r.current;
|
|
52615
52615
|
if (!f || !h) return;
|
|
52616
52616
|
const p = h.ownerDocument.defaultView, m = h.ownerDocument, g = () => {
|
|
52617
|
-
const I = p.visualViewport, D = (i.current?.closest("[data-pane-toolbar-boundary]") ?? i.current?.parentElement)?.getBoundingClientRect(),
|
|
52617
|
+
const I = p.visualViewport, D = (i.current?.closest("[data-pane-toolbar-boundary]") ?? i.current?.parentElement)?.getBoundingClientRect(), A = a?.bounds ? {
|
|
52618
52618
|
...a.bounds,
|
|
52619
52619
|
right: a.bounds.left + a.bounds.width,
|
|
52620
52620
|
bottom: a.bounds.top + a.bounds.height
|
|
52621
|
-
} : D,
|
|
52621
|
+
} : D, E = I?.offsetTop ?? 0, L = E + (I?.height ?? p.innerHeight), $ = Math.max(E, A?.top ?? E), H = Math.min(L, A?.bottom ?? L), B = Math.max(I?.offsetLeft ?? 0, A?.left ?? 0) + 8, R = Math.min((I?.offsetLeft ?? 0) + (I?.width ?? p.innerWidth), A?.right ?? p.innerWidth) - 8, j = $ + 8, q = H - 8, P = Math.max(0, Math.min(288, R - B)), Z = h.getBoundingClientRect(), Ce = Math.max(j, Math.min(Z.top - 8, q)), z = Math.max(j, Math.min(Z.bottom + 8, q)), oe = a?.edge === "top", Me = oe ? q - z : Ce - j, xe = oe ? Ce - j : q - z, Ae = Me >= Math.min(100, f.scrollHeight) || Me >= xe ? oe : !oe, ze = Math.max(Me, xe) < Math.min(100, f.scrollHeight), Fe = ze ? j : Ae ? z : j, qe = ze || Ae ? q : Ce, Ne = Math.max(0, qe - Fe), Et = Math.min(f.scrollHeight, Ne);
|
|
52622
52622
|
d({
|
|
52623
52623
|
left: Math.max(B, Math.min(Z.left, R - P)),
|
|
52624
52624
|
top: Ae ? Fe : Math.max(j, qe - Et),
|
|
@@ -52638,22 +52638,22 @@ function iV({
|
|
|
52638
52638
|
}, k = (I) => {
|
|
52639
52639
|
I.target instanceof Node && !f.contains(I.target) && !i.current?.contains(I.target) && o(!1);
|
|
52640
52640
|
};
|
|
52641
|
-
let
|
|
52641
|
+
let T;
|
|
52642
52642
|
const x = () => {
|
|
52643
|
-
|
|
52643
|
+
T = void 0;
|
|
52644
52644
|
const I = m.activeElement;
|
|
52645
52645
|
f.contains(I) || o(!I || I === m.body);
|
|
52646
52646
|
}, S = (I) => {
|
|
52647
52647
|
if (I.key === "Tab" && f.contains(m.activeElement)) {
|
|
52648
|
-
p.clearTimeout(
|
|
52648
|
+
p.clearTimeout(T), T = p.setTimeout(x, 0);
|
|
52649
52649
|
return;
|
|
52650
52650
|
}
|
|
52651
52651
|
I.key === "Escape" && (I.preventDefault(), o(!0));
|
|
52652
52652
|
}, M = () => {
|
|
52653
|
-
|
|
52653
|
+
T === void 0 ? o(!1) : (p.clearTimeout(T), x());
|
|
52654
52654
|
};
|
|
52655
52655
|
return m.addEventListener("pointerdown", w, !0), m.addEventListener("focusin", k), m.addEventListener("keydown", S), p.addEventListener("blur", M), p.addEventListener("resize", g), p.addEventListener("scroll", g, !0), p.visualViewport?.addEventListener("resize", g), p.visualViewport?.addEventListener("scroll", g), n ? f.querySelector('[role^="menuitem"]:not(:disabled)')?.focus() : f.querySelector('input:not([type="radio"]),input[type="radio"]:checked,select,button')?.focus(), () => {
|
|
52656
|
-
p.clearTimeout(
|
|
52656
|
+
p.clearTimeout(T), y?.disconnect(), m.removeEventListener("pointerdown", w, !0), m.removeEventListener("focusin", k), m.removeEventListener("keydown", S), p.removeEventListener("blur", M), p.removeEventListener("resize", g), p.removeEventListener("scroll", g, !0), p.visualViewport?.removeEventListener("resize", g), p.visualViewport?.removeEventListener("scroll", g);
|
|
52657
52657
|
};
|
|
52658
52658
|
}, [r, i, n, o, a]), /* @__PURE__ */ He("div", {
|
|
52659
52659
|
ref: c,
|
|
@@ -52691,7 +52691,7 @@ function sV({
|
|
|
52691
52691
|
layout: s,
|
|
52692
52692
|
onOpen: a
|
|
52693
52693
|
}) {
|
|
52694
|
-
const l = te(null), c = te(null), u = Ah(), [d, f] = Ue(null), [h, p] = Ue(!1), [m, g] = Ue(""), y = te(!1), w = te(0), k = te(!1),
|
|
52694
|
+
const l = te(null), c = te(null), u = Ah(), [d, f] = Ue(null), [h, p] = Ue(!1), [m, g] = Ue(""), y = te(!1), w = te(0), k = te(!1), T = Ve((I) => {
|
|
52695
52695
|
w.current++, f(null), g(""), k.current = I;
|
|
52696
52696
|
}, []);
|
|
52697
52697
|
Pt(() => {
|
|
@@ -52703,22 +52703,22 @@ function sV({
|
|
|
52703
52703
|
const D = O ? o : i;
|
|
52704
52704
|
if (d === null || r || y.current) return;
|
|
52705
52705
|
if (!O && I === e) {
|
|
52706
|
-
|
|
52706
|
+
T(!0);
|
|
52707
52707
|
return;
|
|
52708
52708
|
}
|
|
52709
52709
|
if (!D || O && (!t || t.length <= 1)) return;
|
|
52710
|
-
const
|
|
52710
|
+
const A = w.current;
|
|
52711
52711
|
y.current = !0, p(!0), g("");
|
|
52712
52712
|
try {
|
|
52713
|
-
const
|
|
52713
|
+
const E = await D({
|
|
52714
52714
|
fileKey: I,
|
|
52715
52715
|
paneId: d,
|
|
52716
52716
|
requestId: `${u}-${++oV}`
|
|
52717
52717
|
});
|
|
52718
|
-
if (
|
|
52719
|
-
|
|
52720
|
-
} catch (
|
|
52721
|
-
|
|
52718
|
+
if (A !== w.current) return;
|
|
52719
|
+
E.status === "success" ? T(!0) : E.status === "failed" && g(E.message);
|
|
52720
|
+
} catch (E) {
|
|
52721
|
+
A === w.current && g(E instanceof Error ? E.message : "文件操作失败,请重试");
|
|
52722
52722
|
} finally {
|
|
52723
52723
|
y.current = !1, p(!1);
|
|
52724
52724
|
}
|
|
@@ -52742,7 +52742,7 @@ function sV({
|
|
|
52742
52742
|
"aria-haspopup": "menu",
|
|
52743
52743
|
"aria-expanded": d !== null,
|
|
52744
52744
|
"aria-controls": d !== null ? u : void 0,
|
|
52745
|
-
onClick: () => d === null ? x() :
|
|
52745
|
+
onClick: () => d === null ? x() : T(!1),
|
|
52746
52746
|
onKeyDown: (I) => {
|
|
52747
52747
|
(I.key === "ArrowDown" || I.key === "ArrowUp") && (I.preventDefault(), x());
|
|
52748
52748
|
},
|
|
@@ -52772,7 +52772,7 @@ function sV({
|
|
|
52772
52772
|
anchor: c,
|
|
52773
52773
|
boundary: l,
|
|
52774
52774
|
layout: s,
|
|
52775
|
-
onClose:
|
|
52775
|
+
onClose: T,
|
|
52776
52776
|
children: [t.length === 0 ? /* @__PURE__ */ X("p", {
|
|
52777
52777
|
role: "status",
|
|
52778
52778
|
children: "没有可切换的文件"
|
|
@@ -52861,7 +52861,7 @@ function aV({
|
|
|
52861
52861
|
placement: "floating",
|
|
52862
52862
|
layout: s,
|
|
52863
52863
|
label: "笔记工具",
|
|
52864
|
-
onOccupiedSpaceChange: h,
|
|
52864
|
+
...h ? { onOccupiedSpaceChange: h } : {},
|
|
52865
52865
|
children: g
|
|
52866
52866
|
}
|
|
52867
52867
|
) });
|
|
@@ -52922,39 +52922,39 @@ function gV({
|
|
|
52922
52922
|
onRequestRemove: a,
|
|
52923
52923
|
layout: l
|
|
52924
52924
|
}) {
|
|
52925
|
-
const c = hm(V7), u = cV(c), [d, f] = Ue(null)
|
|
52925
|
+
const c = hm(V7), u = cV(c), [d, f] = Ue(null);
|
|
52926
52926
|
Pt(() => {
|
|
52927
52927
|
if (!c || c.getState().lifecycle !== "ready") {
|
|
52928
52928
|
f(null);
|
|
52929
52929
|
return;
|
|
52930
52930
|
}
|
|
52931
|
-
const
|
|
52932
|
-
return f(
|
|
52931
|
+
const g = c.attachView(t);
|
|
52932
|
+
return f(g), () => c.detachView(t, g);
|
|
52933
52933
|
}, [c, t]);
|
|
52934
|
-
const
|
|
52934
|
+
const h = rr(() => c ? {
|
|
52935
52935
|
read: () => c.readDraft(t),
|
|
52936
|
-
write: (
|
|
52937
|
-
open: (
|
|
52936
|
+
write: (g) => c.writeDraft(t, g),
|
|
52937
|
+
open: (g) => c.beginDraft(t, g),
|
|
52938
52938
|
change: () => c.updateDraft("editing", !0),
|
|
52939
52939
|
validating: () => c.updateDraft("validating", !1),
|
|
52940
52940
|
invalid: () => c.updateDraft("invalid", !1),
|
|
52941
52941
|
canInput: () => c.draftInputAllowed(),
|
|
52942
|
-
commit: (
|
|
52942
|
+
commit: (g) => c.commitDraft(g),
|
|
52943
52943
|
close: () => c.endDraft()
|
|
52944
|
-
} : void 0, [c, t]),
|
|
52944
|
+
} : void 0, [c, t]), p = !u || u.inputFrozen || u.draft.phase !== "none", m = c?.pictureDialogForView(t) ?? null;
|
|
52945
52945
|
return /* @__PURE__ */ He(
|
|
52946
52946
|
"div",
|
|
52947
52947
|
{
|
|
52948
52948
|
className: `hn-editor hn-editor--${e}`,
|
|
52949
52949
|
"data-view-id": t,
|
|
52950
|
-
onClickCapture: (
|
|
52951
|
-
if (!(
|
|
52952
|
-
const
|
|
52953
|
-
|
|
52950
|
+
onClickCapture: (g) => {
|
|
52951
|
+
if (!(g.target instanceof Element)) return;
|
|
52952
|
+
const w = g.target.closest("a[href]")?.getAttribute("href");
|
|
52953
|
+
w?.startsWith("hnmagic:") && xr(w) && g.preventDefault();
|
|
52954
52954
|
},
|
|
52955
52955
|
children: [
|
|
52956
|
-
/* @__PURE__ */ He("div", {
|
|
52957
|
-
/* @__PURE__ */ He("div", { inert:
|
|
52956
|
+
/* @__PURE__ */ He("div", { children: [
|
|
52957
|
+
/* @__PURE__ */ He("div", { inert: p, children: [
|
|
52958
52958
|
/* @__PURE__ */ X(jm, { editor: d?.editor ?? null }),
|
|
52959
52959
|
d?.references && /* @__PURE__ */ X(z6, { editor: d.editor, installer: d.references })
|
|
52960
52960
|
] }),
|
|
@@ -52963,13 +52963,13 @@ function gV({
|
|
|
52963
52963
|
{
|
|
52964
52964
|
installer: d.pictureUpload,
|
|
52965
52965
|
theme: e,
|
|
52966
|
-
disabled:
|
|
52967
|
-
...
|
|
52966
|
+
disabled: p,
|
|
52967
|
+
...m?.uploadId ? { excludeUploadId: m.uploadId } : {}
|
|
52968
52968
|
}
|
|
52969
52969
|
)
|
|
52970
52970
|
] }),
|
|
52971
52971
|
d && c && /* @__PURE__ */ He(mi, { children: [
|
|
52972
|
-
/* @__PURE__ */ X(O6, { editor: d.editor, theme: e, coordinator:
|
|
52972
|
+
/* @__PURE__ */ X(O6, { editor: d.editor, theme: e, coordinator: h, inputFrozen: u?.inputFrozen ?? !1 }),
|
|
52973
52973
|
/* @__PURE__ */ X(
|
|
52974
52974
|
aV,
|
|
52975
52975
|
{
|
|
@@ -52980,24 +52980,23 @@ function gV({
|
|
|
52980
52980
|
onSelectFile: s,
|
|
52981
52981
|
onRequestRemove: a,
|
|
52982
52982
|
layout: l,
|
|
52983
|
-
locked:
|
|
52983
|
+
locked: p,
|
|
52984
52984
|
saveDisabled: u?.lifecycle !== "ready",
|
|
52985
52985
|
status: u ? { clean: "已保存", dirty: "待保存", pending: "保存中", blocked: "暂不能保存", failure: "保存失败" }[u.save] : "",
|
|
52986
52986
|
onUndo: () => c.history(t, !1),
|
|
52987
52987
|
onRedo: () => c.history(t, !0),
|
|
52988
52988
|
onSave: () => {
|
|
52989
52989
|
c.controller.requestSave({ reason: "editor-button", expectedSessionId: c.identity.sessionId });
|
|
52990
|
-
}
|
|
52991
|
-
onOccupiedSpaceChange: (w) => p((k) => k.top === w.top && k.bottom === w.bottom ? k : w)
|
|
52990
|
+
}
|
|
52992
52991
|
}
|
|
52993
52992
|
),
|
|
52994
|
-
|
|
52993
|
+
m && d.pictureUpload && /* @__PURE__ */ X(
|
|
52995
52994
|
H7,
|
|
52996
52995
|
{
|
|
52997
52996
|
installer: d.pictureUpload,
|
|
52998
|
-
anchor:
|
|
52999
|
-
...
|
|
53000
|
-
onConfirm: (
|
|
52997
|
+
anchor: m.anchor,
|
|
52998
|
+
...m.uploadId ? { uploadId: m.uploadId } : {},
|
|
52999
|
+
onConfirm: (g) => c.confirmPictureDialog(t, g),
|
|
53001
53000
|
onClose: () => c.closePictureDialog(t)
|
|
53002
53001
|
}
|
|
53003
53002
|
)
|