@jvs-milkdown/crepe 1.2.11 → 1.2.13

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.
Files changed (52) hide show
  1. package/lib/cjs/feature/block-edit/index.js +1 -0
  2. package/lib/cjs/feature/block-edit/index.js.map +1 -1
  3. package/lib/cjs/feature/image-block/index.js +1 -1
  4. package/lib/cjs/feature/image-block/index.js.map +1 -1
  5. package/lib/cjs/feature/link-tooltip/index.js +1 -0
  6. package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
  7. package/lib/cjs/feature/table/index.js +1 -0
  8. package/lib/cjs/feature/table/index.js.map +1 -1
  9. package/lib/cjs/feature/toolbar/index.js +123 -9
  10. package/lib/cjs/feature/toolbar/index.js.map +1 -1
  11. package/lib/cjs/index.js +248 -98
  12. package/lib/cjs/index.js.map +1 -1
  13. package/lib/esm/feature/block-edit/index.js +1 -0
  14. package/lib/esm/feature/block-edit/index.js.map +1 -1
  15. package/lib/esm/feature/image-block/index.js +1 -1
  16. package/lib/esm/feature/image-block/index.js.map +1 -1
  17. package/lib/esm/feature/link-tooltip/index.js +1 -0
  18. package/lib/esm/feature/link-tooltip/index.js.map +1 -1
  19. package/lib/esm/feature/table/index.js +1 -0
  20. package/lib/esm/feature/table/index.js.map +1 -1
  21. package/lib/esm/feature/toolbar/index.js +123 -9
  22. package/lib/esm/feature/toolbar/index.js.map +1 -1
  23. package/lib/esm/index.js +309 -159
  24. package/lib/esm/index.js.map +1 -1
  25. package/lib/theme/common/table.css +4 -4
  26. package/lib/tsconfig.tsbuildinfo +1 -1
  27. package/lib/types/feature/attachment/view/components/attachment-block.d.ts.map +1 -1
  28. package/lib/types/feature/fixed-toolbar/component.d.ts.map +1 -1
  29. package/lib/types/feature/fixed-toolbar/document-header.d.ts.map +1 -1
  30. package/lib/types/feature/fixed-toolbar/index.d.ts.map +1 -1
  31. package/lib/types/feature/fixed-toolbar/menu-bar.d.ts.map +1 -1
  32. package/lib/types/feature/toolbar/component.d.ts.map +1 -1
  33. package/lib/types/feature/toolbar/index.d.ts.map +1 -1
  34. package/lib/types/icons/remove.d.ts +1 -1
  35. package/lib/types/icons/remove.d.ts.map +1 -1
  36. package/lib/types/utils/fixed-toolbar-popup-state.d.ts +7 -0
  37. package/lib/types/utils/fixed-toolbar-popup-state.d.ts.map +1 -0
  38. package/package.json +4 -4
  39. package/src/feature/attachment/view/components/attachment-block.tsx +1 -1
  40. package/src/feature/fixed-toolbar/component.tsx +1 -1
  41. package/src/feature/fixed-toolbar/document-header.tsx +5 -0
  42. package/src/feature/fixed-toolbar/index.ts +39 -2
  43. package/src/feature/fixed-toolbar/menu-bar.tsx +13 -2
  44. package/src/feature/fixed-toolbar/outline-panel.tsx +1 -1
  45. package/src/feature/fixed-toolbar/shortcut-help-modal.tsx +1 -1
  46. package/src/feature/fixed-toolbar/view-menu-state.ts +1 -1
  47. package/src/feature/image-block/index.ts +1 -1
  48. package/src/feature/toolbar/component.tsx +95 -8
  49. package/src/feature/toolbar/index.ts +33 -0
  50. package/src/icons/remove.ts +1 -0
  51. package/src/theme/common/table.css +4 -4
  52. package/src/utils/fixed-toolbar-popup-state.ts +27 -0
package/lib/cjs/index.js CHANGED
@@ -441,6 +441,7 @@ const removeIcon = `
441
441
  >
442
442
  <path
443
443
  d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"
444
+ fill="#363B4C"
444
445
  />
445
446
  </svg>
446
447
  `;
@@ -1198,7 +1199,7 @@ const MilkdownAttachmentBlock = vue.defineComponent({
1198
1199
  return () => {
1199
1200
  var _a;
1200
1201
  if (!((_a = src.value) == null ? void 0 : _a.length)) {
1201
- return /* @__PURE__ */ h(
1202
+ return /* @__PURE__ */ vue.h(
1202
1203
  "div",
1203
1204
  {
1204
1205
  class: [
@@ -1206,7 +1207,7 @@ const MilkdownAttachmentBlock = vue.defineComponent({
1206
1207
  props.selected.value ? "selected" : ""
1207
1208
  ]
1208
1209
  },
1209
- /* @__PURE__ */ h("div", { class: "milkdown-attachment-uploader", onClick: triggerUpload }, /* @__PURE__ */ h(component.Icon, { icon: fileLinkIcon }), /* @__PURE__ */ h("span", { class: "milkdown-attachment-upload-text" }, isUploading.value ? "Uploading..." : props.config.uploadButton), /* @__PURE__ */ h(
1210
+ /* @__PURE__ */ vue.h("div", { class: "milkdown-attachment-uploader", onClick: triggerUpload }, /* @__PURE__ */ vue.h(component.Icon, { icon: fileLinkIcon }), /* @__PURE__ */ vue.h("span", { class: "milkdown-attachment-upload-text" }, isUploading.value ? "Uploading..." : props.config.uploadButton), /* @__PURE__ */ vue.h(
1210
1211
  "input",
1211
1212
  {
1212
1213
  type: "file",
@@ -1220,7 +1221,7 @@ const MilkdownAttachmentBlock = vue.defineComponent({
1220
1221
  if (isVideo.value) {
1221
1222
  const savedWidth = videoWidth.value;
1222
1223
  const widthStyle = isResizing.value && currentWidth.value > 0 ? `${currentWidth.value}px` : savedWidth && savedWidth > 0 ? `${savedWidth}px` : "100%";
1223
- return /* @__PURE__ */ h(
1224
+ return /* @__PURE__ */ vue.h(
1224
1225
  "div",
1225
1226
  {
1226
1227
  ref: videoWrapperRef,
@@ -1234,7 +1235,7 @@ const MilkdownAttachmentBlock = vue.defineComponent({
1234
1235
  position: "relative"
1235
1236
  }
1236
1237
  },
1237
- /* @__PURE__ */ h(
1238
+ /* @__PURE__ */ vue.h(
1238
1239
  "video",
1239
1240
  {
1240
1241
  src: src.value,
@@ -1243,28 +1244,28 @@ const MilkdownAttachmentBlock = vue.defineComponent({
1243
1244
  onMousedown: (e) => e.stopPropagation()
1244
1245
  }
1245
1246
  ),
1246
- /* @__PURE__ */ h(
1247
+ /* @__PURE__ */ vue.h(
1247
1248
  "div",
1248
1249
  {
1249
1250
  class: "video-resize-handle top-left",
1250
1251
  onPointerdown: (e) => onResizePointerDown(e, "top-left")
1251
1252
  }
1252
1253
  ),
1253
- /* @__PURE__ */ h(
1254
+ /* @__PURE__ */ vue.h(
1254
1255
  "div",
1255
1256
  {
1256
1257
  class: "video-resize-handle top-right",
1257
1258
  onPointerdown: (e) => onResizePointerDown(e, "top-right")
1258
1259
  }
1259
1260
  ),
1260
- /* @__PURE__ */ h(
1261
+ /* @__PURE__ */ vue.h(
1261
1262
  "div",
1262
1263
  {
1263
1264
  class: "video-resize-handle bottom-left",
1264
1265
  onPointerdown: (e) => onResizePointerDown(e, "bottom-left")
1265
1266
  }
1266
1267
  ),
1267
- /* @__PURE__ */ h(
1268
+ /* @__PURE__ */ vue.h(
1268
1269
  "div",
1269
1270
  {
1270
1271
  class: "video-resize-handle bottom-right",
@@ -1273,7 +1274,7 @@ const MilkdownAttachmentBlock = vue.defineComponent({
1273
1274
  )
1274
1275
  );
1275
1276
  }
1276
- return /* @__PURE__ */ h(
1277
+ return /* @__PURE__ */ vue.h(
1277
1278
  "div",
1278
1279
  {
1279
1280
  class: [
@@ -1281,16 +1282,16 @@ const MilkdownAttachmentBlock = vue.defineComponent({
1281
1282
  props.selected.value ? "selected" : ""
1282
1283
  ]
1283
1284
  },
1284
- /* @__PURE__ */ h("div", { class: "milkdown-attachment-icon-wrapper" }, /* @__PURE__ */ h("div", { class: "milkdown-attachment-raw-icon-bg" }, /* @__PURE__ */ h(component.Icon, { icon: fileLinkIcon }))),
1285
- /* @__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) : "")),
1286
- /* @__PURE__ */ h(
1285
+ /* @__PURE__ */ vue.h("div", { class: "milkdown-attachment-icon-wrapper" }, /* @__PURE__ */ vue.h("div", { class: "milkdown-attachment-raw-icon-bg" }, /* @__PURE__ */ vue.h(component.Icon, { icon: fileLinkIcon }))),
1286
+ /* @__PURE__ */ vue.h("div", { class: "milkdown-attachment-info" }, /* @__PURE__ */ vue.h("div", { class: "milkdown-attachment-name" }, name.value), /* @__PURE__ */ vue.h("div", { class: "milkdown-attachment-size" }, (size.value || 0) > 0 ? formatBytes(size.value) : "")),
1287
+ /* @__PURE__ */ vue.h(
1287
1288
  "div",
1288
1289
  {
1289
1290
  class: "milkdown-attachment-action",
1290
1291
  onClick: openLink,
1291
1292
  title: props.config.downloadText
1292
1293
  },
1293
- /* @__PURE__ */ h(component.Icon, { icon: downloadIcon })
1294
+ /* @__PURE__ */ vue.h(component.Icon, { icon: downloadIcon })
1294
1295
  )
1295
1296
  );
1296
1297
  };
@@ -4296,6 +4297,29 @@ const cursor = (editor, config) => {
4296
4297
  editor.use(utils.$prose(() => virtualCursor));
4297
4298
  };
4298
4299
 
4300
+ const listeners = /* @__PURE__ */ new Set();
4301
+ let _popupCount = 0;
4302
+ function getIsAnyPopupOpen() {
4303
+ return _popupCount > 0;
4304
+ }
4305
+ function addPopupChangeListener(fn) {
4306
+ listeners.add(fn);
4307
+ return () => listeners.delete(fn);
4308
+ }
4309
+ function incrementPopupCount() {
4310
+ const wasZero = _popupCount === 0;
4311
+ _popupCount++;
4312
+ if (wasZero) {
4313
+ listeners.forEach((fn) => fn());
4314
+ }
4315
+ }
4316
+ function decrementPopupCount() {
4317
+ _popupCount = Math.max(0, _popupCount - 1);
4318
+ if (_popupCount === 0) {
4319
+ listeners.forEach((fn) => fn());
4320
+ }
4321
+ }
4322
+
4299
4323
  const remarkHighlightMarkPlugin = utils.$remark(
4300
4324
  "remarkHighlightMark",
4301
4325
  () => function() {
@@ -5392,6 +5416,8 @@ const Toolbar = vue.defineComponent({
5392
5416
  const {
5393
5417
  marks: savedMarks,
5394
5418
  align: savedAlign,
5419
+ blockType: savedBlockType,
5420
+ blockAttrs: savedBlockAttrs,
5395
5421
  isPersistent
5396
5422
  } = formatPainterState.value;
5397
5423
  let applied = false;
@@ -5413,6 +5439,30 @@ const Toolbar = vue.defineComponent({
5413
5439
  }
5414
5440
  );
5415
5441
  }
5442
+ if (savedBlockType) {
5443
+ curState.doc.nodesBetween(
5444
+ curSelection.from,
5445
+ curSelection.to,
5446
+ (node, pos) => {
5447
+ if (node.type.name === "paragraph") {
5448
+ tr.setNodeMarkup(
5449
+ pos,
5450
+ curState.schema.nodes[savedBlockType],
5451
+ {
5452
+ ...savedBlockAttrs,
5453
+ ...savedAlign ? { align: savedAlign } : {}
5454
+ }
5455
+ );
5456
+ } else if (node.type.name === "heading" && savedBlockAttrs) {
5457
+ tr.setNodeMarkup(pos, null, {
5458
+ ...node.attrs,
5459
+ ...savedBlockAttrs,
5460
+ ...savedAlign ? { align: savedAlign } : {}
5461
+ });
5462
+ }
5463
+ }
5464
+ );
5465
+ }
5416
5466
  dispatch(tr);
5417
5467
  applied = true;
5418
5468
  } else {
@@ -5445,6 +5495,22 @@ const Toolbar = vue.defineComponent({
5445
5495
  });
5446
5496
  }
5447
5497
  }
5498
+ if (savedBlockType) {
5499
+ const pos = curSelection.$from.before(curSelection.$from.depth);
5500
+ const node = curState.doc.nodeAt(pos);
5501
+ if (node && node.type.name === "paragraph") {
5502
+ tr.setNodeMarkup(pos, curState.schema.nodes[savedBlockType], {
5503
+ ...savedBlockAttrs,
5504
+ ...savedAlign ? { align: savedAlign } : {}
5505
+ });
5506
+ } else if (node && node.type.name === "heading" && savedBlockAttrs) {
5507
+ tr.setNodeMarkup(pos, null, {
5508
+ ...node.attrs,
5509
+ ...savedBlockAttrs,
5510
+ ...savedAlign ? { align: savedAlign } : {}
5511
+ });
5512
+ }
5513
+ }
5448
5514
  tr.setStoredMarks(savedMarks);
5449
5515
  dispatch(tr);
5450
5516
  applied = true;
@@ -5493,7 +5559,22 @@ const Toolbar = vue.defineComponent({
5493
5559
  }
5494
5560
  }
5495
5561
  align = foundAlign;
5496
- formatPainterState.value = { marks, align, isPersistent };
5562
+ let blockType = null;
5563
+ let blockAttrs = null;
5564
+ {
5565
+ const parent = selection.$from.parent;
5566
+ if (parent.type.name === "heading") {
5567
+ blockType = "heading";
5568
+ blockAttrs = { level: parent.attrs.level };
5569
+ }
5570
+ }
5571
+ formatPainterState.value = {
5572
+ marks,
5573
+ align,
5574
+ blockType,
5575
+ blockAttrs,
5576
+ isPersistent
5577
+ };
5497
5578
  document.removeEventListener("pointerup", formatPainterHandler);
5498
5579
  setTimeout(() => {
5499
5580
  document.addEventListener("pointerup", formatPainterHandler);
@@ -5546,6 +5627,13 @@ const Toolbar = vue.defineComponent({
5546
5627
  const showOverflowMenu = vue.ref(false);
5547
5628
  const overflowMenuPos = vue.ref({ top: 0 });
5548
5629
  const cachedWidths = /* @__PURE__ */ new Map();
5630
+ const anyFixedPopup = vue.computed(
5631
+ () => !!isFixed && (showBlockMenu.value || showAlignMenu.value || showColorMenu.value || showFontFamilyMenu.value || showFontSizeMenu.value || showTableMenu.value || showOverflowMenu.value)
5632
+ );
5633
+ vue.watch(anyFixedPopup, (val) => {
5634
+ if (val) incrementPopupCount();
5635
+ else decrementPopupCount();
5636
+ });
5549
5637
  const getMenuLeftPos = (rect, menuWidth) => {
5550
5638
  let left = rect.left;
5551
5639
  if (left + menuWidth > window.innerWidth) {
@@ -5782,6 +5870,7 @@ const Toolbar = vue.defineComponent({
5782
5870
  if (hideFontFamilyTimer) clearTimeout(hideFontFamilyTimer);
5783
5871
  if (hideFontSizeTimer) clearTimeout(hideFontSizeTimer);
5784
5872
  if (hideTableTimer) clearTimeout(hideTableTimer);
5873
+ if (anyFixedPopup.value) decrementPopupCount();
5785
5874
  });
5786
5875
  let overflowResizeObserver = null;
5787
5876
  let overflowSetupDone = false;
@@ -6220,13 +6309,11 @@ const Toolbar = vue.defineComponent({
6220
6309
  });
6221
6310
  }
6222
6311
  });
6223
- const nonHeadingGroups = toolbarGroupInfo.value.filter(
6224
- (group) => {
6225
- if (group.key === "heading") return false;
6226
- if (props.isFixed && group.key === "function") return false;
6227
- return true;
6228
- }
6229
- );
6312
+ const nonHeadingGroups = toolbarGroupInfo.value.filter((group) => {
6313
+ if (group.key === "heading") return false;
6314
+ if (props.isFixed && group.key === "function") return false;
6315
+ return true;
6316
+ });
6230
6317
  const isSectionOverflowed = (idx) => idx >= overflowVisibleCount.value;
6231
6318
  const hasOverflow = overflowVisibleCount.value < totalSectionCount.value;
6232
6319
  return /* @__PURE__ */ vue.h(
@@ -7522,7 +7609,7 @@ const createViewMenuState = () => vue.reactive({
7522
7609
  outlineVisible: false,
7523
7610
  outlinePosition: "left",
7524
7611
  outlineWidth: 250,
7525
- documentBackground: null,
7612
+ documentBackground: "#FFFFFF",
7526
7613
  showTitle: false,
7527
7614
  showCover: false,
7528
7615
  coverUrl: "",
@@ -7536,7 +7623,7 @@ const ToggleSwitch = vue.defineComponent({
7536
7623
  },
7537
7624
  emits: ["update:modelValue"],
7538
7625
  setup(props, { emit }) {
7539
- return () => /* @__PURE__ */ h(
7626
+ return () => /* @__PURE__ */ vue.h(
7540
7627
  "div",
7541
7628
  {
7542
7629
  onClick: (e) => {
@@ -7553,7 +7640,7 @@ const ToggleSwitch = vue.defineComponent({
7553
7640
  transition: "background-color 0.2s"
7554
7641
  }
7555
7642
  },
7556
- /* @__PURE__ */ h(
7643
+ /* @__PURE__ */ vue.h(
7557
7644
  "div",
7558
7645
  {
7559
7646
  style: {
@@ -7622,10 +7709,15 @@ const MenuBar = vue.defineComponent({
7622
7709
  vue.onUnmounted(() => {
7623
7710
  document.removeEventListener("click", closeMenu);
7624
7711
  if (rafId) cancelAnimationFrame(rafId);
7712
+ if (showMenu.value) decrementPopupCount();
7713
+ });
7714
+ vue.watch(showMenu, (val) => {
7715
+ if (val) incrementPopupCount();
7716
+ else decrementPopupCount();
7625
7717
  });
7626
7718
  const viewState = vue.computed(() => props.ctx.get(viewMenuStateCtx.key));
7627
7719
  const bgColors = [
7628
- { name: "\u9ED8\u8BA4", value: null },
7720
+ { name: "\u767D\u8272", value: "#FFFFFF" },
7629
7721
  { name: "\u6D45\u7070", value: "#F7F7F5" },
7630
7722
  { name: "\u6D45\u68D5", value: "#F4EEDB" },
7631
7723
  { name: "\u6D45\u6A59", value: "#FBECDD" },
@@ -7639,7 +7731,7 @@ const MenuBar = vue.defineComponent({
7639
7731
  const hasSubmenu = (key) => key === "view";
7640
7732
  return () => {
7641
7733
  const state = viewState.value;
7642
- return /* @__PURE__ */ h(
7734
+ return /* @__PURE__ */ vue.h(
7643
7735
  "div",
7644
7736
  {
7645
7737
  class: "milkdown-menu-bar",
@@ -7651,7 +7743,7 @@ const MenuBar = vue.defineComponent({
7651
7743
  position: "relative"
7652
7744
  }
7653
7745
  },
7654
- /* @__PURE__ */ h(
7746
+ /* @__PURE__ */ vue.h(
7655
7747
  "div",
7656
7748
  {
7657
7749
  ref: buttonRef,
@@ -7674,7 +7766,7 @@ const MenuBar = vue.defineComponent({
7674
7766
  e.currentTarget.style.backgroundColor = "transparent";
7675
7767
  }
7676
7768
  },
7677
- /* @__PURE__ */ h(
7769
+ /* @__PURE__ */ vue.h(
7678
7770
  "span",
7679
7771
  {
7680
7772
  style: {
@@ -7685,9 +7777,9 @@ const MenuBar = vue.defineComponent({
7685
7777
  justifyContent: "center"
7686
7778
  }
7687
7779
  },
7688
- /* @__PURE__ */ h(component.Icon, { icon: menuIcon })
7780
+ /* @__PURE__ */ vue.h(component.Icon, { icon: menuIcon })
7689
7781
  ),
7690
- /* @__PURE__ */ h(
7782
+ /* @__PURE__ */ vue.h(
7691
7783
  "span",
7692
7784
  {
7693
7785
  style: {
@@ -7700,7 +7792,7 @@ const MenuBar = vue.defineComponent({
7700
7792
  "\u83DC\u5355"
7701
7793
  )
7702
7794
  ),
7703
- showMenu.value ? /* @__PURE__ */ h(
7795
+ showMenu.value ? /* @__PURE__ */ vue.h(
7704
7796
  "div",
7705
7797
  {
7706
7798
  ref: mainRef,
@@ -7727,7 +7819,7 @@ const MenuBar = vue.defineComponent({
7727
7819
  menuKeys.map((menuKey) => {
7728
7820
  const isHovered = activeSubmenu.value === menuKey;
7729
7821
  const label = i18n(props.ctx, `menuBar.${menuKey}`) || menuKey;
7730
- return /* @__PURE__ */ h(
7822
+ return /* @__PURE__ */ vue.h(
7731
7823
  "div",
7732
7824
  {
7733
7825
  key: menuKey,
@@ -7749,7 +7841,7 @@ const MenuBar = vue.defineComponent({
7749
7841
  backgroundColor: isHovered ? "var(--crepe-color-hover, #f5f5f5)" : "transparent"
7750
7842
  }
7751
7843
  },
7752
- /* @__PURE__ */ h(
7844
+ /* @__PURE__ */ vue.h(
7753
7845
  "span",
7754
7846
  {
7755
7847
  style: {
@@ -7759,7 +7851,7 @@ const MenuBar = vue.defineComponent({
7759
7851
  },
7760
7852
  label
7761
7853
  ),
7762
- hasSubmenu(menuKey) ? /* @__PURE__ */ h(
7854
+ hasSubmenu(menuKey) ? /* @__PURE__ */ vue.h(
7763
7855
  "span",
7764
7856
  {
7765
7857
  style: {
@@ -7768,7 +7860,7 @@ const MenuBar = vue.defineComponent({
7768
7860
  display: "flex"
7769
7861
  }
7770
7862
  },
7771
- /* @__PURE__ */ h(
7863
+ /* @__PURE__ */ vue.h(
7772
7864
  "svg",
7773
7865
  {
7774
7866
  width: "12",
@@ -7780,10 +7872,10 @@ const MenuBar = vue.defineComponent({
7780
7872
  "stroke-linecap": "round",
7781
7873
  "stroke-linejoin": "round"
7782
7874
  },
7783
- /* @__PURE__ */ h("polyline", { points: "9 18 15 12 9 6" })
7875
+ /* @__PURE__ */ vue.h("polyline", { points: "9 18 15 12 9 6" })
7784
7876
  )
7785
7877
  ) : null,
7786
- menuKey === "view" && isHovered ? /* @__PURE__ */ h(
7878
+ menuKey === "view" && isHovered ? /* @__PURE__ */ vue.h(
7787
7879
  "div",
7788
7880
  {
7789
7881
  style: {
@@ -7801,7 +7893,7 @@ const MenuBar = vue.defineComponent({
7801
7893
  cursor: "default"
7802
7894
  }
7803
7895
  },
7804
- /* @__PURE__ */ h(
7896
+ /* @__PURE__ */ vue.h(
7805
7897
  "div",
7806
7898
  {
7807
7899
  style: {
@@ -7811,7 +7903,7 @@ const MenuBar = vue.defineComponent({
7811
7903
  alignItems: "center"
7812
7904
  }
7813
7905
  },
7814
- /* @__PURE__ */ h(
7906
+ /* @__PURE__ */ vue.h(
7815
7907
  "span",
7816
7908
  {
7817
7909
  style: {
@@ -7821,7 +7913,7 @@ const MenuBar = vue.defineComponent({
7821
7913
  },
7822
7914
  i18n(props.ctx, "view.title") || "\u6807\u9898"
7823
7915
  ),
7824
- /* @__PURE__ */ h(
7916
+ /* @__PURE__ */ vue.h(
7825
7917
  ToggleSwitch,
7826
7918
  {
7827
7919
  modelValue: state.showTitle,
@@ -7829,7 +7921,7 @@ const MenuBar = vue.defineComponent({
7829
7921
  }
7830
7922
  )
7831
7923
  ),
7832
- /* @__PURE__ */ h(
7924
+ /* @__PURE__ */ vue.h(
7833
7925
  "div",
7834
7926
  {
7835
7927
  style: {
@@ -7839,7 +7931,7 @@ const MenuBar = vue.defineComponent({
7839
7931
  alignItems: "center"
7840
7932
  }
7841
7933
  },
7842
- /* @__PURE__ */ h(
7934
+ /* @__PURE__ */ vue.h(
7843
7935
  "span",
7844
7936
  {
7845
7937
  style: {
@@ -7849,7 +7941,7 @@ const MenuBar = vue.defineComponent({
7849
7941
  },
7850
7942
  i18n(props.ctx, "view.outline") || "\u5927\u7EB2"
7851
7943
  ),
7852
- /* @__PURE__ */ h(
7944
+ /* @__PURE__ */ vue.h(
7853
7945
  ToggleSwitch,
7854
7946
  {
7855
7947
  modelValue: state.outlineVisible,
@@ -7857,7 +7949,7 @@ const MenuBar = vue.defineComponent({
7857
7949
  }
7858
7950
  )
7859
7951
  ),
7860
- /* @__PURE__ */ h(
7952
+ /* @__PURE__ */ vue.h(
7861
7953
  "div",
7862
7954
  {
7863
7955
  style: {
@@ -7867,7 +7959,7 @@ const MenuBar = vue.defineComponent({
7867
7959
  alignItems: "center"
7868
7960
  }
7869
7961
  },
7870
- /* @__PURE__ */ h(
7962
+ /* @__PURE__ */ vue.h(
7871
7963
  "span",
7872
7964
  {
7873
7965
  style: {
@@ -7877,7 +7969,7 @@ const MenuBar = vue.defineComponent({
7877
7969
  },
7878
7970
  i18n(props.ctx, "view.cover") || "\u5C01\u9762"
7879
7971
  ),
7880
- /* @__PURE__ */ h(
7972
+ /* @__PURE__ */ vue.h(
7881
7973
  ToggleSwitch,
7882
7974
  {
7883
7975
  modelValue: state.showCover,
@@ -7893,7 +7985,7 @@ const MenuBar = vue.defineComponent({
7893
7985
  }
7894
7986
  )
7895
7987
  ),
7896
- /* @__PURE__ */ h(
7988
+ /* @__PURE__ */ vue.h(
7897
7989
  "div",
7898
7990
  {
7899
7991
  style: {
@@ -7903,7 +7995,7 @@ const MenuBar = vue.defineComponent({
7903
7995
  }
7904
7996
  }
7905
7997
  ),
7906
- /* @__PURE__ */ h(
7998
+ /* @__PURE__ */ vue.h(
7907
7999
  "div",
7908
8000
  {
7909
8001
  style: {
@@ -7913,7 +8005,7 @@ const MenuBar = vue.defineComponent({
7913
8005
  alignItems: "center"
7914
8006
  }
7915
8007
  },
7916
- /* @__PURE__ */ h(
8008
+ /* @__PURE__ */ vue.h(
7917
8009
  "span",
7918
8010
  {
7919
8011
  style: {
@@ -7924,7 +8016,7 @@ const MenuBar = vue.defineComponent({
7924
8016
  i18n(props.ctx, "view.docBackground") || "\u6587\u6863\u80CC\u666F"
7925
8017
  )
7926
8018
  ),
7927
- /* @__PURE__ */ h(
8019
+ /* @__PURE__ */ vue.h(
7928
8020
  "div",
7929
8021
  {
7930
8022
  style: {
@@ -7934,7 +8026,7 @@ const MenuBar = vue.defineComponent({
7934
8026
  gap: "6px"
7935
8027
  }
7936
8028
  },
7937
- bgColors.map((bg) => /* @__PURE__ */ h(
8029
+ bgColors.map((bg) => /* @__PURE__ */ vue.h(
7938
8030
  "div",
7939
8031
  {
7940
8032
  key: bg.value || "default",
@@ -7956,7 +8048,7 @@ const MenuBar = vue.defineComponent({
7956
8048
  justifyContent: "center"
7957
8049
  }
7958
8050
  },
7959
- bg.value === null ? /* @__PURE__ */ h(
8051
+ bg.value === null ? /* @__PURE__ */ vue.h(
7960
8052
  "div",
7961
8053
  {
7962
8054
  style: {
@@ -7969,7 +8061,7 @@ const MenuBar = vue.defineComponent({
7969
8061
  borderRadius: "3px"
7970
8062
  }
7971
8063
  },
7972
- /* @__PURE__ */ h(
8064
+ /* @__PURE__ */ vue.h(
7973
8065
  "div",
7974
8066
  {
7975
8067
  style: {
@@ -7987,7 +8079,7 @@ const MenuBar = vue.defineComponent({
7987
8079
  ) : null
7988
8080
  ))
7989
8081
  ),
7990
- /* @__PURE__ */ h(
8082
+ /* @__PURE__ */ vue.h(
7991
8083
  "div",
7992
8084
  {
7993
8085
  style: {
@@ -7997,7 +8089,7 @@ const MenuBar = vue.defineComponent({
7997
8089
  }
7998
8090
  }
7999
8091
  ),
8000
- /* @__PURE__ */ h(
8092
+ /* @__PURE__ */ vue.h(
8001
8093
  "div",
8002
8094
  {
8003
8095
  style: {
@@ -8007,7 +8099,7 @@ const MenuBar = vue.defineComponent({
8007
8099
  alignItems: "center"
8008
8100
  }
8009
8101
  },
8010
- /* @__PURE__ */ h(
8102
+ /* @__PURE__ */ vue.h(
8011
8103
  "span",
8012
8104
  {
8013
8105
  style: {
@@ -8018,7 +8110,7 @@ const MenuBar = vue.defineComponent({
8018
8110
  i18n(props.ctx, "view.editorWidth") || "\u5185\u5BB9\u5BBD\u5EA6"
8019
8111
  )
8020
8112
  ),
8021
- /* @__PURE__ */ h(
8113
+ /* @__PURE__ */ vue.h(
8022
8114
  "div",
8023
8115
  {
8024
8116
  style: {
@@ -8040,7 +8132,7 @@ const MenuBar = vue.defineComponent({
8040
8132
  key: "full",
8041
8133
  labelKey: "view.widthFull"
8042
8134
  }
8043
- ].map(({ key, labelKey }) => /* @__PURE__ */ h(
8135
+ ].map(({ key, labelKey }) => /* @__PURE__ */ vue.h(
8044
8136
  "button",
8045
8137
  {
8046
8138
  key,
@@ -8113,7 +8205,7 @@ const rightGroups = [
8113
8205
  titleKey: "shortcuts.history",
8114
8206
  items: [
8115
8207
  { labelKey: "shortcuts.undo", keys: ["Mod+z"] },
8116
- { labelKey: "shortcuts.redo", keys: ["Mod+y", "Shift+Mod+z"] }
8208
+ { labelKey: "shortcuts.redo", keys: ["Mod+y", "Shift+Mod+Z"] }
8117
8209
  ]
8118
8210
  }
8119
8211
  ];
@@ -8267,7 +8359,7 @@ const FixedToolbarComponent = vue.defineComponent({
8267
8359
  },
8268
8360
  setup(props) {
8269
8361
  const showShortcuts = vue.ref(false);
8270
- return () => /* @__PURE__ */ h(
8362
+ return () => /* @__PURE__ */ vue.h(
8271
8363
  "div",
8272
8364
  {
8273
8365
  style: {
@@ -8278,8 +8370,8 @@ const FixedToolbarComponent = vue.defineComponent({
8278
8370
  gap: "0px"
8279
8371
  }
8280
8372
  },
8281
- /* @__PURE__ */ h(MenuBar, { ctx: props.ctx, config: props.config }),
8282
- /* @__PURE__ */ h(
8373
+ /* @__PURE__ */ vue.h(MenuBar, { ctx: props.ctx, config: props.config }),
8374
+ /* @__PURE__ */ vue.h(
8283
8375
  "div",
8284
8376
  {
8285
8377
  style: {
@@ -8290,7 +8382,7 @@ const FixedToolbarComponent = vue.defineComponent({
8290
8382
  }
8291
8383
  }
8292
8384
  ),
8293
- /* @__PURE__ */ h(
8385
+ /* @__PURE__ */ vue.h(
8294
8386
  Toolbar,
8295
8387
  {
8296
8388
  ctx: props.ctx,
@@ -8301,7 +8393,7 @@ const FixedToolbarComponent = vue.defineComponent({
8301
8393
  isFixed: true
8302
8394
  }
8303
8395
  ),
8304
- /* @__PURE__ */ h(
8396
+ /* @__PURE__ */ vue.h(
8305
8397
  "div",
8306
8398
  {
8307
8399
  style: {
@@ -8313,7 +8405,7 @@ const FixedToolbarComponent = vue.defineComponent({
8313
8405
  }
8314
8406
  }
8315
8407
  ),
8316
- /* @__PURE__ */ h(
8408
+ /* @__PURE__ */ vue.h(
8317
8409
  "button",
8318
8410
  {
8319
8411
  type: "button",
@@ -8323,9 +8415,9 @@ const FixedToolbarComponent = vue.defineComponent({
8323
8415
  showShortcuts.value = true;
8324
8416
  }
8325
8417
  },
8326
- /* @__PURE__ */ h(component.Icon, { icon: keyboardIcon })
8418
+ /* @__PURE__ */ vue.h(component.Icon, { icon: keyboardIcon })
8327
8419
  ),
8328
- showShortcuts.value && /* @__PURE__ */ h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
8420
+ showShortcuts.value && /* @__PURE__ */ vue.h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
8329
8421
  );
8330
8422
  }
8331
8423
  });
@@ -8755,6 +8847,7 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
8755
8847
  return builder.build();
8756
8848
  }
8757
8849
 
8850
+ keepAlive(vue.h);
8758
8851
  const DocumentHeader = vue.defineComponent({
8759
8852
  props: {
8760
8853
  ctx: { type: Object, required: true },
@@ -8831,13 +8924,13 @@ const DocumentHeader = vue.defineComponent({
8831
8924
  var _a, _b;
8832
8925
  const state = viewState.value;
8833
8926
  if (!state.showTitle && !state.showCover) return null;
8834
- return /* @__PURE__ */ h(
8927
+ return /* @__PURE__ */ vue.h(
8835
8928
  "div",
8836
8929
  {
8837
8930
  class: "milkdown-document-header",
8838
8931
  style: { width: "100%", display: "flex", flexDirection: "column" }
8839
8932
  },
8840
- state.showCover ? /* @__PURE__ */ h(
8933
+ state.showCover ? /* @__PURE__ */ vue.h(
8841
8934
  "div",
8842
8935
  {
8843
8936
  class: "milkdown-document-cover",
@@ -8855,7 +8948,7 @@ const DocumentHeader = vue.defineComponent({
8855
8948
  overflow: "hidden"
8856
8949
  }
8857
8950
  },
8858
- /* @__PURE__ */ h(
8951
+ /* @__PURE__ */ vue.h(
8859
8952
  "img",
8860
8953
  {
8861
8954
  src: state.coverUrl,
@@ -8868,7 +8961,7 @@ const DocumentHeader = vue.defineComponent({
8868
8961
  }
8869
8962
  }
8870
8963
  ),
8871
- /* @__PURE__ */ h(
8964
+ /* @__PURE__ */ vue.h(
8872
8965
  "div",
8873
8966
  {
8874
8967
  style: {
@@ -8885,7 +8978,7 @@ const DocumentHeader = vue.defineComponent({
8885
8978
  background: "linear-gradient(transparent, rgba(0,0,0,0.7))"
8886
8979
  }
8887
8980
  },
8888
- /* @__PURE__ */ h(
8981
+ /* @__PURE__ */ vue.h(
8889
8982
  "div",
8890
8983
  {
8891
8984
  style: {
@@ -8897,7 +8990,7 @@ const DocumentHeader = vue.defineComponent({
8897
8990
  },
8898
8991
  (lastUploadedUrl.value ? [lastUploadedUrl.value] : []).concat(
8899
8992
  ((_b = (_a = props.config) == null ? void 0 : _a.defaultCoverImages) == null ? void 0 : _b.length) ? props.config.defaultCoverImages : builtInCoverImages
8900
- ).map((src, i) => /* @__PURE__ */ h(
8993
+ ).map((src, i) => /* @__PURE__ */ vue.h(
8901
8994
  "img",
8902
8995
  {
8903
8996
  key: i,
@@ -8927,7 +9020,7 @@ const DocumentHeader = vue.defineComponent({
8927
9020
  }
8928
9021
  ))
8929
9022
  ),
8930
- /* @__PURE__ */ h(
9023
+ /* @__PURE__ */ vue.h(
8931
9024
  "div",
8932
9025
  {
8933
9026
  onClick: () => {
@@ -8955,7 +9048,7 @@ const DocumentHeader = vue.defineComponent({
8955
9048
  e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.2)";
8956
9049
  }
8957
9050
  },
8958
- /* @__PURE__ */ h(
9051
+ /* @__PURE__ */ vue.h(
8959
9052
  "svg",
8960
9053
  {
8961
9054
  width: "14",
@@ -8967,14 +9060,14 @@ const DocumentHeader = vue.defineComponent({
8967
9060
  "stroke-linecap": "round",
8968
9061
  "stroke-linejoin": "round"
8969
9062
  },
8970
- /* @__PURE__ */ h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
8971
- /* @__PURE__ */ h("polyline", { points: "17 8 12 3 7 8" }),
8972
- /* @__PURE__ */ h("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
9063
+ /* @__PURE__ */ vue.h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
9064
+ /* @__PURE__ */ vue.h("polyline", { points: "17 8 12 3 7 8" }),
9065
+ /* @__PURE__ */ vue.h("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
8973
9066
  ),
8974
9067
  "\u4E0A\u4F20"
8975
9068
  )
8976
9069
  ),
8977
- /* @__PURE__ */ h(
9070
+ /* @__PURE__ */ vue.h(
8978
9071
  "input",
8979
9072
  {
8980
9073
  type: "file",
@@ -8985,7 +9078,7 @@ const DocumentHeader = vue.defineComponent({
8985
9078
  }
8986
9079
  )
8987
9080
  ) : null,
8988
- state.showTitle ? /* @__PURE__ */ h(
9081
+ state.showTitle ? /* @__PURE__ */ vue.h(
8989
9082
  "div",
8990
9083
  {
8991
9084
  class: "milkdown-document-title-wrapper",
@@ -8996,8 +9089,8 @@ const DocumentHeader = vue.defineComponent({
8996
9089
  padding: `40px ${editorWidthMap[state.editorWidth] === "none" ? "80px" : "0"} 0`
8997
9090
  }
8998
9091
  },
8999
- /* @__PURE__ */ h("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
9000
- /* @__PURE__ */ h(
9092
+ /* @__PURE__ */ vue.h("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
9093
+ /* @__PURE__ */ vue.h(
9001
9094
  "textarea",
9002
9095
  {
9003
9096
  ref: titleTextareaRef,
@@ -9232,7 +9325,7 @@ const OutlinePanel = vue.defineComponent({
9232
9325
  const state = viewState.value;
9233
9326
  if (!state.outlineVisible) return null;
9234
9327
  const isLeft = state.outlinePosition === "left";
9235
- return /* @__PURE__ */ h(
9328
+ return /* @__PURE__ */ vue.h(
9236
9329
  "div",
9237
9330
  {
9238
9331
  class: "milkdown-outline-panel",
@@ -9253,7 +9346,7 @@ const OutlinePanel = vue.defineComponent({
9253
9346
  overflow: "hidden"
9254
9347
  }
9255
9348
  },
9256
- /* @__PURE__ */ h(
9349
+ /* @__PURE__ */ vue.h(
9257
9350
  "div",
9258
9351
  {
9259
9352
  style: {
@@ -9267,8 +9360,8 @@ const OutlinePanel = vue.defineComponent({
9267
9360
  alignItems: "center"
9268
9361
  }
9269
9362
  },
9270
- /* @__PURE__ */ h("span", null, i18n(props.ctx, "view.outline")),
9271
- /* @__PURE__ */ h(
9363
+ /* @__PURE__ */ vue.h("span", null, i18n(props.ctx, "view.outline")),
9364
+ /* @__PURE__ */ vue.h(
9272
9365
  "div",
9273
9366
  {
9274
9367
  style: {
@@ -9292,7 +9385,7 @@ const OutlinePanel = vue.defineComponent({
9292
9385
  },
9293
9386
  title: "\u5173\u95ED\u5927\u7EB2"
9294
9387
  },
9295
- /* @__PURE__ */ h(
9388
+ /* @__PURE__ */ vue.h(
9296
9389
  "svg",
9297
9390
  {
9298
9391
  width: "16",
@@ -9304,12 +9397,12 @@ const OutlinePanel = vue.defineComponent({
9304
9397
  "stroke-linecap": "round",
9305
9398
  "stroke-linejoin": "round"
9306
9399
  },
9307
- /* @__PURE__ */ h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
9308
- /* @__PURE__ */ h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
9400
+ /* @__PURE__ */ vue.h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
9401
+ /* @__PURE__ */ vue.h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
9309
9402
  )
9310
9403
  )
9311
9404
  ),
9312
- /* @__PURE__ */ h("div", { style: { flexGrow: 1, overflowY: "auto", padding: "12px 0" } }, items.value.length === 0 ? /* @__PURE__ */ h(
9405
+ /* @__PURE__ */ vue.h("div", { style: { flexGrow: 1, overflowY: "auto", padding: "12px 0" } }, items.value.length === 0 ? /* @__PURE__ */ vue.h(
9313
9406
  "div",
9314
9407
  {
9315
9408
  style: {
@@ -9322,7 +9415,7 @@ const OutlinePanel = vue.defineComponent({
9322
9415
  ) : null, visibleItems.value.map(({ item, hasChildren: hasKids }) => {
9323
9416
  const isActive = activeId.value === item.id;
9324
9417
  const collapsed = collapsedIds.value.has(item.id);
9325
- return /* @__PURE__ */ h(
9418
+ return /* @__PURE__ */ vue.h(
9326
9419
  "div",
9327
9420
  {
9328
9421
  key: item.id,
@@ -9355,7 +9448,7 @@ const OutlinePanel = vue.defineComponent({
9355
9448
  }
9356
9449
  }
9357
9450
  },
9358
- /* @__PURE__ */ h(
9451
+ /* @__PURE__ */ vue.h(
9359
9452
  "span",
9360
9453
  {
9361
9454
  onClick: (e) => {
@@ -9388,7 +9481,7 @@ const OutlinePanel = vue.defineComponent({
9388
9481
  "\uFFFD?",
9389
9482
  " "
9390
9483
  ),
9391
- /* @__PURE__ */ h(
9484
+ /* @__PURE__ */ vue.h(
9392
9485
  "span",
9393
9486
  {
9394
9487
  title: item.text,
@@ -9401,7 +9494,7 @@ const OutlinePanel = vue.defineComponent({
9401
9494
  )
9402
9495
  );
9403
9496
  })),
9404
- /* @__PURE__ */ h(
9497
+ /* @__PURE__ */ vue.h(
9405
9498
  "div",
9406
9499
  {
9407
9500
  onPointerdown: onPointerDown,
@@ -9440,7 +9533,7 @@ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Ca
9440
9533
  var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9441
9534
  var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
9442
9535
  var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
9443
- var _content$2, _app$2, _headerContent, _headerApp, _outlineContent, _outlineApp, _watcher, _selection$1, _show$1, _resizeObserver, _updateOutlineGeometry, _scrollContainers, _view;
9536
+ var _content$2, _app$2, _headerContent, _headerApp, _outlineContent, _outlineApp, _watcher, _selection$1, _show$1, _resizeObserver, _updateOutlineGeometry, _scrollContainers, _onDblClick, _view;
9444
9537
  const fixedToolbarConfig = utils.$ctx(
9445
9538
  {},
9446
9539
  "fixedToolbarConfigCtx"
@@ -9460,12 +9553,16 @@ class FixedToolbarView {
9460
9553
  __privateAdd$3(this, _resizeObserver);
9461
9554
  __privateAdd$3(this, _updateOutlineGeometry);
9462
9555
  __privateAdd$3(this, _scrollContainers, []);
9556
+ __privateAdd$3(this, _onDblClick);
9463
9557
  __privateAdd$3(this, _view);
9464
9558
  this.update = (view) => {
9465
9559
  __privateGet$3(this, _selection$1).value = view.state.selection;
9466
9560
  };
9467
9561
  this.destroy = () => {
9468
9562
  if (__privateGet$3(this, _watcher)) __privateGet$3(this, _watcher).call(this);
9563
+ if (__privateGet$3(this, _onDblClick)) {
9564
+ __privateGet$3(this, _view).dom.removeEventListener("dblclick", __privateGet$3(this, _onDblClick));
9565
+ }
9469
9566
  if (__privateGet$3(this, _resizeObserver)) __privateGet$3(this, _resizeObserver).disconnect();
9470
9567
  window.removeEventListener("resize", __privateGet$3(this, _updateOutlineGeometry));
9471
9568
  window.removeEventListener("scroll", __privateGet$3(this, _updateOutlineGeometry), {
@@ -9516,6 +9613,31 @@ class FixedToolbarView {
9516
9613
  __privateGet$3(this, _outlineApp).mount(outlineContent);
9517
9614
  __privateSet$3(this, _outlineContent, outlineContent);
9518
9615
  root.appendChild(outlineContent);
9616
+ __privateSet$3(this, _onDblClick, (event) => {
9617
+ const view2 = __privateGet$3(this, _view);
9618
+ if (!view2.editable) return;
9619
+ const dom = view2.dom;
9620
+ const children = dom.children;
9621
+ if (children.length === 0) return;
9622
+ const lastChild = children[children.length - 1];
9623
+ if (!lastChild) return;
9624
+ const lastRect = lastChild.getBoundingClientRect();
9625
+ if (event.clientY <= lastRect.bottom) return;
9626
+ const { doc } = view2.state;
9627
+ const lastNode = doc.lastChild;
9628
+ if (!lastNode) return;
9629
+ if (lastNode.type.name === "paragraph" && lastNode.content.size === 0)
9630
+ return;
9631
+ const paragraphType = view2.state.schema.nodes["paragraph"];
9632
+ if (!paragraphType) return;
9633
+ const pos = doc.content.size;
9634
+ const tr = view2.state.tr.insert(pos, paragraphType.create());
9635
+ const sel = state.TextSelection.create(tr.doc, pos + 1);
9636
+ tr.setSelection(sel);
9637
+ view2.dispatch(tr);
9638
+ view2.focus();
9639
+ });
9640
+ view.dom.addEventListener("dblclick", __privateGet$3(this, _onDblClick));
9519
9641
  __privateGet$3(this, _content$2).style.transition = "margin 0.1s ease-out, width 0.1s ease-out";
9520
9642
  const viewState = ctx.get(viewMenuStateCtx.key);
9521
9643
  if (config.outlinePosition) {
@@ -9614,7 +9736,7 @@ class FixedToolbarView {
9614
9736
  __privateGet$3(this, _view).dom.style.maxWidth = maxWidth;
9615
9737
  __privateGet$3(this, _view).dom.style.width = isFull ? "100%" : maxWidth;
9616
9738
  __privateGet$3(this, _view).dom.style.margin = isFull ? "0" : "0 auto";
9617
- __privateGet$3(this, _view).dom.style.padding = `20px ${px} 0`;
9739
+ __privateGet$3(this, _view).dom.style.padding = `20px ${px} 36px`;
9618
9740
  if (__privateGet$3(this, _headerContent)) {
9619
9741
  __privateGet$3(this, _headerContent).style.margin = isFull && !viewState.showCover ? "0 auto" : "0";
9620
9742
  __privateGet$3(this, _headerContent).style.padding = `0px`;
@@ -9641,6 +9763,7 @@ _show$1 = new WeakMap();
9641
9763
  _resizeObserver = new WeakMap();
9642
9764
  _updateOutlineGeometry = new WeakMap();
9643
9765
  _scrollContainers = new WeakMap();
9766
+ _onDblClick = new WeakMap();
9644
9767
  _view = new WeakMap();
9645
9768
  const fixedToolbarPlugin = utils.$prose((ctx) => {
9646
9769
  return new state.Plugin({
@@ -9762,7 +9885,7 @@ const imageBlockConverter = utils$1.$prose((ctx) => {
9762
9885
  const r = replacements[i];
9763
9886
  tr.replaceWith(r.from, r.to, r.blocks);
9764
9887
  }
9765
- return tr;
9888
+ return tr.setMeta("addToHistory", false);
9766
9889
  }
9767
9890
  });
9768
9891
  });
@@ -10243,7 +10366,7 @@ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Ca
10243
10366
  var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
10244
10367
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10245
10368
  var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
10246
- var _tooltipProvider, _content, _app, _selection, _show, _mousePressed;
10369
+ var _tooltipProvider, _content, _app, _selection, _show, _mousePressed, _removePopupListener, _onDocumentMouseUp;
10247
10370
  const toolbarTooltip = tooltip.tooltipFactory("CREPE_TOOLBAR");
10248
10371
  class ToolbarView {
10249
10372
  constructor(ctx, view, config) {
@@ -10253,11 +10376,18 @@ class ToolbarView {
10253
10376
  __privateAdd$1(this, _selection);
10254
10377
  __privateAdd$1(this, _show, vue.ref(false));
10255
10378
  __privateAdd$1(this, _mousePressed, false);
10379
+ __privateAdd$1(this, _removePopupListener);
10380
+ __privateAdd$1(this, _onDocumentMouseUp);
10256
10381
  this.update = (view, prevState) => {
10257
10382
  __privateGet$1(this, _tooltipProvider).update(view, prevState);
10258
10383
  __privateGet$1(this, _selection).value = view.state.selection;
10259
10384
  };
10260
10385
  this.destroy = () => {
10386
+ var _a;
10387
+ (_a = __privateGet$1(this, _removePopupListener)) == null ? void 0 : _a.call(this);
10388
+ if (__privateGet$1(this, _onDocumentMouseUp)) {
10389
+ document.removeEventListener("mouseup", __privateGet$1(this, _onDocumentMouseUp));
10390
+ }
10261
10391
  __privateGet$1(this, _tooltipProvider).destroy();
10262
10392
  __privateGet$1(this, _app).unmount();
10263
10393
  __privateGet$1(this, _content).remove();
@@ -10287,12 +10417,23 @@ class ToolbarView {
10287
10417
  this.update(view);
10288
10418
  }, 0);
10289
10419
  });
10420
+ const onDocumentMouseUp = () => {
10421
+ if (__privateGet$1(this, _mousePressed)) {
10422
+ __privateSet$1(this, _mousePressed, false);
10423
+ setTimeout(() => {
10424
+ this.update(view);
10425
+ }, 0);
10426
+ }
10427
+ };
10428
+ document.addEventListener("mouseup", onDocumentMouseUp);
10429
+ __privateSet$1(this, _onDocumentMouseUp, onDocumentMouseUp);
10290
10430
  __privateSet$1(this, _tooltipProvider, new tooltip.TooltipProvider({
10291
10431
  content: __privateGet$1(this, _content),
10292
10432
  debounce: 20,
10293
10433
  offset: 10,
10294
10434
  shouldShow: (view2) => {
10295
10435
  if (__privateGet$1(this, _mousePressed)) return false;
10436
+ if (getIsAnyPopupOpen()) return false;
10296
10437
  const { doc, selection } = view2.state;
10297
10438
  const { empty, from, to } = selection;
10298
10439
  const isEmptyTextBlock = !doc.textBetween(from, to).length && selection instanceof state.TextSelection;
@@ -10312,6 +10453,13 @@ class ToolbarView {
10312
10453
  __privateGet$1(this, _tooltipProvider).onHide = () => {
10313
10454
  __privateGet$1(this, _show).value = false;
10314
10455
  };
10456
+ __privateSet$1(this, _removePopupListener, addPopupChangeListener(() => {
10457
+ if (getIsAnyPopupOpen()) {
10458
+ __privateGet$1(this, _tooltipProvider).hide();
10459
+ } else {
10460
+ __privateGet$1(this, _tooltipProvider).update(view);
10461
+ }
10462
+ }));
10315
10463
  this.update(view);
10316
10464
  }
10317
10465
  }
@@ -10321,6 +10469,8 @@ _app = new WeakMap();
10321
10469
  _selection = new WeakMap();
10322
10470
  _show = new WeakMap();
10323
10471
  _mousePressed = new WeakMap();
10472
+ _removePopupListener = new WeakMap();
10473
+ _onDocumentMouseUp = new WeakMap();
10324
10474
  const toolbar = (editor, config) => {
10325
10475
  editor.config(crepeFeatureConfig(CrepeFeature.Toolbar)).config((ctx) => {
10326
10476
  ctx.set(toolbarTooltip.key, {