superdoc 2.23.1-next.9 → 2.24.0-next.10

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 (53) hide show
  1. package/dist/chunks/{create-super-doc-ui-DFNXiKvQ.es.js → create-super-doc-ui-8UTu16Lw.es.js} +229 -82
  2. package/dist/chunks/{create-super-doc-ui-D_FbXpOQ.cjs → create-super-doc-ui-bTFGKVRb.cjs} +229 -82
  3. package/dist/collaboration-upgrade-engine.cjs +1 -1
  4. package/dist/collaboration-upgrade-engine.es.js +1 -1
  5. package/dist/document-api/src/authorities/authorities.types.d.ts +2 -0
  6. package/dist/document-api/src/bookmarks/bookmarks.types.d.ts +1 -0
  7. package/dist/document-api/src/capabilities/html-markdown-support.d.ts +2 -4
  8. package/dist/document-api/src/captions/captions.types.d.ts +1 -0
  9. package/dist/document-api/src/citations/citations.types.d.ts +2 -0
  10. package/dist/document-api/src/content-controls/content-controls.types.d.ts +1 -0
  11. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  12. package/dist/document-api/src/contract/operation-definitions.d.ts +15 -5
  13. package/dist/document-api/src/cross-refs/cross-refs.types.d.ts +1 -0
  14. package/dist/document-api/src/fields/fields.types.d.ts +1 -0
  15. package/dist/document-api/src/footnotes/footnotes.types.d.ts +2 -0
  16. package/dist/document-api/src/hyperlinks/hyperlinks.types.d.ts +1 -0
  17. package/dist/document-api/src/images/images.types.d.ts +2 -0
  18. package/dist/document-api/src/index/index.types.d.ts +2 -0
  19. package/dist/document-api/src/index.d.ts +6 -6
  20. package/dist/document-api/src/insert/insert.d.ts +7 -1
  21. package/dist/document-api/src/lists/lists.types.d.ts +10 -0
  22. package/dist/document-api/src/paragraphs/paragraphs.types.d.ts +3 -0
  23. package/dist/document-api/src/receipt-bridge.d.ts +1 -0
  24. package/dist/document-api/src/replace/replace.d.ts +31 -4
  25. package/dist/document-api/src/sections/sections.types.d.ts +4 -1
  26. package/dist/document-api/src/selection/selection.d.ts +9 -2
  27. package/dist/document-api/src/selection/selection.types.d.ts +57 -8
  28. package/dist/document-api/src/toc/toc.types.d.ts +3 -0
  29. package/dist/document-api/src/types/blocks.types.d.ts +6 -1
  30. package/dist/document-api/src/types/create.types.d.ts +3 -1
  31. package/dist/document-api/src/types/mutation-plan.types.d.ts +4 -0
  32. package/dist/document-api/src/types/receipt.d.ts +8 -0
  33. package/dist/document-api/src/types/sd-contract.d.ts +2 -0
  34. package/dist/document-api/src/types/table-operations.types.d.ts +2 -0
  35. package/dist/document-api/src/write/write.d.ts +4 -2
  36. package/dist/public/ui-react.cjs +1 -1
  37. package/dist/public/ui-react.es.js +1 -1
  38. package/dist/public/ui-vue.cjs +1 -1
  39. package/dist/public/ui-vue.es.js +1 -1
  40. package/dist/public/ui.cjs +1 -1
  41. package/dist/public/ui.es.js +1 -1
  42. package/dist/style.css +124 -120
  43. package/dist/style.layered.css +124 -120
  44. package/dist/superdoc/src/composables/use-link-popover.d.ts +14 -0
  45. package/dist/superdoc/src/public/ui/types.d.ts +22 -0
  46. package/dist/superdoc/src/public/ui.d.cts +4 -0
  47. package/dist/superdoc/src/public/ui.d.ts +1 -1
  48. package/dist/superdoc.cjs +210 -111
  49. package/dist/superdoc.es.js +212 -113
  50. package/dist-cdn/style.layered.css +1 -1
  51. package/dist-cdn/superdoc.min.css +1 -1
  52. package/dist-cdn/superdoc.min.js +42 -42
  53. package/package.json +2 -2
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./chunks/rolldown-runtime-74VwNCz7.cjs");
3
3
  const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
4
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-D_FbXpOQ.cjs");
4
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-bTFGKVRb.cjs");
5
5
  const require_eventemitter3 = require("./chunks/eventemitter3-C_TAnXOl.cjs");
6
6
  const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
7
7
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-CYxINHh_.cjs");
@@ -304,7 +304,7 @@ var awarenessStatesToArray = (context, states) => {
304
304
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
305
305
  function getSuperdocVersion() {
306
306
  try {
307
- return "2.23.1-next.9";
307
+ return "2.24.0-next.10";
308
308
  } catch {
309
309
  return "unknown";
310
310
  }
@@ -13319,7 +13319,7 @@ var _hoisted_15$2 = {
13319
13319
  };
13320
13320
  var _hoisted_16$2 = { class: "change-type" };
13321
13321
  var _hoisted_17$2 = { key: 1 };
13322
- var _hoisted_18$1 = { class: "tracked-change-text is-inserted" };
13322
+ var _hoisted_18$2 = { class: "tracked-change-text is-inserted" };
13323
13323
  var _hoisted_19$1 = { key: 2 };
13324
13324
  var _hoisted_20$1 = { class: "tracked-change-text is-inserted" };
13325
13325
  var _hoisted_21$1 = { key: 3 };
@@ -13932,10 +13932,35 @@ var _sfc_main$34 = {
13932
13932
  require__plugin_vue_export_helper.nextTick(() => emit("resize"));
13933
13933
  });
13934
13934
  };
13935
- const isV2Mode = require__plugin_vue_export_helper.computed(() => proxy.$superdoc?.activeEditor?.editorVersion === 2);
13936
- const v2CommentsAdapter = require__plugin_vue_export_helper.computed(() => isV2Mode.value ? proxy.$superdoc?.activeEditor?.v2Comments ?? null : null);
13937
- const v2TrackedChangesAdapter = require__plugin_vue_export_helper.computed(() => isV2Mode.value ? proxy.$superdoc?.activeEditor?.v2TrackedChanges ?? null : null);
13935
+ const activeEditorRevision = require__plugin_vue_export_helper.ref(0);
13936
+ const v2CapabilityRevision = require__plugin_vue_export_helper.ref(0);
13937
+ const refreshActiveEditor = () => {
13938
+ activeEditorRevision.value += 1;
13939
+ };
13940
+ const isV2Mode = require__plugin_vue_export_helper.computed(() => {
13941
+ activeEditorRevision.value;
13942
+ return proxy.$superdoc?.activeEditor?.editorVersion === 2;
13943
+ });
13944
+ const v2CommentsAdapter = require__plugin_vue_export_helper.computed(() => {
13945
+ activeEditorRevision.value;
13946
+ return isV2Mode.value ? proxy.$superdoc?.activeEditor?.v2Comments ?? null : null;
13947
+ });
13948
+ const v2TrackedChangesAdapter = require__plugin_vue_export_helper.computed(() => {
13949
+ activeEditorRevision.value;
13950
+ return isV2Mode.value ? proxy.$superdoc?.activeEditor?.v2TrackedChanges ?? null : null;
13951
+ });
13952
+ require__plugin_vue_export_helper.watch(() => {
13953
+ activeEditorRevision.value;
13954
+ return isV2Mode.value ? proxy.$superdoc?.activeEditor?.host ?? null : null;
13955
+ }, (host, _previous, onCleanup) => {
13956
+ v2CapabilityRevision.value += 1;
13957
+ const unsubscribe = host?.subscribe?.(() => {
13958
+ v2CapabilityRevision.value += 1;
13959
+ });
13960
+ onCleanup(() => unsubscribe?.());
13961
+ }, { immediate: true });
13938
13962
  const v2WriteCapability = require__plugin_vue_export_helper.computed(() => {
13963
+ v2CapabilityRevision.value;
13939
13964
  if (!v2CommentsAdapter.value) return null;
13940
13965
  const documentMode = commentsStore.viewingVisibility.documentMode;
13941
13966
  const command = isPendingNewComment.value ? "comments.createFromSelection" : null;
@@ -13959,6 +13984,7 @@ var _sfc_main$34 = {
13959
13984
  return v2WriteCapability.value?.reason ?? "v2-write-unavailable";
13960
13985
  });
13961
13986
  const v2TrackedChangeCapability = require__plugin_vue_export_helper.computed(() => {
13987
+ v2CapabilityRevision.value;
13962
13988
  if (!v2TrackedChangesAdapter.value) return null;
13963
13989
  const documentMode = commentsStore.viewingVisibility.documentMode;
13964
13990
  const capability = v2TrackedChangesAdapter.value.getCapabilityState?.() ?? null;
@@ -14243,6 +14269,7 @@ var _sfc_main$34 = {
14243
14269
  return users;
14244
14270
  });
14245
14271
  require__plugin_vue_export_helper.onMounted(() => {
14272
+ proxy.$superdoc?.on?.("active-editor-change", refreshActiveEditor);
14246
14273
  if (props.autoFocus) require__plugin_vue_export_helper.nextTick(() => setFocus());
14247
14274
  if (isPendingNewComment.value) require__plugin_vue_export_helper.nextTick(() => {
14248
14275
  commentInput.value?.focus?.({ preventScroll: true });
@@ -14256,6 +14283,9 @@ var _sfc_main$34 = {
14256
14283
  checkOverflow();
14257
14284
  });
14258
14285
  });
14286
+ require__plugin_vue_export_helper.onBeforeUnmount(() => {
14287
+ proxy.$superdoc?.off?.("active-editor-change", refreshActiveEditor);
14288
+ });
14259
14289
  require__plugin_vue_export_helper.watch(showInputSection, (isVisible) => {
14260
14290
  if (!isVisible) return;
14261
14291
  require__plugin_vue_export_helper.nextTick(() => {
@@ -14392,7 +14422,7 @@ var _sfc_main$34 = {
14392
14422
  line.excerpt ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("span", _hoisted_15$2, " — ")) : require__plugin_vue_export_helper.createCommentVNode("", true),
14393
14423
  require__plugin_vue_export_helper.createElementVNode("span", _hoisted_16$2, require__plugin_vue_export_helper.toDisplayString(line.label), 1)
14394
14424
  ]);
14395
- }), 128))])) : require__plugin_vue_export_helper.createCommentVNode("", true)])) : comment.trackedChangeDisplayType === "hyperlinkAdded" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_17$2, [_cache[2] || (_cache[2] = require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Added hyperlink ", -1)), require__plugin_vue_export_helper.createElementVNode("span", _hoisted_18$1, "\"" + require__plugin_vue_export_helper.toDisplayString(comment.trackedChangeText) + "\"", 1)])) : comment.trackedChangeDisplayType === "hyperlinkModified" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_19$1, [_cache[3] || (_cache[3] = require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Changed hyperlink to ", -1)), require__plugin_vue_export_helper.createElementVNode("span", _hoisted_20$1, "\"" + require__plugin_vue_export_helper.toDisplayString(comment.trackedChangeText) + "\"", 1)])) : comment.trackedChangeDisplayType === "paragraphSplit" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_21$1, [..._cache[4] || (_cache[4] = [require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Added new line", -1)])])) : comment.trackedChangeDisplayType === "tableInsert" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_22$1, [..._cache[5] || (_cache[5] = [require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Added table", -1)])])) : comment.trackedChangeDisplayType === "tableDelete" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_23$1, [..._cache[6] || (_cache[6] = [require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Deleted table", -1)])])) : comment.trackedChangeType === "trackFormat" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_24, [_cache[7] || (_cache[7] = require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Format: ", -1)), require__plugin_vue_export_helper.createElementVNode("span", _hoisted_25, require__plugin_vue_export_helper.toDisplayString(comment.trackedChangeText), 1)])) : comment.trackedChangeType === "both" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_26, [
14425
+ }), 128))])) : require__plugin_vue_export_helper.createCommentVNode("", true)])) : comment.trackedChangeDisplayType === "hyperlinkAdded" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_17$2, [_cache[2] || (_cache[2] = require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Added hyperlink ", -1)), require__plugin_vue_export_helper.createElementVNode("span", _hoisted_18$2, "\"" + require__plugin_vue_export_helper.toDisplayString(comment.trackedChangeText) + "\"", 1)])) : comment.trackedChangeDisplayType === "hyperlinkModified" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_19$1, [_cache[3] || (_cache[3] = require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Changed hyperlink to ", -1)), require__plugin_vue_export_helper.createElementVNode("span", _hoisted_20$1, "\"" + require__plugin_vue_export_helper.toDisplayString(comment.trackedChangeText) + "\"", 1)])) : comment.trackedChangeDisplayType === "paragraphSplit" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_21$1, [..._cache[4] || (_cache[4] = [require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Added new line", -1)])])) : comment.trackedChangeDisplayType === "tableInsert" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_22$1, [..._cache[5] || (_cache[5] = [require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Added table", -1)])])) : comment.trackedChangeDisplayType === "tableDelete" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_23$1, [..._cache[6] || (_cache[6] = [require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Deleted table", -1)])])) : comment.trackedChangeType === "trackFormat" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_24, [_cache[7] || (_cache[7] = require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Format: ", -1)), require__plugin_vue_export_helper.createElementVNode("span", _hoisted_25, require__plugin_vue_export_helper.toDisplayString(comment.trackedChangeText), 1)])) : comment.trackedChangeType === "both" ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_26, [
14396
14426
  _cache[8] || (_cache[8] = require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, "Replaced ", -1)),
14397
14427
  require__plugin_vue_export_helper.createElementVNode("span", _hoisted_27, "\"" + require__plugin_vue_export_helper.toDisplayString(comment.deletedText) + "\"", 1),
14398
14428
  _cache[9] || (_cache[9] = require__plugin_vue_export_helper.createElementVNode("span", { class: "change-type" }, " with ", -1)),
@@ -14503,7 +14533,7 @@ var _sfc_main$34 = {
14503
14533
  };
14504
14534
  }
14505
14535
  };
14506
- var CommentDialog_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$34, [["__scopeId", "data-v-c189ab35"]]);
14536
+ var CommentDialog_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$34, [["__scopeId", "data-v-5ace8cef"]]);
14507
14537
  //#endregion
14508
14538
  //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
14509
14539
  var _hoisted_1$25 = [
@@ -19001,6 +19031,11 @@ var _hoisted_17$1 = {
19001
19031
  key: 5,
19002
19032
  class: "input-row go-to-anchor clickable"
19003
19033
  };
19034
+ var _hoisted_18$1 = {
19035
+ key: 6,
19036
+ role: "status",
19037
+ class: "sd-error"
19038
+ };
19004
19039
  /**
19005
19040
  * Built-in link editing popover.
19006
19041
  *
@@ -19214,62 +19249,72 @@ var _sfc_main$26 = {
19214
19249
  hyperlinkTarget: props.hyperlinkTarget
19215
19250
  });
19216
19251
  };
19217
- const navigateToAnchor = (anchorUrl) => {
19218
- if (props.goToAnchor) props.goToAnchor(anchorUrl);
19252
+ const navigationError = require__plugin_vue_export_helper.ref("");
19253
+ const navigateToAnchor = async (anchorUrl) => {
19254
+ navigationError.value = "";
19255
+ try {
19256
+ if (await props.goToAnchor?.(anchorUrl) === false) navigationError.value = "Reference target is unavailable";
19257
+ } catch {
19258
+ navigationError.value = "Reference target is unavailable";
19259
+ }
19219
19260
  };
19220
19261
  return (_ctx, _cache) => {
19221
- return require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", { class: require__plugin_vue_export_helper.normalizeClass(["link-input-ctn", { "high-contrast": require__plugin_vue_export_helper.unref(isHighContrastMode) }]) }, [isAnchor.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_1$19, "Page anchor")) : isViewingMode.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_2$16, "Link details")) : isEditing.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_3$13, "Edit link")) : (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_4$8, "Add link")), __props.showInput && !isAnchor.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_5$6, [
19222
- require__plugin_vue_export_helper.createElementVNode("div", _hoisted_6$5, [_cache[5] || (_cache[5] = require__plugin_vue_export_helper.createElementVNode("div", { class: "input-icon text-input-icon" }, "T", -1)), require__plugin_vue_export_helper.withDirectives(require__plugin_vue_export_helper.createElementVNode("input", {
19223
- type: "text",
19224
- name: "text",
19225
- placeholder: "Text",
19226
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => text.value = $event),
19227
- readonly: isViewingMode.value,
19228
- onKeydown: require__plugin_vue_export_helper.withKeys(require__plugin_vue_export_helper.withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"])
19229
- }, null, 40, _hoisted_7$3), [[require__plugin_vue_export_helper.vModelText, text.value]])]),
19230
- require__plugin_vue_export_helper.createElementVNode("div", _hoisted_8$3, [
19231
- require__plugin_vue_export_helper.createElementVNode("div", {
19232
- class: "input-icon",
19233
- innerHTML: require__plugin_vue_export_helper.unref(toolbarIcons).linkInput
19234
- }, null, 8, _hoisted_9$2),
19235
- require__plugin_vue_export_helper.withDirectives(require__plugin_vue_export_helper.createElementVNode("input", {
19262
+ return require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", { class: require__plugin_vue_export_helper.normalizeClass(["link-input-ctn", { "high-contrast": require__plugin_vue_export_helper.unref(isHighContrastMode) }]) }, [
19263
+ isAnchor.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_1$19, "Page anchor")) : isViewingMode.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_2$16, "Link details")) : isEditing.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_3$13, "Edit link")) : (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_4$8, "Add link")),
19264
+ __props.showInput && !isAnchor.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_5$6, [
19265
+ require__plugin_vue_export_helper.createElementVNode("div", _hoisted_6$5, [_cache[5] || (_cache[5] = require__plugin_vue_export_helper.createElementVNode("div", { class: "input-icon text-input-icon" }, "T", -1)), require__plugin_vue_export_helper.withDirectives(require__plugin_vue_export_helper.createElementVNode("input", {
19236
19266
  type: "text",
19237
- name: "link",
19238
- placeholder: "Type or paste a link",
19239
- class: require__plugin_vue_export_helper.normalizeClass({ "sd-error": urlError.value }),
19240
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => rawUrl.value = $event),
19267
+ name: "text",
19268
+ placeholder: "Text",
19269
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => text.value = $event),
19241
19270
  readonly: isViewingMode.value,
19242
- onInput: _cache[2] || (_cache[2] = ($event) => commandError.value = ""),
19243
- onKeydown: [require__plugin_vue_export_helper.withKeys(require__plugin_vue_export_helper.withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"]), _cache[3] || (_cache[3] = ($event) => urlError.value = false)]
19244
- }, null, 42, _hoisted_10$2), [[require__plugin_vue_export_helper.vModelText, rawUrl.value]]),
19245
- require__plugin_vue_export_helper.createElementVNode("div", {
19246
- class: require__plugin_vue_export_helper.normalizeClass(["open-link-icon", { "sd-disabled": !validUrl.value }]),
19247
- innerHTML: require__plugin_vue_export_helper.unref(toolbarIcons).openLink,
19248
- onClick: openLink,
19249
- "data-item": "btn-link-open"
19250
- }, null, 10, _hoisted_11$2)
19251
- ]),
19252
- !isViewingMode.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_12$1, [isEditing.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("button", {
19253
- key: 0,
19254
- class: "remove-btn",
19255
- onClick: handleRemove,
19256
- disabled: isSubmitting.value,
19257
- "data-item": "btn-link-remove"
19258
- }, [require__plugin_vue_export_helper.createElementVNode("div", {
19259
- class: "remove-btn__icon",
19260
- innerHTML: require__plugin_vue_export_helper.unref(toolbarIcons).removeLink
19261
- }, null, 8, _hoisted_14$1), _cache[6] || (_cache[6] = require__plugin_vue_export_helper.createTextVNode(" Remove ", -1))], 8, _hoisted_13$1)) : require__plugin_vue_export_helper.createCommentVNode("", true), require__plugin_vue_export_helper.createElementVNode("button", {
19262
- class: require__plugin_vue_export_helper.normalizeClass(["sd-submit-btn", { "disable-btn": isDisabled.value }]),
19263
- onClick: handleSubmit,
19264
- disabled: isSubmitting.value,
19265
- "data-item": "btn-link-apply"
19266
- }, " Apply ", 10, _hoisted_15$1)])) : require__plugin_vue_export_helper.createCommentVNode("", true),
19267
- commandError.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_16$1, require__plugin_vue_export_helper.toDisplayString(commandError.value), 1)) : require__plugin_vue_export_helper.createCommentVNode("", true)
19268
- ])) : isAnchor.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_17$1, [require__plugin_vue_export_helper.createElementVNode("a", { onClick: _cache[4] || (_cache[4] = require__plugin_vue_export_helper.withModifiers(($event) => navigateToAnchor(rawUrl.value), ["stop", "prevent"])) }, "Go to " + require__plugin_vue_export_helper.toDisplayString(rawUrl.value.startsWith("#_") ? rawUrl.value.substring(2) : rawUrl.value), 1)])) : require__plugin_vue_export_helper.createCommentVNode("", true)], 2);
19271
+ onKeydown: require__plugin_vue_export_helper.withKeys(require__plugin_vue_export_helper.withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"])
19272
+ }, null, 40, _hoisted_7$3), [[require__plugin_vue_export_helper.vModelText, text.value]])]),
19273
+ require__plugin_vue_export_helper.createElementVNode("div", _hoisted_8$3, [
19274
+ require__plugin_vue_export_helper.createElementVNode("div", {
19275
+ class: "input-icon",
19276
+ innerHTML: require__plugin_vue_export_helper.unref(toolbarIcons).linkInput
19277
+ }, null, 8, _hoisted_9$2),
19278
+ require__plugin_vue_export_helper.withDirectives(require__plugin_vue_export_helper.createElementVNode("input", {
19279
+ type: "text",
19280
+ name: "link",
19281
+ placeholder: "Type or paste a link",
19282
+ class: require__plugin_vue_export_helper.normalizeClass({ "sd-error": urlError.value }),
19283
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => rawUrl.value = $event),
19284
+ readonly: isViewingMode.value,
19285
+ onInput: _cache[2] || (_cache[2] = ($event) => commandError.value = ""),
19286
+ onKeydown: [require__plugin_vue_export_helper.withKeys(require__plugin_vue_export_helper.withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"]), _cache[3] || (_cache[3] = ($event) => urlError.value = false)]
19287
+ }, null, 42, _hoisted_10$2), [[require__plugin_vue_export_helper.vModelText, rawUrl.value]]),
19288
+ require__plugin_vue_export_helper.createElementVNode("div", {
19289
+ class: require__plugin_vue_export_helper.normalizeClass(["open-link-icon", { "sd-disabled": !validUrl.value }]),
19290
+ innerHTML: require__plugin_vue_export_helper.unref(toolbarIcons).openLink,
19291
+ onClick: openLink,
19292
+ "data-item": "btn-link-open"
19293
+ }, null, 10, _hoisted_11$2)
19294
+ ]),
19295
+ !isViewingMode.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_12$1, [isEditing.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("button", {
19296
+ key: 0,
19297
+ class: "remove-btn",
19298
+ onClick: handleRemove,
19299
+ disabled: isSubmitting.value,
19300
+ "data-item": "btn-link-remove"
19301
+ }, [require__plugin_vue_export_helper.createElementVNode("div", {
19302
+ class: "remove-btn__icon",
19303
+ innerHTML: require__plugin_vue_export_helper.unref(toolbarIcons).removeLink
19304
+ }, null, 8, _hoisted_14$1), _cache[6] || (_cache[6] = require__plugin_vue_export_helper.createTextVNode(" Remove ", -1))], 8, _hoisted_13$1)) : require__plugin_vue_export_helper.createCommentVNode("", true), require__plugin_vue_export_helper.createElementVNode("button", {
19305
+ class: require__plugin_vue_export_helper.normalizeClass(["sd-submit-btn", { "disable-btn": isDisabled.value }]),
19306
+ onClick: handleSubmit,
19307
+ disabled: isSubmitting.value,
19308
+ "data-item": "btn-link-apply"
19309
+ }, " Apply ", 10, _hoisted_15$1)])) : require__plugin_vue_export_helper.createCommentVNode("", true),
19310
+ commandError.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_16$1, require__plugin_vue_export_helper.toDisplayString(commandError.value), 1)) : require__plugin_vue_export_helper.createCommentVNode("", true)
19311
+ ])) : isAnchor.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_17$1, [require__plugin_vue_export_helper.createElementVNode("a", { onClick: _cache[4] || (_cache[4] = require__plugin_vue_export_helper.withModifiers(($event) => navigateToAnchor(rawUrl.value), ["stop", "prevent"])) }, "Go to " + require__plugin_vue_export_helper.toDisplayString(rawUrl.value.startsWith("#_") ? rawUrl.value.substring(2) : rawUrl.value), 1)])) : require__plugin_vue_export_helper.createCommentVNode("", true),
19312
+ navigationError.value ? (require__plugin_vue_export_helper.openBlock(), require__plugin_vue_export_helper.createElementBlock("div", _hoisted_18$1, require__plugin_vue_export_helper.toDisplayString(navigationError.value), 1)) : require__plugin_vue_export_helper.createCommentVNode("", true)
19313
+ ], 2);
19269
19314
  };
19270
19315
  }
19271
19316
  };
19272
- var LinkInput_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$26, [["__scopeId", "data-v-498a6e6e"]]);
19317
+ var LinkInput_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$26, [["__scopeId", "data-v-360db842"]]);
19273
19318
  //#endregion
19274
19319
  //#region src/internal/toolbar/built-in/scroll-helpers.js
19275
19320
  function getScrollableParent(element) {
@@ -19389,7 +19434,8 @@ function scrollToElement(targetElement, options = {
19389
19434
  * which keeps anchor navigation scoped to body targets.
19390
19435
  * @typedef {Object} BookmarkGetResult
19391
19436
  * @property {{ story?: { kind?: string, storyType?: string } }} [address]
19392
- * @property {{ from?: { blockId?: string } }} [range]
19437
+ * @property {{ from?: { blockId?: string, offset?: number } }} [range]
19438
+ * @property {{ colFirst: number, colLast: number }} [tableColumn]
19393
19439
  */
19394
19440
  /**
19395
19441
  * The narrow Document API subset this composable reads. The host facade
@@ -19402,7 +19448,7 @@ function scrollToElement(targetElement, options = {
19402
19448
  * @property {{ list?: () => BlocksListResult | null | undefined } | null} [blocks]
19403
19449
  * @property {{ match?: (query: { select: { type: 'text', pattern: string, caseSensitive: boolean }, require: 'any' }) => QueryMatchResult | null | undefined } | null} [query]
19404
19450
  * @property {{ list?: () => HyperlinksListResult | Promise<HyperlinksListResult | null | undefined> | null | undefined, get?: (input: { storyId: string, hyperlinkNodeId: string }) => HyperlinkGetResult | Promise<HyperlinkGetResult | null | undefined> | null | undefined } | null} [hyperlinks]
19405
- * @property {{ get?: (input: { target: { kind: 'entity', entityType: 'bookmark', name: string } }) => BookmarkGetResult | Promise<BookmarkGetResult | null | undefined> | null | undefined } | null} [bookmarks]
19451
+ * @property {{ list?: () => Promise<{ items: Array<{ name: string }> }> | { items: Array<{ name: string }> }, get?: (input: { target: { kind: 'entity', entityType: 'bookmark', name: string } }) => BookmarkGetResult | Promise<BookmarkGetResult | null | undefined> | null | undefined } | null} [bookmarks]
19406
19452
  */
19407
19453
  /**
19408
19454
  * The `v2-link-click` payload the shell relays from the v2 host's
@@ -19719,6 +19765,11 @@ function textTargetFromQueryMatch(doc, text, blockId) {
19719
19765
  function isTocEntryLinkElement(element) {
19720
19766
  return Boolean(element && typeof element.closest === "function" && element.closest(".superdoc-toc-entry"));
19721
19767
  }
19768
+ /** @param {Element | null | undefined} element */
19769
+ function isNoteCrossReferenceLinkElement(element) {
19770
+ const kind = element?.getAttribute("data-sd-note-cross-reference");
19771
+ return (kind === "ref" || kind === "noteRef") && Boolean(element?.closest("[data-sd-note-role=\"body\"]"));
19772
+ }
19722
19773
  /**
19723
19774
  * @param {Object} options
19724
19775
  * @param {() => SurfaceManager | null | undefined} options.getSurfaceManager
@@ -19831,7 +19882,7 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
19831
19882
  * editing/suggesting via `placeCaret`.
19832
19883
  * @param {string} blockId
19833
19884
  */
19834
- async function placeCaretAtHeadingStart(blockId) {
19885
+ async function placeCaretAtBookmark(blockId, offset) {
19835
19886
  const setSelectionTarget = getActiveEditor()?.authoring?.setSelectionTarget;
19836
19887
  if (typeof setSelectionTarget !== "function") return;
19837
19888
  const story = {
@@ -19841,7 +19892,7 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
19841
19892
  const anchor = {
19842
19893
  kind: "text",
19843
19894
  blockId,
19844
- offset: 0,
19895
+ offset,
19845
19896
  story
19846
19897
  };
19847
19898
  const target = {
@@ -19862,59 +19913,88 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
19862
19913
  * Navigate to a body bookmark through its model address. A mounted-anchor
19863
19914
  * fallback is reserved for runtimes without a callable bookmark model.
19864
19915
  * @param {string | null | undefined} anchorUrl
19865
- * @param {{ placeCaret?: boolean }} [options]
19916
+ * @param {{ placeCaret?: boolean, revalidateCaretAfterReveal?: boolean }} [options]
19866
19917
  */
19867
- async function navigateToAnchor(anchorUrl, { placeCaret = false } = {}) {
19868
- if (typeof anchorUrl !== "string" || !anchorUrl.startsWith("#")) return;
19918
+ async function navigateToAnchor(anchorUrl, { placeCaret = false, revalidateCaretAfterReveal = false } = {}) {
19919
+ if (typeof anchorUrl !== "string" || !anchorUrl.startsWith("#")) return false;
19869
19920
  const anchorName = decodeAnchorFragment(anchorUrl.slice(1));
19921
+ const editor = getActiveEditor();
19922
+ const generation = openGeneration;
19870
19923
  /** @type {LinkPopoverDocumentApi | null | undefined} */
19871
- const doc = getActiveEditor()?.doc;
19924
+ const doc = editor?.doc;
19872
19925
  const bookmarkGet = doc?.bookmarks?.get;
19873
19926
  if (typeof bookmarkGet !== "function") {
19874
19927
  const mountedAnchor = findMountedAnchor(getUi()?.viewport?.getHost?.() ?? null, cssEscape(anchorName));
19875
- if (mountedAnchor) scrollToElement(mountedAnchor, {
19928
+ if (!mountedAnchor) return false;
19929
+ scrollToElement(mountedAnchor, {
19876
19930
  block: "start",
19877
19931
  behavior: "instant"
19878
19932
  });
19879
- return;
19933
+ return true;
19880
19934
  }
19881
- /** @type {BookmarkGetResult | null} */
19882
- let bookmark = null;
19883
- try {
19884
- bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
19885
- kind: "entity",
19886
- entityType: "bookmark",
19887
- name: anchorName
19888
- } }));
19889
- bookmark ??= null;
19890
- } catch {
19891
- return;
19935
+ async function readBodyBookmark() {
19936
+ try {
19937
+ const list = doc?.bookmarks?.list;
19938
+ if (typeof list === "function") {
19939
+ if ((await Promise.resolve(list.call(doc.bookmarks)))?.items?.filter((item) => item.name === anchorName).length !== 1) return null;
19940
+ }
19941
+ const bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
19942
+ kind: "entity",
19943
+ entityType: "bookmark",
19944
+ name: anchorName
19945
+ } }));
19946
+ if (editor !== getActiveEditor() || generation !== openGeneration) return null;
19947
+ const story = bookmark?.address?.story;
19948
+ if (story && story.storyType !== "body" || bookmark?.tableColumn) return null;
19949
+ const blockId = bookmark?.range?.from?.blockId;
19950
+ const offset = bookmark?.range?.from?.offset ?? 0;
19951
+ if (typeof blockId !== "string" || !Number.isInteger(offset) || offset < 0) return null;
19952
+ return {
19953
+ blockId,
19954
+ offset
19955
+ };
19956
+ } catch {
19957
+ return null;
19958
+ }
19892
19959
  }
19893
- const story = bookmark?.address?.story;
19894
- if (story && story.storyType !== "body") return;
19895
- const blockId = bookmark?.range?.from?.blockId;
19896
- if (typeof blockId !== "string") return;
19897
- if (placeCaret) await placeCaretAtHeadingStart(blockId);
19960
+ let position = await readBodyBookmark();
19961
+ if (!position) return false;
19962
+ if (placeCaret && !revalidateCaretAfterReveal) await placeCaretAtBookmark(position.blockId, position.offset);
19898
19963
  const viewport = getUi()?.viewport;
19899
19964
  const scrollIntoView = viewport?.scrollIntoView;
19900
- if (typeof scrollIntoView !== "function") return;
19901
- const target = {
19902
- kind: "text",
19903
- blockId,
19904
- range: {
19905
- start: 0,
19906
- end: 0
19907
- }
19908
- };
19965
+ if (typeof scrollIntoView !== "function") return false;
19909
19966
  for (let step = 0; step < MAX_ANCHOR_NAVIGATION_STEPS; step += 1) try {
19910
- if ((await Promise.resolve(scrollIntoView.call(viewport, {
19967
+ const target = {
19968
+ kind: "text",
19969
+ blockId: position.blockId,
19970
+ range: {
19971
+ start: position.offset,
19972
+ end: position.offset
19973
+ }
19974
+ };
19975
+ const result = await Promise.resolve(scrollIntoView.call(viewport, {
19911
19976
  target,
19912
19977
  block: "start",
19913
19978
  behavior: "instant"
19914
- })))?.success !== false) return;
19979
+ }));
19980
+ if (editor !== getActiveEditor() || generation !== openGeneration) return false;
19981
+ if (result?.success !== false) {
19982
+ if (revalidateCaretAfterReveal) {
19983
+ const current = await readBodyBookmark();
19984
+ if (!current) return false;
19985
+ if (current.blockId !== position.blockId || current.offset !== position.offset) {
19986
+ position = current;
19987
+ continue;
19988
+ }
19989
+ if (placeCaret) await placeCaretAtBookmark(current.blockId, current.offset);
19990
+ if (editor !== getActiveEditor() || generation !== openGeneration) return false;
19991
+ }
19992
+ return true;
19993
+ }
19915
19994
  } catch {
19916
- return;
19995
+ return false;
19917
19996
  }
19997
+ return false;
19918
19998
  }
19919
19999
  /**
19920
20000
  * @param {HyperlinkActivationContext} ctx
@@ -20036,8 +20116,13 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20036
20116
  return;
20037
20117
  }
20038
20118
  if (ctx.defaultAction === "navigate") {
20039
- if (ctx.isAnchorLink) navigateToAnchor(ctx.href);
20040
- else if (ctx.href) {
20119
+ if (ctx.isAnchorLink) {
20120
+ const noteReference = isNoteCrossReferenceLinkElement(ctx.element);
20121
+ navigateToAnchor(ctx.href, {
20122
+ placeCaret: noteReference && ctx.documentMode !== "viewing",
20123
+ revalidateCaretAfterReveal: noteReference && ctx.documentMode !== "viewing"
20124
+ });
20125
+ } else if (ctx.href) {
20041
20126
  const target = ctx.target || "_self";
20042
20127
  const features = linkOpenFeaturesForTarget(ctx.rel, target);
20043
20128
  if (features) window.open(ctx.href, target, features);
@@ -20048,9 +20133,10 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20048
20133
  if (getBuiltInEditorDisabled()) return;
20049
20134
  const closePopover = () => closeCurrentPopover("closed");
20050
20135
  /** @param {string | null | undefined} anchorUrl */
20051
- const goToAnchor = (anchorUrl) => {
20052
- closePopover();
20053
- navigateToAnchor(anchorUrl, { placeCaret: true });
20136
+ const goToAnchor = async (anchorUrl) => {
20137
+ const success = await navigateToAnchor(anchorUrl, { placeCaret: ctx.documentMode !== "viewing" });
20138
+ if (success) closePopover();
20139
+ return success;
20054
20140
  };
20055
20141
  const generation = openGeneration;
20056
20142
  /** @param {ResolvedHyperlinkTarget | null} hyperlinkTarget */
@@ -21635,7 +21721,7 @@ var _sfc_main$24 = {
21635
21721
  }
21636
21722
  function setInitialFocus() {
21637
21723
  if (!dialogRef.value) return;
21638
- const firstFocusable = dialogRef.value.querySelector(FOCUSABLE_SELECTOR);
21724
+ const firstFocusable = dialogRef.value.querySelector("[data-sd-autofocus]") ?? dialogRef.value.querySelector(FOCUSABLE_SELECTOR);
21639
21725
  if (firstFocusable) firstFocusable.focus();
21640
21726
  else dialogRef.value.focus();
21641
21727
  }
@@ -21747,7 +21833,7 @@ var _sfc_main$24 = {
21747
21833
  };
21748
21834
  }
21749
21835
  };
21750
- var SurfaceDialog_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$24, [["__scopeId", "data-v-582b6534"]]);
21836
+ var SurfaceDialog_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$24, [["__scopeId", "data-v-5cee3b11"]]);
21751
21837
  //#endregion
21752
21838
  //#region src/components/surfaces/SurfaceFloating.vue
21753
21839
  var _hoisted_1$17 = ["aria-labelledby", "aria-label"];
@@ -40901,19 +40987,25 @@ var _sfc_main$12 = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
40901
40987
  const contentRef = require__plugin_vue_export_helper.ref(null);
40902
40988
  const position = require__plugin_vue_export_helper.ref({
40903
40989
  top: "0px",
40904
- left: "0px"
40990
+ left: "0px",
40991
+ below: false
40905
40992
  });
40906
40993
  let closeTimeout = null;
40907
40994
  let openTimeout = null;
40908
40995
  let autoHideTimeout = null;
40909
- const mergedContentClass = require__plugin_vue_export_helper.computed(() => ["sd-tooltip-content", attrs.class]);
40996
+ const mergedContentClass = require__plugin_vue_export_helper.computed(() => [
40997
+ "sd-tooltip-content",
40998
+ position.value.below && "sd-tooltip-below",
40999
+ attrs.class
41000
+ ]);
40910
41001
  const contentStyle = require__plugin_vue_export_helper.computed(() => ({
40911
41002
  ...props.contentStyle,
40912
41003
  ...attrs.style || {},
40913
41004
  position: "fixed",
40914
41005
  top: position.value.top,
40915
41006
  left: position.value.left,
40916
- zIndex: 2100
41007
+ zIndex: 2100,
41008
+ transformOrigin: position.value.below ? "top center" : "bottom center"
40917
41009
  }));
40918
41010
  const clearCloseTimeout = () => {
40919
41011
  if (closeTimeout) {
@@ -40946,12 +41038,18 @@ var _sfc_main$12 = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
40946
41038
  const contentWidth = contentRef.value.offsetWidth;
40947
41039
  const contentHeight = contentRef.value.offsetHeight;
40948
41040
  const viewportWidth = window.innerWidth || document.documentElement.clientWidth || 0;
41041
+ const viewportHeight = window.innerHeight || document.documentElement.clientHeight || 0;
40949
41042
  const gutter = 8;
40950
41043
  let left = triggerRect.left + triggerRect.width / 2 - contentWidth / 2;
40951
41044
  left = Math.max(gutter, Math.min(left, viewportWidth - contentWidth - gutter));
41045
+ const aboveTop = triggerRect.top - contentHeight - 10;
41046
+ const below = aboveTop < gutter;
41047
+ const preferredTop = below ? triggerRect.bottom + 10 : aboveTop;
41048
+ const top = Math.max(gutter, Math.min(preferredTop, viewportHeight - contentHeight - gutter));
40952
41049
  position.value = {
40953
- top: `${triggerRect.top - contentHeight - 10}px`,
40954
- left: `${left}px`
41050
+ top: `${top}px`,
41051
+ left: `${left}px`,
41052
+ below
40955
41053
  };
40956
41054
  };
40957
41055
  const open = async () => {
@@ -41072,7 +41170,7 @@ var _sfc_main$12 = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
41072
41170
  };
41073
41171
  }
41074
41172
  });
41075
- var SdTooltip_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$12, [["__scopeId", "data-v-1449088a"]]);
41173
+ var SdTooltip_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$12, [["__scopeId", "data-v-71c6de4c"]]);
41076
41174
  //#endregion
41077
41175
  //#region src/internal/toolbar/built-in/ButtonGroup.vue
41078
41176
  var _hoisted_1$10 = [
@@ -46523,7 +46621,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46523
46621
  }
46524
46622
  this.userColorMap = /* @__PURE__ */ new Map();
46525
46623
  this.colorIndex = 0;
46526
- this.version = "2.23.1-next.9";
46624
+ this.version = "2.24.0-next.10";
46527
46625
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46528
46626
  this.superdocId = config.superdocId || require_uuid.v4();
46529
46627
  this.colors = this.config.colors ?? [];
@@ -48701,11 +48799,12 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
48701
48799
  async #replaceActiveDocument(source) {
48702
48800
  const activeEditor = this.activeEditor;
48703
48801
  if (isV2ActiveEditorFacade(activeEditor) && typeof activeEditor.replaceFile === "function") {
48704
- const result = await activeEditor.replaceFile(source);
48802
+ const replacementSource = this.#savedDocxToBlob(source);
48803
+ const result = await activeEditor.replaceFile(replacementSource);
48705
48804
  const state = result && typeof result === "object" ? result.state : null;
48706
48805
  const confirmed = state === null || state === "review-ready" || state === "editing-ready";
48707
48806
  if (confirmed) {
48708
- this.#replaceActiveDocumentData(activeEditor, source);
48807
+ this.#replaceActiveDocumentData(activeEditor, replacementSource);
48709
48808
  this.emit("document-replaced", {
48710
48809
  editor: activeEditor,
48711
48810
  host: activeEditor?.host