@jvs-milkdown/crepe 1.2.18 → 1.2.20

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/lib/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import { languages } from '@codemirror/language-data';
4
4
  import { oneDark } from '@codemirror/theme-one-dark';
5
5
  import { createSlice } from '@jvs-milkdown/kit/ctx';
6
6
  import { $ctx, $nodeSchema, $view, $remark, $markAttr, $markSchema, $command, $prose, $useKeymap, getMarkdown, $inputRule } from '@jvs-milkdown/kit/utils';
7
- import { defineComponent, shallowRef, ref, computed, h, createApp, watchEffect, watch, onUnmounted, Fragment, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue';
7
+ import { defineComponent, shallowRef, ref, computed, h as h$1, createApp, watchEffect, watch, onUnmounted, Fragment, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue';
8
8
  import { Icon } from '@jvs-milkdown/kit/component';
9
9
  import { blockConfig, block, BlockProvider } from '@jvs-milkdown/kit/plugin/block';
10
10
  import { commandsCtx, editorViewCtx, schemaCtx, editorCtx, EditorStatus, parserCtx, editorViewOptionsCtx, Editor, rootCtx, defaultValueCtx } from '@jvs-milkdown/kit/core';
@@ -1238,7 +1238,7 @@ const MilkdownAttachmentBlock = defineComponent({
1238
1238
  return () => {
1239
1239
  var _a;
1240
1240
  if (!((_a = src.value) == null ? void 0 : _a.length)) {
1241
- return /* @__PURE__ */ h(
1241
+ return /* @__PURE__ */ h$1(
1242
1242
  "div",
1243
1243
  {
1244
1244
  class: [
@@ -1246,7 +1246,7 @@ const MilkdownAttachmentBlock = defineComponent({
1246
1246
  props.selected.value ? "selected" : ""
1247
1247
  ]
1248
1248
  },
1249
- /* @__PURE__ */ h("div", { class: "milkdown-attachment-uploader", onClick: triggerUpload }, /* @__PURE__ */ h(Icon, { icon: fileLinkIcon }), /* @__PURE__ */ h("span", { class: "milkdown-attachment-upload-text" }, isUploading.value ? "Uploading..." : props.config.uploadButton), /* @__PURE__ */ h(
1249
+ /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-uploader", onClick: triggerUpload }, /* @__PURE__ */ h$1(Icon, { icon: fileLinkIcon }), /* @__PURE__ */ h$1("span", { class: "milkdown-attachment-upload-text" }, isUploading.value ? "Uploading..." : props.config.uploadButton), /* @__PURE__ */ h$1(
1250
1250
  "input",
1251
1251
  {
1252
1252
  type: "file",
@@ -1260,7 +1260,7 @@ const MilkdownAttachmentBlock = defineComponent({
1260
1260
  if (isVideo.value) {
1261
1261
  const savedWidth = videoWidth.value;
1262
1262
  const widthStyle = isResizing.value && currentWidth.value > 0 ? `${currentWidth.value}px` : savedWidth && savedWidth > 0 ? `${savedWidth}px` : "100%";
1263
- return /* @__PURE__ */ h(
1263
+ return /* @__PURE__ */ h$1(
1264
1264
  "div",
1265
1265
  {
1266
1266
  ref: videoWrapperRef,
@@ -1274,7 +1274,7 @@ const MilkdownAttachmentBlock = defineComponent({
1274
1274
  position: "relative"
1275
1275
  }
1276
1276
  },
1277
- /* @__PURE__ */ h(
1277
+ /* @__PURE__ */ h$1(
1278
1278
  "video",
1279
1279
  {
1280
1280
  src: src.value,
@@ -1283,28 +1283,28 @@ const MilkdownAttachmentBlock = defineComponent({
1283
1283
  onMousedown: (e) => e.stopPropagation()
1284
1284
  }
1285
1285
  ),
1286
- /* @__PURE__ */ h(
1286
+ /* @__PURE__ */ h$1(
1287
1287
  "div",
1288
1288
  {
1289
1289
  class: "video-resize-handle top-left",
1290
1290
  onPointerdown: (e) => onResizePointerDown(e, "top-left")
1291
1291
  }
1292
1292
  ),
1293
- /* @__PURE__ */ h(
1293
+ /* @__PURE__ */ h$1(
1294
1294
  "div",
1295
1295
  {
1296
1296
  class: "video-resize-handle top-right",
1297
1297
  onPointerdown: (e) => onResizePointerDown(e, "top-right")
1298
1298
  }
1299
1299
  ),
1300
- /* @__PURE__ */ h(
1300
+ /* @__PURE__ */ h$1(
1301
1301
  "div",
1302
1302
  {
1303
1303
  class: "video-resize-handle bottom-left",
1304
1304
  onPointerdown: (e) => onResizePointerDown(e, "bottom-left")
1305
1305
  }
1306
1306
  ),
1307
- /* @__PURE__ */ h(
1307
+ /* @__PURE__ */ h$1(
1308
1308
  "div",
1309
1309
  {
1310
1310
  class: "video-resize-handle bottom-right",
@@ -1313,7 +1313,7 @@ const MilkdownAttachmentBlock = defineComponent({
1313
1313
  )
1314
1314
  );
1315
1315
  }
1316
- return /* @__PURE__ */ h(
1316
+ return /* @__PURE__ */ h$1(
1317
1317
  "div",
1318
1318
  {
1319
1319
  class: [
@@ -1321,16 +1321,16 @@ const MilkdownAttachmentBlock = defineComponent({
1321
1321
  props.selected.value ? "selected" : ""
1322
1322
  ]
1323
1323
  },
1324
- /* @__PURE__ */ h("div", { class: "milkdown-attachment-icon-wrapper" }, /* @__PURE__ */ h("div", { class: "milkdown-attachment-raw-icon-bg" }, /* @__PURE__ */ h(Icon, { icon: fileLinkIcon }))),
1325
- /* @__PURE__ */ h("div", { class: "milkdown-attachment-info" }, /* @__PURE__ */ h("div", { class: "milkdown-attachment-name" }, name.value), /* @__PURE__ */ h("div", { class: "milkdown-attachment-size" }, (size.value || 0) > 0 ? formatBytes(size.value) : "")),
1326
- /* @__PURE__ */ h(
1324
+ /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-icon-wrapper" }, /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-raw-icon-bg" }, /* @__PURE__ */ h$1(Icon, { icon: fileLinkIcon }))),
1325
+ /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-info" }, /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-name" }, name.value), /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-size" }, (size.value || 0) > 0 ? formatBytes(size.value) : "")),
1326
+ /* @__PURE__ */ h$1(
1327
1327
  "div",
1328
1328
  {
1329
1329
  class: "milkdown-attachment-action",
1330
1330
  onClick: openLink,
1331
1331
  title: props.config.downloadText
1332
1332
  },
1333
- /* @__PURE__ */ h(Icon, { icon: downloadIcon })
1333
+ /* @__PURE__ */ h$1(Icon, { icon: downloadIcon })
1334
1334
  )
1335
1335
  );
1336
1336
  };
@@ -2523,7 +2523,7 @@ function getGroups$1(filter, config, ctx) {
2523
2523
  };
2524
2524
  }
2525
2525
 
2526
- keepAlive(h);
2526
+ keepAlive(h$1);
2527
2527
  const Menu = defineComponent({
2528
2528
  props: {
2529
2529
  ctx: {
@@ -2869,7 +2869,7 @@ const Menu = defineComponent({
2869
2869
  const api = ctx.get(menuAPI.key);
2870
2870
  const showListMenu = (api == null ? void 0 : api.getMode()) === "list" || !(api == null ? void 0 : api.isProgrammatic()) || filter.value !== "";
2871
2871
  if (showListMenu) {
2872
- return /* @__PURE__ */ h("div", { ref: host, onPointerdown: (e) => e.preventDefault() }, /* @__PURE__ */ h("div", { class: "menu-groups", onPointermove: onPointerMove }, groupInfo.value.groups.map((group) => /* @__PURE__ */ h("div", { key: group.key, class: "menu-group" }, /* @__PURE__ */ h("h6", null, group.label), /* @__PURE__ */ h("ul", null, group.items.map((item) => /* @__PURE__ */ h(
2872
+ return /* @__PURE__ */ h$1("div", { ref: host, onPointerdown: (e) => e.preventDefault() }, /* @__PURE__ */ h$1("div", { class: "menu-groups", onPointermove: onPointerMove }, groupInfo.value.groups.map((group) => /* @__PURE__ */ h$1("div", { key: group.key, class: "menu-group" }, /* @__PURE__ */ h$1("h6", null, group.label), /* @__PURE__ */ h$1("ul", null, group.items.map((item) => /* @__PURE__ */ h$1(
2873
2873
  "li",
2874
2874
  {
2875
2875
  key: item.key,
@@ -2912,9 +2912,9 @@ const Menu = defineComponent({
2912
2912
  runByIndex(item.index);
2913
2913
  }
2914
2914
  },
2915
- /* @__PURE__ */ h(Icon, { icon: item.icon }),
2916
- /* @__PURE__ */ h("span", { style: item.key === "table" ? { flex: 1 } : {} }, item.label),
2917
- item.key === "table" ? /* @__PURE__ */ h(
2915
+ /* @__PURE__ */ h$1(Icon, { icon: item.icon }),
2916
+ /* @__PURE__ */ h$1("span", { style: item.key === "table" ? { flex: 1 } : {} }, item.label),
2917
+ item.key === "table" ? /* @__PURE__ */ h$1(
2918
2918
  "div",
2919
2919
  {
2920
2920
  style: {
@@ -2924,9 +2924,9 @@ const Menu = defineComponent({
2924
2924
  transform: "rotate(-90deg)"
2925
2925
  }
2926
2926
  },
2927
- /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
2927
+ /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
2928
2928
  ) : null
2929
- )))))), showTableMenu.value ? /* @__PURE__ */ h(
2929
+ )))))), showTableMenu.value ? /* @__PURE__ */ h$1(
2930
2930
  "div",
2931
2931
  {
2932
2932
  class: "milkdown-slash-menu custom-submenu",
@@ -2949,7 +2949,7 @@ const Menu = defineComponent({
2949
2949
  },
2950
2950
  onPointerleave: handleTableLeave
2951
2951
  },
2952
- /* @__PURE__ */ h(
2952
+ /* @__PURE__ */ h$1(
2953
2953
  "div",
2954
2954
  {
2955
2955
  style: {
@@ -2961,7 +2961,7 @@ const Menu = defineComponent({
2961
2961
  },
2962
2962
  i18n(ctx, "customMenu.insertTable")
2963
2963
  ),
2964
- /* @__PURE__ */ h(
2964
+ /* @__PURE__ */ h$1(
2965
2965
  "div",
2966
2966
  {
2967
2967
  style: {
@@ -2974,7 +2974,7 @@ const Menu = defineComponent({
2974
2974
  Array.from({ length: 9 }).map(
2975
2975
  (_, r) => Array.from({ length: 9 }).map((_2, c) => {
2976
2976
  const isHovered = r < tableHoverIndices.value.r && c < tableHoverIndices.value.c;
2977
- return /* @__PURE__ */ h(
2977
+ return /* @__PURE__ */ h$1(
2978
2978
  "div",
2979
2979
  {
2980
2980
  key: `cell-${r}-${c}`,
@@ -3003,7 +3003,7 @@ const Menu = defineComponent({
3003
3003
  })
3004
3004
  )
3005
3005
  ),
3006
- tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h(
3006
+ tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h$1(
3007
3007
  "div",
3008
3008
  {
3009
3009
  style: {
@@ -3016,7 +3016,7 @@ const Menu = defineComponent({
3016
3016
  tableHoverIndices.value.r,
3017
3017
  " x ",
3018
3018
  tableHoverIndices.value.c
3019
- ) : /* @__PURE__ */ h(
3019
+ ) : /* @__PURE__ */ h$1(
3020
3020
  "div",
3021
3021
  {
3022
3022
  style: {
@@ -3205,7 +3205,7 @@ const Menu = defineComponent({
3205
3205
  const renderGridBtn = (key) => {
3206
3206
  const item = findItem(key);
3207
3207
  if (!item) return null;
3208
- return /* @__PURE__ */ h(
3208
+ return /* @__PURE__ */ h$1(
3209
3209
  "div",
3210
3210
  {
3211
3211
  title: item.label,
@@ -3226,11 +3226,11 @@ const Menu = defineComponent({
3226
3226
  },
3227
3227
  "data-index": item.index
3228
3228
  },
3229
- /* @__PURE__ */ h(Icon, { icon: item.icon })
3229
+ /* @__PURE__ */ h$1(Icon, { icon: item.icon })
3230
3230
  );
3231
3231
  };
3232
3232
  const renderCustomRow = (iconHtml, label, hasArrow, onPointerEnter, onPointerLeave, onClick) => {
3233
- return /* @__PURE__ */ h(
3233
+ return /* @__PURE__ */ h$1(
3234
3234
  "div",
3235
3235
  {
3236
3236
  class: "custom-menu-row",
@@ -3246,12 +3246,12 @@ const Menu = defineComponent({
3246
3246
  onClick == null ? void 0 : onClick();
3247
3247
  }
3248
3248
  },
3249
- /* @__PURE__ */ h("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h(Icon, { icon: iconHtml }), /* @__PURE__ */ h("span", null, label)),
3250
- hasArrow ? /* @__PURE__ */ h(Icon, { icon: chevronDownIcon }) : null
3249
+ /* @__PURE__ */ h$1("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h$1(Icon, { icon: iconHtml }), /* @__PURE__ */ h$1("span", null, label)),
3250
+ hasArrow ? /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon }) : null
3251
3251
  );
3252
3252
  };
3253
3253
  const renderSubMenuItem = (iconHtml, label, isActive, onClick, disabled = false) => {
3254
- return /* @__PURE__ */ h(
3254
+ return /* @__PURE__ */ h$1(
3255
3255
  "div",
3256
3256
  {
3257
3257
  class: ["custom-menu-row", disabled ? "disabled" : ""],
@@ -3269,7 +3269,7 @@ const Menu = defineComponent({
3269
3269
  if (!disabled) onClick();
3270
3270
  }
3271
3271
  },
3272
- /* @__PURE__ */ h("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h(Icon, { icon: iconHtml }), /* @__PURE__ */ h(
3272
+ /* @__PURE__ */ h$1("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h$1(Icon, { icon: iconHtml }), /* @__PURE__ */ h$1(
3273
3273
  "span",
3274
3274
  {
3275
3275
  style: {
@@ -3278,18 +3278,18 @@ const Menu = defineComponent({
3278
3278
  },
3279
3279
  label
3280
3280
  )),
3281
- isActive ? /* @__PURE__ */ h("span", { style: { color: "var(--crepe-color-primary)" } }, /* @__PURE__ */ h(Icon, { icon: confirmIcon })) : null
3281
+ isActive ? /* @__PURE__ */ h$1("span", { style: { color: "var(--crepe-color-primary)" } }, /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })) : null
3282
3282
  );
3283
3283
  };
3284
- return /* @__PURE__ */ h(
3284
+ return /* @__PURE__ */ h$1(
3285
3285
  "div",
3286
3286
  {
3287
3287
  ref: host,
3288
3288
  onPointerdown: (e) => e.preventDefault(),
3289
3289
  class: "custom-block-menu"
3290
3290
  },
3291
- !isMedia ? /* @__PURE__ */ h("div", { class: "custom-grid-container" }, gridRows.map((rowKeys, rIndex) => /* @__PURE__ */ h("div", { class: "custom-grid-row", key: "row-" + rIndex }, rowKeys.map(renderGridBtn)))) : null,
3292
- showAlign ? /* @__PURE__ */ h("div", { class: "custom-divider" }) : null,
3291
+ !isMedia ? /* @__PURE__ */ h$1("div", { class: "custom-grid-container" }, gridRows.map((rowKeys, rIndex) => /* @__PURE__ */ h$1("div", { class: "custom-grid-row", key: "row-" + rIndex }, rowKeys.map(renderGridBtn)))) : null,
3292
+ showAlign ? /* @__PURE__ */ h$1("div", { class: "custom-divider" }) : null,
3293
3293
  showAlign && renderCustomRow(
3294
3294
  alignLeftIcon,
3295
3295
  i18n(ctx, "customMenu.indentAndAlign"),
@@ -3297,7 +3297,7 @@ const Menu = defineComponent({
3297
3297
  handleIndentAlignEnter,
3298
3298
  handleIndentAlignLeave
3299
3299
  ),
3300
- showIndentAlignMenu.value ? /* @__PURE__ */ h(
3300
+ showIndentAlignMenu.value ? /* @__PURE__ */ h$1(
3301
3301
  "div",
3302
3302
  {
3303
3303
  class: "milkdown-slash-menu custom-submenu",
@@ -3334,7 +3334,7 @@ const Menu = defineComponent({
3334
3334
  currentAlign === "right",
3335
3335
  () => setAlign("right")
3336
3336
  ),
3337
- /* @__PURE__ */ h("div", { class: "custom-divider" }),
3337
+ /* @__PURE__ */ h$1("div", { class: "custom-divider" }),
3338
3338
  renderSubMenuItem(
3339
3339
  indentIncreaseIcon,
3340
3340
  i18n(ctx, "customMenu.increaseIndent"),
@@ -3356,7 +3356,7 @@ const Menu = defineComponent({
3356
3356
  handleColorEnter,
3357
3357
  handleColorLeave
3358
3358
  ),
3359
- showColorMenu.value ? /* @__PURE__ */ h(
3359
+ showColorMenu.value ? /* @__PURE__ */ h$1(
3360
3360
  "div",
3361
3361
  {
3362
3362
  class: "milkdown-slash-menu custom-submenu",
@@ -3380,7 +3380,7 @@ const Menu = defineComponent({
3380
3380
  },
3381
3381
  onPointerleave: handleColorLeave
3382
3382
  },
3383
- /* @__PURE__ */ h(
3383
+ /* @__PURE__ */ h$1(
3384
3384
  "div",
3385
3385
  {
3386
3386
  style: {
@@ -3391,7 +3391,7 @@ const Menu = defineComponent({
3391
3391
  },
3392
3392
  i18n(ctx, "customMenu.textColor")
3393
3393
  ),
3394
- /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
3394
+ /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
3395
3395
  "#000000",
3396
3396
  "#8C8C8C",
3397
3397
  "#F5222D",
@@ -3400,7 +3400,7 @@ const Menu = defineComponent({
3400
3400
  "#52C41A",
3401
3401
  "#1677FF",
3402
3402
  "#722ED1"
3403
- ].map((color) => /* @__PURE__ */ h(
3403
+ ].map((color) => /* @__PURE__ */ h$1(
3404
3404
  "div",
3405
3405
  {
3406
3406
  key: color,
@@ -3430,7 +3430,7 @@ const Menu = defineComponent({
3430
3430
  },
3431
3431
  "A"
3432
3432
  ))),
3433
- /* @__PURE__ */ h(
3433
+ /* @__PURE__ */ h$1(
3434
3434
  "div",
3435
3435
  {
3436
3436
  style: {
@@ -3442,7 +3442,7 @@ const Menu = defineComponent({
3442
3442
  },
3443
3443
  i18n(ctx, "customMenu.bgColor")
3444
3444
  ),
3445
- /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
3445
+ /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
3446
3446
  "transparent",
3447
3447
  "#F5F5F5",
3448
3448
  "#FFCCC7",
@@ -3451,7 +3451,7 @@ const Menu = defineComponent({
3451
3451
  "#D9F7BE",
3452
3452
  "#D6E4FF",
3453
3453
  "#EFDBFF"
3454
- ].map((color) => /* @__PURE__ */ h(
3454
+ ].map((color) => /* @__PURE__ */ h$1(
3455
3455
  "div",
3456
3456
  {
3457
3457
  key: color,
@@ -3475,7 +3475,7 @@ const Menu = defineComponent({
3475
3475
  overflow: "hidden"
3476
3476
  }
3477
3477
  },
3478
- color === "transparent" ? /* @__PURE__ */ h(
3478
+ color === "transparent" ? /* @__PURE__ */ h$1(
3479
3479
  "div",
3480
3480
  {
3481
3481
  style: {
@@ -3499,7 +3499,7 @@ const Menu = defineComponent({
3499
3499
  "#52C41A",
3500
3500
  "#1677FF",
3501
3501
  "#722ED1"
3502
- ].map((color) => /* @__PURE__ */ h(
3502
+ ].map((color) => /* @__PURE__ */ h$1(
3503
3503
  "div",
3504
3504
  {
3505
3505
  key: color,
@@ -3522,7 +3522,7 @@ const Menu = defineComponent({
3522
3522
  }
3523
3523
  }
3524
3524
  ))),
3525
- /* @__PURE__ */ h(
3525
+ /* @__PURE__ */ h$1(
3526
3526
  "button",
3527
3527
  {
3528
3528
  onPointerdown: (e) => {
@@ -3549,7 +3549,7 @@ const Menu = defineComponent({
3549
3549
  i18n(ctx, "customMenu.restoreDefault")
3550
3550
  )
3551
3551
  ) : null,
3552
- !isMedia ? /* @__PURE__ */ h("div", { class: "custom-divider" }) : null,
3552
+ !isMedia ? /* @__PURE__ */ h$1("div", { class: "custom-divider" }) : null,
3553
3553
  renderCustomRow(
3554
3554
  clearIcon,
3555
3555
  i18n(ctx, "customMenu.cut"),
@@ -3574,7 +3574,7 @@ const Menu = defineComponent({
3574
3574
  void 0,
3575
3575
  applyDelete
3576
3576
  ),
3577
- /* @__PURE__ */ h("div", { class: "custom-divider" }),
3577
+ /* @__PURE__ */ h$1("div", { class: "custom-divider" }),
3578
3578
  renderCustomRow(
3579
3579
  plusIcon,
3580
3580
  i18n(ctx, "customMenu.addBelow"),
@@ -3582,7 +3582,7 @@ const Menu = defineComponent({
3582
3582
  handleAddBelowEnter,
3583
3583
  handleAddBelowLeave
3584
3584
  ),
3585
- showAddBelowMenu.value ? /* @__PURE__ */ h(
3585
+ showAddBelowMenu.value ? /* @__PURE__ */ h$1(
3586
3586
  "div",
3587
3587
  {
3588
3588
  class: "milkdown-slash-menu custom-submenu",
@@ -3602,14 +3602,14 @@ const Menu = defineComponent({
3602
3602
  },
3603
3603
  onPointerleave: handleAddBelowLeave
3604
3604
  },
3605
- /* @__PURE__ */ h(
3605
+ /* @__PURE__ */ h$1(
3606
3606
  "div",
3607
3607
  {
3608
3608
  class: "menu-groups",
3609
3609
  onPointermove: onPointerMove,
3610
3610
  style: { maxHeight: "300px", overflowY: "auto" }
3611
3611
  },
3612
- groupInfo.value.groups.map((group) => /* @__PURE__ */ h("div", { key: group.key, class: "menu-group" }, /* @__PURE__ */ h("h6", null, group.label), /* @__PURE__ */ h("ul", null, group.items.map((item) => /* @__PURE__ */ h(
3612
+ groupInfo.value.groups.map((group) => /* @__PURE__ */ h$1("div", { key: group.key, class: "menu-group" }, /* @__PURE__ */ h$1("h6", null, group.label), /* @__PURE__ */ h$1("ul", null, group.items.map((item) => /* @__PURE__ */ h$1(
3613
3613
  "li",
3614
3614
  {
3615
3615
  key: item.key,
@@ -3636,8 +3636,8 @@ const Menu = defineComponent({
3636
3636
  runByIndexForAddBelow(item.index);
3637
3637
  }
3638
3638
  },
3639
- /* @__PURE__ */ h(Icon, { icon: item.icon }),
3640
- /* @__PURE__ */ h("span", null, item.label)
3639
+ /* @__PURE__ */ h$1(Icon, { icon: item.icon }),
3640
+ /* @__PURE__ */ h$1("span", null, item.label)
3641
3641
  )))))
3642
3642
  )
3643
3643
  ) : null
@@ -3885,7 +3885,7 @@ function getBlockKey(node) {
3885
3885
  }
3886
3886
  }
3887
3887
 
3888
- keepAlive(h, Fragment);
3888
+ keepAlive(h$1, Fragment);
3889
3889
  const BlockHandle = defineComponent({
3890
3890
  props: {
3891
3891
  onAdd: {
@@ -3933,7 +3933,7 @@ const BlockHandle = defineComponent({
3933
3933
  const addButton = ref();
3934
3934
  const menuButton = ref();
3935
3935
  return () => {
3936
- return /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
3936
+ return /* @__PURE__ */ h$1(Fragment, null, /* @__PURE__ */ h$1(
3937
3937
  "div",
3938
3938
  {
3939
3939
  ref: addButton,
@@ -3959,8 +3959,8 @@ const BlockHandle = defineComponent({
3959
3959
  props.onAdd(addButton.value);
3960
3960
  }
3961
3961
  },
3962
- /* @__PURE__ */ h(Icon, { icon: props.addIcon })
3963
- ), /* @__PURE__ */ h(
3962
+ /* @__PURE__ */ h$1(Icon, { icon: props.addIcon })
3963
+ ), /* @__PURE__ */ h$1(
3964
3964
  "div",
3965
3965
  {
3966
3966
  ref: menuButton,
@@ -3978,14 +3978,14 @@ const BlockHandle = defineComponent({
3978
3978
  props.onLeaveMenu();
3979
3979
  }
3980
3980
  },
3981
- /* @__PURE__ */ h(Icon, { icon: props.state.icon })
3982
- ), /* @__PURE__ */ h("div", { class: "divider" }), /* @__PURE__ */ h(
3981
+ /* @__PURE__ */ h$1(Icon, { icon: props.state.icon })
3982
+ ), /* @__PURE__ */ h$1("div", { class: "divider" }), /* @__PURE__ */ h$1(
3983
3983
  "div",
3984
3984
  {
3985
3985
  class: "operation-item drag-item",
3986
3986
  title: i18n(props.ctx, "handle.drag")
3987
3987
  },
3988
- /* @__PURE__ */ h(Icon, { icon: dragHandleIcon })
3988
+ /* @__PURE__ */ h$1(Icon, { icon: dragHandleIcon })
3989
3989
  ));
3990
3990
  };
3991
3991
  }
@@ -4881,6 +4881,10 @@ function decrementPopupCount() {
4881
4881
  listeners.forEach((fn) => fn());
4882
4882
  }
4883
4883
  }
4884
+ function resetPopupCount() {
4885
+ _popupCount = 0;
4886
+ listeners.forEach((fn) => fn());
4887
+ }
4884
4888
 
4885
4889
  function getGroups(config, ctx) {
4886
4890
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
@@ -5430,7 +5434,7 @@ const activeIconMap = {
5430
5434
  [dividerIcon]: dividerIconActive
5431
5435
  // [highLineCodeIcon]: highLineCodeIconActive,
5432
5436
  };
5433
- keepAlive(h, Fragment);
5437
+ keepAlive(h$1, Fragment);
5434
5438
  const formatPainterStates = /* @__PURE__ */ new WeakMap();
5435
5439
  const formatPainterHandlers = /* @__PURE__ */ new WeakMap();
5436
5440
  const formatPainterIgnoreNext = /* @__PURE__ */ new WeakMap();
@@ -5736,7 +5740,8 @@ const Toolbar = defineComponent({
5736
5740
  const container = toolbarContainerRef.value;
5737
5741
  if (!isFixed) {
5738
5742
  const view = ctx.get(editorViewCtx);
5739
- container.style.maxWidth = `${view.dom.clientWidth - 32}px`;
5743
+ const containerDOM = view.dom.closest(".milkdown-editor-container") || view.dom.closest(".milkdown") || view.dom;
5744
+ container.style.maxWidth = `${containerDOM.clientWidth - 32}px`;
5740
5745
  }
5741
5746
  let containerWidth;
5742
5747
  if (isFixed) {
@@ -5756,16 +5761,13 @@ const Toolbar = defineComponent({
5756
5761
  }
5757
5762
  } else {
5758
5763
  const view = ctx.get(editorViewCtx);
5759
- containerWidth = view.dom.clientWidth - 32;
5764
+ const containerDOM = view.dom.closest(".milkdown-editor-container") || view.dom.closest(".milkdown") || view.dom;
5765
+ containerWidth = containerDOM.clientWidth - 32;
5760
5766
  }
5761
- if (containerWidth === lastContainerWidth) {
5762
- return;
5763
- }
5764
- lastContainerWidth = containerWidth;
5765
5767
  if (showOverflowMenu.value) {
5766
5768
  showOverflowMenu.value = false;
5767
5769
  }
5768
- const MORE_BUTTON_WIDTH = 44;
5770
+ const MORE_BUTTON_WIDTH = 56;
5769
5771
  const children = Array.from(container.children);
5770
5772
  const toolbarChildren = children.filter(
5771
5773
  (el) => el.style.position !== "fixed" && el.dataset.overflowButton !== "true"
@@ -5775,6 +5777,13 @@ const Toolbar = defineComponent({
5775
5777
  const child = toolbarChildren[i];
5776
5778
  totalWidth += measureChild(child, i);
5777
5779
  }
5780
+ if (totalWidth === 0) {
5781
+ return;
5782
+ }
5783
+ if (containerWidth === lastContainerWidth) {
5784
+ return;
5785
+ }
5786
+ lastContainerWidth = containerWidth;
5778
5787
  if (totalWidth <= containerWidth) {
5779
5788
  overflowVisibleCount.value = Infinity;
5780
5789
  totalSectionCount.value = toolbarChildren.length;
@@ -5967,6 +5976,14 @@ const Toolbar = defineComponent({
5967
5976
  } else {
5968
5977
  const view = ctx.get(editorViewCtx);
5969
5978
  overflowResizeObserver.observe(view.dom);
5979
+ const containerDOM = view.dom.closest(".milkdown-editor-container");
5980
+ if (containerDOM) {
5981
+ overflowResizeObserver.observe(containerDOM);
5982
+ }
5983
+ const rootDOM = view.dom.closest(".milkdown");
5984
+ if (rootDOM) {
5985
+ overflowResizeObserver.observe(rootDOM);
5986
+ }
5970
5987
  }
5971
5988
  computeOverflow();
5972
5989
  };
@@ -5995,6 +6012,20 @@ const Toolbar = defineComponent({
5995
6012
  lastContainerWidth = 0;
5996
6013
  setTimeout(computeOverflow, 0);
5997
6014
  });
6015
+ watch(
6016
+ () => {
6017
+ var _a;
6018
+ return (_a = props.show) == null ? void 0 : _a.value;
6019
+ },
6020
+ (val) => {
6021
+ if (val) {
6022
+ cachedWidths.clear();
6023
+ overflowVisibleCount.value = Infinity;
6024
+ lastContainerWidth = 0;
6025
+ setTimeout(computeOverflow, 0);
6026
+ }
6027
+ }
6028
+ );
5998
6029
  const onClick = (fn) => (e) => {
5999
6030
  e.preventDefault();
6000
6031
  if (ctx) fn(ctx);
@@ -6312,7 +6343,7 @@ const Toolbar = defineComponent({
6312
6343
  showFontSizeMenu.value = false;
6313
6344
  };
6314
6345
  const renderSubMenuItem = (iconHtml, label, isActive, onClick2, disabled = false) => {
6315
- return /* @__PURE__ */ h(
6346
+ return /* @__PURE__ */ h$1(
6316
6347
  "div",
6317
6348
  {
6318
6349
  class: ["custom-menu-row", disabled ? "disabled" : ""],
@@ -6344,13 +6375,13 @@ const Toolbar = defineComponent({
6344
6375
  e.currentTarget.style.backgroundColor = "transparent";
6345
6376
  }
6346
6377
  },
6347
- /* @__PURE__ */ h(
6378
+ /* @__PURE__ */ h$1(
6348
6379
  "div",
6349
6380
  {
6350
6381
  class: "custom-menu-row-left",
6351
6382
  style: { display: "flex", alignItems: "center", gap: "8px" }
6352
6383
  },
6353
- /* @__PURE__ */ h(
6384
+ /* @__PURE__ */ h$1(
6354
6385
  "span",
6355
6386
  {
6356
6387
  style: {
@@ -6362,7 +6393,7 @@ const Toolbar = defineComponent({
6362
6393
  innerHTML: iconHtml
6363
6394
  }
6364
6395
  ),
6365
- /* @__PURE__ */ h(
6396
+ /* @__PURE__ */ h$1(
6366
6397
  "span",
6367
6398
  {
6368
6399
  style: {
@@ -6373,7 +6404,7 @@ const Toolbar = defineComponent({
6373
6404
  label
6374
6405
  )
6375
6406
  ),
6376
- isActive ? /* @__PURE__ */ h(
6407
+ isActive ? /* @__PURE__ */ h$1(
6377
6408
  "span",
6378
6409
  {
6379
6410
  style: {
@@ -6382,7 +6413,7 @@ const Toolbar = defineComponent({
6382
6413
  color: "var(--crepe-color-primary)"
6383
6414
  }
6384
6415
  },
6385
- /* @__PURE__ */ h(Icon, { icon: confirmIcon })
6416
+ /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
6386
6417
  ) : null
6387
6418
  );
6388
6419
  };
@@ -6408,7 +6439,7 @@ const Toolbar = defineComponent({
6408
6439
  });
6409
6440
  const isSectionOverflowed = (idx) => idx >= overflowVisibleCount.value;
6410
6441
  const hasOverflow = overflowVisibleCount.value < totalSectionCount.value;
6411
- return /* @__PURE__ */ h(
6442
+ return /* @__PURE__ */ h$1(
6412
6443
  "div",
6413
6444
  {
6414
6445
  ref: toolbarContainerRef,
@@ -6419,7 +6450,7 @@ const Toolbar = defineComponent({
6419
6450
  overflow: "hidden"
6420
6451
  }
6421
6452
  },
6422
- /* @__PURE__ */ h(
6453
+ /* @__PURE__ */ h$1(
6423
6454
  "div",
6424
6455
  {
6425
6456
  class: "toolbar-item",
@@ -6433,31 +6464,31 @@ const Toolbar = defineComponent({
6433
6464
  flexShrink: 0
6434
6465
  }
6435
6466
  },
6436
- /* @__PURE__ */ h(
6467
+ /* @__PURE__ */ h$1(
6437
6468
  "span",
6438
6469
  {
6439
6470
  style: { display: "inline-flex", alignItems: "center" },
6440
6471
  innerHTML: activeBlockItem.value || textIcon
6441
6472
  }
6442
6473
  ),
6443
- /* @__PURE__ */ h(
6474
+ /* @__PURE__ */ h$1(
6444
6475
  "span",
6445
6476
  {
6446
6477
  style: { width: "20px", display: "flex", alignItems: "center" }
6447
6478
  },
6448
- /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6479
+ /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6449
6480
  )
6450
6481
  ),
6451
- /* @__PURE__ */ h(
6482
+ /* @__PURE__ */ h$1(
6452
6483
  "div",
6453
6484
  {
6454
6485
  style: {
6455
6486
  position: "relative",
6456
- display: isSectionOverflowed(0) ? "none" : "flex",
6487
+ display: isSectionOverflowed(1) ? "none" : "flex",
6457
6488
  flexShrink: 0
6458
6489
  }
6459
6490
  },
6460
- /* @__PURE__ */ h(
6491
+ /* @__PURE__ */ h$1(
6461
6492
  "button",
6462
6493
  {
6463
6494
  type: "button",
@@ -6478,7 +6509,7 @@ const Toolbar = defineComponent({
6478
6509
  backgroundColor: formatPainterState.value ? "var(--crepe-color-selected, var(--crepe-color-hover))" : void 0
6479
6510
  }
6480
6511
  },
6481
- /* @__PURE__ */ h(
6512
+ /* @__PURE__ */ h$1(
6482
6513
  "span",
6483
6514
  {
6484
6515
  style: {
@@ -6491,19 +6522,19 @@ const Toolbar = defineComponent({
6491
6522
  )
6492
6523
  )
6493
6524
  ),
6494
- /* @__PURE__ */ h(
6525
+ /* @__PURE__ */ h$1(
6495
6526
  "div",
6496
6527
  {
6497
6528
  class: "divider",
6498
6529
  style: {
6499
6530
  margin: "0 4px",
6500
6531
  alignSelf: "center",
6501
- display: isSectionOverflowed(1) ? "none" : void 0,
6532
+ display: isSectionOverflowed(2) ? "none" : void 0,
6502
6533
  flexShrink: 0
6503
6534
  }
6504
6535
  }
6505
6536
  ),
6506
- /* @__PURE__ */ h(
6537
+ /* @__PURE__ */ h$1(
6507
6538
  "div",
6508
6539
  {
6509
6540
  class: "toolbar-item custom-font-family-item",
@@ -6511,14 +6542,14 @@ const Toolbar = defineComponent({
6511
6542
  onMouseleave: handleFontFamilyLeave,
6512
6543
  style: {
6513
6544
  position: "relative",
6514
- display: isSectionOverflowed(2) ? "none" : "flex",
6545
+ display: isSectionOverflowed(3) ? "none" : "flex",
6515
6546
  alignItems: "center",
6516
6547
  padding: "0 6px",
6517
6548
  minWidth: "50px",
6518
6549
  flexShrink: 0
6519
6550
  }
6520
6551
  },
6521
- /* @__PURE__ */ h(
6552
+ /* @__PURE__ */ h$1(
6522
6553
  "span",
6523
6554
  {
6524
6555
  style: {
@@ -6532,7 +6563,7 @@ const Toolbar = defineComponent({
6532
6563
  },
6533
6564
  currentFontState.value.fontFamily && currentFontState.value.fontFamily !== "mixed" ? currentFontState.value.fontFamily.split(",")[0].replace(/['"]/g, "") || (ctx ? i18n(ctx, "customMenu.fontDefault") : "\u9ED8\u8BA4") : ctx ? i18n(ctx, "customMenu.fontDefault") : "\u9ED8\u8BA4"
6534
6565
  ),
6535
- /* @__PURE__ */ h(
6566
+ /* @__PURE__ */ h$1(
6536
6567
  "span",
6537
6568
  {
6538
6569
  style: {
@@ -6542,10 +6573,10 @@ const Toolbar = defineComponent({
6542
6573
  marginLeft: "4px"
6543
6574
  }
6544
6575
  },
6545
- /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6576
+ /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6546
6577
  )
6547
6578
  ),
6548
- /* @__PURE__ */ h(
6579
+ /* @__PURE__ */ h$1(
6549
6580
  "div",
6550
6581
  {
6551
6582
  class: "toolbar-item custom-font-size-item",
@@ -6553,15 +6584,15 @@ const Toolbar = defineComponent({
6553
6584
  onMouseleave: handleFontSizeLeave,
6554
6585
  style: {
6555
6586
  position: "relative",
6556
- display: isSectionOverflowed(3) ? "none" : "flex",
6587
+ display: isSectionOverflowed(4) ? "none" : "flex",
6557
6588
  alignItems: "center",
6558
6589
  padding: "0 6px",
6559
6590
  minWidth: "40px",
6560
6591
  flexShrink: 0
6561
6592
  }
6562
6593
  },
6563
- /* @__PURE__ */ h("span", { style: { fontSize: "13px", color: "#363B4C" } }, currentFontState.value.fontSize && currentFontState.value.fontSize !== "mixed" ? currentFontState.value.fontSize : "16px"),
6564
- /* @__PURE__ */ h(
6594
+ /* @__PURE__ */ h$1("span", { style: { fontSize: "13px", color: "#363B4C" } }, currentFontState.value.fontSize && currentFontState.value.fontSize !== "mixed" ? currentFontState.value.fontSize : "16px"),
6595
+ /* @__PURE__ */ h$1(
6565
6596
  "span",
6566
6597
  {
6567
6598
  style: {
@@ -6571,22 +6602,22 @@ const Toolbar = defineComponent({
6571
6602
  marginLeft: "4px"
6572
6603
  }
6573
6604
  },
6574
- /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6605
+ /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6575
6606
  )
6576
6607
  ),
6577
- /* @__PURE__ */ h(
6608
+ /* @__PURE__ */ h$1(
6578
6609
  "div",
6579
6610
  {
6580
6611
  class: "divider",
6581
6612
  style: {
6582
6613
  margin: "0 4px",
6583
6614
  alignSelf: "center",
6584
- display: isSectionOverflowed(4) ? "none" : void 0,
6615
+ display: isSectionOverflowed(5) ? "none" : void 0,
6585
6616
  flexShrink: 0
6586
6617
  }
6587
6618
  }
6588
6619
  ),
6589
- /* @__PURE__ */ h(
6620
+ /* @__PURE__ */ h$1(
6590
6621
  "div",
6591
6622
  {
6592
6623
  class: "toolbar-item",
@@ -6594,28 +6625,28 @@ const Toolbar = defineComponent({
6594
6625
  onMouseleave: handleAlignLeave,
6595
6626
  style: {
6596
6627
  position: "relative",
6597
- display: isSectionOverflowed(5) ? "none" : "flex",
6628
+ display: isSectionOverflowed(6) ? "none" : "flex",
6598
6629
  alignItems: "center",
6599
6630
  padding: "0 6px",
6600
6631
  flexShrink: 0
6601
6632
  }
6602
6633
  },
6603
- /* @__PURE__ */ h(
6634
+ /* @__PURE__ */ h$1(
6604
6635
  "span",
6605
6636
  {
6606
6637
  style: { display: "inline-flex", alignItems: "center" },
6607
6638
  innerHTML: currentAlignIndent.value.align === "center" ? alignCenterIcon : currentAlignIndent.value.align === "right" ? alignRightIcon : alignLeftIcon
6608
6639
  }
6609
6640
  ),
6610
- /* @__PURE__ */ h(
6641
+ /* @__PURE__ */ h$1(
6611
6642
  "span",
6612
6643
  {
6613
6644
  style: { width: "20px", display: "flex", alignItems: "center" }
6614
6645
  },
6615
- /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6646
+ /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6616
6647
  )
6617
6648
  ),
6618
- /* @__PURE__ */ h(
6649
+ /* @__PURE__ */ h$1(
6619
6650
  "div",
6620
6651
  {
6621
6652
  class: "toolbar-item",
@@ -6623,13 +6654,13 @@ const Toolbar = defineComponent({
6623
6654
  onMouseleave: handleColorLeave,
6624
6655
  style: {
6625
6656
  position: "relative",
6626
- display: isSectionOverflowed(6) ? "none" : "flex",
6657
+ display: isSectionOverflowed(7) ? "none" : "flex",
6627
6658
  alignItems: "center",
6628
6659
  padding: "0 4px",
6629
6660
  flexShrink: 0
6630
6661
  }
6631
6662
  },
6632
- /* @__PURE__ */ h(
6663
+ /* @__PURE__ */ h$1(
6633
6664
  "span",
6634
6665
  {
6635
6666
  class: "milkdown-icon",
@@ -6642,22 +6673,22 @@ const Toolbar = defineComponent({
6642
6673
  }
6643
6674
  }
6644
6675
  ),
6645
- /* @__PURE__ */ h(
6676
+ /* @__PURE__ */ h$1(
6646
6677
  "span",
6647
6678
  {
6648
6679
  style: { width: "20px", display: "flex", alignItems: "center" }
6649
6680
  },
6650
- /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6681
+ /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6651
6682
  )
6652
6683
  ),
6653
6684
  (() => {
6654
- let sectionIdx = 7;
6685
+ let sectionIdx = 8;
6655
6686
  return nonHeadingGroups.map((group, groupIndex) => {
6656
6687
  const items = group.items.map((item) => {
6657
6688
  const idx = sectionIdx;
6658
6689
  sectionIdx++;
6659
6690
  const isTable = item.icon === tableIcon;
6660
- return /* @__PURE__ */ h(
6691
+ return /* @__PURE__ */ h$1(
6661
6692
  "div",
6662
6693
  {
6663
6694
  key: item.label,
@@ -6669,7 +6700,7 @@ const Toolbar = defineComponent({
6669
6700
  onMouseenter: isTable ? handleTableEnter : void 0,
6670
6701
  onMouseleave: isTable ? handleTableLeave : void 0
6671
6702
  },
6672
- /* @__PURE__ */ h(
6703
+ /* @__PURE__ */ h$1(
6673
6704
  "button",
6674
6705
  {
6675
6706
  type: "button",
@@ -6693,14 +6724,14 @@ const Toolbar = defineComponent({
6693
6724
  justifyContent: "center"
6694
6725
  }
6695
6726
  },
6696
- /* @__PURE__ */ h(
6727
+ /* @__PURE__ */ h$1(
6697
6728
  "span",
6698
6729
  {
6699
6730
  style: { display: "inline-flex", alignItems: "center" },
6700
6731
  innerHTML: ctx && checkActive(item.active) ? activeIconMap[item.icon] || item.icon : item.icon
6701
6732
  }
6702
6733
  ),
6703
- isTable ? /* @__PURE__ */ h(
6734
+ isTable ? /* @__PURE__ */ h$1(
6704
6735
  "span",
6705
6736
  {
6706
6737
  style: {
@@ -6711,7 +6742,7 @@ const Toolbar = defineComponent({
6711
6742
  opacity: 0.5
6712
6743
  }
6713
6744
  },
6714
- /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6745
+ /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6715
6746
  ) : null
6716
6747
  )
6717
6748
  );
@@ -6720,7 +6751,7 @@ const Toolbar = defineComponent({
6720
6751
  if (groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0) {
6721
6752
  sectionIdx++;
6722
6753
  }
6723
- return /* @__PURE__ */ h(Fragment, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h(
6754
+ return /* @__PURE__ */ h$1(Fragment, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h$1(
6724
6755
  "div",
6725
6756
  {
6726
6757
  class: "divider",
@@ -6732,7 +6763,7 @@ const Toolbar = defineComponent({
6732
6763
  ) : null);
6733
6764
  });
6734
6765
  })(),
6735
- hasOverflow ? /* @__PURE__ */ h(
6766
+ hasOverflow ? /* @__PURE__ */ h$1(
6736
6767
  "div",
6737
6768
  {
6738
6769
  "data-overflow-button": "true",
@@ -6759,7 +6790,7 @@ const Toolbar = defineComponent({
6759
6790
  showOverflowMenu.value = true;
6760
6791
  }
6761
6792
  },
6762
- /* @__PURE__ */ h(
6793
+ /* @__PURE__ */ h$1(
6763
6794
  "span",
6764
6795
  {
6765
6796
  style: { display: "inline-flex", alignItems: "center" },
@@ -6767,7 +6798,7 @@ const Toolbar = defineComponent({
6767
6798
  }
6768
6799
  )
6769
6800
  ) : null,
6770
- showBlockMenu.value ? /* @__PURE__ */ h(
6801
+ showBlockMenu.value ? /* @__PURE__ */ h$1(
6771
6802
  "div",
6772
6803
  {
6773
6804
  class: "milkdown-slash-menu custom-submenu",
@@ -6792,7 +6823,7 @@ const Toolbar = defineComponent({
6792
6823
  },
6793
6824
  onMouseleave: handleBlockLeave
6794
6825
  },
6795
- /* @__PURE__ */ h(
6826
+ /* @__PURE__ */ h$1(
6796
6827
  "div",
6797
6828
  {
6798
6829
  style: {
@@ -6849,7 +6880,7 @@ const Toolbar = defineComponent({
6849
6880
  );
6850
6881
  })
6851
6882
  ) : null,
6852
- showAlignMenu.value ? /* @__PURE__ */ h(
6883
+ showAlignMenu.value ? /* @__PURE__ */ h$1(
6853
6884
  "div",
6854
6885
  {
6855
6886
  class: "milkdown-slash-menu custom-submenu",
@@ -6872,7 +6903,7 @@ const Toolbar = defineComponent({
6872
6903
  },
6873
6904
  onMouseleave: handleAlignLeave
6874
6905
  },
6875
- /* @__PURE__ */ h(
6906
+ /* @__PURE__ */ h$1(
6876
6907
  "div",
6877
6908
  {
6878
6909
  style: {
@@ -6903,7 +6934,7 @@ const Toolbar = defineComponent({
6903
6934
  currentAlignIndent.value.align === "right",
6904
6935
  () => setAlign("right")
6905
6936
  ),
6906
- /* @__PURE__ */ h(
6937
+ /* @__PURE__ */ h$1(
6907
6938
  "div",
6908
6939
  {
6909
6940
  style: {
@@ -6925,7 +6956,7 @@ const Toolbar = defineComponent({
6925
6956
  () => setIndent(-1),
6926
6957
  currentAlignIndent.value.indent <= 0
6927
6958
  ),
6928
- canMerge.value || canSplit.value ? /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
6959
+ canMerge.value || canSplit.value ? /* @__PURE__ */ h$1(Fragment, null, /* @__PURE__ */ h$1(
6929
6960
  "div",
6930
6961
  {
6931
6962
  style: {
@@ -6945,7 +6976,7 @@ const Toolbar = defineComponent({
6945
6976
  onSplitCell
6946
6977
  )) : null
6947
6978
  ) : null,
6948
- showColorMenu.value ? /* @__PURE__ */ h(
6979
+ showColorMenu.value ? /* @__PURE__ */ h$1(
6949
6980
  "div",
6950
6981
  {
6951
6982
  class: "milkdown-slash-menu custom-submenu",
@@ -6969,7 +7000,7 @@ const Toolbar = defineComponent({
6969
7000
  },
6970
7001
  onMouseleave: handleColorLeave
6971
7002
  },
6972
- /* @__PURE__ */ h(
7003
+ /* @__PURE__ */ h$1(
6973
7004
  "div",
6974
7005
  {
6975
7006
  style: {
@@ -6982,7 +7013,7 @@ const Toolbar = defineComponent({
6982
7013
  }
6983
7014
  }
6984
7015
  ),
6985
- /* @__PURE__ */ h(
7016
+ /* @__PURE__ */ h$1(
6986
7017
  "div",
6987
7018
  {
6988
7019
  style: {
@@ -6993,7 +7024,7 @@ const Toolbar = defineComponent({
6993
7024
  },
6994
7025
  ctx ? i18n(ctx, "customMenu.textColor") : "\u5B57\u4F53\u989C\u8272"
6995
7026
  ),
6996
- /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
7027
+ /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
6997
7028
  "#000000",
6998
7029
  "#8C8C8C",
6999
7030
  "#F5222D",
@@ -7002,7 +7033,7 @@ const Toolbar = defineComponent({
7002
7033
  "#52C41A",
7003
7034
  "#1677FF",
7004
7035
  "#722ED1"
7005
- ].map((color) => /* @__PURE__ */ h(
7036
+ ].map((color) => /* @__PURE__ */ h$1(
7006
7037
  "div",
7007
7038
  {
7008
7039
  key: color,
@@ -7025,7 +7056,7 @@ const Toolbar = defineComponent({
7025
7056
  },
7026
7057
  "A"
7027
7058
  ))),
7028
- /* @__PURE__ */ h(
7059
+ /* @__PURE__ */ h$1(
7029
7060
  "div",
7030
7061
  {
7031
7062
  style: {
@@ -7037,7 +7068,7 @@ const Toolbar = defineComponent({
7037
7068
  },
7038
7069
  ctx ? i18n(ctx, "customMenu.bgColor") : "\u80CC\u666F\u989C\u8272"
7039
7070
  ),
7040
- /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
7071
+ /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
7041
7072
  "transparent",
7042
7073
  "#F5F5F5",
7043
7074
  "#FFCCC7",
@@ -7046,7 +7077,7 @@ const Toolbar = defineComponent({
7046
7077
  "#D9F7BE",
7047
7078
  "#D6E4FF",
7048
7079
  "#EFDBFF"
7049
- ].map((color) => /* @__PURE__ */ h(
7080
+ ].map((color) => /* @__PURE__ */ h$1(
7050
7081
  "div",
7051
7082
  {
7052
7083
  key: color,
@@ -7063,7 +7094,7 @@ const Toolbar = defineComponent({
7063
7094
  overflow: "hidden"
7064
7095
  }
7065
7096
  },
7066
- color === "transparent" ? /* @__PURE__ */ h(
7097
+ color === "transparent" ? /* @__PURE__ */ h$1(
7067
7098
  "div",
7068
7099
  {
7069
7100
  style: {
@@ -7087,7 +7118,7 @@ const Toolbar = defineComponent({
7087
7118
  "#52C41A",
7088
7119
  "#1677FF",
7089
7120
  "#722ED1"
7090
- ].map((color) => /* @__PURE__ */ h(
7121
+ ].map((color) => /* @__PURE__ */ h$1(
7091
7122
  "div",
7092
7123
  {
7093
7124
  key: color,
@@ -7103,7 +7134,7 @@ const Toolbar = defineComponent({
7103
7134
  }
7104
7135
  }
7105
7136
  ))),
7106
- /* @__PURE__ */ h(
7137
+ /* @__PURE__ */ h$1(
7107
7138
  "button",
7108
7139
  {
7109
7140
  onClick: clearColor,
@@ -7122,7 +7153,7 @@ const Toolbar = defineComponent({
7122
7153
  ctx ? i18n(ctx, "customMenu.restoreDefault") : "\u6062\u590D\u9ED8\u8BA4"
7123
7154
  )
7124
7155
  ) : null,
7125
- showFontFamilyMenu.value ? /* @__PURE__ */ h(
7156
+ showFontFamilyMenu.value ? /* @__PURE__ */ h$1(
7126
7157
  "div",
7127
7158
  {
7128
7159
  class: "milkdown-slash-menu custom-submenu",
@@ -7147,7 +7178,7 @@ const Toolbar = defineComponent({
7147
7178
  },
7148
7179
  onMouseleave: handleFontFamilyLeave
7149
7180
  },
7150
- /* @__PURE__ */ h(
7181
+ /* @__PURE__ */ h$1(
7151
7182
  "div",
7152
7183
  {
7153
7184
  style: {
@@ -7208,7 +7239,7 @@ const Toolbar = defineComponent({
7208
7239
  }
7209
7240
  ].map((font) => {
7210
7241
  const supported = isFontSupported(font.value);
7211
- return /* @__PURE__ */ h(
7242
+ return /* @__PURE__ */ h$1(
7212
7243
  "div",
7213
7244
  {
7214
7245
  key: font.label,
@@ -7245,7 +7276,7 @@ const Toolbar = defineComponent({
7245
7276
  e.currentTarget.style.backgroundColor = "transparent";
7246
7277
  }
7247
7278
  },
7248
- /* @__PURE__ */ h(
7279
+ /* @__PURE__ */ h$1(
7249
7280
  "span",
7250
7281
  {
7251
7282
  style: {
@@ -7255,7 +7286,7 @@ const Toolbar = defineComponent({
7255
7286
  },
7256
7287
  font.label
7257
7288
  ),
7258
- currentFontState.value.fontFamily === font.value ? /* @__PURE__ */ h(
7289
+ currentFontState.value.fontFamily === font.value ? /* @__PURE__ */ h$1(
7259
7290
  "span",
7260
7291
  {
7261
7292
  style: {
@@ -7264,12 +7295,12 @@ const Toolbar = defineComponent({
7264
7295
  color: "var(--crepe-color-primary)"
7265
7296
  }
7266
7297
  },
7267
- /* @__PURE__ */ h(Icon, { icon: confirmIcon })
7298
+ /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
7268
7299
  ) : null
7269
7300
  );
7270
7301
  })
7271
7302
  ) : null,
7272
- showFontSizeMenu.value ? /* @__PURE__ */ h(
7303
+ showFontSizeMenu.value ? /* @__PURE__ */ h$1(
7273
7304
  "div",
7274
7305
  {
7275
7306
  class: "milkdown-slash-menu custom-submenu",
@@ -7294,7 +7325,7 @@ const Toolbar = defineComponent({
7294
7325
  },
7295
7326
  onMouseleave: handleFontSizeLeave
7296
7327
  },
7297
- /* @__PURE__ */ h(
7328
+ /* @__PURE__ */ h$1(
7298
7329
  "div",
7299
7330
  {
7300
7331
  style: {
@@ -7319,7 +7350,7 @@ const Toolbar = defineComponent({
7319
7350
  { label: "28px", value: "28px" },
7320
7351
  { label: "32px", value: "32px" },
7321
7352
  { label: "36px", value: "36px" }
7322
- ].map((size) => /* @__PURE__ */ h(
7353
+ ].map((size) => /* @__PURE__ */ h$1(
7323
7354
  "div",
7324
7355
  {
7325
7356
  key: size.label,
@@ -7350,7 +7381,7 @@ const Toolbar = defineComponent({
7350
7381
  e.currentTarget.style.backgroundColor = "transparent";
7351
7382
  }
7352
7383
  },
7353
- /* @__PURE__ */ h(
7384
+ /* @__PURE__ */ h$1(
7354
7385
  "span",
7355
7386
  {
7356
7387
  style: {
@@ -7360,7 +7391,7 @@ const Toolbar = defineComponent({
7360
7391
  },
7361
7392
  size.label
7362
7393
  ),
7363
- currentFontState.value.fontSize === size.value ? /* @__PURE__ */ h(
7394
+ currentFontState.value.fontSize === size.value ? /* @__PURE__ */ h$1(
7364
7395
  "span",
7365
7396
  {
7366
7397
  style: {
@@ -7369,11 +7400,11 @@ const Toolbar = defineComponent({
7369
7400
  color: "var(--crepe-color-primary)"
7370
7401
  }
7371
7402
  },
7372
- /* @__PURE__ */ h(Icon, { icon: confirmIcon })
7403
+ /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
7373
7404
  ) : null
7374
7405
  ))
7375
7406
  ) : null,
7376
- showTableMenu.value ? /* @__PURE__ */ h(
7407
+ showTableMenu.value ? /* @__PURE__ */ h$1(
7377
7408
  "div",
7378
7409
  {
7379
7410
  class: "milkdown-slash-menu custom-submenu",
@@ -7396,7 +7427,7 @@ const Toolbar = defineComponent({
7396
7427
  },
7397
7428
  onMouseleave: handleTableLeave
7398
7429
  },
7399
- /* @__PURE__ */ h(
7430
+ /* @__PURE__ */ h$1(
7400
7431
  "div",
7401
7432
  {
7402
7433
  style: {
@@ -7409,7 +7440,7 @@ const Toolbar = defineComponent({
7409
7440
  }
7410
7441
  }
7411
7442
  ),
7412
- /* @__PURE__ */ h(
7443
+ /* @__PURE__ */ h$1(
7413
7444
  "div",
7414
7445
  {
7415
7446
  style: {
@@ -7421,7 +7452,7 @@ const Toolbar = defineComponent({
7421
7452
  },
7422
7453
  i18n(ctx, "customMenu.insertTable")
7423
7454
  ),
7424
- /* @__PURE__ */ h(
7455
+ /* @__PURE__ */ h$1(
7425
7456
  "div",
7426
7457
  {
7427
7458
  style: {
@@ -7434,7 +7465,7 @@ const Toolbar = defineComponent({
7434
7465
  Array.from({ length: 9 }).map(
7435
7466
  (_, r) => Array.from({ length: 9 }).map((_2, c) => {
7436
7467
  const isHovered = r < tableHoverIndices.value.r && c < tableHoverIndices.value.c;
7437
- return /* @__PURE__ */ h(
7468
+ return /* @__PURE__ */ h$1(
7438
7469
  "div",
7439
7470
  {
7440
7471
  key: `cell-${r}-${c}`,
@@ -7463,7 +7494,7 @@ const Toolbar = defineComponent({
7463
7494
  })
7464
7495
  )
7465
7496
  ),
7466
- tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h(
7497
+ tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h$1(
7467
7498
  "div",
7468
7499
  {
7469
7500
  style: {
@@ -7476,7 +7507,7 @@ const Toolbar = defineComponent({
7476
7507
  tableHoverIndices.value.r,
7477
7508
  " x ",
7478
7509
  tableHoverIndices.value.c
7479
- ) : /* @__PURE__ */ h(
7510
+ ) : /* @__PURE__ */ h$1(
7480
7511
  "div",
7481
7512
  {
7482
7513
  style: {
@@ -7489,7 +7520,7 @@ const Toolbar = defineComponent({
7489
7520
  "0 x 0"
7490
7521
  )
7491
7522
  ) : null,
7492
- showOverflowMenu.value ? /* @__PURE__ */ h(
7523
+ showOverflowMenu.value ? /* @__PURE__ */ h$1(
7493
7524
  "div",
7494
7525
  {
7495
7526
  class: "overflow-menu-popup",
@@ -7514,7 +7545,7 @@ const Toolbar = defineComponent({
7514
7545
  (() => {
7515
7546
  const cutoff = overflowVisibleCount.value;
7516
7547
  const items = [];
7517
- const renderIconButton = (iconHtml, title, isActive, onClick2, hasDropdown = false, onMouseEnter, onMouseLeave, key) => /* @__PURE__ */ h(
7548
+ const renderIconButton = (iconHtml, title, isActive, onClick2, hasDropdown = false, onMouseEnter, onMouseLeave, key) => /* @__PURE__ */ h$1(
7518
7549
  "button",
7519
7550
  {
7520
7551
  type: "button",
@@ -7538,14 +7569,14 @@ const Toolbar = defineComponent({
7538
7569
  justifyContent: "center"
7539
7570
  }
7540
7571
  },
7541
- /* @__PURE__ */ h(
7572
+ /* @__PURE__ */ h$1(
7542
7573
  "span",
7543
7574
  {
7544
7575
  style: { display: "inline-flex", alignItems: "center" },
7545
7576
  innerHTML: iconHtml
7546
7577
  }
7547
7578
  ),
7548
- hasDropdown ? /* @__PURE__ */ h(
7579
+ hasDropdown ? /* @__PURE__ */ h$1(
7549
7580
  "span",
7550
7581
  {
7551
7582
  style: {
@@ -7555,7 +7586,7 @@ const Toolbar = defineComponent({
7555
7586
  opacity: 0.5
7556
7587
  }
7557
7588
  },
7558
- /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
7589
+ /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
7559
7590
  ) : null
7560
7591
  );
7561
7592
  if (0 >= cutoff) {
@@ -7571,7 +7602,7 @@ const Toolbar = defineComponent({
7571
7602
  )
7572
7603
  );
7573
7604
  }
7574
- if (2 >= cutoff) {
7605
+ if (3 >= cutoff) {
7575
7606
  items.push(
7576
7607
  renderIconButton(
7577
7608
  textIcon,
@@ -7584,7 +7615,7 @@ const Toolbar = defineComponent({
7584
7615
  )
7585
7616
  );
7586
7617
  }
7587
- if (3 >= cutoff) {
7618
+ if (4 >= cutoff) {
7588
7619
  items.push(
7589
7620
  renderIconButton(
7590
7621
  textIcon,
@@ -7597,7 +7628,7 @@ const Toolbar = defineComponent({
7597
7628
  )
7598
7629
  );
7599
7630
  }
7600
- if (5 >= cutoff) {
7631
+ if (6 >= cutoff) {
7601
7632
  items.push(
7602
7633
  renderIconButton(
7603
7634
  currentAlignIndent.value.align === "center" ? alignCenterIcon : currentAlignIndent.value.align === "right" ? alignRightIcon : alignLeftIcon,
@@ -7610,7 +7641,7 @@ const Toolbar = defineComponent({
7610
7641
  )
7611
7642
  );
7612
7643
  }
7613
- if (6 >= cutoff) {
7644
+ if (7 >= cutoff) {
7614
7645
  items.push(
7615
7646
  renderIconButton(
7616
7647
  fontColorIcon,
@@ -7623,7 +7654,7 @@ const Toolbar = defineComponent({
7623
7654
  )
7624
7655
  );
7625
7656
  }
7626
- let fmtIdx = 7;
7657
+ let fmtIdx = 8;
7627
7658
  for (const group of nonHeadingGroups) {
7628
7659
  for (const item of group.items) {
7629
7660
  const idx = fmtIdx;
@@ -8349,7 +8380,7 @@ const labelStyle = {
8349
8380
  color: "var(--crepe-color-on-surface, #333)"
8350
8381
  };
8351
8382
  function renderGroup(ctx, group) {
8352
- return /* @__PURE__ */ h("div", { style: { marginBottom: "16px" }, key: group.titleKey }, /* @__PURE__ */ h("div", { style: groupTitleStyle }, i18n(ctx, group.titleKey)), /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column" } }, group.items.map((item) => /* @__PURE__ */ h("div", { key: item.labelKey, style: rowStyle }, /* @__PURE__ */ h("span", { style: labelStyle }, i18n(ctx, item.labelKey)), /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", alignItems: "center" } }, item.keys.map((key, i) => /* @__PURE__ */ h("span", { key: i, style: badgeStyle }, fmt(key))))))));
8383
+ return /* @__PURE__ */ h$1("div", { style: { marginBottom: "16px" }, key: group.titleKey }, /* @__PURE__ */ h$1("div", { style: groupTitleStyle }, i18n(ctx, group.titleKey)), /* @__PURE__ */ h$1("div", { style: { display: "flex", flexDirection: "column" } }, group.items.map((item) => /* @__PURE__ */ h$1("div", { key: item.labelKey, style: rowStyle }, /* @__PURE__ */ h$1("span", { style: labelStyle }, i18n(ctx, item.labelKey)), /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", alignItems: "center" } }, item.keys.map((key, i) => /* @__PURE__ */ h$1("span", { key: i, style: badgeStyle }, fmt(key))))))));
8353
8384
  }
8354
8385
  const ShortcutHelpModal = defineComponent({
8355
8386
  props: {
@@ -8365,7 +8396,7 @@ const ShortcutHelpModal = defineComponent({
8365
8396
  };
8366
8397
  onMounted(() => document.addEventListener("keydown", onKeydown));
8367
8398
  onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
8368
- return () => /* @__PURE__ */ h(
8399
+ return () => /* @__PURE__ */ h$1(
8369
8400
  "div",
8370
8401
  {
8371
8402
  style: {
@@ -8379,7 +8410,7 @@ const ShortcutHelpModal = defineComponent({
8379
8410
  },
8380
8411
  onClick: close
8381
8412
  },
8382
- /* @__PURE__ */ h(
8413
+ /* @__PURE__ */ h$1(
8383
8414
  "div",
8384
8415
  {
8385
8416
  style: {
@@ -8393,7 +8424,7 @@ const ShortcutHelpModal = defineComponent({
8393
8424
  },
8394
8425
  onClick: (e) => e.stopPropagation()
8395
8426
  },
8396
- /* @__PURE__ */ h(
8427
+ /* @__PURE__ */ h$1(
8397
8428
  "div",
8398
8429
  {
8399
8430
  style: {
@@ -8405,7 +8436,7 @@ const ShortcutHelpModal = defineComponent({
8405
8436
  borderBottom: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8406
8437
  }
8407
8438
  },
8408
- /* @__PURE__ */ h(
8439
+ /* @__PURE__ */ h$1(
8409
8440
  "span",
8410
8441
  {
8411
8442
  style: {
@@ -8416,7 +8447,7 @@ const ShortcutHelpModal = defineComponent({
8416
8447
  },
8417
8448
  i18n(props.ctx, "shortcuts.title")
8418
8449
  ),
8419
- /* @__PURE__ */ h(
8450
+ /* @__PURE__ */ h$1(
8420
8451
  "button",
8421
8452
  {
8422
8453
  type: "button",
@@ -8434,10 +8465,10 @@ const ShortcutHelpModal = defineComponent({
8434
8465
  color: "var(--crepe-color-on-surface-variant, #666)"
8435
8466
  }
8436
8467
  },
8437
- /* @__PURE__ */ h(Icon, { icon: closeIcon })
8468
+ /* @__PURE__ */ h$1(Icon, { icon: closeIcon })
8438
8469
  )
8439
8470
  ),
8440
- /* @__PURE__ */ h("div", { style: { display: "flex", gap: "24px" } }, /* @__PURE__ */ h("div", { style: columnStyle }, leftGroups.map((g) => renderGroup(props.ctx, g))), /* @__PURE__ */ h(
8471
+ /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "24px" } }, /* @__PURE__ */ h$1("div", { style: columnStyle }, leftGroups.map((g) => renderGroup(props.ctx, g))), /* @__PURE__ */ h$1(
8441
8472
  "div",
8442
8473
  {
8443
8474
  style: {
@@ -8446,7 +8477,7 @@ const ShortcutHelpModal = defineComponent({
8446
8477
  backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8447
8478
  }
8448
8479
  }
8449
- ), /* @__PURE__ */ h("div", { style: columnStyle }, rightGroups.map((g) => renderGroup(props.ctx, g))))
8480
+ ), /* @__PURE__ */ h$1("div", { style: columnStyle }, rightGroups.map((g) => renderGroup(props.ctx, g))))
8450
8481
  )
8451
8482
  );
8452
8483
  }
@@ -8489,7 +8520,9 @@ const FixedToolbarComponent = defineComponent({
8489
8520
  alignItems: "center",
8490
8521
  justifyContent: "center",
8491
8522
  width: "100%",
8492
- gap: "0px"
8523
+ gap: "0px",
8524
+ minWidth: "0",
8525
+ overflow: "hidden"
8493
8526
  }
8494
8527
  },
8495
8528
  ((_c = props.config) == null ? void 0 : _c.showMenuBar) !== false && [
@@ -9098,7 +9131,7 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
9098
9131
  return builder.build();
9099
9132
  }
9100
9133
 
9101
- keepAlive(h);
9134
+ keepAlive(h$1);
9102
9135
  const DocumentHeader = defineComponent({
9103
9136
  props: {
9104
9137
  ctx: { type: Object, required: true },
@@ -9175,13 +9208,13 @@ const DocumentHeader = defineComponent({
9175
9208
  var _a, _b;
9176
9209
  const state = viewState.value;
9177
9210
  if (!state.showTitle && !state.showCover) return null;
9178
- return /* @__PURE__ */ h(
9211
+ return /* @__PURE__ */ h$1(
9179
9212
  "div",
9180
9213
  {
9181
9214
  class: "milkdown-document-header",
9182
9215
  style: { width: "100%", display: "flex", flexDirection: "column" }
9183
9216
  },
9184
- state.showCover ? /* @__PURE__ */ h(
9217
+ state.showCover ? /* @__PURE__ */ h$1(
9185
9218
  "div",
9186
9219
  {
9187
9220
  class: "milkdown-document-cover",
@@ -9199,7 +9232,7 @@ const DocumentHeader = defineComponent({
9199
9232
  overflow: "hidden"
9200
9233
  }
9201
9234
  },
9202
- /* @__PURE__ */ h(
9235
+ /* @__PURE__ */ h$1(
9203
9236
  "img",
9204
9237
  {
9205
9238
  src: state.coverUrl,
@@ -9212,7 +9245,7 @@ const DocumentHeader = defineComponent({
9212
9245
  }
9213
9246
  }
9214
9247
  ),
9215
- /* @__PURE__ */ h(
9248
+ /* @__PURE__ */ h$1(
9216
9249
  "div",
9217
9250
  {
9218
9251
  style: {
@@ -9229,7 +9262,7 @@ const DocumentHeader = defineComponent({
9229
9262
  background: "linear-gradient(transparent, rgba(0,0,0,0.7))"
9230
9263
  }
9231
9264
  },
9232
- /* @__PURE__ */ h(
9265
+ /* @__PURE__ */ h$1(
9233
9266
  "div",
9234
9267
  {
9235
9268
  style: {
@@ -9241,7 +9274,7 @@ const DocumentHeader = defineComponent({
9241
9274
  },
9242
9275
  (lastUploadedUrl.value ? [lastUploadedUrl.value] : []).concat(
9243
9276
  ((_b = (_a = props.config) == null ? void 0 : _a.defaultCoverImages) == null ? void 0 : _b.length) ? props.config.defaultCoverImages : builtInCoverImages
9244
- ).map((src, i) => /* @__PURE__ */ h(
9277
+ ).map((src, i) => /* @__PURE__ */ h$1(
9245
9278
  "img",
9246
9279
  {
9247
9280
  key: i,
@@ -9271,7 +9304,7 @@ const DocumentHeader = defineComponent({
9271
9304
  }
9272
9305
  ))
9273
9306
  ),
9274
- /* @__PURE__ */ h(
9307
+ /* @__PURE__ */ h$1(
9275
9308
  "div",
9276
9309
  {
9277
9310
  onClick: () => {
@@ -9299,7 +9332,7 @@ const DocumentHeader = defineComponent({
9299
9332
  e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.2)";
9300
9333
  }
9301
9334
  },
9302
- /* @__PURE__ */ h(
9335
+ /* @__PURE__ */ h$1(
9303
9336
  "svg",
9304
9337
  {
9305
9338
  width: "14",
@@ -9311,14 +9344,14 @@ const DocumentHeader = defineComponent({
9311
9344
  "stroke-linecap": "round",
9312
9345
  "stroke-linejoin": "round"
9313
9346
  },
9314
- /* @__PURE__ */ h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
9315
- /* @__PURE__ */ h("polyline", { points: "17 8 12 3 7 8" }),
9316
- /* @__PURE__ */ h("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
9347
+ /* @__PURE__ */ h$1("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
9348
+ /* @__PURE__ */ h$1("polyline", { points: "17 8 12 3 7 8" }),
9349
+ /* @__PURE__ */ h$1("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
9317
9350
  ),
9318
9351
  "\u4E0A\u4F20"
9319
9352
  )
9320
9353
  ),
9321
- /* @__PURE__ */ h(
9354
+ /* @__PURE__ */ h$1(
9322
9355
  "input",
9323
9356
  {
9324
9357
  type: "file",
@@ -9329,7 +9362,7 @@ const DocumentHeader = defineComponent({
9329
9362
  }
9330
9363
  )
9331
9364
  ) : null,
9332
- state.showTitle ? /* @__PURE__ */ h(
9365
+ state.showTitle ? /* @__PURE__ */ h$1(
9333
9366
  "div",
9334
9367
  {
9335
9368
  class: "milkdown-document-title-wrapper",
@@ -9340,8 +9373,8 @@ const DocumentHeader = defineComponent({
9340
9373
  padding: `40px ${editorWidthMap[state.editorWidth] === "none" ? "80px" : "0"} 0`
9341
9374
  }
9342
9375
  },
9343
- /* @__PURE__ */ h("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
9344
- /* @__PURE__ */ h(
9376
+ /* @__PURE__ */ h$1("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
9377
+ /* @__PURE__ */ h$1(
9345
9378
  "textarea",
9346
9379
  {
9347
9380
  ref: titleTextareaRef,
@@ -9715,7 +9748,7 @@ const OutlinePanel = defineComponent({
9715
9748
  const state = viewState.value;
9716
9749
  if (!state.outlineVisible) return null;
9717
9750
  const isLeft = state.outlinePosition === "left";
9718
- return /* @__PURE__ */ h(
9751
+ return /* @__PURE__ */ h$1(
9719
9752
  "div",
9720
9753
  {
9721
9754
  class: "milkdown-outline-panel",
@@ -9736,7 +9769,7 @@ const OutlinePanel = defineComponent({
9736
9769
  overflow: "hidden"
9737
9770
  }
9738
9771
  },
9739
- /* @__PURE__ */ h(
9772
+ /* @__PURE__ */ h$1(
9740
9773
  "div",
9741
9774
  {
9742
9775
  style: {
@@ -9750,8 +9783,8 @@ const OutlinePanel = defineComponent({
9750
9783
  alignItems: "center"
9751
9784
  }
9752
9785
  },
9753
- /* @__PURE__ */ h("span", null, i18n(props.ctx, "view.outline")),
9754
- /* @__PURE__ */ h(
9786
+ /* @__PURE__ */ h$1("span", null, i18n(props.ctx, "view.outline")),
9787
+ /* @__PURE__ */ h$1(
9755
9788
  "div",
9756
9789
  {
9757
9790
  style: {
@@ -9775,7 +9808,7 @@ const OutlinePanel = defineComponent({
9775
9808
  },
9776
9809
  title: "\u5173\u95ED\u5927\u7EB2"
9777
9810
  },
9778
- /* @__PURE__ */ h(
9811
+ /* @__PURE__ */ h$1(
9779
9812
  "svg",
9780
9813
  {
9781
9814
  width: "16",
@@ -9787,12 +9820,12 @@ const OutlinePanel = defineComponent({
9787
9820
  "stroke-linecap": "round",
9788
9821
  "stroke-linejoin": "round"
9789
9822
  },
9790
- /* @__PURE__ */ h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
9791
- /* @__PURE__ */ h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
9823
+ /* @__PURE__ */ h$1("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
9824
+ /* @__PURE__ */ h$1("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
9792
9825
  )
9793
9826
  )
9794
9827
  ),
9795
- /* @__PURE__ */ h("div", { style: { flexGrow: 1, overflowY: "auto", padding: "12px 0" } }, items.value.length === 0 ? /* @__PURE__ */ h(
9828
+ /* @__PURE__ */ h$1("div", { style: { flexGrow: 1, overflowY: "auto", padding: "12px 0" } }, items.value.length === 0 ? /* @__PURE__ */ h$1(
9796
9829
  "div",
9797
9830
  {
9798
9831
  style: {
@@ -9805,7 +9838,7 @@ const OutlinePanel = defineComponent({
9805
9838
  ) : null, visibleItems.value.map(({ item, hasChildren: hasKids }) => {
9806
9839
  const isActive = activeId.value === item.id;
9807
9840
  const collapsed = collapsedIds.value.has(item.id);
9808
- return /* @__PURE__ */ h(
9841
+ return /* @__PURE__ */ h$1(
9809
9842
  "div",
9810
9843
  {
9811
9844
  key: item.id,
@@ -9839,7 +9872,7 @@ const OutlinePanel = defineComponent({
9839
9872
  }
9840
9873
  }
9841
9874
  },
9842
- /* @__PURE__ */ h(
9875
+ /* @__PURE__ */ h$1(
9843
9876
  "span",
9844
9877
  {
9845
9878
  onClick: (e) => {
@@ -9872,7 +9905,7 @@ const OutlinePanel = defineComponent({
9872
9905
  "\u25BC",
9873
9906
  " "
9874
9907
  ),
9875
- /* @__PURE__ */ h(
9908
+ /* @__PURE__ */ h$1(
9876
9909
  "span",
9877
9910
  {
9878
9911
  title: item.text,
@@ -9885,7 +9918,7 @@ const OutlinePanel = defineComponent({
9885
9918
  )
9886
9919
  );
9887
9920
  })),
9888
- /* @__PURE__ */ h(
9921
+ /* @__PURE__ */ h$1(
9889
9922
  "div",
9890
9923
  {
9891
9924
  onPointerdown: onPointerDown,
@@ -10404,7 +10437,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10404
10437
  }));
10405
10438
  function renderTab(tab, label) {
10406
10439
  const isActive = activeTab.value === tab;
10407
- return h(
10440
+ return h$1(
10408
10441
  "button",
10409
10442
  {
10410
10443
  style: {
@@ -10426,8 +10459,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10426
10459
  function renderItem(change, index) {
10427
10460
  const color = typeColors[change.type];
10428
10461
  const children = [
10429
- h("div", { style: { marginBottom: "4px" } }, [
10430
- h(
10462
+ h$1("div", { style: { marginBottom: "4px" } }, [
10463
+ h$1(
10431
10464
  "span",
10432
10465
  {
10433
10466
  style: {
@@ -10446,7 +10479,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10446
10479
  ];
10447
10480
  if (change.oldText) {
10448
10481
  children.push(
10449
- h(
10482
+ h$1(
10450
10483
  "div",
10451
10484
  {
10452
10485
  style: {
@@ -10458,19 +10491,19 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10458
10491
  }
10459
10492
  },
10460
10493
  [
10461
- h(
10494
+ h$1(
10462
10495
  "span",
10463
10496
  { style: { color: "#999", fontSize: "11px" } },
10464
10497
  "\u539F\u6587: "
10465
10498
  ),
10466
- h("span", null, change.oldText)
10499
+ h$1("span", null, change.oldText)
10467
10500
  ]
10468
10501
  )
10469
10502
  );
10470
10503
  }
10471
10504
  if (change.newText) {
10472
10505
  children.push(
10473
- h(
10506
+ h$1(
10474
10507
  "div",
10475
10508
  {
10476
10509
  style: {
@@ -10481,17 +10514,17 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10481
10514
  }
10482
10515
  },
10483
10516
  [
10484
- h(
10517
+ h$1(
10485
10518
  "span",
10486
10519
  { style: { color: "#999", fontSize: "11px" } },
10487
10520
  "\u5DEE\u5F02: "
10488
10521
  ),
10489
- h("span", { style: { color } }, change.newText)
10522
+ h$1("span", { style: { color } }, change.newText)
10490
10523
  ]
10491
10524
  )
10492
10525
  );
10493
10526
  }
10494
- return h(
10527
+ return h$1(
10495
10528
  "div",
10496
10529
  {
10497
10530
  style: {
@@ -10509,7 +10542,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10509
10542
  children
10510
10543
  );
10511
10544
  }
10512
- return () => h(
10545
+ return () => h$1(
10513
10546
  "div",
10514
10547
  {
10515
10548
  style: {
@@ -10527,7 +10560,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10527
10560
  },
10528
10561
  [
10529
10562
  // Header
10530
- h(
10563
+ h$1(
10531
10564
  "div",
10532
10565
  {
10533
10566
  style: {
@@ -10543,8 +10576,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10543
10576
  }
10544
10577
  },
10545
10578
  [
10546
- h("span", null, "\u6587\u6863\u5DEE\u5F02\u53D8\u66F4"),
10547
- onClose ? h(
10579
+ h$1("span", null, "\u6587\u6863\u5DEE\u5F02\u53D8\u66F4"),
10580
+ onClose ? h$1(
10548
10581
  "div",
10549
10582
  {
10550
10583
  style: {
@@ -10572,7 +10605,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10572
10605
  title: "\u5173\u95ED\u5DEE\u5F02"
10573
10606
  },
10574
10607
  [
10575
- h(
10608
+ h$1(
10576
10609
  "svg",
10577
10610
  {
10578
10611
  width: "16",
@@ -10585,8 +10618,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10585
10618
  strokeLinejoin: "round"
10586
10619
  },
10587
10620
  [
10588
- h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
10589
- h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
10621
+ h$1("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
10622
+ h$1("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
10590
10623
  ]
10591
10624
  )
10592
10625
  ]
@@ -10594,7 +10627,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10594
10627
  ]
10595
10628
  ),
10596
10629
  // Tabs
10597
- h(
10630
+ h$1(
10598
10631
  "div",
10599
10632
  {
10600
10633
  style: {
@@ -10611,7 +10644,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10611
10644
  ]
10612
10645
  ),
10613
10646
  // List
10614
- h(
10647
+ h$1(
10615
10648
  "div",
10616
10649
  {
10617
10650
  style: {
@@ -11319,7 +11352,7 @@ const blockLatexSchema = codeBlockSchema.extendSchema((prev) => {
11319
11352
 
11320
11353
  const inlineLatexTooltip = tooltipFactory("INLINE_LATEX");
11321
11354
 
11322
- keepAlive(h);
11355
+ keepAlive(h$1);
11323
11356
  const LatexTooltip = defineComponent({
11324
11357
  props: {
11325
11358
  ctx: {
@@ -11355,7 +11388,7 @@ const LatexTooltip = defineComponent({
11355
11388
  }
11356
11389
  };
11357
11390
  return () => {
11358
- return /* @__PURE__ */ h("div", { class: "container container-large" }, /* @__PURE__ */ h("div", { class: "input-container" }, props.innerView ? /* @__PURE__ */ h("div", { ref: innerViewRef }) : null), /* @__PURE__ */ h("div", { class: "footer" }, /* @__PURE__ */ h("span", { class: "left" }, i18n(props.ctx, "latex.escToExit")), /* @__PURE__ */ h(
11391
+ return /* @__PURE__ */ h$1("div", { class: "container container-large" }, /* @__PURE__ */ h$1("div", { class: "input-container" }, props.innerView ? /* @__PURE__ */ h$1("div", { ref: innerViewRef }) : null), /* @__PURE__ */ h$1("div", { class: "footer" }, /* @__PURE__ */ h$1("span", { class: "left" }, i18n(props.ctx, "latex.escToExit")), /* @__PURE__ */ h$1(
11359
11392
  "a",
11360
11393
  {
11361
11394
  class: "right",
@@ -11363,7 +11396,7 @@ const LatexTooltip = defineComponent({
11363
11396
  target: "_blank",
11364
11397
  style: "display: none;"
11365
11398
  },
11366
- /* @__PURE__ */ h(Icon, { icon: helpIcon }),
11399
+ /* @__PURE__ */ h$1(Icon, { icon: helpIcon }),
11367
11400
  " ",
11368
11401
  i18n(props.ctx, "latex.helpDoc")
11369
11402
  )));
@@ -12126,6 +12159,7 @@ class Crepe extends CrepeBuilder {
12126
12159
  /// Calling the constructor will not create the editor, you need to call `create` to create the editor.
12127
12160
  constructor(config = {}) {
12128
12161
  var _a;
12162
+ resetPopupCount();
12129
12163
  const { features = {}, featureConfigs = {}, ...crepeBuilderConfig } = config;
12130
12164
  const finalConfigs = defaultsDeep(featureConfigs, defaultConfig);
12131
12165
  const fixedToolbarConfig = finalConfigs[CrepeFeature.FixedToolbar];
@@ -12146,6 +12180,10 @@ class Crepe extends CrepeBuilder {
12146
12180
  }
12147
12181
  }
12148
12182
  super(crepeBuilderConfig);
12183
+ this.destroy = () => {
12184
+ resetPopupCount();
12185
+ return this.editor.destroy();
12186
+ };
12149
12187
  const enabledFeatures = Object.entries({
12150
12188
  ...defaultFeatures,
12151
12189
  ...features
@@ -12158,24 +12196,47 @@ class Crepe extends CrepeBuilder {
12158
12196
  this.on((listener) => {
12159
12197
  listener.markdownUpdated((_, markdown) => {
12160
12198
  try {
12161
- const stored = localStorage.getItem("jvs-milkdown-data");
12162
- let parsed = {};
12163
- if (stored) {
12164
- parsed = JSON.parse(stored);
12165
- }
12166
- if (!parsed.content) {
12167
- parsed.content = {};
12168
- }
12169
12199
  const html = this.editor.action(getHTML());
12170
12200
  const docId = fixedToolbarConfig.id || "default";
12171
- const currentEntry = parsed.content[docId];
12172
- const hasChanged = !currentEntry || typeof currentEntry === "string" && currentEntry !== markdown || typeof currentEntry === "object" && (currentEntry.markdown !== markdown || currentEntry.html !== html);
12173
- if (hasChanged) {
12174
- parsed.content[docId] = {
12175
- markdown,
12176
- html
12177
- };
12178
- localStorage.setItem("jvs-milkdown-data", JSON.stringify(parsed));
12201
+ const saveToLocalStorage = (mdVal, htmlVal) => {
12202
+ try {
12203
+ const stored = localStorage.getItem("jvs-milkdown-data");
12204
+ let parsed = {};
12205
+ if (stored) {
12206
+ parsed = JSON.parse(stored);
12207
+ }
12208
+ if (!parsed.content) {
12209
+ parsed.content = {};
12210
+ }
12211
+ const currentEntry = parsed.content[docId];
12212
+ const hasChanged = !currentEntry || typeof currentEntry === "string" && currentEntry !== mdVal || typeof currentEntry === "object" && (currentEntry.markdown !== mdVal || currentEntry.html !== htmlVal);
12213
+ if (hasChanged) {
12214
+ parsed.content[docId] = {
12215
+ markdown: mdVal,
12216
+ html: htmlVal
12217
+ };
12218
+ localStorage.setItem(
12219
+ "jvs-milkdown-data",
12220
+ JSON.stringify(parsed)
12221
+ );
12222
+ }
12223
+ } catch (e) {
12224
+ console.error("Error saving content to localStorage:", e);
12225
+ }
12226
+ };
12227
+ const hasBlobUrl = /blob:https?:\/\//.test(markdown) || /blob:https?:\/\//.test(html);
12228
+ if (hasBlobUrl) {
12229
+ Promise.all([
12230
+ replaceBlobUrlsWithBase64(markdown),
12231
+ replaceBlobUrlsWithBase64(html)
12232
+ ]).then(([base64Markdown, base64Html]) => {
12233
+ saveToLocalStorage(base64Markdown, base64Html);
12234
+ }).catch((e) => {
12235
+ console.error("Error converting blob URLs:", e);
12236
+ saveToLocalStorage(markdown, html);
12237
+ });
12238
+ } else {
12239
+ saveToLocalStorage(markdown, html);
12179
12240
  }
12180
12241
  } catch (e) {
12181
12242
  console.error("Error saving content to localStorage:", e);
@@ -12187,6 +12248,29 @@ class Crepe extends CrepeBuilder {
12187
12248
  }
12188
12249
  /// This is an alias for the `CrepeFeature` enum.
12189
12250
  Crepe.Feature = CrepeFeature;
12251
+ async function replaceBlobUrlsWithBase64(content) {
12252
+ const blobRegex = /blob:https?:\/\/[^\s'")>]+/g;
12253
+ const matches = content.match(blobRegex);
12254
+ if (!matches) return content;
12255
+ let result = content;
12256
+ const uniqueBlobs = Array.from(new Set(matches));
12257
+ for (const blobUrl of uniqueBlobs) {
12258
+ try {
12259
+ const response = await fetch(blobUrl);
12260
+ const blob = await response.blob();
12261
+ const base64 = await new Promise((resolve, reject) => {
12262
+ const reader = new FileReader();
12263
+ reader.onloadend = () => resolve(reader.result);
12264
+ reader.onerror = reject;
12265
+ reader.readAsDataURL(blob);
12266
+ });
12267
+ result = result.replaceAll(blobUrl, base64);
12268
+ } catch (e) {
12269
+ console.error("Failed to convert blob URL to base64:", blobUrl, e);
12270
+ }
12271
+ }
12272
+ return result;
12273
+ }
12190
12274
 
12191
12275
  export { Crepe, CrepeBuilder, CrepeFeature, enUS, i18n, localeCtx, translationsCtx, useCrepe, useCrepeFeatures, zhCN };
12192
12276
  //# sourceMappingURL=index.js.map