@jvs-milkdown/crepe 1.2.21 → 1.2.23

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 as h$1, createApp, watchEffect, watch, onUnmounted, Fragment, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue';
7
+ import { defineComponent, shallowRef, ref, computed, h, 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';
@@ -1115,6 +1115,10 @@ const attachmentSchema = $nodeSchema("attachment", () => {
1115
1115
  };
1116
1116
  });
1117
1117
 
1118
+ function keepAlive(..._args) {
1119
+ }
1120
+
1121
+ keepAlive(h);
1118
1122
  const downloadIcon = `<svg viewBox="0 0 1024 1024" width="20" height="20" fill="currentColor">
1119
1123
  <path d="M464.96 743.936L194.304 479.68c-4.928-4.8-10.24-9.408-14.592-14.656-20.736-24.768-21.376-45.76-2.368-63.424 17.664-16.384 43.328-16 65.472 4.8 49.088 46.144 96.64 93.824 144.896 140.8l69.376 67.52 11.968 11.392v-184.96c0-36.096-0.128-86.272-0.32-136.96-0.192-54.912-0.32-110.464-0.32-149.504l-0.064-9.28a208 208 0 0 1 0.704-26.56c3.52-31.168 19.328-46.592 45.248-45.76 25.344 0.832 41.088 16.96 42.688 48.576 1.28 24.384 1.024 48.896 0.768 73.408l-0.128 28.928c0 53.376 0.128 120.32 0.256 188.096 0.192 76.352 0.384 153.792 0.32 214.016 74.432-72.704 185.6-181.12 216.32-210.88 7.424-7.168 14.912-15.168 24-19.52 18.688-8.96 37.632-8.32 52.672 7.872 14.72 15.744 16.448 33.408 4.032 51.392-3.84 5.632-8.576 10.816-13.44 15.616-45.696 44.736-243.328 238.272-289.728 282.24a62.592 62.592 0 0 1-8.064 6.4 43.392 43.392 0 0 1-15.872 10.432c-20.544 7.616-37.504-0.512-51.968-14.848l-11.2-10.88z m430.784-39.744c24-0.576 42.176 14.4 43.328 41.6 1.728 40.832 2.944 82.176-1.088 122.816-5.312 54.144-51.52 89.792-114.752 91.008-50.112 0.896-100.224 0.704-150.4 0.512L608 960H434.944c-64.832 0.128-129.6 0.192-194.432-0.192-90.624-0.512-130.752-40.192-131.392-128.64l-0.192-18.56c-0.32-21.12-0.576-42.304 0.768-63.36 1.92-29.76 20.48-46.528 45.76-45.184 23.488 1.28 37.312 16.32 40.064 45.184 0.896 9.792 0.832 19.648 0.704 29.504l-0.064 11.52c0.384 76.544 7.36 83.392 88.128 83.456a163213.952 163213.952 0 0 0 351.68 0.064l43.968 0.128c36.096 0.128 72.192 0.256 108.288-0.448 52.672-1.024 64-12.864 65.152-64.32 0.192-7.68 0.128-15.488 0-23.232a414.72 414.72 0 0 1 0.704-38.208c2.24-27.712 17.92-42.944 41.664-43.52z" fill="currentColor"></path>
1120
1124
  </svg>`;
@@ -1238,7 +1242,7 @@ const MilkdownAttachmentBlock = defineComponent({
1238
1242
  return () => {
1239
1243
  var _a;
1240
1244
  if (!((_a = src.value) == null ? void 0 : _a.length)) {
1241
- return /* @__PURE__ */ h$1(
1245
+ return /* @__PURE__ */ h(
1242
1246
  "div",
1243
1247
  {
1244
1248
  class: [
@@ -1246,7 +1250,7 @@ const MilkdownAttachmentBlock = defineComponent({
1246
1250
  props.selected.value ? "selected" : ""
1247
1251
  ]
1248
1252
  },
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(
1253
+ /* @__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(
1250
1254
  "input",
1251
1255
  {
1252
1256
  type: "file",
@@ -1260,7 +1264,7 @@ const MilkdownAttachmentBlock = defineComponent({
1260
1264
  if (isVideo.value) {
1261
1265
  const savedWidth = videoWidth.value;
1262
1266
  const widthStyle = isResizing.value && currentWidth.value > 0 ? `${currentWidth.value}px` : savedWidth && savedWidth > 0 ? `${savedWidth}px` : "100%";
1263
- return /* @__PURE__ */ h$1(
1267
+ return /* @__PURE__ */ h(
1264
1268
  "div",
1265
1269
  {
1266
1270
  ref: videoWrapperRef,
@@ -1274,7 +1278,7 @@ const MilkdownAttachmentBlock = defineComponent({
1274
1278
  position: "relative"
1275
1279
  }
1276
1280
  },
1277
- /* @__PURE__ */ h$1(
1281
+ /* @__PURE__ */ h(
1278
1282
  "video",
1279
1283
  {
1280
1284
  src: src.value,
@@ -1283,28 +1287,28 @@ const MilkdownAttachmentBlock = defineComponent({
1283
1287
  onMousedown: (e) => e.stopPropagation()
1284
1288
  }
1285
1289
  ),
1286
- /* @__PURE__ */ h$1(
1290
+ /* @__PURE__ */ h(
1287
1291
  "div",
1288
1292
  {
1289
1293
  class: "video-resize-handle top-left",
1290
1294
  onPointerdown: (e) => onResizePointerDown(e, "top-left")
1291
1295
  }
1292
1296
  ),
1293
- /* @__PURE__ */ h$1(
1297
+ /* @__PURE__ */ h(
1294
1298
  "div",
1295
1299
  {
1296
1300
  class: "video-resize-handle top-right",
1297
1301
  onPointerdown: (e) => onResizePointerDown(e, "top-right")
1298
1302
  }
1299
1303
  ),
1300
- /* @__PURE__ */ h$1(
1304
+ /* @__PURE__ */ h(
1301
1305
  "div",
1302
1306
  {
1303
1307
  class: "video-resize-handle bottom-left",
1304
1308
  onPointerdown: (e) => onResizePointerDown(e, "bottom-left")
1305
1309
  }
1306
1310
  ),
1307
- /* @__PURE__ */ h$1(
1311
+ /* @__PURE__ */ h(
1308
1312
  "div",
1309
1313
  {
1310
1314
  class: "video-resize-handle bottom-right",
@@ -1313,7 +1317,7 @@ const MilkdownAttachmentBlock = defineComponent({
1313
1317
  )
1314
1318
  );
1315
1319
  }
1316
- return /* @__PURE__ */ h$1(
1320
+ return /* @__PURE__ */ h(
1317
1321
  "div",
1318
1322
  {
1319
1323
  class: [
@@ -1321,16 +1325,16 @@ const MilkdownAttachmentBlock = defineComponent({
1321
1325
  props.selected.value ? "selected" : ""
1322
1326
  ]
1323
1327
  },
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(
1328
+ /* @__PURE__ */ h("div", { class: "milkdown-attachment-icon-wrapper" }, /* @__PURE__ */ h("div", { class: "milkdown-attachment-raw-icon-bg" }, /* @__PURE__ */ h(Icon, { icon: fileLinkIcon }))),
1329
+ /* @__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) : "")),
1330
+ /* @__PURE__ */ h(
1327
1331
  "div",
1328
1332
  {
1329
1333
  class: "milkdown-attachment-action",
1330
1334
  onClick: openLink,
1331
1335
  title: props.config.downloadText
1332
1336
  },
1333
- /* @__PURE__ */ h$1(Icon, { icon: downloadIcon })
1337
+ /* @__PURE__ */ h(Icon, { icon: downloadIcon })
1334
1338
  )
1335
1339
  );
1336
1340
  };
@@ -1482,9 +1486,6 @@ class GroupBuilder {
1482
1486
  _groups = new WeakMap();
1483
1487
  _getGroupInstance = new WeakMap();
1484
1488
 
1485
- function keepAlive(..._args) {
1486
- }
1487
-
1488
1489
  const remarkTextColorPlugin = $remark(
1489
1490
  "remarkTextColor",
1490
1491
  () => function() {
@@ -2523,7 +2524,7 @@ function getGroups$1(filter, config, ctx) {
2523
2524
  };
2524
2525
  }
2525
2526
 
2526
- keepAlive(h$1);
2527
+ keepAlive(h);
2527
2528
  const Menu = defineComponent({
2528
2529
  props: {
2529
2530
  ctx: {
@@ -2869,7 +2870,7 @@ const Menu = defineComponent({
2869
2870
  const api = ctx.get(menuAPI.key);
2870
2871
  const showListMenu = (api == null ? void 0 : api.getMode()) === "list" || !(api == null ? void 0 : api.isProgrammatic()) || filter.value !== "";
2871
2872
  if (showListMenu) {
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
+ 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(
2873
2874
  "li",
2874
2875
  {
2875
2876
  key: item.key,
@@ -2912,9 +2913,9 @@ const Menu = defineComponent({
2912
2913
  runByIndex(item.index);
2913
2914
  }
2914
2915
  },
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(
2916
+ /* @__PURE__ */ h(Icon, { icon: item.icon }),
2917
+ /* @__PURE__ */ h("span", { style: item.key === "table" ? { flex: 1 } : {} }, item.label),
2918
+ item.key === "table" ? /* @__PURE__ */ h(
2918
2919
  "div",
2919
2920
  {
2920
2921
  style: {
@@ -2924,9 +2925,9 @@ const Menu = defineComponent({
2924
2925
  transform: "rotate(-90deg)"
2925
2926
  }
2926
2927
  },
2927
- /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
2928
+ /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
2928
2929
  ) : null
2929
- )))))), showTableMenu.value ? /* @__PURE__ */ h$1(
2930
+ )))))), showTableMenu.value ? /* @__PURE__ */ h(
2930
2931
  "div",
2931
2932
  {
2932
2933
  class: "milkdown-slash-menu custom-submenu",
@@ -2949,7 +2950,7 @@ const Menu = defineComponent({
2949
2950
  },
2950
2951
  onPointerleave: handleTableLeave
2951
2952
  },
2952
- /* @__PURE__ */ h$1(
2953
+ /* @__PURE__ */ h(
2953
2954
  "div",
2954
2955
  {
2955
2956
  style: {
@@ -2961,7 +2962,7 @@ const Menu = defineComponent({
2961
2962
  },
2962
2963
  i18n(ctx, "customMenu.insertTable")
2963
2964
  ),
2964
- /* @__PURE__ */ h$1(
2965
+ /* @__PURE__ */ h(
2965
2966
  "div",
2966
2967
  {
2967
2968
  style: {
@@ -2974,7 +2975,7 @@ const Menu = defineComponent({
2974
2975
  Array.from({ length: 9 }).map(
2975
2976
  (_, r) => Array.from({ length: 9 }).map((_2, c) => {
2976
2977
  const isHovered = r < tableHoverIndices.value.r && c < tableHoverIndices.value.c;
2977
- return /* @__PURE__ */ h$1(
2978
+ return /* @__PURE__ */ h(
2978
2979
  "div",
2979
2980
  {
2980
2981
  key: `cell-${r}-${c}`,
@@ -3003,7 +3004,7 @@ const Menu = defineComponent({
3003
3004
  })
3004
3005
  )
3005
3006
  ),
3006
- tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h$1(
3007
+ tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h(
3007
3008
  "div",
3008
3009
  {
3009
3010
  style: {
@@ -3016,7 +3017,7 @@ const Menu = defineComponent({
3016
3017
  tableHoverIndices.value.r,
3017
3018
  " x ",
3018
3019
  tableHoverIndices.value.c
3019
- ) : /* @__PURE__ */ h$1(
3020
+ ) : /* @__PURE__ */ h(
3020
3021
  "div",
3021
3022
  {
3022
3023
  style: {
@@ -3205,7 +3206,7 @@ const Menu = defineComponent({
3205
3206
  const renderGridBtn = (key) => {
3206
3207
  const item = findItem(key);
3207
3208
  if (!item) return null;
3208
- return /* @__PURE__ */ h$1(
3209
+ return /* @__PURE__ */ h(
3209
3210
  "div",
3210
3211
  {
3211
3212
  title: item.label,
@@ -3226,11 +3227,11 @@ const Menu = defineComponent({
3226
3227
  },
3227
3228
  "data-index": item.index
3228
3229
  },
3229
- /* @__PURE__ */ h$1(Icon, { icon: item.icon })
3230
+ /* @__PURE__ */ h(Icon, { icon: item.icon })
3230
3231
  );
3231
3232
  };
3232
3233
  const renderCustomRow = (iconHtml, label, hasArrow, onPointerEnter, onPointerLeave, onClick) => {
3233
- return /* @__PURE__ */ h$1(
3234
+ return /* @__PURE__ */ h(
3234
3235
  "div",
3235
3236
  {
3236
3237
  class: "custom-menu-row",
@@ -3246,12 +3247,12 @@ const Menu = defineComponent({
3246
3247
  onClick == null ? void 0 : onClick();
3247
3248
  }
3248
3249
  },
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
3250
+ /* @__PURE__ */ h("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h(Icon, { icon: iconHtml }), /* @__PURE__ */ h("span", null, label)),
3251
+ hasArrow ? /* @__PURE__ */ h(Icon, { icon: chevronDownIcon }) : null
3251
3252
  );
3252
3253
  };
3253
3254
  const renderSubMenuItem = (iconHtml, label, isActive, onClick, disabled = false) => {
3254
- return /* @__PURE__ */ h$1(
3255
+ return /* @__PURE__ */ h(
3255
3256
  "div",
3256
3257
  {
3257
3258
  class: ["custom-menu-row", disabled ? "disabled" : ""],
@@ -3269,7 +3270,7 @@ const Menu = defineComponent({
3269
3270
  if (!disabled) onClick();
3270
3271
  }
3271
3272
  },
3272
- /* @__PURE__ */ h$1("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h$1(Icon, { icon: iconHtml }), /* @__PURE__ */ h$1(
3273
+ /* @__PURE__ */ h("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h(Icon, { icon: iconHtml }), /* @__PURE__ */ h(
3273
3274
  "span",
3274
3275
  {
3275
3276
  style: {
@@ -3278,18 +3279,18 @@ const Menu = defineComponent({
3278
3279
  },
3279
3280
  label
3280
3281
  )),
3281
- isActive ? /* @__PURE__ */ h$1("span", { style: { color: "var(--crepe-color-primary)" } }, /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })) : null
3282
+ isActive ? /* @__PURE__ */ h("span", { style: { color: "var(--crepe-color-primary)" } }, /* @__PURE__ */ h(Icon, { icon: confirmIcon })) : null
3282
3283
  );
3283
3284
  };
3284
- return /* @__PURE__ */ h$1(
3285
+ return /* @__PURE__ */ h(
3285
3286
  "div",
3286
3287
  {
3287
3288
  ref: host,
3288
3289
  onPointerdown: (e) => e.preventDefault(),
3289
3290
  class: "custom-block-menu"
3290
3291
  },
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,
3292
+ !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,
3293
+ showAlign ? /* @__PURE__ */ h("div", { class: "custom-divider" }) : null,
3293
3294
  showAlign && renderCustomRow(
3294
3295
  alignLeftIcon,
3295
3296
  i18n(ctx, "customMenu.indentAndAlign"),
@@ -3297,7 +3298,7 @@ const Menu = defineComponent({
3297
3298
  handleIndentAlignEnter,
3298
3299
  handleIndentAlignLeave
3299
3300
  ),
3300
- showIndentAlignMenu.value ? /* @__PURE__ */ h$1(
3301
+ showIndentAlignMenu.value ? /* @__PURE__ */ h(
3301
3302
  "div",
3302
3303
  {
3303
3304
  class: "milkdown-slash-menu custom-submenu",
@@ -3334,7 +3335,7 @@ const Menu = defineComponent({
3334
3335
  currentAlign === "right",
3335
3336
  () => setAlign("right")
3336
3337
  ),
3337
- /* @__PURE__ */ h$1("div", { class: "custom-divider" }),
3338
+ /* @__PURE__ */ h("div", { class: "custom-divider" }),
3338
3339
  renderSubMenuItem(
3339
3340
  indentIncreaseIcon,
3340
3341
  i18n(ctx, "customMenu.increaseIndent"),
@@ -3356,7 +3357,7 @@ const Menu = defineComponent({
3356
3357
  handleColorEnter,
3357
3358
  handleColorLeave
3358
3359
  ),
3359
- showColorMenu.value ? /* @__PURE__ */ h$1(
3360
+ showColorMenu.value ? /* @__PURE__ */ h(
3360
3361
  "div",
3361
3362
  {
3362
3363
  class: "milkdown-slash-menu custom-submenu",
@@ -3380,7 +3381,7 @@ const Menu = defineComponent({
3380
3381
  },
3381
3382
  onPointerleave: handleColorLeave
3382
3383
  },
3383
- /* @__PURE__ */ h$1(
3384
+ /* @__PURE__ */ h(
3384
3385
  "div",
3385
3386
  {
3386
3387
  style: {
@@ -3391,7 +3392,7 @@ const Menu = defineComponent({
3391
3392
  },
3392
3393
  i18n(ctx, "customMenu.textColor")
3393
3394
  ),
3394
- /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
3395
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
3395
3396
  "#000000",
3396
3397
  "#8C8C8C",
3397
3398
  "#F5222D",
@@ -3400,7 +3401,7 @@ const Menu = defineComponent({
3400
3401
  "#52C41A",
3401
3402
  "#1677FF",
3402
3403
  "#722ED1"
3403
- ].map((color) => /* @__PURE__ */ h$1(
3404
+ ].map((color) => /* @__PURE__ */ h(
3404
3405
  "div",
3405
3406
  {
3406
3407
  key: color,
@@ -3430,7 +3431,7 @@ const Menu = defineComponent({
3430
3431
  },
3431
3432
  "A"
3432
3433
  ))),
3433
- /* @__PURE__ */ h$1(
3434
+ /* @__PURE__ */ h(
3434
3435
  "div",
3435
3436
  {
3436
3437
  style: {
@@ -3442,7 +3443,7 @@ const Menu = defineComponent({
3442
3443
  },
3443
3444
  i18n(ctx, "customMenu.bgColor")
3444
3445
  ),
3445
- /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
3446
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
3446
3447
  "transparent",
3447
3448
  "#F5F5F5",
3448
3449
  "#FFCCC7",
@@ -3451,7 +3452,7 @@ const Menu = defineComponent({
3451
3452
  "#D9F7BE",
3452
3453
  "#D6E4FF",
3453
3454
  "#EFDBFF"
3454
- ].map((color) => /* @__PURE__ */ h$1(
3455
+ ].map((color) => /* @__PURE__ */ h(
3455
3456
  "div",
3456
3457
  {
3457
3458
  key: color,
@@ -3475,7 +3476,7 @@ const Menu = defineComponent({
3475
3476
  overflow: "hidden"
3476
3477
  }
3477
3478
  },
3478
- color === "transparent" ? /* @__PURE__ */ h$1(
3479
+ color === "transparent" ? /* @__PURE__ */ h(
3479
3480
  "div",
3480
3481
  {
3481
3482
  style: {
@@ -3499,7 +3500,7 @@ const Menu = defineComponent({
3499
3500
  "#52C41A",
3500
3501
  "#1677FF",
3501
3502
  "#722ED1"
3502
- ].map((color) => /* @__PURE__ */ h$1(
3503
+ ].map((color) => /* @__PURE__ */ h(
3503
3504
  "div",
3504
3505
  {
3505
3506
  key: color,
@@ -3522,7 +3523,7 @@ const Menu = defineComponent({
3522
3523
  }
3523
3524
  }
3524
3525
  ))),
3525
- /* @__PURE__ */ h$1(
3526
+ /* @__PURE__ */ h(
3526
3527
  "button",
3527
3528
  {
3528
3529
  onPointerdown: (e) => {
@@ -3549,7 +3550,7 @@ const Menu = defineComponent({
3549
3550
  i18n(ctx, "customMenu.restoreDefault")
3550
3551
  )
3551
3552
  ) : null,
3552
- !isMedia ? /* @__PURE__ */ h$1("div", { class: "custom-divider" }) : null,
3553
+ !isMedia ? /* @__PURE__ */ h("div", { class: "custom-divider" }) : null,
3553
3554
  renderCustomRow(
3554
3555
  clearIcon,
3555
3556
  i18n(ctx, "customMenu.cut"),
@@ -3574,7 +3575,7 @@ const Menu = defineComponent({
3574
3575
  void 0,
3575
3576
  applyDelete
3576
3577
  ),
3577
- /* @__PURE__ */ h$1("div", { class: "custom-divider" }),
3578
+ /* @__PURE__ */ h("div", { class: "custom-divider" }),
3578
3579
  renderCustomRow(
3579
3580
  plusIcon,
3580
3581
  i18n(ctx, "customMenu.addBelow"),
@@ -3582,7 +3583,7 @@ const Menu = defineComponent({
3582
3583
  handleAddBelowEnter,
3583
3584
  handleAddBelowLeave
3584
3585
  ),
3585
- showAddBelowMenu.value ? /* @__PURE__ */ h$1(
3586
+ showAddBelowMenu.value ? /* @__PURE__ */ h(
3586
3587
  "div",
3587
3588
  {
3588
3589
  class: "milkdown-slash-menu custom-submenu",
@@ -3602,14 +3603,14 @@ const Menu = defineComponent({
3602
3603
  },
3603
3604
  onPointerleave: handleAddBelowLeave
3604
3605
  },
3605
- /* @__PURE__ */ h$1(
3606
+ /* @__PURE__ */ h(
3606
3607
  "div",
3607
3608
  {
3608
3609
  class: "menu-groups",
3609
3610
  onPointermove: onPointerMove,
3610
3611
  style: { maxHeight: "300px", overflowY: "auto" }
3611
3612
  },
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
+ 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(
3613
3614
  "li",
3614
3615
  {
3615
3616
  key: item.key,
@@ -3636,8 +3637,8 @@ const Menu = defineComponent({
3636
3637
  runByIndexForAddBelow(item.index);
3637
3638
  }
3638
3639
  },
3639
- /* @__PURE__ */ h$1(Icon, { icon: item.icon }),
3640
- /* @__PURE__ */ h$1("span", null, item.label)
3640
+ /* @__PURE__ */ h(Icon, { icon: item.icon }),
3641
+ /* @__PURE__ */ h("span", null, item.label)
3641
3642
  )))))
3642
3643
  )
3643
3644
  ) : null
@@ -3885,7 +3886,7 @@ function getBlockKey(node) {
3885
3886
  }
3886
3887
  }
3887
3888
 
3888
- keepAlive(h$1, Fragment);
3889
+ keepAlive(h, Fragment);
3889
3890
  const BlockHandle = defineComponent({
3890
3891
  props: {
3891
3892
  onAdd: {
@@ -3933,7 +3934,7 @@ const BlockHandle = defineComponent({
3933
3934
  const addButton = ref();
3934
3935
  const menuButton = ref();
3935
3936
  return () => {
3936
- return /* @__PURE__ */ h$1(Fragment, null, /* @__PURE__ */ h$1(
3937
+ return /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
3937
3938
  "div",
3938
3939
  {
3939
3940
  ref: addButton,
@@ -3959,8 +3960,8 @@ const BlockHandle = defineComponent({
3959
3960
  props.onAdd(addButton.value);
3960
3961
  }
3961
3962
  },
3962
- /* @__PURE__ */ h$1(Icon, { icon: props.addIcon })
3963
- ), /* @__PURE__ */ h$1(
3963
+ /* @__PURE__ */ h(Icon, { icon: props.addIcon })
3964
+ ), /* @__PURE__ */ h(
3964
3965
  "div",
3965
3966
  {
3966
3967
  ref: menuButton,
@@ -3978,14 +3979,14 @@ const BlockHandle = defineComponent({
3978
3979
  props.onLeaveMenu();
3979
3980
  }
3980
3981
  },
3981
- /* @__PURE__ */ h$1(Icon, { icon: props.state.icon })
3982
- ), /* @__PURE__ */ h$1("div", { class: "divider" }), /* @__PURE__ */ h$1(
3982
+ /* @__PURE__ */ h(Icon, { icon: props.state.icon })
3983
+ ), /* @__PURE__ */ h("div", { class: "divider" }), /* @__PURE__ */ h(
3983
3984
  "div",
3984
3985
  {
3985
3986
  class: "operation-item drag-item",
3986
3987
  title: i18n(props.ctx, "handle.drag")
3987
3988
  },
3988
- /* @__PURE__ */ h$1(Icon, { icon: dragHandleIcon })
3989
+ /* @__PURE__ */ h(Icon, { icon: dragHandleIcon })
3989
3990
  ));
3990
3991
  };
3991
3992
  }
@@ -5434,7 +5435,7 @@ const activeIconMap = {
5434
5435
  [dividerIcon]: dividerIconActive
5435
5436
  // [highLineCodeIcon]: highLineCodeIconActive,
5436
5437
  };
5437
- keepAlive(h$1, Fragment);
5438
+ keepAlive(h, Fragment);
5438
5439
  const formatPainterStates = /* @__PURE__ */ new WeakMap();
5439
5440
  const formatPainterHandlers = /* @__PURE__ */ new WeakMap();
5440
5441
  const formatPainterIgnoreNext = /* @__PURE__ */ new WeakMap();
@@ -5736,12 +5737,18 @@ const Toolbar = defineComponent({
5736
5737
  };
5737
5738
  let lastContainerWidth = 0;
5738
5739
  const computeOverflow = () => {
5740
+ var _a;
5739
5741
  if (!toolbarContainerRef.value) return;
5742
+ const status = (_a = ctx == null ? void 0 : ctx.get(editorCtx)) == null ? void 0 : _a.status;
5743
+ if (status !== EditorStatus.Created) return;
5744
+ const view = ctx.get(editorViewCtx);
5745
+ if (!view || !view.dom) return;
5740
5746
  const container = toolbarContainerRef.value;
5741
5747
  if (!isFixed) {
5742
- const view = ctx.get(editorViewCtx);
5743
5748
  const containerDOM = view.dom.closest(".milkdown-editor-container") || view.dom.closest(".milkdown") || view.dom;
5744
- container.style.maxWidth = `${containerDOM.clientWidth - 32}px`;
5749
+ if (containerDOM) {
5750
+ container.style.maxWidth = `${containerDOM.clientWidth - 32}px`;
5751
+ }
5745
5752
  }
5746
5753
  let containerWidth;
5747
5754
  if (isFixed) {
@@ -5760,9 +5767,8 @@ const Toolbar = defineComponent({
5760
5767
  containerWidth = container.clientWidth;
5761
5768
  }
5762
5769
  } else {
5763
- const view = ctx.get(editorViewCtx);
5764
5770
  const containerDOM = view.dom.closest(".milkdown-editor-container") || view.dom.closest(".milkdown") || view.dom;
5765
- containerWidth = containerDOM.clientWidth - 32;
5771
+ containerWidth = containerDOM ? containerDOM.clientWidth - 32 : 0;
5766
5772
  }
5767
5773
  if (showOverflowMenu.value) {
5768
5774
  showOverflowMenu.value = false;
@@ -5964,7 +5970,18 @@ const Toolbar = defineComponent({
5964
5970
  let overflowResizeObserver = null;
5965
5971
  let overflowSetupDone = false;
5966
5972
  const setupOverflowObserver = () => {
5973
+ var _a;
5967
5974
  if (!toolbarContainerRef.value || overflowSetupDone) return;
5975
+ const status = (_a = ctx == null ? void 0 : ctx.get(editorCtx)) == null ? void 0 : _a.status;
5976
+ if (status !== EditorStatus.Created) {
5977
+ setTimeout(setupOverflowObserver, 50);
5978
+ return;
5979
+ }
5980
+ const view = ctx.get(editorViewCtx);
5981
+ if (!view || !view.dom) {
5982
+ setTimeout(setupOverflowObserver, 50);
5983
+ return;
5984
+ }
5968
5985
  overflowSetupDone = true;
5969
5986
  overflowResizeObserver = new ResizeObserver(() => {
5970
5987
  computeOverflow();
@@ -5974,7 +5991,6 @@ const Toolbar = defineComponent({
5974
5991
  const parent = toolbarContainerRef.value.parentElement;
5975
5992
  if (parent) overflowResizeObserver.observe(parent);
5976
5993
  } else {
5977
- const view = ctx.get(editorViewCtx);
5978
5994
  overflowResizeObserver.observe(view.dom);
5979
5995
  const containerDOM = view.dom.closest(".milkdown-editor-container");
5980
5996
  if (containerDOM) {
@@ -6343,7 +6359,7 @@ const Toolbar = defineComponent({
6343
6359
  showFontSizeMenu.value = false;
6344
6360
  };
6345
6361
  const renderSubMenuItem = (iconHtml, label, isActive, onClick2, disabled = false) => {
6346
- return /* @__PURE__ */ h$1(
6362
+ return /* @__PURE__ */ h(
6347
6363
  "div",
6348
6364
  {
6349
6365
  class: ["custom-menu-row", disabled ? "disabled" : ""],
@@ -6375,13 +6391,13 @@ const Toolbar = defineComponent({
6375
6391
  e.currentTarget.style.backgroundColor = "transparent";
6376
6392
  }
6377
6393
  },
6378
- /* @__PURE__ */ h$1(
6394
+ /* @__PURE__ */ h(
6379
6395
  "div",
6380
6396
  {
6381
6397
  class: "custom-menu-row-left",
6382
6398
  style: { display: "flex", alignItems: "center", gap: "8px" }
6383
6399
  },
6384
- /* @__PURE__ */ h$1(
6400
+ /* @__PURE__ */ h(
6385
6401
  "span",
6386
6402
  {
6387
6403
  style: {
@@ -6393,7 +6409,7 @@ const Toolbar = defineComponent({
6393
6409
  innerHTML: iconHtml
6394
6410
  }
6395
6411
  ),
6396
- /* @__PURE__ */ h$1(
6412
+ /* @__PURE__ */ h(
6397
6413
  "span",
6398
6414
  {
6399
6415
  style: {
@@ -6404,7 +6420,7 @@ const Toolbar = defineComponent({
6404
6420
  label
6405
6421
  )
6406
6422
  ),
6407
- isActive ? /* @__PURE__ */ h$1(
6423
+ isActive ? /* @__PURE__ */ h(
6408
6424
  "span",
6409
6425
  {
6410
6426
  style: {
@@ -6413,7 +6429,7 @@ const Toolbar = defineComponent({
6413
6429
  color: "var(--crepe-color-primary)"
6414
6430
  }
6415
6431
  },
6416
- /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
6432
+ /* @__PURE__ */ h(Icon, { icon: confirmIcon })
6417
6433
  ) : null
6418
6434
  );
6419
6435
  };
@@ -6439,7 +6455,7 @@ const Toolbar = defineComponent({
6439
6455
  });
6440
6456
  const isSectionOverflowed = (idx) => idx >= overflowVisibleCount.value;
6441
6457
  const hasOverflow = overflowVisibleCount.value < totalSectionCount.value;
6442
- return /* @__PURE__ */ h$1(
6458
+ return /* @__PURE__ */ h(
6443
6459
  "div",
6444
6460
  {
6445
6461
  ref: toolbarContainerRef,
@@ -6450,7 +6466,7 @@ const Toolbar = defineComponent({
6450
6466
  overflow: "hidden"
6451
6467
  }
6452
6468
  },
6453
- /* @__PURE__ */ h$1(
6469
+ /* @__PURE__ */ h(
6454
6470
  "div",
6455
6471
  {
6456
6472
  class: "toolbar-item",
@@ -6464,22 +6480,22 @@ const Toolbar = defineComponent({
6464
6480
  flexShrink: 0
6465
6481
  }
6466
6482
  },
6467
- /* @__PURE__ */ h$1(
6483
+ /* @__PURE__ */ h(
6468
6484
  "span",
6469
6485
  {
6470
6486
  style: { display: "inline-flex", alignItems: "center" },
6471
6487
  innerHTML: activeBlockItem.value || textIcon
6472
6488
  }
6473
6489
  ),
6474
- /* @__PURE__ */ h$1(
6490
+ /* @__PURE__ */ h(
6475
6491
  "span",
6476
6492
  {
6477
6493
  style: { width: "20px", display: "flex", alignItems: "center" }
6478
6494
  },
6479
- /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6495
+ /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6480
6496
  )
6481
6497
  ),
6482
- /* @__PURE__ */ h$1(
6498
+ /* @__PURE__ */ h(
6483
6499
  "div",
6484
6500
  {
6485
6501
  style: {
@@ -6488,7 +6504,7 @@ const Toolbar = defineComponent({
6488
6504
  flexShrink: 0
6489
6505
  }
6490
6506
  },
6491
- /* @__PURE__ */ h$1(
6507
+ /* @__PURE__ */ h(
6492
6508
  "button",
6493
6509
  {
6494
6510
  type: "button",
@@ -6509,7 +6525,7 @@ const Toolbar = defineComponent({
6509
6525
  backgroundColor: formatPainterState.value ? "var(--crepe-color-selected, var(--crepe-color-hover))" : void 0
6510
6526
  }
6511
6527
  },
6512
- /* @__PURE__ */ h$1(
6528
+ /* @__PURE__ */ h(
6513
6529
  "span",
6514
6530
  {
6515
6531
  style: {
@@ -6522,7 +6538,7 @@ const Toolbar = defineComponent({
6522
6538
  )
6523
6539
  )
6524
6540
  ),
6525
- /* @__PURE__ */ h$1(
6541
+ /* @__PURE__ */ h(
6526
6542
  "div",
6527
6543
  {
6528
6544
  class: "divider",
@@ -6534,7 +6550,7 @@ const Toolbar = defineComponent({
6534
6550
  }
6535
6551
  }
6536
6552
  ),
6537
- /* @__PURE__ */ h$1(
6553
+ /* @__PURE__ */ h(
6538
6554
  "div",
6539
6555
  {
6540
6556
  class: "toolbar-item custom-font-family-item",
@@ -6549,7 +6565,7 @@ const Toolbar = defineComponent({
6549
6565
  flexShrink: 0
6550
6566
  }
6551
6567
  },
6552
- /* @__PURE__ */ h$1(
6568
+ /* @__PURE__ */ h(
6553
6569
  "span",
6554
6570
  {
6555
6571
  style: {
@@ -6563,7 +6579,7 @@ const Toolbar = defineComponent({
6563
6579
  },
6564
6580
  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"
6565
6581
  ),
6566
- /* @__PURE__ */ h$1(
6582
+ /* @__PURE__ */ h(
6567
6583
  "span",
6568
6584
  {
6569
6585
  style: {
@@ -6573,10 +6589,10 @@ const Toolbar = defineComponent({
6573
6589
  marginLeft: "4px"
6574
6590
  }
6575
6591
  },
6576
- /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6592
+ /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6577
6593
  )
6578
6594
  ),
6579
- /* @__PURE__ */ h$1(
6595
+ /* @__PURE__ */ h(
6580
6596
  "div",
6581
6597
  {
6582
6598
  class: "toolbar-item custom-font-size-item",
@@ -6591,8 +6607,8 @@ const Toolbar = defineComponent({
6591
6607
  flexShrink: 0
6592
6608
  }
6593
6609
  },
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(
6610
+ /* @__PURE__ */ h("span", { style: { fontSize: "13px", color: "#363B4C" } }, currentFontState.value.fontSize && currentFontState.value.fontSize !== "mixed" ? currentFontState.value.fontSize : "16px"),
6611
+ /* @__PURE__ */ h(
6596
6612
  "span",
6597
6613
  {
6598
6614
  style: {
@@ -6602,10 +6618,10 @@ const Toolbar = defineComponent({
6602
6618
  marginLeft: "4px"
6603
6619
  }
6604
6620
  },
6605
- /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6621
+ /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6606
6622
  )
6607
6623
  ),
6608
- /* @__PURE__ */ h$1(
6624
+ /* @__PURE__ */ h(
6609
6625
  "div",
6610
6626
  {
6611
6627
  class: "divider",
@@ -6617,7 +6633,7 @@ const Toolbar = defineComponent({
6617
6633
  }
6618
6634
  }
6619
6635
  ),
6620
- /* @__PURE__ */ h$1(
6636
+ /* @__PURE__ */ h(
6621
6637
  "div",
6622
6638
  {
6623
6639
  class: "toolbar-item",
@@ -6631,22 +6647,22 @@ const Toolbar = defineComponent({
6631
6647
  flexShrink: 0
6632
6648
  }
6633
6649
  },
6634
- /* @__PURE__ */ h$1(
6650
+ /* @__PURE__ */ h(
6635
6651
  "span",
6636
6652
  {
6637
6653
  style: { display: "inline-flex", alignItems: "center" },
6638
6654
  innerHTML: currentAlignIndent.value.align === "center" ? alignCenterIcon : currentAlignIndent.value.align === "right" ? alignRightIcon : alignLeftIcon
6639
6655
  }
6640
6656
  ),
6641
- /* @__PURE__ */ h$1(
6657
+ /* @__PURE__ */ h(
6642
6658
  "span",
6643
6659
  {
6644
6660
  style: { width: "20px", display: "flex", alignItems: "center" }
6645
6661
  },
6646
- /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6662
+ /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6647
6663
  )
6648
6664
  ),
6649
- /* @__PURE__ */ h$1(
6665
+ /* @__PURE__ */ h(
6650
6666
  "div",
6651
6667
  {
6652
6668
  class: "toolbar-item",
@@ -6660,7 +6676,7 @@ const Toolbar = defineComponent({
6660
6676
  flexShrink: 0
6661
6677
  }
6662
6678
  },
6663
- /* @__PURE__ */ h$1(
6679
+ /* @__PURE__ */ h(
6664
6680
  "span",
6665
6681
  {
6666
6682
  class: "milkdown-icon",
@@ -6673,12 +6689,12 @@ const Toolbar = defineComponent({
6673
6689
  }
6674
6690
  }
6675
6691
  ),
6676
- /* @__PURE__ */ h$1(
6692
+ /* @__PURE__ */ h(
6677
6693
  "span",
6678
6694
  {
6679
6695
  style: { width: "20px", display: "flex", alignItems: "center" }
6680
6696
  },
6681
- /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6697
+ /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6682
6698
  )
6683
6699
  ),
6684
6700
  (() => {
@@ -6688,7 +6704,7 @@ const Toolbar = defineComponent({
6688
6704
  const idx = sectionIdx;
6689
6705
  sectionIdx++;
6690
6706
  const isTable = item.icon === tableIcon;
6691
- return /* @__PURE__ */ h$1(
6707
+ return /* @__PURE__ */ h(
6692
6708
  "div",
6693
6709
  {
6694
6710
  key: item.label,
@@ -6700,7 +6716,7 @@ const Toolbar = defineComponent({
6700
6716
  onMouseenter: isTable ? handleTableEnter : void 0,
6701
6717
  onMouseleave: isTable ? handleTableLeave : void 0
6702
6718
  },
6703
- /* @__PURE__ */ h$1(
6719
+ /* @__PURE__ */ h(
6704
6720
  "button",
6705
6721
  {
6706
6722
  type: "button",
@@ -6724,14 +6740,14 @@ const Toolbar = defineComponent({
6724
6740
  justifyContent: "center"
6725
6741
  }
6726
6742
  },
6727
- /* @__PURE__ */ h$1(
6743
+ /* @__PURE__ */ h(
6728
6744
  "span",
6729
6745
  {
6730
6746
  style: { display: "inline-flex", alignItems: "center" },
6731
6747
  innerHTML: ctx && checkActive(item.active) ? activeIconMap[item.icon] || item.icon : item.icon
6732
6748
  }
6733
6749
  ),
6734
- isTable ? /* @__PURE__ */ h$1(
6750
+ isTable ? /* @__PURE__ */ h(
6735
6751
  "span",
6736
6752
  {
6737
6753
  style: {
@@ -6742,7 +6758,7 @@ const Toolbar = defineComponent({
6742
6758
  opacity: 0.5
6743
6759
  }
6744
6760
  },
6745
- /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
6761
+ /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
6746
6762
  ) : null
6747
6763
  )
6748
6764
  );
@@ -6751,7 +6767,7 @@ const Toolbar = defineComponent({
6751
6767
  if (groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0) {
6752
6768
  sectionIdx++;
6753
6769
  }
6754
- return /* @__PURE__ */ h$1(Fragment, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h$1(
6770
+ return /* @__PURE__ */ h(Fragment, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h(
6755
6771
  "div",
6756
6772
  {
6757
6773
  class: "divider",
@@ -6763,7 +6779,7 @@ const Toolbar = defineComponent({
6763
6779
  ) : null);
6764
6780
  });
6765
6781
  })(),
6766
- hasOverflow ? /* @__PURE__ */ h$1(
6782
+ hasOverflow ? /* @__PURE__ */ h(
6767
6783
  "div",
6768
6784
  {
6769
6785
  "data-overflow-button": "true",
@@ -6790,7 +6806,7 @@ const Toolbar = defineComponent({
6790
6806
  showOverflowMenu.value = true;
6791
6807
  }
6792
6808
  },
6793
- /* @__PURE__ */ h$1(
6809
+ /* @__PURE__ */ h(
6794
6810
  "span",
6795
6811
  {
6796
6812
  style: { display: "inline-flex", alignItems: "center" },
@@ -6798,7 +6814,7 @@ const Toolbar = defineComponent({
6798
6814
  }
6799
6815
  )
6800
6816
  ) : null,
6801
- showBlockMenu.value ? /* @__PURE__ */ h$1(
6817
+ showBlockMenu.value ? /* @__PURE__ */ h(
6802
6818
  "div",
6803
6819
  {
6804
6820
  class: "milkdown-slash-menu custom-submenu",
@@ -6823,7 +6839,7 @@ const Toolbar = defineComponent({
6823
6839
  },
6824
6840
  onMouseleave: handleBlockLeave
6825
6841
  },
6826
- /* @__PURE__ */ h$1(
6842
+ /* @__PURE__ */ h(
6827
6843
  "div",
6828
6844
  {
6829
6845
  style: {
@@ -6880,7 +6896,7 @@ const Toolbar = defineComponent({
6880
6896
  );
6881
6897
  })
6882
6898
  ) : null,
6883
- showAlignMenu.value ? /* @__PURE__ */ h$1(
6899
+ showAlignMenu.value ? /* @__PURE__ */ h(
6884
6900
  "div",
6885
6901
  {
6886
6902
  class: "milkdown-slash-menu custom-submenu",
@@ -6903,7 +6919,7 @@ const Toolbar = defineComponent({
6903
6919
  },
6904
6920
  onMouseleave: handleAlignLeave
6905
6921
  },
6906
- /* @__PURE__ */ h$1(
6922
+ /* @__PURE__ */ h(
6907
6923
  "div",
6908
6924
  {
6909
6925
  style: {
@@ -6934,7 +6950,7 @@ const Toolbar = defineComponent({
6934
6950
  currentAlignIndent.value.align === "right",
6935
6951
  () => setAlign("right")
6936
6952
  ),
6937
- /* @__PURE__ */ h$1(
6953
+ /* @__PURE__ */ h(
6938
6954
  "div",
6939
6955
  {
6940
6956
  style: {
@@ -6956,7 +6972,7 @@ const Toolbar = defineComponent({
6956
6972
  () => setIndent(-1),
6957
6973
  currentAlignIndent.value.indent <= 0
6958
6974
  ),
6959
- canMerge.value || canSplit.value ? /* @__PURE__ */ h$1(Fragment, null, /* @__PURE__ */ h$1(
6975
+ canMerge.value || canSplit.value ? /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
6960
6976
  "div",
6961
6977
  {
6962
6978
  style: {
@@ -6976,7 +6992,7 @@ const Toolbar = defineComponent({
6976
6992
  onSplitCell
6977
6993
  )) : null
6978
6994
  ) : null,
6979
- showColorMenu.value ? /* @__PURE__ */ h$1(
6995
+ showColorMenu.value ? /* @__PURE__ */ h(
6980
6996
  "div",
6981
6997
  {
6982
6998
  class: "milkdown-slash-menu custom-submenu",
@@ -7000,7 +7016,7 @@ const Toolbar = defineComponent({
7000
7016
  },
7001
7017
  onMouseleave: handleColorLeave
7002
7018
  },
7003
- /* @__PURE__ */ h$1(
7019
+ /* @__PURE__ */ h(
7004
7020
  "div",
7005
7021
  {
7006
7022
  style: {
@@ -7013,7 +7029,7 @@ const Toolbar = defineComponent({
7013
7029
  }
7014
7030
  }
7015
7031
  ),
7016
- /* @__PURE__ */ h$1(
7032
+ /* @__PURE__ */ h(
7017
7033
  "div",
7018
7034
  {
7019
7035
  style: {
@@ -7024,7 +7040,7 @@ const Toolbar = defineComponent({
7024
7040
  },
7025
7041
  ctx ? i18n(ctx, "customMenu.textColor") : "\u5B57\u4F53\u989C\u8272"
7026
7042
  ),
7027
- /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
7043
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
7028
7044
  "#000000",
7029
7045
  "#8C8C8C",
7030
7046
  "#F5222D",
@@ -7033,7 +7049,7 @@ const Toolbar = defineComponent({
7033
7049
  "#52C41A",
7034
7050
  "#1677FF",
7035
7051
  "#722ED1"
7036
- ].map((color) => /* @__PURE__ */ h$1(
7052
+ ].map((color) => /* @__PURE__ */ h(
7037
7053
  "div",
7038
7054
  {
7039
7055
  key: color,
@@ -7056,7 +7072,7 @@ const Toolbar = defineComponent({
7056
7072
  },
7057
7073
  "A"
7058
7074
  ))),
7059
- /* @__PURE__ */ h$1(
7075
+ /* @__PURE__ */ h(
7060
7076
  "div",
7061
7077
  {
7062
7078
  style: {
@@ -7068,7 +7084,7 @@ const Toolbar = defineComponent({
7068
7084
  },
7069
7085
  ctx ? i18n(ctx, "customMenu.bgColor") : "\u80CC\u666F\u989C\u8272"
7070
7086
  ),
7071
- /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
7087
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
7072
7088
  "transparent",
7073
7089
  "#F5F5F5",
7074
7090
  "#FFCCC7",
@@ -7077,7 +7093,7 @@ const Toolbar = defineComponent({
7077
7093
  "#D9F7BE",
7078
7094
  "#D6E4FF",
7079
7095
  "#EFDBFF"
7080
- ].map((color) => /* @__PURE__ */ h$1(
7096
+ ].map((color) => /* @__PURE__ */ h(
7081
7097
  "div",
7082
7098
  {
7083
7099
  key: color,
@@ -7094,7 +7110,7 @@ const Toolbar = defineComponent({
7094
7110
  overflow: "hidden"
7095
7111
  }
7096
7112
  },
7097
- color === "transparent" ? /* @__PURE__ */ h$1(
7113
+ color === "transparent" ? /* @__PURE__ */ h(
7098
7114
  "div",
7099
7115
  {
7100
7116
  style: {
@@ -7118,7 +7134,7 @@ const Toolbar = defineComponent({
7118
7134
  "#52C41A",
7119
7135
  "#1677FF",
7120
7136
  "#722ED1"
7121
- ].map((color) => /* @__PURE__ */ h$1(
7137
+ ].map((color) => /* @__PURE__ */ h(
7122
7138
  "div",
7123
7139
  {
7124
7140
  key: color,
@@ -7134,7 +7150,7 @@ const Toolbar = defineComponent({
7134
7150
  }
7135
7151
  }
7136
7152
  ))),
7137
- /* @__PURE__ */ h$1(
7153
+ /* @__PURE__ */ h(
7138
7154
  "button",
7139
7155
  {
7140
7156
  onClick: clearColor,
@@ -7153,7 +7169,7 @@ const Toolbar = defineComponent({
7153
7169
  ctx ? i18n(ctx, "customMenu.restoreDefault") : "\u6062\u590D\u9ED8\u8BA4"
7154
7170
  )
7155
7171
  ) : null,
7156
- showFontFamilyMenu.value ? /* @__PURE__ */ h$1(
7172
+ showFontFamilyMenu.value ? /* @__PURE__ */ h(
7157
7173
  "div",
7158
7174
  {
7159
7175
  class: "milkdown-slash-menu custom-submenu",
@@ -7178,7 +7194,7 @@ const Toolbar = defineComponent({
7178
7194
  },
7179
7195
  onMouseleave: handleFontFamilyLeave
7180
7196
  },
7181
- /* @__PURE__ */ h$1(
7197
+ /* @__PURE__ */ h(
7182
7198
  "div",
7183
7199
  {
7184
7200
  style: {
@@ -7239,7 +7255,7 @@ const Toolbar = defineComponent({
7239
7255
  }
7240
7256
  ].map((font) => {
7241
7257
  const supported = isFontSupported(font.value);
7242
- return /* @__PURE__ */ h$1(
7258
+ return /* @__PURE__ */ h(
7243
7259
  "div",
7244
7260
  {
7245
7261
  key: font.label,
@@ -7276,7 +7292,7 @@ const Toolbar = defineComponent({
7276
7292
  e.currentTarget.style.backgroundColor = "transparent";
7277
7293
  }
7278
7294
  },
7279
- /* @__PURE__ */ h$1(
7295
+ /* @__PURE__ */ h(
7280
7296
  "span",
7281
7297
  {
7282
7298
  style: {
@@ -7286,7 +7302,7 @@ const Toolbar = defineComponent({
7286
7302
  },
7287
7303
  font.label
7288
7304
  ),
7289
- currentFontState.value.fontFamily === font.value ? /* @__PURE__ */ h$1(
7305
+ currentFontState.value.fontFamily === font.value ? /* @__PURE__ */ h(
7290
7306
  "span",
7291
7307
  {
7292
7308
  style: {
@@ -7295,12 +7311,12 @@ const Toolbar = defineComponent({
7295
7311
  color: "var(--crepe-color-primary)"
7296
7312
  }
7297
7313
  },
7298
- /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
7314
+ /* @__PURE__ */ h(Icon, { icon: confirmIcon })
7299
7315
  ) : null
7300
7316
  );
7301
7317
  })
7302
7318
  ) : null,
7303
- showFontSizeMenu.value ? /* @__PURE__ */ h$1(
7319
+ showFontSizeMenu.value ? /* @__PURE__ */ h(
7304
7320
  "div",
7305
7321
  {
7306
7322
  class: "milkdown-slash-menu custom-submenu",
@@ -7325,7 +7341,7 @@ const Toolbar = defineComponent({
7325
7341
  },
7326
7342
  onMouseleave: handleFontSizeLeave
7327
7343
  },
7328
- /* @__PURE__ */ h$1(
7344
+ /* @__PURE__ */ h(
7329
7345
  "div",
7330
7346
  {
7331
7347
  style: {
@@ -7350,7 +7366,7 @@ const Toolbar = defineComponent({
7350
7366
  { label: "28px", value: "28px" },
7351
7367
  { label: "32px", value: "32px" },
7352
7368
  { label: "36px", value: "36px" }
7353
- ].map((size) => /* @__PURE__ */ h$1(
7369
+ ].map((size) => /* @__PURE__ */ h(
7354
7370
  "div",
7355
7371
  {
7356
7372
  key: size.label,
@@ -7381,7 +7397,7 @@ const Toolbar = defineComponent({
7381
7397
  e.currentTarget.style.backgroundColor = "transparent";
7382
7398
  }
7383
7399
  },
7384
- /* @__PURE__ */ h$1(
7400
+ /* @__PURE__ */ h(
7385
7401
  "span",
7386
7402
  {
7387
7403
  style: {
@@ -7391,7 +7407,7 @@ const Toolbar = defineComponent({
7391
7407
  },
7392
7408
  size.label
7393
7409
  ),
7394
- currentFontState.value.fontSize === size.value ? /* @__PURE__ */ h$1(
7410
+ currentFontState.value.fontSize === size.value ? /* @__PURE__ */ h(
7395
7411
  "span",
7396
7412
  {
7397
7413
  style: {
@@ -7400,11 +7416,11 @@ const Toolbar = defineComponent({
7400
7416
  color: "var(--crepe-color-primary)"
7401
7417
  }
7402
7418
  },
7403
- /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
7419
+ /* @__PURE__ */ h(Icon, { icon: confirmIcon })
7404
7420
  ) : null
7405
7421
  ))
7406
7422
  ) : null,
7407
- showTableMenu.value ? /* @__PURE__ */ h$1(
7423
+ showTableMenu.value ? /* @__PURE__ */ h(
7408
7424
  "div",
7409
7425
  {
7410
7426
  class: "milkdown-slash-menu custom-submenu",
@@ -7427,7 +7443,7 @@ const Toolbar = defineComponent({
7427
7443
  },
7428
7444
  onMouseleave: handleTableLeave
7429
7445
  },
7430
- /* @__PURE__ */ h$1(
7446
+ /* @__PURE__ */ h(
7431
7447
  "div",
7432
7448
  {
7433
7449
  style: {
@@ -7440,7 +7456,7 @@ const Toolbar = defineComponent({
7440
7456
  }
7441
7457
  }
7442
7458
  ),
7443
- /* @__PURE__ */ h$1(
7459
+ /* @__PURE__ */ h(
7444
7460
  "div",
7445
7461
  {
7446
7462
  style: {
@@ -7452,7 +7468,7 @@ const Toolbar = defineComponent({
7452
7468
  },
7453
7469
  i18n(ctx, "customMenu.insertTable")
7454
7470
  ),
7455
- /* @__PURE__ */ h$1(
7471
+ /* @__PURE__ */ h(
7456
7472
  "div",
7457
7473
  {
7458
7474
  style: {
@@ -7465,7 +7481,7 @@ const Toolbar = defineComponent({
7465
7481
  Array.from({ length: 9 }).map(
7466
7482
  (_, r) => Array.from({ length: 9 }).map((_2, c) => {
7467
7483
  const isHovered = r < tableHoverIndices.value.r && c < tableHoverIndices.value.c;
7468
- return /* @__PURE__ */ h$1(
7484
+ return /* @__PURE__ */ h(
7469
7485
  "div",
7470
7486
  {
7471
7487
  key: `cell-${r}-${c}`,
@@ -7494,7 +7510,7 @@ const Toolbar = defineComponent({
7494
7510
  })
7495
7511
  )
7496
7512
  ),
7497
- tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h$1(
7513
+ tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h(
7498
7514
  "div",
7499
7515
  {
7500
7516
  style: {
@@ -7507,7 +7523,7 @@ const Toolbar = defineComponent({
7507
7523
  tableHoverIndices.value.r,
7508
7524
  " x ",
7509
7525
  tableHoverIndices.value.c
7510
- ) : /* @__PURE__ */ h$1(
7526
+ ) : /* @__PURE__ */ h(
7511
7527
  "div",
7512
7528
  {
7513
7529
  style: {
@@ -7520,7 +7536,7 @@ const Toolbar = defineComponent({
7520
7536
  "0 x 0"
7521
7537
  )
7522
7538
  ) : null,
7523
- showOverflowMenu.value ? /* @__PURE__ */ h$1(
7539
+ showOverflowMenu.value ? /* @__PURE__ */ h(
7524
7540
  "div",
7525
7541
  {
7526
7542
  class: "overflow-menu-popup",
@@ -7545,7 +7561,7 @@ const Toolbar = defineComponent({
7545
7561
  (() => {
7546
7562
  const cutoff = overflowVisibleCount.value;
7547
7563
  const items = [];
7548
- const renderIconButton = (iconHtml, title, isActive, onClick2, hasDropdown = false, onMouseEnter, onMouseLeave, key) => /* @__PURE__ */ h$1(
7564
+ const renderIconButton = (iconHtml, title, isActive, onClick2, hasDropdown = false, onMouseEnter, onMouseLeave, key) => /* @__PURE__ */ h(
7549
7565
  "button",
7550
7566
  {
7551
7567
  type: "button",
@@ -7569,14 +7585,14 @@ const Toolbar = defineComponent({
7569
7585
  justifyContent: "center"
7570
7586
  }
7571
7587
  },
7572
- /* @__PURE__ */ h$1(
7588
+ /* @__PURE__ */ h(
7573
7589
  "span",
7574
7590
  {
7575
7591
  style: { display: "inline-flex", alignItems: "center" },
7576
7592
  innerHTML: iconHtml
7577
7593
  }
7578
7594
  ),
7579
- hasDropdown ? /* @__PURE__ */ h$1(
7595
+ hasDropdown ? /* @__PURE__ */ h(
7580
7596
  "span",
7581
7597
  {
7582
7598
  style: {
@@ -7586,7 +7602,7 @@ const Toolbar = defineComponent({
7586
7602
  opacity: 0.5
7587
7603
  }
7588
7604
  },
7589
- /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
7605
+ /* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
7590
7606
  ) : null
7591
7607
  );
7592
7608
  if (0 >= cutoff) {
@@ -7743,6 +7759,7 @@ const createViewMenuState = () => reactive({
7743
7759
  });
7744
7760
  const viewMenuStateCtx = $ctx(createViewMenuState(), "viewMenuStateCtx");
7745
7761
 
7762
+ keepAlive(h);
7746
7763
  const ToggleSwitch = defineComponent({
7747
7764
  props: {
7748
7765
  modelValue: { type: Boolean, required: true }
@@ -8298,6 +8315,7 @@ const MenuBar = defineComponent({
8298
8315
  }
8299
8316
  });
8300
8317
 
8318
+ keepAlive(h);
8301
8319
  const isMac = typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
8302
8320
  function fmt(shortcut) {
8303
8321
  return shortcut.replace(/Mod/g, isMac ? "\u2318" : "Ctrl").replace(/\+/g, isMac ? "" : "+").replace(/Shift/g, isMac ? "\u21E7" : "Shift").replace(/Alt/g, isMac ? "\u2325" : "Alt");
@@ -8380,7 +8398,7 @@ const labelStyle = {
8380
8398
  color: "var(--crepe-color-on-surface, #333)"
8381
8399
  };
8382
8400
  function renderGroup(ctx, group) {
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))))))));
8401
+ 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))))))));
8384
8402
  }
8385
8403
  const ShortcutHelpModal = defineComponent({
8386
8404
  props: {
@@ -8396,7 +8414,7 @@ const ShortcutHelpModal = defineComponent({
8396
8414
  };
8397
8415
  onMounted(() => document.addEventListener("keydown", onKeydown));
8398
8416
  onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
8399
- return () => /* @__PURE__ */ h$1(
8417
+ return () => /* @__PURE__ */ h(
8400
8418
  "div",
8401
8419
  {
8402
8420
  style: {
@@ -8410,7 +8428,7 @@ const ShortcutHelpModal = defineComponent({
8410
8428
  },
8411
8429
  onClick: close
8412
8430
  },
8413
- /* @__PURE__ */ h$1(
8431
+ /* @__PURE__ */ h(
8414
8432
  "div",
8415
8433
  {
8416
8434
  style: {
@@ -8424,7 +8442,7 @@ const ShortcutHelpModal = defineComponent({
8424
8442
  },
8425
8443
  onClick: (e) => e.stopPropagation()
8426
8444
  },
8427
- /* @__PURE__ */ h$1(
8445
+ /* @__PURE__ */ h(
8428
8446
  "div",
8429
8447
  {
8430
8448
  style: {
@@ -8436,7 +8454,7 @@ const ShortcutHelpModal = defineComponent({
8436
8454
  borderBottom: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8437
8455
  }
8438
8456
  },
8439
- /* @__PURE__ */ h$1(
8457
+ /* @__PURE__ */ h(
8440
8458
  "span",
8441
8459
  {
8442
8460
  style: {
@@ -8447,7 +8465,7 @@ const ShortcutHelpModal = defineComponent({
8447
8465
  },
8448
8466
  i18n(props.ctx, "shortcuts.title")
8449
8467
  ),
8450
- /* @__PURE__ */ h$1(
8468
+ /* @__PURE__ */ h(
8451
8469
  "button",
8452
8470
  {
8453
8471
  type: "button",
@@ -8465,10 +8483,10 @@ const ShortcutHelpModal = defineComponent({
8465
8483
  color: "var(--crepe-color-on-surface-variant, #666)"
8466
8484
  }
8467
8485
  },
8468
- /* @__PURE__ */ h$1(Icon, { icon: closeIcon })
8486
+ /* @__PURE__ */ h(Icon, { icon: closeIcon })
8469
8487
  )
8470
8488
  ),
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(
8489
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: "24px" } }, /* @__PURE__ */ h("div", { style: columnStyle }, leftGroups.map((g) => renderGroup(props.ctx, g))), /* @__PURE__ */ h(
8472
8490
  "div",
8473
8491
  {
8474
8492
  style: {
@@ -8477,7 +8495,7 @@ const ShortcutHelpModal = defineComponent({
8477
8495
  backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8478
8496
  }
8479
8497
  }
8480
- ), /* @__PURE__ */ h$1("div", { style: columnStyle }, rightGroups.map((g) => renderGroup(props.ctx, g))))
8498
+ ), /* @__PURE__ */ h("div", { style: columnStyle }, rightGroups.map((g) => renderGroup(props.ctx, g))))
8481
8499
  )
8482
8500
  );
8483
8501
  }
@@ -8494,6 +8512,7 @@ const FixedToolbarComponent = defineComponent({
8494
8512
  canRedo: { type: Object, required: true }
8495
8513
  },
8496
8514
  setup(props) {
8515
+ keepAlive(h);
8497
8516
  const showShortcuts = ref(false);
8498
8517
  onMounted(() => {
8499
8518
  const handleShowShortcuts = () => {
@@ -9131,7 +9150,7 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
9131
9150
  return builder.build();
9132
9151
  }
9133
9152
 
9134
- keepAlive(h$1);
9153
+ keepAlive(h);
9135
9154
  const DocumentHeader = defineComponent({
9136
9155
  props: {
9137
9156
  ctx: { type: Object, required: true },
@@ -9208,13 +9227,13 @@ const DocumentHeader = defineComponent({
9208
9227
  var _a, _b;
9209
9228
  const state = viewState.value;
9210
9229
  if (!state.showTitle && !state.showCover) return null;
9211
- return /* @__PURE__ */ h$1(
9230
+ return /* @__PURE__ */ h(
9212
9231
  "div",
9213
9232
  {
9214
9233
  class: "milkdown-document-header",
9215
9234
  style: { width: "100%", display: "flex", flexDirection: "column" }
9216
9235
  },
9217
- state.showCover ? /* @__PURE__ */ h$1(
9236
+ state.showCover ? /* @__PURE__ */ h(
9218
9237
  "div",
9219
9238
  {
9220
9239
  class: "milkdown-document-cover",
@@ -9232,7 +9251,7 @@ const DocumentHeader = defineComponent({
9232
9251
  overflow: "hidden"
9233
9252
  }
9234
9253
  },
9235
- /* @__PURE__ */ h$1(
9254
+ /* @__PURE__ */ h(
9236
9255
  "img",
9237
9256
  {
9238
9257
  src: state.coverUrl,
@@ -9245,7 +9264,7 @@ const DocumentHeader = defineComponent({
9245
9264
  }
9246
9265
  }
9247
9266
  ),
9248
- /* @__PURE__ */ h$1(
9267
+ /* @__PURE__ */ h(
9249
9268
  "div",
9250
9269
  {
9251
9270
  style: {
@@ -9262,7 +9281,7 @@ const DocumentHeader = defineComponent({
9262
9281
  background: "linear-gradient(transparent, rgba(0,0,0,0.7))"
9263
9282
  }
9264
9283
  },
9265
- /* @__PURE__ */ h$1(
9284
+ /* @__PURE__ */ h(
9266
9285
  "div",
9267
9286
  {
9268
9287
  style: {
@@ -9274,7 +9293,7 @@ const DocumentHeader = defineComponent({
9274
9293
  },
9275
9294
  (lastUploadedUrl.value ? [lastUploadedUrl.value] : []).concat(
9276
9295
  ((_b = (_a = props.config) == null ? void 0 : _a.defaultCoverImages) == null ? void 0 : _b.length) ? props.config.defaultCoverImages : builtInCoverImages
9277
- ).map((src, i) => /* @__PURE__ */ h$1(
9296
+ ).map((src, i) => /* @__PURE__ */ h(
9278
9297
  "img",
9279
9298
  {
9280
9299
  key: i,
@@ -9304,7 +9323,7 @@ const DocumentHeader = defineComponent({
9304
9323
  }
9305
9324
  ))
9306
9325
  ),
9307
- /* @__PURE__ */ h$1(
9326
+ /* @__PURE__ */ h(
9308
9327
  "div",
9309
9328
  {
9310
9329
  onClick: () => {
@@ -9332,7 +9351,7 @@ const DocumentHeader = defineComponent({
9332
9351
  e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.2)";
9333
9352
  }
9334
9353
  },
9335
- /* @__PURE__ */ h$1(
9354
+ /* @__PURE__ */ h(
9336
9355
  "svg",
9337
9356
  {
9338
9357
  width: "14",
@@ -9344,14 +9363,14 @@ const DocumentHeader = defineComponent({
9344
9363
  "stroke-linecap": "round",
9345
9364
  "stroke-linejoin": "round"
9346
9365
  },
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" })
9366
+ /* @__PURE__ */ h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
9367
+ /* @__PURE__ */ h("polyline", { points: "17 8 12 3 7 8" }),
9368
+ /* @__PURE__ */ h("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
9350
9369
  ),
9351
9370
  "\u4E0A\u4F20"
9352
9371
  )
9353
9372
  ),
9354
- /* @__PURE__ */ h$1(
9373
+ /* @__PURE__ */ h(
9355
9374
  "input",
9356
9375
  {
9357
9376
  type: "file",
@@ -9362,7 +9381,7 @@ const DocumentHeader = defineComponent({
9362
9381
  }
9363
9382
  )
9364
9383
  ) : null,
9365
- state.showTitle ? /* @__PURE__ */ h$1(
9384
+ state.showTitle ? /* @__PURE__ */ h(
9366
9385
  "div",
9367
9386
  {
9368
9387
  class: "milkdown-document-title-wrapper",
@@ -9373,8 +9392,8 @@ const DocumentHeader = defineComponent({
9373
9392
  padding: `40px ${editorWidthMap[state.editorWidth] === "none" ? "80px" : "0"} 0`
9374
9393
  }
9375
9394
  },
9376
- /* @__PURE__ */ h$1("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
9377
- /* @__PURE__ */ h$1(
9395
+ /* @__PURE__ */ h("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
9396
+ /* @__PURE__ */ h(
9378
9397
  "textarea",
9379
9398
  {
9380
9399
  ref: titleTextareaRef,
@@ -9426,6 +9445,7 @@ const DocumentHeader = defineComponent({
9426
9445
  }
9427
9446
  });
9428
9447
 
9448
+ keepAlive(h);
9429
9449
  const OutlinePanel = defineComponent({
9430
9450
  props: {
9431
9451
  ctx: { type: Object, required: true }
@@ -9748,7 +9768,7 @@ const OutlinePanel = defineComponent({
9748
9768
  const state = viewState.value;
9749
9769
  if (!state.outlineVisible) return null;
9750
9770
  const isLeft = state.outlinePosition === "left";
9751
- return /* @__PURE__ */ h$1(
9771
+ return /* @__PURE__ */ h(
9752
9772
  "div",
9753
9773
  {
9754
9774
  class: "milkdown-outline-panel",
@@ -9769,7 +9789,7 @@ const OutlinePanel = defineComponent({
9769
9789
  overflow: "hidden"
9770
9790
  }
9771
9791
  },
9772
- /* @__PURE__ */ h$1(
9792
+ /* @__PURE__ */ h(
9773
9793
  "div",
9774
9794
  {
9775
9795
  style: {
@@ -9783,8 +9803,8 @@ const OutlinePanel = defineComponent({
9783
9803
  alignItems: "center"
9784
9804
  }
9785
9805
  },
9786
- /* @__PURE__ */ h$1("span", null, i18n(props.ctx, "view.outline")),
9787
- /* @__PURE__ */ h$1(
9806
+ /* @__PURE__ */ h("span", null, i18n(props.ctx, "view.outline")),
9807
+ /* @__PURE__ */ h(
9788
9808
  "div",
9789
9809
  {
9790
9810
  style: {
@@ -9808,7 +9828,7 @@ const OutlinePanel = defineComponent({
9808
9828
  },
9809
9829
  title: "\u5173\u95ED\u5927\u7EB2"
9810
9830
  },
9811
- /* @__PURE__ */ h$1(
9831
+ /* @__PURE__ */ h(
9812
9832
  "svg",
9813
9833
  {
9814
9834
  width: "16",
@@ -9820,12 +9840,12 @@ const OutlinePanel = defineComponent({
9820
9840
  "stroke-linecap": "round",
9821
9841
  "stroke-linejoin": "round"
9822
9842
  },
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" })
9843
+ /* @__PURE__ */ h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
9844
+ /* @__PURE__ */ h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
9825
9845
  )
9826
9846
  )
9827
9847
  ),
9828
- /* @__PURE__ */ h$1("div", { style: { flexGrow: 1, overflowY: "auto", padding: "12px 0" } }, items.value.length === 0 ? /* @__PURE__ */ h$1(
9848
+ /* @__PURE__ */ h("div", { style: { flexGrow: 1, overflowY: "auto", padding: "12px 0" } }, items.value.length === 0 ? /* @__PURE__ */ h(
9829
9849
  "div",
9830
9850
  {
9831
9851
  style: {
@@ -9838,7 +9858,7 @@ const OutlinePanel = defineComponent({
9838
9858
  ) : null, visibleItems.value.map(({ item, hasChildren: hasKids }) => {
9839
9859
  const isActive = activeId.value === item.id;
9840
9860
  const collapsed = collapsedIds.value.has(item.id);
9841
- return /* @__PURE__ */ h$1(
9861
+ return /* @__PURE__ */ h(
9842
9862
  "div",
9843
9863
  {
9844
9864
  key: item.id,
@@ -9872,7 +9892,7 @@ const OutlinePanel = defineComponent({
9872
9892
  }
9873
9893
  }
9874
9894
  },
9875
- /* @__PURE__ */ h$1(
9895
+ /* @__PURE__ */ h(
9876
9896
  "span",
9877
9897
  {
9878
9898
  onClick: (e) => {
@@ -9905,7 +9925,7 @@ const OutlinePanel = defineComponent({
9905
9925
  "\u25BC",
9906
9926
  " "
9907
9927
  ),
9908
- /* @__PURE__ */ h$1(
9928
+ /* @__PURE__ */ h(
9909
9929
  "span",
9910
9930
  {
9911
9931
  title: item.text,
@@ -9918,7 +9938,7 @@ const OutlinePanel = defineComponent({
9918
9938
  )
9919
9939
  );
9920
9940
  })),
9921
- /* @__PURE__ */ h$1(
9941
+ /* @__PURE__ */ h(
9922
9942
  "div",
9923
9943
  {
9924
9944
  onPointerdown: onPointerDown,
@@ -10437,7 +10457,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10437
10457
  }));
10438
10458
  function renderTab(tab, label) {
10439
10459
  const isActive = activeTab.value === tab;
10440
- return h$1(
10460
+ return h(
10441
10461
  "button",
10442
10462
  {
10443
10463
  style: {
@@ -10459,8 +10479,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10459
10479
  function renderItem(change, index) {
10460
10480
  const color = typeColors[change.type];
10461
10481
  const children = [
10462
- h$1("div", { style: { marginBottom: "4px" } }, [
10463
- h$1(
10482
+ h("div", { style: { marginBottom: "4px" } }, [
10483
+ h(
10464
10484
  "span",
10465
10485
  {
10466
10486
  style: {
@@ -10479,7 +10499,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10479
10499
  ];
10480
10500
  if (change.oldText) {
10481
10501
  children.push(
10482
- h$1(
10502
+ h(
10483
10503
  "div",
10484
10504
  {
10485
10505
  style: {
@@ -10491,19 +10511,19 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10491
10511
  }
10492
10512
  },
10493
10513
  [
10494
- h$1(
10514
+ h(
10495
10515
  "span",
10496
10516
  { style: { color: "#999", fontSize: "11px" } },
10497
10517
  "\u539F\u6587: "
10498
10518
  ),
10499
- h$1("span", null, change.oldText)
10519
+ h("span", null, change.oldText)
10500
10520
  ]
10501
10521
  )
10502
10522
  );
10503
10523
  }
10504
10524
  if (change.newText) {
10505
10525
  children.push(
10506
- h$1(
10526
+ h(
10507
10527
  "div",
10508
10528
  {
10509
10529
  style: {
@@ -10514,17 +10534,17 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10514
10534
  }
10515
10535
  },
10516
10536
  [
10517
- h$1(
10537
+ h(
10518
10538
  "span",
10519
10539
  { style: { color: "#999", fontSize: "11px" } },
10520
10540
  "\u5DEE\u5F02: "
10521
10541
  ),
10522
- h$1("span", { style: { color } }, change.newText)
10542
+ h("span", { style: { color } }, change.newText)
10523
10543
  ]
10524
10544
  )
10525
10545
  );
10526
10546
  }
10527
- return h$1(
10547
+ return h(
10528
10548
  "div",
10529
10549
  {
10530
10550
  style: {
@@ -10542,7 +10562,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10542
10562
  children
10543
10563
  );
10544
10564
  }
10545
- return () => h$1(
10565
+ return () => h(
10546
10566
  "div",
10547
10567
  {
10548
10568
  style: {
@@ -10560,7 +10580,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10560
10580
  },
10561
10581
  [
10562
10582
  // Header
10563
- h$1(
10583
+ h(
10564
10584
  "div",
10565
10585
  {
10566
10586
  style: {
@@ -10576,8 +10596,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10576
10596
  }
10577
10597
  },
10578
10598
  [
10579
- h$1("span", null, "\u6587\u6863\u5DEE\u5F02\u53D8\u66F4"),
10580
- onClose ? h$1(
10599
+ h("span", null, "\u6587\u6863\u5DEE\u5F02\u53D8\u66F4"),
10600
+ onClose ? h(
10581
10601
  "div",
10582
10602
  {
10583
10603
  style: {
@@ -10605,7 +10625,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10605
10625
  title: "\u5173\u95ED\u5DEE\u5F02"
10606
10626
  },
10607
10627
  [
10608
- h$1(
10628
+ h(
10609
10629
  "svg",
10610
10630
  {
10611
10631
  width: "16",
@@ -10618,8 +10638,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10618
10638
  strokeLinejoin: "round"
10619
10639
  },
10620
10640
  [
10621
- h$1("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
10622
- h$1("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
10641
+ h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
10642
+ h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
10623
10643
  ]
10624
10644
  )
10625
10645
  ]
@@ -10627,7 +10647,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10627
10647
  ]
10628
10648
  ),
10629
10649
  // Tabs
10630
- h$1(
10650
+ h(
10631
10651
  "div",
10632
10652
  {
10633
10653
  style: {
@@ -10644,7 +10664,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
10644
10664
  ]
10645
10665
  ),
10646
10666
  // List
10647
- h$1(
10667
+ h(
10648
10668
  "div",
10649
10669
  {
10650
10670
  style: {
@@ -11352,7 +11372,7 @@ const blockLatexSchema = codeBlockSchema.extendSchema((prev) => {
11352
11372
 
11353
11373
  const inlineLatexTooltip = tooltipFactory("INLINE_LATEX");
11354
11374
 
11355
- keepAlive(h$1);
11375
+ keepAlive(h);
11356
11376
  const LatexTooltip = defineComponent({
11357
11377
  props: {
11358
11378
  ctx: {
@@ -11388,7 +11408,7 @@ const LatexTooltip = defineComponent({
11388
11408
  }
11389
11409
  };
11390
11410
  return () => {
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(
11411
+ 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(
11392
11412
  "a",
11393
11413
  {
11394
11414
  class: "right",
@@ -11396,7 +11416,7 @@ const LatexTooltip = defineComponent({
11396
11416
  target: "_blank",
11397
11417
  style: "display: none;"
11398
11418
  },
11399
- /* @__PURE__ */ h$1(Icon, { icon: helpIcon }),
11419
+ /* @__PURE__ */ h(Icon, { icon: helpIcon }),
11400
11420
  " ",
11401
11421
  i18n(props.ctx, "latex.helpDoc")
11402
11422
  )));
@@ -12056,6 +12076,21 @@ class CrepeBuilder {
12056
12076
  });
12057
12077
  return this;
12058
12078
  };
12079
+ /// Set the visibility of the outline panel.
12080
+ this.setOutlineVisible = (visible) => {
12081
+ __privateGet(this, _editor).action((ctx) => {
12082
+ if (__privateGet(this, _editor).status === EditorStatus.Created) {
12083
+ try {
12084
+ const state = ctx.get(viewMenuStateCtx.key);
12085
+ if (state) {
12086
+ state.outlineVisible = visible;
12087
+ }
12088
+ } catch (e) {
12089
+ }
12090
+ }
12091
+ });
12092
+ return this;
12093
+ };
12059
12094
  var _a;
12060
12095
  __privateSet(this, _rootElement, (_a = typeof root === "string" ? document.querySelector(root) : root) != null ? _a : document.body);
12061
12096
  const mergedTranslations = {
@@ -12148,6 +12183,22 @@ class CrepeBuilder {
12148
12183
  get readonly() {
12149
12184
  return !__privateGet(this, _editable);
12150
12185
  }
12186
+ /// Get the visibility of the outline panel.
12187
+ get outlineVisible() {
12188
+ let visible = false;
12189
+ __privateGet(this, _editor).action((ctx) => {
12190
+ if (__privateGet(this, _editor).status === EditorStatus.Created) {
12191
+ try {
12192
+ const state = ctx.get(viewMenuStateCtx.key);
12193
+ if (state) {
12194
+ visible = state.outlineVisible;
12195
+ }
12196
+ } catch (e) {
12197
+ }
12198
+ }
12199
+ });
12200
+ return visible;
12201
+ }
12151
12202
  }
12152
12203
  _editor = new WeakMap();
12153
12204
  _rootElement = new WeakMap();