@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/cjs/index.js CHANGED
@@ -1136,6 +1136,10 @@ const attachmentSchema = utils.$nodeSchema("attachment", () => {
1136
1136
  };
1137
1137
  });
1138
1138
 
1139
+ function keepAlive(..._args) {
1140
+ }
1141
+
1142
+ keepAlive(vue.h);
1139
1143
  const downloadIcon = `<svg viewBox="0 0 1024 1024" width="20" height="20" fill="currentColor">
1140
1144
  <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>
1141
1145
  </svg>`;
@@ -1503,9 +1507,6 @@ class GroupBuilder {
1503
1507
  _groups = new WeakMap();
1504
1508
  _getGroupInstance = new WeakMap();
1505
1509
 
1506
- function keepAlive(..._args) {
1507
- }
1508
-
1509
1510
  const remarkTextColorPlugin = utils.$remark(
1510
1511
  "remarkTextColor",
1511
1512
  () => function() {
@@ -5757,12 +5758,18 @@ const Toolbar = vue.defineComponent({
5757
5758
  };
5758
5759
  let lastContainerWidth = 0;
5759
5760
  const computeOverflow = () => {
5761
+ var _a;
5760
5762
  if (!toolbarContainerRef.value) return;
5763
+ const status = (_a = ctx == null ? void 0 : ctx.get(core.editorCtx)) == null ? void 0 : _a.status;
5764
+ if (status !== core.EditorStatus.Created) return;
5765
+ const view = ctx.get(core.editorViewCtx);
5766
+ if (!view || !view.dom) return;
5761
5767
  const container = toolbarContainerRef.value;
5762
5768
  if (!isFixed) {
5763
- const view = ctx.get(core.editorViewCtx);
5764
5769
  const containerDOM = view.dom.closest(".milkdown-editor-container") || view.dom.closest(".milkdown") || view.dom;
5765
- container.style.maxWidth = `${containerDOM.clientWidth - 32}px`;
5770
+ if (containerDOM) {
5771
+ container.style.maxWidth = `${containerDOM.clientWidth - 32}px`;
5772
+ }
5766
5773
  }
5767
5774
  let containerWidth;
5768
5775
  if (isFixed) {
@@ -5781,9 +5788,8 @@ const Toolbar = vue.defineComponent({
5781
5788
  containerWidth = container.clientWidth;
5782
5789
  }
5783
5790
  } else {
5784
- const view = ctx.get(core.editorViewCtx);
5785
5791
  const containerDOM = view.dom.closest(".milkdown-editor-container") || view.dom.closest(".milkdown") || view.dom;
5786
- containerWidth = containerDOM.clientWidth - 32;
5792
+ containerWidth = containerDOM ? containerDOM.clientWidth - 32 : 0;
5787
5793
  }
5788
5794
  if (showOverflowMenu.value) {
5789
5795
  showOverflowMenu.value = false;
@@ -5985,7 +5991,18 @@ const Toolbar = vue.defineComponent({
5985
5991
  let overflowResizeObserver = null;
5986
5992
  let overflowSetupDone = false;
5987
5993
  const setupOverflowObserver = () => {
5994
+ var _a;
5988
5995
  if (!toolbarContainerRef.value || overflowSetupDone) return;
5996
+ const status = (_a = ctx == null ? void 0 : ctx.get(core.editorCtx)) == null ? void 0 : _a.status;
5997
+ if (status !== core.EditorStatus.Created) {
5998
+ setTimeout(setupOverflowObserver, 50);
5999
+ return;
6000
+ }
6001
+ const view = ctx.get(core.editorViewCtx);
6002
+ if (!view || !view.dom) {
6003
+ setTimeout(setupOverflowObserver, 50);
6004
+ return;
6005
+ }
5989
6006
  overflowSetupDone = true;
5990
6007
  overflowResizeObserver = new ResizeObserver(() => {
5991
6008
  computeOverflow();
@@ -5995,7 +6012,6 @@ const Toolbar = vue.defineComponent({
5995
6012
  const parent = toolbarContainerRef.value.parentElement;
5996
6013
  if (parent) overflowResizeObserver.observe(parent);
5997
6014
  } else {
5998
- const view = ctx.get(core.editorViewCtx);
5999
6015
  overflowResizeObserver.observe(view.dom);
6000
6016
  const containerDOM = view.dom.closest(".milkdown-editor-container");
6001
6017
  if (containerDOM) {
@@ -7764,13 +7780,14 @@ const createViewMenuState = () => vue.reactive({
7764
7780
  });
7765
7781
  const viewMenuStateCtx = utils.$ctx(createViewMenuState(), "viewMenuStateCtx");
7766
7782
 
7783
+ keepAlive(vue.h);
7767
7784
  const ToggleSwitch = vue.defineComponent({
7768
7785
  props: {
7769
7786
  modelValue: { type: Boolean, required: true }
7770
7787
  },
7771
7788
  emits: ["update:modelValue"],
7772
7789
  setup(props, { emit }) {
7773
- return () => /* @__PURE__ */ h(
7790
+ return () => /* @__PURE__ */ vue.h(
7774
7791
  "div",
7775
7792
  {
7776
7793
  onClick: (e) => {
@@ -7787,7 +7804,7 @@ const ToggleSwitch = vue.defineComponent({
7787
7804
  transition: "background-color 0.2s"
7788
7805
  }
7789
7806
  },
7790
- /* @__PURE__ */ h(
7807
+ /* @__PURE__ */ vue.h(
7791
7808
  "div",
7792
7809
  {
7793
7810
  style: {
@@ -7886,7 +7903,7 @@ const MenuBar = vue.defineComponent({
7886
7903
  const hasSubmenu = (key) => key === "view";
7887
7904
  return () => {
7888
7905
  const state = viewState.value;
7889
- return /* @__PURE__ */ h(
7906
+ return /* @__PURE__ */ vue.h(
7890
7907
  "div",
7891
7908
  {
7892
7909
  class: "milkdown-menu-bar",
@@ -7898,7 +7915,7 @@ const MenuBar = vue.defineComponent({
7898
7915
  position: "relative"
7899
7916
  }
7900
7917
  },
7901
- /* @__PURE__ */ h(
7918
+ /* @__PURE__ */ vue.h(
7902
7919
  "div",
7903
7920
  {
7904
7921
  ref: buttonRef,
@@ -7921,7 +7938,7 @@ const MenuBar = vue.defineComponent({
7921
7938
  e.currentTarget.style.backgroundColor = "transparent";
7922
7939
  }
7923
7940
  },
7924
- /* @__PURE__ */ h(
7941
+ /* @__PURE__ */ vue.h(
7925
7942
  "span",
7926
7943
  {
7927
7944
  style: {
@@ -7932,9 +7949,9 @@ const MenuBar = vue.defineComponent({
7932
7949
  justifyContent: "center"
7933
7950
  }
7934
7951
  },
7935
- /* @__PURE__ */ h(component.Icon, { icon: menuIcon })
7952
+ /* @__PURE__ */ vue.h(component.Icon, { icon: menuIcon })
7936
7953
  ),
7937
- /* @__PURE__ */ h(
7954
+ /* @__PURE__ */ vue.h(
7938
7955
  "span",
7939
7956
  {
7940
7957
  style: {
@@ -7947,7 +7964,7 @@ const MenuBar = vue.defineComponent({
7947
7964
  "\u83DC\u5355"
7948
7965
  )
7949
7966
  ),
7950
- showMenu.value ? /* @__PURE__ */ h(
7967
+ showMenu.value ? /* @__PURE__ */ vue.h(
7951
7968
  "div",
7952
7969
  {
7953
7970
  ref: mainRef,
@@ -7974,7 +7991,7 @@ const MenuBar = vue.defineComponent({
7974
7991
  menuKeys.value.map((menuKey) => {
7975
7992
  const isHovered = activeSubmenu.value === menuKey;
7976
7993
  const label = i18n(props.ctx, `menuBar.${menuKey}`) || menuKey;
7977
- return /* @__PURE__ */ h(
7994
+ return /* @__PURE__ */ vue.h(
7978
7995
  "div",
7979
7996
  {
7980
7997
  key: menuKey,
@@ -7996,7 +8013,7 @@ const MenuBar = vue.defineComponent({
7996
8013
  backgroundColor: isHovered ? "var(--crepe-color-hover, #f5f5f5)" : "transparent"
7997
8014
  }
7998
8015
  },
7999
- /* @__PURE__ */ h(
8016
+ /* @__PURE__ */ vue.h(
8000
8017
  "span",
8001
8018
  {
8002
8019
  style: {
@@ -8006,7 +8023,7 @@ const MenuBar = vue.defineComponent({
8006
8023
  },
8007
8024
  label
8008
8025
  ),
8009
- hasSubmenu(menuKey) ? /* @__PURE__ */ h(
8026
+ hasSubmenu(menuKey) ? /* @__PURE__ */ vue.h(
8010
8027
  "span",
8011
8028
  {
8012
8029
  style: {
@@ -8015,7 +8032,7 @@ const MenuBar = vue.defineComponent({
8015
8032
  display: "flex"
8016
8033
  }
8017
8034
  },
8018
- /* @__PURE__ */ h(
8035
+ /* @__PURE__ */ vue.h(
8019
8036
  "svg",
8020
8037
  {
8021
8038
  width: "12",
@@ -8027,10 +8044,10 @@ const MenuBar = vue.defineComponent({
8027
8044
  "stroke-linecap": "round",
8028
8045
  "stroke-linejoin": "round"
8029
8046
  },
8030
- /* @__PURE__ */ h("polyline", { points: "9 18 15 12 9 6" })
8047
+ /* @__PURE__ */ vue.h("polyline", { points: "9 18 15 12 9 6" })
8031
8048
  )
8032
8049
  ) : null,
8033
- menuKey === "view" && isHovered ? /* @__PURE__ */ h(
8050
+ menuKey === "view" && isHovered ? /* @__PURE__ */ vue.h(
8034
8051
  "div",
8035
8052
  {
8036
8053
  style: {
@@ -8048,7 +8065,7 @@ const MenuBar = vue.defineComponent({
8048
8065
  cursor: "default"
8049
8066
  }
8050
8067
  },
8051
- /* @__PURE__ */ h(
8068
+ /* @__PURE__ */ vue.h(
8052
8069
  "div",
8053
8070
  {
8054
8071
  style: {
@@ -8058,7 +8075,7 @@ const MenuBar = vue.defineComponent({
8058
8075
  alignItems: "center"
8059
8076
  }
8060
8077
  },
8061
- /* @__PURE__ */ h(
8078
+ /* @__PURE__ */ vue.h(
8062
8079
  "span",
8063
8080
  {
8064
8081
  style: {
@@ -8068,7 +8085,7 @@ const MenuBar = vue.defineComponent({
8068
8085
  },
8069
8086
  i18n(props.ctx, "view.title") || "\u6807\u9898"
8070
8087
  ),
8071
- /* @__PURE__ */ h(
8088
+ /* @__PURE__ */ vue.h(
8072
8089
  ToggleSwitch,
8073
8090
  {
8074
8091
  modelValue: state.showTitle,
@@ -8076,7 +8093,7 @@ const MenuBar = vue.defineComponent({
8076
8093
  }
8077
8094
  )
8078
8095
  ),
8079
- /* @__PURE__ */ h(
8096
+ /* @__PURE__ */ vue.h(
8080
8097
  "div",
8081
8098
  {
8082
8099
  style: {
@@ -8086,7 +8103,7 @@ const MenuBar = vue.defineComponent({
8086
8103
  alignItems: "center"
8087
8104
  }
8088
8105
  },
8089
- /* @__PURE__ */ h(
8106
+ /* @__PURE__ */ vue.h(
8090
8107
  "span",
8091
8108
  {
8092
8109
  style: {
@@ -8096,7 +8113,7 @@ const MenuBar = vue.defineComponent({
8096
8113
  },
8097
8114
  i18n(props.ctx, "view.outline") || "\u5927\u7EB2"
8098
8115
  ),
8099
- /* @__PURE__ */ h(
8116
+ /* @__PURE__ */ vue.h(
8100
8117
  ToggleSwitch,
8101
8118
  {
8102
8119
  modelValue: state.outlineVisible,
@@ -8104,7 +8121,7 @@ const MenuBar = vue.defineComponent({
8104
8121
  }
8105
8122
  )
8106
8123
  ),
8107
- /* @__PURE__ */ h(
8124
+ /* @__PURE__ */ vue.h(
8108
8125
  "div",
8109
8126
  {
8110
8127
  style: {
@@ -8114,7 +8131,7 @@ const MenuBar = vue.defineComponent({
8114
8131
  alignItems: "center"
8115
8132
  }
8116
8133
  },
8117
- /* @__PURE__ */ h(
8134
+ /* @__PURE__ */ vue.h(
8118
8135
  "span",
8119
8136
  {
8120
8137
  style: {
@@ -8124,7 +8141,7 @@ const MenuBar = vue.defineComponent({
8124
8141
  },
8125
8142
  i18n(props.ctx, "view.cover") || "\u5C01\u9762"
8126
8143
  ),
8127
- /* @__PURE__ */ h(
8144
+ /* @__PURE__ */ vue.h(
8128
8145
  ToggleSwitch,
8129
8146
  {
8130
8147
  modelValue: state.showCover,
@@ -8140,7 +8157,7 @@ const MenuBar = vue.defineComponent({
8140
8157
  }
8141
8158
  )
8142
8159
  ),
8143
- /* @__PURE__ */ h(
8160
+ /* @__PURE__ */ vue.h(
8144
8161
  "div",
8145
8162
  {
8146
8163
  style: {
@@ -8150,7 +8167,7 @@ const MenuBar = vue.defineComponent({
8150
8167
  }
8151
8168
  }
8152
8169
  ),
8153
- /* @__PURE__ */ h(
8170
+ /* @__PURE__ */ vue.h(
8154
8171
  "div",
8155
8172
  {
8156
8173
  style: {
@@ -8160,7 +8177,7 @@ const MenuBar = vue.defineComponent({
8160
8177
  alignItems: "center"
8161
8178
  }
8162
8179
  },
8163
- /* @__PURE__ */ h(
8180
+ /* @__PURE__ */ vue.h(
8164
8181
  "span",
8165
8182
  {
8166
8183
  style: {
@@ -8171,7 +8188,7 @@ const MenuBar = vue.defineComponent({
8171
8188
  i18n(props.ctx, "view.docBackground") || "\u6587\u6863\u80CC\u666F"
8172
8189
  )
8173
8190
  ),
8174
- /* @__PURE__ */ h(
8191
+ /* @__PURE__ */ vue.h(
8175
8192
  "div",
8176
8193
  {
8177
8194
  style: {
@@ -8181,7 +8198,7 @@ const MenuBar = vue.defineComponent({
8181
8198
  gap: "6px"
8182
8199
  }
8183
8200
  },
8184
- bgColors.map((bg) => /* @__PURE__ */ h(
8201
+ bgColors.map((bg) => /* @__PURE__ */ vue.h(
8185
8202
  "div",
8186
8203
  {
8187
8204
  key: bg.value || "default",
@@ -8203,7 +8220,7 @@ const MenuBar = vue.defineComponent({
8203
8220
  justifyContent: "center"
8204
8221
  }
8205
8222
  },
8206
- bg.value === null ? /* @__PURE__ */ h(
8223
+ bg.value === null ? /* @__PURE__ */ vue.h(
8207
8224
  "div",
8208
8225
  {
8209
8226
  style: {
@@ -8216,7 +8233,7 @@ const MenuBar = vue.defineComponent({
8216
8233
  borderRadius: "3px"
8217
8234
  }
8218
8235
  },
8219
- /* @__PURE__ */ h(
8236
+ /* @__PURE__ */ vue.h(
8220
8237
  "div",
8221
8238
  {
8222
8239
  style: {
@@ -8234,7 +8251,7 @@ const MenuBar = vue.defineComponent({
8234
8251
  ) : null
8235
8252
  ))
8236
8253
  ),
8237
- /* @__PURE__ */ h(
8254
+ /* @__PURE__ */ vue.h(
8238
8255
  "div",
8239
8256
  {
8240
8257
  style: {
@@ -8244,7 +8261,7 @@ const MenuBar = vue.defineComponent({
8244
8261
  }
8245
8262
  }
8246
8263
  ),
8247
- /* @__PURE__ */ h(
8264
+ /* @__PURE__ */ vue.h(
8248
8265
  "div",
8249
8266
  {
8250
8267
  style: {
@@ -8254,7 +8271,7 @@ const MenuBar = vue.defineComponent({
8254
8271
  alignItems: "center"
8255
8272
  }
8256
8273
  },
8257
- /* @__PURE__ */ h(
8274
+ /* @__PURE__ */ vue.h(
8258
8275
  "span",
8259
8276
  {
8260
8277
  style: {
@@ -8265,7 +8282,7 @@ const MenuBar = vue.defineComponent({
8265
8282
  i18n(props.ctx, "view.editorWidth") || "\u5185\u5BB9\u5BBD\u5EA6"
8266
8283
  )
8267
8284
  ),
8268
- /* @__PURE__ */ h(
8285
+ /* @__PURE__ */ vue.h(
8269
8286
  "div",
8270
8287
  {
8271
8288
  style: {
@@ -8287,7 +8304,7 @@ const MenuBar = vue.defineComponent({
8287
8304
  key: "full",
8288
8305
  labelKey: "view.widthFull"
8289
8306
  }
8290
- ].map(({ key, labelKey }) => /* @__PURE__ */ h(
8307
+ ].map(({ key, labelKey }) => /* @__PURE__ */ vue.h(
8291
8308
  "button",
8292
8309
  {
8293
8310
  key,
@@ -8319,6 +8336,7 @@ const MenuBar = vue.defineComponent({
8319
8336
  }
8320
8337
  });
8321
8338
 
8339
+ keepAlive(vue.h);
8322
8340
  const isMac = typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
8323
8341
  function fmt(shortcut) {
8324
8342
  return shortcut.replace(/Mod/g, isMac ? "\u2318" : "Ctrl").replace(/\+/g, isMac ? "" : "+").replace(/Shift/g, isMac ? "\u21E7" : "Shift").replace(/Alt/g, isMac ? "\u2325" : "Alt");
@@ -8515,6 +8533,7 @@ const FixedToolbarComponent = vue.defineComponent({
8515
8533
  canRedo: { type: Object, required: true }
8516
8534
  },
8517
8535
  setup(props) {
8536
+ keepAlive(vue.h);
8518
8537
  const showShortcuts = vue.ref(false);
8519
8538
  vue.onMounted(() => {
8520
8539
  const handleShowShortcuts = () => {
@@ -8533,7 +8552,7 @@ const FixedToolbarComponent = vue.defineComponent({
8533
8552
  props.selection.value;
8534
8553
  const canUndo = (typeof props.canUndo === "boolean" ? props.canUndo : (_a = props.canUndo) == null ? void 0 : _a.value) || false;
8535
8554
  const canRedo = (typeof props.canRedo === "boolean" ? props.canRedo : (_b = props.canRedo) == null ? void 0 : _b.value) || false;
8536
- return /* @__PURE__ */ h(
8555
+ return /* @__PURE__ */ vue.h(
8537
8556
  "div",
8538
8557
  {
8539
8558
  style: {
@@ -8547,8 +8566,8 @@ const FixedToolbarComponent = vue.defineComponent({
8547
8566
  }
8548
8567
  },
8549
8568
  ((_c = props.config) == null ? void 0 : _c.showMenuBar) !== false && [
8550
- /* @__PURE__ */ h(MenuBar, { ctx: props.ctx, config: props.config }),
8551
- /* @__PURE__ */ h(
8569
+ /* @__PURE__ */ vue.h(MenuBar, { ctx: props.ctx, config: props.config }),
8570
+ /* @__PURE__ */ vue.h(
8552
8571
  "div",
8553
8572
  {
8554
8573
  style: {
@@ -8561,7 +8580,7 @@ const FixedToolbarComponent = vue.defineComponent({
8561
8580
  )
8562
8581
  ],
8563
8582
  ((_d = props.config) == null ? void 0 : _d.showHistory) !== false && [
8564
- /* @__PURE__ */ h(
8583
+ /* @__PURE__ */ vue.h(
8565
8584
  "button",
8566
8585
  {
8567
8586
  type: "button",
@@ -8592,7 +8611,7 @@ const FixedToolbarComponent = vue.defineComponent({
8592
8611
  "--toolbar-icon-color": canUndo ? "#363b4c" : "#c0c4cc"
8593
8612
  }
8594
8613
  },
8595
- /* @__PURE__ */ h(
8614
+ /* @__PURE__ */ vue.h(
8596
8615
  "span",
8597
8616
  {
8598
8617
  style: { display: "inline-flex", alignItems: "center" },
@@ -8600,7 +8619,7 @@ const FixedToolbarComponent = vue.defineComponent({
8600
8619
  }
8601
8620
  )
8602
8621
  ),
8603
- /* @__PURE__ */ h(
8622
+ /* @__PURE__ */ vue.h(
8604
8623
  "button",
8605
8624
  {
8606
8625
  type: "button",
@@ -8631,7 +8650,7 @@ const FixedToolbarComponent = vue.defineComponent({
8631
8650
  "--toolbar-icon-color": canRedo ? "#363b4c" : "#c0c4cc"
8632
8651
  }
8633
8652
  },
8634
- /* @__PURE__ */ h(
8653
+ /* @__PURE__ */ vue.h(
8635
8654
  "span",
8636
8655
  {
8637
8656
  style: { display: "inline-flex", alignItems: "center" },
@@ -8639,7 +8658,7 @@ const FixedToolbarComponent = vue.defineComponent({
8639
8658
  }
8640
8659
  )
8641
8660
  ),
8642
- /* @__PURE__ */ h(
8661
+ /* @__PURE__ */ vue.h(
8643
8662
  "div",
8644
8663
  {
8645
8664
  style: {
@@ -8651,7 +8670,7 @@ const FixedToolbarComponent = vue.defineComponent({
8651
8670
  }
8652
8671
  )
8653
8672
  ],
8654
- /* @__PURE__ */ h(
8673
+ /* @__PURE__ */ vue.h(
8655
8674
  Toolbar,
8656
8675
  {
8657
8676
  ctx: props.ctx,
@@ -8662,7 +8681,7 @@ const FixedToolbarComponent = vue.defineComponent({
8662
8681
  isFixed: true
8663
8682
  }
8664
8683
  ),
8665
- showShortcuts.value && /* @__PURE__ */ h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
8684
+ showShortcuts.value && /* @__PURE__ */ vue.h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
8666
8685
  );
8667
8686
  };
8668
8687
  }
@@ -9447,6 +9466,7 @@ const DocumentHeader = vue.defineComponent({
9447
9466
  }
9448
9467
  });
9449
9468
 
9469
+ keepAlive(vue.h);
9450
9470
  const OutlinePanel = vue.defineComponent({
9451
9471
  props: {
9452
9472
  ctx: { type: Object, required: true }
@@ -12077,6 +12097,21 @@ class CrepeBuilder {
12077
12097
  });
12078
12098
  return this;
12079
12099
  };
12100
+ /// Set the visibility of the outline panel.
12101
+ this.setOutlineVisible = (visible) => {
12102
+ __privateGet(this, _editor).action((ctx) => {
12103
+ if (__privateGet(this, _editor).status === core.EditorStatus.Created) {
12104
+ try {
12105
+ const state = ctx.get(viewMenuStateCtx.key);
12106
+ if (state) {
12107
+ state.outlineVisible = visible;
12108
+ }
12109
+ } catch (e) {
12110
+ }
12111
+ }
12112
+ });
12113
+ return this;
12114
+ };
12080
12115
  var _a;
12081
12116
  __privateSet(this, _rootElement, (_a = typeof root === "string" ? document.querySelector(root) : root) != null ? _a : document.body);
12082
12117
  const mergedTranslations = {
@@ -12169,6 +12204,22 @@ class CrepeBuilder {
12169
12204
  get readonly() {
12170
12205
  return !__privateGet(this, _editable);
12171
12206
  }
12207
+ /// Get the visibility of the outline panel.
12208
+ get outlineVisible() {
12209
+ let visible = false;
12210
+ __privateGet(this, _editor).action((ctx) => {
12211
+ if (__privateGet(this, _editor).status === core.EditorStatus.Created) {
12212
+ try {
12213
+ const state = ctx.get(viewMenuStateCtx.key);
12214
+ if (state) {
12215
+ visible = state.outlineVisible;
12216
+ }
12217
+ } catch (e) {
12218
+ }
12219
+ }
12220
+ });
12221
+ return visible;
12222
+ }
12172
12223
  }
12173
12224
  _editor = new WeakMap();
12174
12225
  _rootElement = new WeakMap();