zt-react-milkdown 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -53996,8 +53996,12 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
53996
53996
  return uJ.find((e) => t.has(e)) || "paragraph";
53997
53997
  }, mJ = /Mac|iPhone|iPad|iPod/, hJ = {
53998
53998
  paragraph: {
53999
- key: "0",
54000
- code: "Digit0"
53999
+ key: "p",
54000
+ code: "KeyP",
54001
+ modeOverrides: { modAlt: {
54002
+ key: "0",
54003
+ code: "Digit0"
54004
+ } }
54001
54005
  },
54002
54006
  heading1: {
54003
54007
  key: "1",
@@ -54063,25 +54067,25 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54063
54067
  key: "i",
54064
54068
  code: "KeyI"
54065
54069
  }
54066
- }, gJ = {
54070
+ }, gJ = (e) => Object.fromEntries(Object.entries(hJ).map(([t, n]) => [t, n.modeOverrides?.[e] ?? n])), _J = {
54067
54071
  Mod: "Ctrl",
54068
54072
  Alt: "Alt",
54069
54073
  Shift: "Shift"
54070
- }, _J = {
54074
+ }, vJ = {
54071
54075
  Mod: "⌘",
54072
54076
  Alt: "⌥",
54073
54077
  Shift: "⇧"
54074
- }, vJ = () => typeof navigator < "u" && mJ.test(navigator.platform), yJ = (e) => {
54075
- let t = e === "modAlt" ? "Mod-Alt" : "Mod-Shift";
54076
- return Object.fromEntries(Object.entries(hJ).map(([e, n]) => [e, `${t}-${n.key}`]));
54077
- }, bJ = (e) => {
54078
- let t = vJ(), n = t ? _J : gJ;
54079
- return e.split("-").map((e) => n[e] ?? e.toUpperCase()).join(t ? "" : "+");
54078
+ }, yJ = () => typeof navigator < "u" && mJ.test(navigator.platform), bJ = (e) => {
54079
+ let t = e === "modAlt" ? "Mod-Alt" : "Mod-Shift", n = gJ(e);
54080
+ return Object.fromEntries(Object.entries(n).map(([e, n]) => [e, `${t}-${n.key}`]));
54080
54081
  }, xJ = (e) => {
54081
- let t = yJ(e);
54082
- return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, bJ(t)]));
54082
+ let t = yJ(), n = t ? vJ : _J;
54083
+ return e.split("-").map((e) => n[e] ?? e.toUpperCase()).join(t ? "" : "+");
54083
54084
  }, SJ = (e) => {
54084
- let t = xJ(e);
54085
+ let t = bJ(e);
54086
+ return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, xJ(t)]));
54087
+ }, CJ = (e) => {
54088
+ let t = SJ(e);
54085
54089
  return {
54086
54090
  paragraph: t.paragraph,
54087
54091
  heading1: t.heading1,
@@ -54096,8 +54100,8 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54096
54100
  blockquote: t.blockquote,
54097
54101
  codeBlock: t.codeBlock
54098
54102
  };
54099
- }, CJ = (e, t) => {
54100
- let n = yJ(t);
54103
+ }, wJ = (e, t) => {
54104
+ let n = bJ(t);
54101
54105
  e.update(eD.key, (e) => ({
54102
54106
  ...e,
54103
54107
  TurnIntoText: {
@@ -54161,13 +54165,13 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54161
54165
  shortcuts: n.inlineCode
54162
54166
  }
54163
54167
  }));
54164
- }, wJ = (e) => {
54165
- let t = yJ(e).taskList;
54168
+ }, TJ = (e) => {
54169
+ let t = bJ(e).taskList;
54166
54170
  return zw("taskListTransform", { WrapInTaskList: {
54167
54171
  shortcuts: t,
54168
54172
  command: () => (e, t, n) => n ? dJ(n, "taskList") : !1
54169
54173
  } });
54170
- }, TJ = "zt-md-selection-tooltip", EJ = (e) => [
54174
+ }, EJ = "zt-md-selection-tooltip", DJ = (e) => [
54171
54175
  {
54172
54176
  command: "strong",
54173
54177
  icon: ye,
@@ -54198,7 +54202,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54198
54202
  title: e.selectionTooltipLinkTitle,
54199
54203
  markNames: ["link"]
54200
54204
  }
54201
- ], DJ = {
54205
+ ], OJ = {
54202
54206
  paragraph: it,
54203
54207
  heading1: je,
54204
54208
  heading2: Me,
@@ -54211,107 +54215,107 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54211
54215
  taskList: He,
54212
54216
  blockquote: nt,
54213
54217
  codeBlock: Ee
54214
- }, OJ = (e, t) => {
54215
- let n = SJ(t);
54218
+ }, kJ = (e, t) => {
54219
+ let n = CJ(t);
54216
54220
  return [
54217
54221
  {
54218
54222
  command: "paragraph",
54219
- icon: DJ.paragraph,
54223
+ icon: OJ.paragraph,
54220
54224
  label: e.selectionTooltipTransformParagraphLabel,
54221
54225
  shortcut: n.paragraph
54222
54226
  },
54223
54227
  {
54224
54228
  command: "heading1",
54225
- icon: DJ.heading1,
54229
+ icon: OJ.heading1,
54226
54230
  label: e.selectionTooltipTransformHeading1Label,
54227
54231
  shortcut: n.heading1
54228
54232
  },
54229
54233
  {
54230
54234
  command: "heading2",
54231
- icon: DJ.heading2,
54235
+ icon: OJ.heading2,
54232
54236
  label: e.selectionTooltipTransformHeading2Label,
54233
54237
  shortcut: n.heading2
54234
54238
  },
54235
54239
  {
54236
54240
  command: "heading3",
54237
- icon: DJ.heading3,
54241
+ icon: OJ.heading3,
54238
54242
  label: e.selectionTooltipTransformHeading3Label,
54239
54243
  shortcut: n.heading3
54240
54244
  },
54241
54245
  {
54242
54246
  command: "heading4",
54243
- icon: DJ.heading4,
54247
+ icon: OJ.heading4,
54244
54248
  label: e.selectionTooltipTransformHeading4Label,
54245
54249
  shortcut: n.heading4
54246
54250
  },
54247
54251
  {
54248
54252
  command: "heading5",
54249
- icon: DJ.heading5,
54253
+ icon: OJ.heading5,
54250
54254
  label: e.selectionTooltipTransformHeading5Label,
54251
54255
  shortcut: n.heading5
54252
54256
  },
54253
54257
  {
54254
54258
  command: "heading6",
54255
- icon: DJ.heading6,
54259
+ icon: OJ.heading6,
54256
54260
  label: e.selectionTooltipTransformHeading6Label,
54257
54261
  shortcut: n.heading6
54258
54262
  },
54259
54263
  {
54260
54264
  command: "bulletList",
54261
- icon: DJ.bulletList,
54265
+ icon: OJ.bulletList,
54262
54266
  label: e.selectionTooltipTransformBulletListLabel,
54263
54267
  shortcut: n.bulletList
54264
54268
  },
54265
54269
  {
54266
54270
  command: "orderedList",
54267
- icon: DJ.orderedList,
54271
+ icon: OJ.orderedList,
54268
54272
  label: e.selectionTooltipTransformOrderedListLabel,
54269
54273
  shortcut: n.orderedList
54270
54274
  },
54271
54275
  {
54272
54276
  command: "taskList",
54273
- icon: DJ.taskList,
54277
+ icon: OJ.taskList,
54274
54278
  label: e.selectionTooltipTransformTaskListLabel,
54275
54279
  shortcut: n.taskList
54276
54280
  },
54277
54281
  {
54278
54282
  command: "blockquote",
54279
- icon: DJ.blockquote,
54283
+ icon: OJ.blockquote,
54280
54284
  label: e.selectionTooltipTransformBlockquoteLabel,
54281
54285
  shortcut: n.blockquote
54282
54286
  },
54283
54287
  {
54284
54288
  command: "codeBlock",
54285
- icon: DJ.codeBlock,
54289
+ icon: OJ.codeBlock,
54286
54290
  label: e.selectionTooltipTransformCodeBlockLabel,
54287
54291
  shortcut: n.codeBlock
54288
54292
  }
54289
54293
  ];
54290
- }, kJ = (e) => typeof e.props.editable == "function" ? e.props.editable(e.state) : e.editable, AJ = (e, t) => {
54294
+ }, AJ = (e) => typeof e.props.editable == "function" ? e.props.editable(e.state) : e.editable, jJ = (e, t) => {
54291
54295
  let n = e.state.schema.marks, r = t.find((e) => n[e]);
54292
54296
  return r ? n[r] ?? null : null;
54293
- }, jJ = (e, t) => {
54297
+ }, MJ = (e, t) => {
54294
54298
  let { from: n, to: r } = e.selection;
54295
54299
  return e.doc.rangeHasMark(n, r, t);
54296
- }, MJ = (e, t) => {
54300
+ }, NJ = (e, t) => {
54297
54301
  let { from: n, to: r } = e.selection, i = "";
54298
54302
  return e.doc.nodesBetween(n, r, (e) => {
54299
54303
  let n = e.marks.find((e) => e.type === t);
54300
54304
  return n ? (i = typeof n.attrs.href == "string" ? n.attrs.href : "", !1) : !0;
54301
54305
  }), i;
54302
- }, NJ = (e) => {
54303
- O_(e.markType)(e.view.state, e.view.dispatch, e.view), e.view.focus();
54304
54306
  }, PJ = (e) => {
54307
+ O_(e.markType)(e.view.state, e.view.dispatch, e.view), e.view.focus();
54308
+ }, FJ = (e) => {
54305
54309
  e.toggleLinkPopover(e.view);
54306
- }, FJ = (e, t) => {
54310
+ }, IJ = (e, t) => {
54307
54311
  ({
54308
- strong: NJ,
54309
- em: NJ,
54310
- strike: NJ,
54311
- inlineCode: NJ,
54312
- link: PJ
54312
+ strong: PJ,
54313
+ em: PJ,
54314
+ strike: PJ,
54315
+ inlineCode: PJ,
54316
+ link: FJ
54313
54317
  })[e](t);
54314
- }, IJ = (e, t, n, r, a) => {
54318
+ }, LJ = (e, t, n, r, a) => {
54315
54319
  let o = document.createElement("button");
54316
54320
  o.type = "button", o.className = "zt-md-selection-tooltip-button", o.dataset.command = e.command, o.title = e.title, o.setAttribute("aria-label", e.title);
54317
54321
  let s = document.createElement("span");
@@ -54325,19 +54329,19 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54325
54329
  }), o.addEventListener("click", (i) => {
54326
54330
  i.preventDefault();
54327
54331
  let a = n();
54328
- !a || a.state.selection.empty || FJ(e.command, {
54332
+ !a || a.state.selection.empty || IJ(e.command, {
54329
54333
  view: a,
54330
54334
  markType: t,
54331
54335
  toggleLinkPopover: r
54332
54336
  });
54333
54337
  }), o;
54334
- }, LJ = (e, t, n, r, i, a) => {
54338
+ }, RJ = (e, t, n, r, i, a) => {
54335
54339
  let o = document.createElement("div");
54336
54340
  return o.className = "zt-md-selection-tooltip", o.append(i), t.forEach((t) => {
54337
- let i = AJ(e, t.markNames);
54338
- i && t.command !== "link" && o.append(IJ(t, i, n, r, a));
54341
+ let i = jJ(e, t.markNames);
54342
+ i && t.command !== "link" && o.append(LJ(t, i, n, r, a));
54339
54343
  }), o;
54340
- }, RJ = (e) => {
54344
+ }, zJ = (e) => {
54341
54345
  let t = Oq({
54342
54346
  open: e.open,
54343
54347
  portalContainer: e.portalContainer,
@@ -54396,7 +54400,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54396
54400
  "aria-hidden": "true"
54397
54401
  }), i("span", { className: "zt-md-selection-transform-item-label" }, t.label), i("kbd", { className: "zt-md-selection-transform-item-shortcut" }, t.shortcut));
54398
54402
  }))));
54399
- }, zJ = (e) => {
54403
+ }, BJ = (e) => {
54400
54404
  let [t, r] = f(""), a = d(null), o = (e) => {
54401
54405
  e.preventDefault();
54402
54406
  }, s = (t) => {
@@ -54405,7 +54409,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54405
54409
  e.onOpenChange(!1);
54406
54410
  return;
54407
54411
  }
54408
- let r = AJ(n, ["link"]);
54412
+ let r = jJ(n, ["link"]);
54409
54413
  if (!r) {
54410
54414
  e.onOpenChange(!1);
54411
54415
  return;
@@ -54417,12 +54421,12 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54417
54421
  e.onOpenChange(!1);
54418
54422
  return;
54419
54423
  }
54420
- let n = e.getCurrentView(), i = n ? AJ(n, ["link"]) : null;
54424
+ let n = e.getCurrentView(), i = n ? jJ(n, ["link"]) : null;
54421
54425
  if (!n || !i || n.state.selection.empty) {
54422
54426
  e.onOpenChange(!1);
54423
54427
  return;
54424
54428
  }
54425
- r(AF(MJ(n.state, i))), e.onOpenChange(!0);
54429
+ r(AF(NJ(n.state, i))), e.onOpenChange(!0);
54426
54430
  }, u = Oq({
54427
54431
  open: e.open,
54428
54432
  portalContainer: e.portalContainer,
@@ -54435,7 +54439,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54435
54439
  });
54436
54440
  return c(() => {
54437
54441
  if (!e.open) return;
54438
- let t = e.getCurrentView(), n = t ? AJ(t, ["link"]) : null;
54442
+ let t = e.getCurrentView(), n = t ? jJ(t, ["link"]) : null;
54439
54443
  (!t || !n || t.state.selection.empty) && e.onOpenChange(!1);
54440
54444
  }, [
54441
54445
  e.open,
@@ -54497,21 +54501,21 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54497
54501
  size: e.iconSize,
54498
54502
  strokeWidth: e.iconStrokeWidth
54499
54503
  })))));
54500
- }, BJ = (e, t, n) => {
54504
+ }, VJ = (e, t, n) => {
54501
54505
  n.forEach((n) => {
54502
- let r = AJ(t, n.markNames);
54506
+ let r = jJ(t, n.markNames);
54503
54507
  if (!r) return;
54504
54508
  let i = e.querySelector(`[data-command="${n.command}"]`);
54505
- i instanceof HTMLButtonElement && (i.dataset.active = jJ(t.state, r) ? "true" : "false");
54509
+ i instanceof HTMLButtonElement && (i.dataset.active = MJ(t.state, r) ? "true" : "false");
54506
54510
  });
54507
- }, VJ = (e) => {
54511
+ }, HJ = (e) => {
54508
54512
  let { from: t, to: n } = e.state.selection, r = !1;
54509
54513
  return e.state.doc.nodesBetween(t, n, (e) => e.type.name === "code_block" ? (r = !0, !1) : !0), r;
54510
- }, HJ = (e, t, n) => (r) => {
54514
+ }, UJ = (e, t, n) => (r) => {
54511
54515
  let { selection: i, doc: a } = r.state, o = e.contains(document.activeElement);
54512
- return !kJ(r) || i.empty || !(i instanceof N) || !r.hasFocus() && !o && !t() && !n() || VJ(r) ? !1 : e.childElementCount > 0 && a.textBetween(i.from, i.to).trim().length > 0;
54513
- }, UJ = (e, t, n, r) => {
54514
- let a = EJ(n), o = OJ(n, r), s = e, c = !1, l = !1, u = !1, d = [], f = document.createElement("span"), p = b(f), m = document.createElement("span"), h = null, g = b(m), _ = t.closest(".zt-md-editor"), v = (e) => {
54516
+ return !AJ(r) || i.empty || !(i instanceof N) || !r.hasFocus() && !o && !t() && !n() || HJ(r) ? !1 : e.childElementCount > 0 && a.textBetween(i.from, i.to).trim().length > 0;
54517
+ }, WJ = (e, t, n, r) => {
54518
+ let a = DJ(n), o = kJ(n, r), s = e, c = !1, l = !1, u = !1, d = [], f = document.createElement("span"), p = b(f), m = document.createElement("span"), h = null, g = b(m), _ = t.closest(".zt-md-editor"), v = (e) => {
54515
54519
  c !== e && (c = e, C());
54516
54520
  }, y = (e) => {
54517
54521
  l !== e && (l = e, S());
@@ -54519,7 +54523,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54519
54523
  e.state.selection.empty || v(!c);
54520
54524
  }, S = () => {
54521
54525
  let e = s ? fJ(s) : new Set(["paragraph"]), r = s ? pJ(s) : "paragraph", a = o.find((e) => e.command === r) ?? o[0];
54522
- p.render(i(RJ, {
54526
+ p.render(i(zJ, {
54523
54527
  getCurrentView: () => s,
54524
54528
  portalContainer: t,
54525
54529
  collisionBoundary: _,
@@ -54533,7 +54537,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54533
54537
  activeCommands: e
54534
54538
  }));
54535
54539
  }, C = () => {
54536
- g.render(i(zJ, {
54540
+ g.render(i(BJ, {
54537
54541
  getCurrentView: () => s,
54538
54542
  portalContainer: t,
54539
54543
  collisionBoundary: _,
@@ -54546,9 +54550,9 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54546
54550
  onOpenChange: v,
54547
54551
  messages: n
54548
54552
  }));
54549
- }, w = LJ(e, a, () => s, x, f, d);
54550
- S(), AJ(e, ["link"]) && (w.append(m), C());
54551
- let T = HJ(w, () => c, () => l), E = new aJ({
54553
+ }, w = RJ(e, a, () => s, x, f, d);
54554
+ S(), jJ(e, ["link"]) && (w.append(m), C());
54555
+ let T = UJ(w, () => c, () => l), E = new aJ({
54552
54556
  content: w,
54553
54557
  debounce: 80,
54554
54558
  offset: 8,
@@ -54572,9 +54576,9 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54572
54576
  };
54573
54577
  return e.dom.addEventListener("blur", ie), document.addEventListener("mousedown", ae, !0), {
54574
54578
  update: (e, t) => {
54575
- if (s = e, s.state.selection.empty && (v(!1), y(!1)), BJ(w, s, a), S(), h) {
54576
- let e = AJ(s, ["link"]);
54577
- h.dataset.active = e && jJ(s.state, e) ? "true" : "false";
54579
+ if (s = e, s.state.selection.empty && (v(!1), y(!1)), VJ(w, s, a), S(), h) {
54580
+ let e = jJ(s, ["link"]);
54581
+ h.dataset.active = e && MJ(s.state, e) ? "true" : "false";
54578
54582
  }
54579
54583
  if (!T(s)) {
54580
54584
  E.hide(), te();
@@ -54588,21 +54592,21 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54588
54592
  }), E.destroy(), w.remove();
54589
54593
  }
54590
54594
  };
54591
- }, WJ = (e, t, n) => Pw(() => new Xu({
54592
- key: new $u(TJ),
54593
- view: (r) => UJ(r, e, t, n)
54594
- })), GJ = (e, t) => e(t.state, t.dispatch, t), KJ = (e) => {
54595
+ }, GJ = (e, t, n) => Pw(() => new Xu({
54596
+ key: new $u(EJ),
54597
+ view: (r) => WJ(r, e, t, n)
54598
+ })), KJ = (e, t) => e(t.state, t.dispatch, t), qJ = (e) => {
54595
54599
  let t = e?.state?.selection?.$from;
54596
54600
  if (!t) return !1;
54597
54601
  for (let e = t.depth; e > 0; --e) if (t.node(e)?.type?.name === "table") return !0;
54598
54602
  return !1;
54599
- }, qJ = (e, t) => {
54603
+ }, JJ = (e, t) => {
54600
54604
  let n = e?.state?.doc;
54601
54605
  if (!n || typeof t != "number") return -1;
54602
54606
  let r = Math.min(Math.max(t, 0), n.content.size), i = n.resolve(r);
54603
54607
  for (let e = i.depth; e > 0; --e) if (i.node(e)?.type?.name === "table") return i.before(e);
54604
54608
  return -1;
54605
- }, JJ = (e, t, n, r) => {
54609
+ }, YJ = (e, t, n, r) => {
54606
54610
  let i = e?.state?.schema?.nodes;
54607
54611
  if (!i) return null;
54608
54612
  let a = i.table, o = i.table_header_row, s = i.table_row, c = i.table_header, l = i.table_cell;
@@ -54612,21 +54616,21 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54612
54616
  return i.create(null, u);
54613
54617
  });
54614
54618
  return a.create(null, f);
54615
- }, YJ = (e) => {
54616
- if (!e?.state || !e?.dispatch || KJ(e)) return !1;
54617
- let t = e.state.selection.from, n = JJ(e, 3, 3, !0);
54619
+ }, XJ = (e) => {
54620
+ if (!e?.state || !e?.dispatch || qJ(e)) return !1;
54621
+ let t = e.state.selection.from, n = YJ(e, 3, 3, !0);
54618
54622
  if (!n) return !1;
54619
54623
  e.dispatch(e.state.tr.replaceSelectionWith(n).scrollIntoView());
54620
- let r = qJ(e, t);
54621
- if (r < 0 && t > 0 && (r = qJ(e, t - 1)), r < 0) return !0;
54624
+ let r = JJ(e, t);
54625
+ if (r < 0 && t > 0 && (r = JJ(e, t - 1)), r < 0) return !0;
54622
54626
  let i = r + 2;
54623
54627
  if (i > e.state.doc.content.size) return !0;
54624
54628
  let a = N.near(e.state.doc.resolve(i), 1);
54625
54629
  return e.dispatch(e.state.tr.setSelection(a).scrollIntoView()), e.focus(), !0;
54626
- }, XJ = (e, t) => {
54630
+ }, ZJ = (e, t) => {
54627
54631
  let n = e?.state?.schema?.marks ?? {}, r = t.find((e) => n[e]);
54628
54632
  return r ? n[r] ?? null : null;
54629
- }, ZJ = new Set([
54633
+ }, QJ = new Set([
54630
54634
  "paragraph",
54631
54635
  "heading1",
54632
54636
  "heading2",
@@ -54639,10 +54643,10 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54639
54643
  "taskList",
54640
54644
  "blockquote",
54641
54645
  "codeBlock"
54642
- ]), QJ = (e) => ZJ.has(e), $J = {
54646
+ ]), $J = (e) => QJ.has(e), eY = {
54643
54647
  inlineCode: (e) => {
54644
- let t = XJ(e, ["inlineCode", "code_inline"]);
54645
- return t ? GJ(O_(t), e) : !1;
54648
+ let t = ZJ(e, ["inlineCode", "code_inline"]);
54649
+ return t ? KJ(O_(t), e) : !1;
54646
54650
  },
54647
54651
  inlineMath: (e) => {
54648
54652
  let t = e?.state?.schema?.nodes?.math_inline;
@@ -54655,7 +54659,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54655
54659
  },
54656
54660
  mathBlock: (e) => {
54657
54661
  let t = e.state.schema.nodes?.math_block;
54658
- if (!t || !GJ(T_(t), e)) return !1;
54662
+ if (!t || !KJ(T_(t), e)) return !1;
54659
54663
  let n = e.state.selection?.$from;
54660
54664
  if (!n) return !0;
54661
54665
  let r = null;
@@ -54667,8 +54671,8 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54667
54671
  let i = P.create(e.state.doc, r);
54668
54672
  return e.dispatch(e.state.tr.setSelection(i).scrollIntoView()), !0;
54669
54673
  },
54670
- table: YJ
54671
- }, eY = (e, t) => !e?.state || !e?.dispatch ? !1 : QJ(t) ? dJ(e, t) : t === "image" ? !1 : $J[t](e), tY = (e) => typeof e?.props?.editable == "function" ? e.props.editable(e.state) : !!e?.editable, nY = [
54674
+ table: XJ
54675
+ }, tY = (e, t) => !e?.state || !e?.dispatch ? !1 : $J(t) ? dJ(e, t) : t === "image" ? !1 : eY[t](e), nY = (e) => typeof e?.props?.editable == "function" ? e.props.editable(e.state) : !!e?.editable, rY = [
54672
54676
  {
54673
54677
  id: "paragraph",
54674
54678
  label: "普通文本",
@@ -54788,7 +54792,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54788
54792
  icon: "Image",
54789
54793
  command: "image"
54790
54794
  }
54791
- ], rY = [
54795
+ ], iY = [
54792
54796
  {
54793
54797
  id: "paragraph",
54794
54798
  label: "Paragraph",
@@ -54908,7 +54912,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54908
54912
  icon: "Image",
54909
54913
  command: "image"
54910
54914
  }
54911
- ], iY = (e, t = "zh-CN") => e?.items && e.items.length > 0 ? e.items : t === "en-US" ? rY : nY, aY = (e) => {
54915
+ ], aY = (e, t = "zh-CN") => e?.items && e.items.length > 0 ? e.items : t === "en-US" ? iY : rY, oY = (e) => {
54912
54916
  let t = e?.state?.selection?.$from;
54913
54917
  if (!t) return !1;
54914
54918
  let n = String(t.parent?.type?.name ?? "");
@@ -54918,17 +54922,17 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54918
54922
  if (n === "table" || n === "table_cell" || n === "table_header") return !0;
54919
54923
  }
54920
54924
  return !1;
54921
- }, oY = (e) => {
54925
+ }, sY = (e) => {
54922
54926
  let t = e?.state, n = t?.selection?.$from;
54923
54927
  if (!t || !n) return "";
54924
54928
  let r = n.start(), i = n.pos;
54925
54929
  return t.doc.textBetween(r, i, "\n", "\n");
54926
- }, sY = (e) => {
54927
- let t = oY(e), n = t.lastIndexOf("/");
54930
+ }, cY = (e) => {
54931
+ let t = sY(e), n = t.lastIndexOf("/");
54928
54932
  if (n < 0) return null;
54929
54933
  let r = t.slice(n + 1);
54930
54934
  return /\s/.test(r) ? null : r;
54931
- }, cY = (e, t) => {
54935
+ }, lY = (e, t) => {
54932
54936
  if (t === null || t.length === 0) return e;
54933
54937
  let n = t.toLowerCase();
54934
54938
  return e.filter((e) => [
@@ -54937,24 +54941,24 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54937
54941
  e.command,
54938
54942
  e.id
54939
54943
  ].some((e) => String(e).toLowerCase().startsWith(n)));
54940
- }, lY = (e, t) => {
54941
- if (!tY(e)) return {
54944
+ }, uY = (e, t) => {
54945
+ if (!nY(e)) return {
54942
54946
  visibleItems: [],
54943
54947
  shouldShow: !1
54944
54948
  };
54945
- let n = sY(e), r = cY(t, n);
54949
+ let n = cY(e), r = lY(t, n);
54946
54950
  return {
54947
54951
  visibleItems: r,
54948
- shouldShow: !aY(e) && n !== null && r.length > 0
54952
+ shouldShow: !oY(e) && n !== null && r.length > 0
54949
54953
  };
54950
- }, uY = (e) => {
54954
+ }, dY = (e) => {
54951
54955
  let t = e?.state, n = t?.selection?.$from;
54952
54956
  if (!t || !n || !e?.dispatch) return !1;
54953
54957
  let r = n.start(), i = n.pos, a = t.doc.textBetween(r, i, "\n", "\n").lastIndexOf("/");
54954
54958
  if (a < 0) return !1;
54955
54959
  let o = r + a, s = t.tr.delete(o, i);
54956
54960
  return e.dispatch(s.scrollIntoView()), !0;
54957
- }, dY = {
54961
+ }, fY = {
54958
54962
  Type: it,
54959
54963
  Heading1: je,
54960
54964
  Heading2: Me,
@@ -54972,7 +54976,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54972
54976
  TextQuote: nt,
54973
54977
  Sigma: Je,
54974
54978
  Table: Qe
54975
- }, fY = Te, pY = (e, t, n, r, a) => {
54979
+ }, pY = Te, mY = (e, t, n, r, a) => {
54976
54980
  r.splice(0).forEach((e) => {
54977
54981
  e.unmount();
54978
54982
  }), e.innerHTML = "";
@@ -54986,7 +54990,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54986
54990
  c.className = "slash-menu-item", c.dataset.command = t.command, c.dataset.selected = s === n ? "true" : "false";
54987
54991
  let l = document.createElement("span");
54988
54992
  l.className = "slash-menu-item-icon";
54989
- let u = t.icon ? dY[t.icon] ?? fY : null;
54993
+ let u = t.icon ? fY[t.icon] ?? pY : null;
54990
54994
  if (u) {
54991
54995
  let e = b(l);
54992
54996
  e.render(i(u, {
@@ -54999,10 +55003,10 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
54999
55003
  let f = a[t.command], p = f ? document.createElement("kbd") : null;
55000
55004
  p && (p.className = "slash-menu-item-shortcut", p.textContent = f), c.appendChild(l), c.appendChild(d), p && c.appendChild(p), e.appendChild(c);
55001
55005
  });
55002
- }, mY = (e, t) => {
55006
+ }, hY = (e, t) => {
55003
55007
  let n = document.createElement("div");
55004
55008
  n.className = "slash-menu", n.style.display = "none", e.appendChild(n);
55005
- let r = !1, i = "", a = !1, o = null, s = [], c = xJ(t), l = () => {
55009
+ let r = !1, i = "", a = !1, o = null, s = [], c = SJ(t), l = () => {
55006
55010
  if (!r || !o) return;
55007
55011
  let { editorWrapper: t, anchorTopInContent: i, anchorBottomInContent: a, anchorLeftInContent: s, placement: c, offsetY: l } = o, u = Tq({
55008
55012
  wrapper: t,
@@ -55036,7 +55040,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
55036
55040
  },
55037
55041
  renderIfNeeded: (e, t) => {
55038
55042
  let r = `${e.map((e) => e.command).join("|")}::${t}`;
55039
- i !== r && (pY(n, e, t, s, c), i = r);
55043
+ i !== r && (mY(n, e, t, s, c), i = r);
55040
55044
  },
55041
55045
  scrollActiveItemIntoView: (e) => {
55042
55046
  let t = n.querySelector(".slash-menu-item[data-selected=\"true\"]");
@@ -55058,7 +55062,7 @@ var pq = /* @__PURE__ */ new Set(), mq = !1, hq = () => typeof document < "u", g
55058
55062
  };
55059
55063
  //#endregion
55060
55064
  //#region node_modules/.pnpm/@milkdown+plugin-slash@7.21.1/node_modules/@milkdown/plugin-slash/lib/index.js
55061
- function hY(e) {
55065
+ function gY(e) {
55062
55066
  let t = Iw({}, `${e}_SLASH_SPEC`), n = Pw((n) => {
55063
55067
  let r = n.get(t.key);
55064
55068
  return new Xu({
@@ -55076,29 +55080,29 @@ function hY(e) {
55076
55080
  }
55077
55081
  //#endregion
55078
55082
  //#region src/plugins/custom/slash-menu/slash-menu.ts
55079
- var gY = (e, t) => {
55083
+ var _Y = (e, t) => {
55080
55084
  if (!(!e || typeof e != "object")) return e[t];
55081
- }, _Y = () => {
55082
- if (typeof hY != "function") return console.error("[zt-md/slash] slashFactory not found"), null;
55083
- let e = hY("zt-md-slash"), t = Array.isArray(e) ? e[0] : void 0, n = Array.isArray(e) ? e[1] : e, r = Array.isArray(e) ? e[2] : void 0;
55085
+ }, vY = () => {
55086
+ if (typeof gY != "function") return console.error("[zt-md/slash] slashFactory not found"), null;
55087
+ let e = gY("zt-md-slash"), t = Array.isArray(e) ? e[0] : void 0, n = Array.isArray(e) ? e[1] : e, r = Array.isArray(e) ? e[2] : void 0;
55084
55088
  if (!n) return null;
55085
- let i = Array.isArray(e) ? e.filter((e, t) => t < 2 && e != null) : [n], a = gY(t, "key") ?? gY(n, "key") ?? gY(r, "key") ?? gY(e, "key");
55089
+ let i = Array.isArray(e) ? e.filter((e, t) => t < 2 && e != null) : [n], a = _Y(t, "key") ?? _Y(n, "key") ?? _Y(r, "key") ?? _Y(e, "key");
55086
55090
  return i.length === 0 || a === void 0 ? null : {
55087
55091
  plugins: i,
55088
55092
  key: a
55089
55093
  };
55090
- }, vY = (e, t, n, r, i = "zh-CN", a = "modShift") => {
55094
+ }, yY = (e, t, n, r, i = "zh-CN", a = "modShift") => {
55091
55095
  if (t?.enabled === !1) return {
55092
55096
  plugins: [],
55093
55097
  config: null
55094
55098
  };
55095
55099
  try {
55096
- let o = _Y();
55100
+ let o = vY();
55097
55101
  if (!o) return {
55098
55102
  plugins: [],
55099
55103
  config: null
55100
55104
  };
55101
- let s = iY(t, i), c = mY(e, a), l = 0, u = null, d = s, f = !1, p = new Set([
55105
+ let s = aY(t, i), c = hY(e, a), l = 0, u = null, d = s, f = !1, p = new Set([
55102
55106
  "ArrowDown",
55103
55107
  "ArrowUp",
55104
55108
  "Enter",
@@ -55113,11 +55117,11 @@ var gY = (e, t) => {
55113
55117
  let n = e?.coordsAtPos?.(t);
55114
55118
  return n ? new DOMRect(n.left, n.top, Math.max(n.right - n.left, 1), n.bottom - n.top) : null;
55115
55119
  }, g = (e) => {
55116
- if (!tY(e)) {
55120
+ if (!nY(e)) {
55117
55121
  d = [], f = !1, c.updatePositionContext(null), c.setVisible(!1);
55118
55122
  return;
55119
55123
  }
55120
- let t = lY(e, s);
55124
+ let t = uY(e, s);
55121
55125
  if (d = t.visibleItems, f = t.shouldShow, t.shouldShow && l >= d.length && (l = 0), t.shouldShow && !c.isVisible() && (l = 0), !t.shouldShow) {
55122
55126
  c.updatePositionContext(null), c.setVisible(!1);
55123
55127
  return;
@@ -55138,13 +55142,13 @@ var gY = (e, t) => {
55138
55142
  c.updatePosition();
55139
55143
  });
55140
55144
  }, _ = () => {
55141
- if (!tY(u)) {
55145
+ if (!nY(u)) {
55142
55146
  f = !1, c.updatePositionContext(null), c.setVisible(!1);
55143
55147
  return;
55144
55148
  }
55145
55149
  if (!u || l < 0 || l >= d.length) return;
55146
55150
  let t = d[l];
55147
- if (uY(u)) {
55151
+ if (dY(u)) {
55148
55152
  if (t.command === "image") {
55149
55153
  c.setVisible(!1), n && YI({
55150
55154
  portalContainer: e,
@@ -55154,7 +55158,7 @@ var gY = (e, t) => {
55154
55158
  });
55155
55159
  return;
55156
55160
  }
55157
- eY(u, t.command) && (c.setVisible(!1), t.command === "mathBlock" && queueMicrotask(() => {
55161
+ tY(u, t.command) && (c.setVisible(!1), t.command === "mathBlock" && queueMicrotask(() => {
55158
55162
  let e = u?.dom?.querySelector?.(".zt-md-math-block-editing .zt-md-math-block-textarea");
55159
55163
  !e || document.activeElement === e || e.focus();
55160
55164
  }));
@@ -55188,17 +55192,20 @@ var gY = (e, t) => {
55188
55192
  config: null
55189
55193
  };
55190
55194
  }
55191
- }, yY = /Mac|iPhone|iPad|iPod/, bY = Object.fromEntries(Object.entries(hJ).map(([e, t]) => [t.code, e])), xY = (e, t) => (typeof navigator < "u" && yY.test(navigator.platform) ? e.metaKey && !e.ctrlKey : e.ctrlKey && !e.metaKey) ? t === "modAlt" ? e.altKey && !e.shiftKey : e.shiftKey && !e.altKey : !1, SY = (e, t, n, r) => (YI({
55195
+ }, bY = /Mac|iPhone|iPad|iPod/, xY = (e, t) => (typeof navigator < "u" && bY.test(navigator.platform) ? e.metaKey && !e.ctrlKey : e.ctrlKey && !e.metaKey) ? t === "modAlt" ? e.altKey && !e.shiftKey : e.shiftKey && !e.altKey : !1, SY = (e, t, n, r) => (YI({
55192
55196
  portalContainer: t,
55193
55197
  view: e,
55194
55198
  messages: n,
55195
55199
  imageUpload: r
55196
- }), !0), CY = (e, t, n, r) => (i, a) => {
55197
- if (a.isComposing || !xY(a, n) || !tY(i)) return !1;
55198
- let o = bY[a.code];
55199
- if (!o) return !1;
55200
- let s = o === "image" ? SY(i, e, t, r) : eY(i, o);
55201
- return s && a.preventDefault(), s;
55200
+ }), !0), CY = (e, t, n, r) => {
55201
+ let i = gJ(n), a = Object.fromEntries(Object.entries(i).map(([e, t]) => [t.code, e]));
55202
+ return (i, o) => {
55203
+ if (o.isComposing || !xY(o, n) || !nY(i)) return !1;
55204
+ let s = a[o.code];
55205
+ if (!s) return !1;
55206
+ let c = s === "image" ? SY(i, e, t, r) : tY(i, s);
55207
+ return c && o.preventDefault(), c;
55208
+ };
55202
55209
  }, wY = "table", TY = "ArrowUp", EY = (e) => e.key !== TY || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey, DY = (e, t) => {
55203
55210
  let n = t.nodeBefore;
55204
55211
  return !n || n.type.name !== wY ? null : {
@@ -56312,10 +56319,10 @@ var ZZ = XZ(!0, !0), QZ = (e, t) => {
56312
56319
  let r = AF(n.getAttribute("href"));
56313
56320
  return !r || t || !e.ctrlKey ? !1 : (e.preventDefault(), e.stopPropagation(), window.open(r, "_blank", "noopener,noreferrer"), !0);
56314
56321
  }, gQ = (e, t) => !t || !pQ(e) ? !1 : (e.preventDefault(), e.stopPropagation(), !0), _Q = (e) => {
56315
- let t = e.messages ?? SF(), n = uX(e.contentPortalContainer, t), r = WJ(e.contentPortalContainer, t, e.shortcutMode), i = Gq(t, e.contentPortalContainer), a = kU(t, e.contentPortalContainer), o = II(e.imageUpload, t), s = dQ(e.onSearchSnapshotChange), c = vY(e.portalContainer, e.slashMenu, t, e.imageUpload, e.locale, e.shortcutMode), l = c.plugins, u = CY(e.portalContainer, t, e.shortcutMode, e.imageUpload), d = {
56322
+ let t = e.messages ?? SF(), n = uX(e.contentPortalContainer, t), r = GJ(e.contentPortalContainer, t, e.shortcutMode), i = Gq(t, e.contentPortalContainer), a = kU(t, e.contentPortalContainer), o = II(e.imageUpload, t), s = dQ(e.onSearchSnapshotChange), c = yY(e.portalContainer, e.slashMenu, t, e.imageUpload, e.locale, e.shortcutMode), l = c.plugins, u = CY(e.portalContainer, t, e.shortcutMode, e.imageUpload), d = {
56316
56323
  listener: mE,
56317
56324
  commonmark: yO,
56318
- taskListTransformKeymap: wJ(e.shortcutMode),
56325
+ taskListTransformKeymap: TJ(e.shortcutMode),
56319
56326
  inlineCodeBoundaryNavigation: EZ,
56320
56327
  gfm: IN,
56321
56328
  history: wT,
@@ -56345,7 +56352,7 @@ var ZZ = XZ(!0, !0), QZ = (e, t) => {
56345
56352
  slash: l.length > 0 ? l : null
56346
56353
  }, f = zN(d, { includeRuntime: !1 }), p = zN(d, { includeRuntime: !0 }).filter((e) => e.name === "clipboard" || e.name === "indent"), m = Ew.make();
56347
56354
  m.config((n) => {
56348
- CJ(n, e.shortcutMode), GW(n), UF(n, e.imageUpload?.allowedProtocols), n.set(vw, e.root), n.set(iw, e.markdown), n.set(_w, {
56355
+ wJ(n, e.shortcutMode), GW(n), UF(n, e.imageUpload?.allowedProtocols), n.set(vw, e.root), n.set(iw, e.markdown), n.set(_w, {
56349
56356
  editable: () => !e.readOnly,
56350
56357
  handleKeyDown: u,
56351
56358
  handleDOMEvents: {