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
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM$2 } from "./chunks/rolldown-runtime-0pSA04fp.es.js";
2
2
  import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
3
- import { c as createImageFilePicker, d as DOM_CLASS_NAMES, f as closeInteractionHistory, g as recordInteraction, h as isWorkflowRecordingEnabled, i as registerFirstPartyCommandMutation, l as resolveImageSrc, m as getWorkflowRecording, n as executeFirstPartyCommandAsync, o as applyV2CommentInvalidationFromMutation, p as createInteractionHistory, r as readFirstPartyPageNumbers, s as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-DFNXiKvQ.es.js";
3
+ import { c as createImageFilePicker, d as DOM_CLASS_NAMES, f as closeInteractionHistory, g as recordInteraction, h as isWorkflowRecordingEnabled, i as registerFirstPartyCommandMutation, l as resolveImageSrc, m as getWorkflowRecording, n as executeFirstPartyCommandAsync, o as applyV2CommentInvalidationFromMutation, p as createInteractionHistory, r as readFirstPartyPageNumbers, s as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-8UTu16Lw.es.js";
4
4
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-DEIiXiH2.es.js";
5
5
  import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
6
6
  import { $ as watch$1, A as onActivated, B as resolveDirective, C as isRef$1, D as normalizeClass, E as nextTick, F as openBlock, G as toRef, H as shallowRef$1, I as reactive, J as useAttrs, K as toRefs, L as ref, M as onDeactivated, N as onMounted, O as normalizeProps, P as onScopeDispose$1, Q as vModelText, R as renderList, S as isReactive$1, T as mergeProps, U as toDisplayString, V as resolveDynamicComponent, W as toRaw$2, X as vModelCheckbox, Y as useSlots, Z as vModelSelect, _ as getCurrentInstance, a as computed$1, b as hasInjectionContext, c as createCommentVNode, d as createStaticVNode, et as withCtx, f as createTextVNode, g as effectScope, h as defineComponent, i as Transition, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, m as defineAsyncComponent, n as Fragment, nt as withKeys, o as createApp, p as createVNode, q as unref, r as Teleport, rt as withModifiers, s as createBlock, t as _plugin_vue_export_helper_default, tt as withDirectives, u as createElementVNode, v as getCurrentScope, w as markRaw, x as inject$1, y as h, z as renderSlot } from "./chunks/_plugin-vue_export-helper-DHiJKCsy.es.js";
@@ -302,7 +302,7 @@ var awarenessStatesToArray = (context, states) => {
302
302
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
303
303
  function getSuperdocVersion() {
304
304
  try {
305
- return "2.23.1-next.9";
305
+ return "2.24.0-next.10";
306
306
  } catch {
307
307
  return "unknown";
308
308
  }
@@ -13312,7 +13312,7 @@ var _hoisted_15$2 = {
13312
13312
  };
13313
13313
  var _hoisted_16$2 = { class: "change-type" };
13314
13314
  var _hoisted_17$2 = { key: 1 };
13315
- var _hoisted_18$1 = { class: "tracked-change-text is-inserted" };
13315
+ var _hoisted_18$2 = { class: "tracked-change-text is-inserted" };
13316
13316
  var _hoisted_19$1 = { key: 2 };
13317
13317
  var _hoisted_20$1 = { class: "tracked-change-text is-inserted" };
13318
13318
  var _hoisted_21$1 = { key: 3 };
@@ -13925,10 +13925,35 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13925
13925
  nextTick(() => emit("resize"));
13926
13926
  });
13927
13927
  };
13928
- const isV2Mode = computed$1(() => proxy.$superdoc?.activeEditor?.editorVersion === 2);
13929
- const v2CommentsAdapter = computed$1(() => isV2Mode.value ? proxy.$superdoc?.activeEditor?.v2Comments ?? null : null);
13930
- const v2TrackedChangesAdapter = computed$1(() => isV2Mode.value ? proxy.$superdoc?.activeEditor?.v2TrackedChanges ?? null : null);
13928
+ const activeEditorRevision = ref(0);
13929
+ const v2CapabilityRevision = ref(0);
13930
+ const refreshActiveEditor = () => {
13931
+ activeEditorRevision.value += 1;
13932
+ };
13933
+ const isV2Mode = computed$1(() => {
13934
+ activeEditorRevision.value;
13935
+ return proxy.$superdoc?.activeEditor?.editorVersion === 2;
13936
+ });
13937
+ const v2CommentsAdapter = computed$1(() => {
13938
+ activeEditorRevision.value;
13939
+ return isV2Mode.value ? proxy.$superdoc?.activeEditor?.v2Comments ?? null : null;
13940
+ });
13941
+ const v2TrackedChangesAdapter = computed$1(() => {
13942
+ activeEditorRevision.value;
13943
+ return isV2Mode.value ? proxy.$superdoc?.activeEditor?.v2TrackedChanges ?? null : null;
13944
+ });
13945
+ watch$1(() => {
13946
+ activeEditorRevision.value;
13947
+ return isV2Mode.value ? proxy.$superdoc?.activeEditor?.host ?? null : null;
13948
+ }, (host, _previous, onCleanup) => {
13949
+ v2CapabilityRevision.value += 1;
13950
+ const unsubscribe = host?.subscribe?.(() => {
13951
+ v2CapabilityRevision.value += 1;
13952
+ });
13953
+ onCleanup(() => unsubscribe?.());
13954
+ }, { immediate: true });
13931
13955
  const v2WriteCapability = computed$1(() => {
13956
+ v2CapabilityRevision.value;
13932
13957
  if (!v2CommentsAdapter.value) return null;
13933
13958
  const documentMode = commentsStore.viewingVisibility.documentMode;
13934
13959
  const command = isPendingNewComment.value ? "comments.createFromSelection" : null;
@@ -13952,6 +13977,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13952
13977
  return v2WriteCapability.value?.reason ?? "v2-write-unavailable";
13953
13978
  });
13954
13979
  const v2TrackedChangeCapability = computed$1(() => {
13980
+ v2CapabilityRevision.value;
13955
13981
  if (!v2TrackedChangesAdapter.value) return null;
13956
13982
  const documentMode = commentsStore.viewingVisibility.documentMode;
13957
13983
  const capability = v2TrackedChangesAdapter.value.getCapabilityState?.() ?? null;
@@ -14236,6 +14262,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14236
14262
  return users;
14237
14263
  });
14238
14264
  onMounted(() => {
14265
+ proxy.$superdoc?.on?.("active-editor-change", refreshActiveEditor);
14239
14266
  if (props.autoFocus) nextTick(() => setFocus());
14240
14267
  if (isPendingNewComment.value) nextTick(() => {
14241
14268
  commentInput.value?.focus?.({ preventScroll: true });
@@ -14249,6 +14276,9 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14249
14276
  checkOverflow();
14250
14277
  });
14251
14278
  });
14279
+ onBeforeUnmount(() => {
14280
+ proxy.$superdoc?.off?.("active-editor-change", refreshActiveEditor);
14281
+ });
14252
14282
  watch$1(showInputSection, (isVisible) => {
14253
14283
  if (!isVisible) return;
14254
14284
  nextTick(() => {
@@ -14385,7 +14415,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14385
14415
  line.excerpt ? (openBlock(), createElementBlock("span", _hoisted_15$2, " — ")) : createCommentVNode("", true),
14386
14416
  createElementVNode("span", _hoisted_16$2, toDisplayString(line.label), 1)
14387
14417
  ]);
14388
- }), 128))])) : createCommentVNode("", true)])) : comment.trackedChangeDisplayType === "hyperlinkAdded" ? (openBlock(), createElementBlock("div", _hoisted_17$2, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "change-type" }, "Added hyperlink ", -1)), createElementVNode("span", _hoisted_18$1, "\"" + toDisplayString(comment.trackedChangeText) + "\"", 1)])) : comment.trackedChangeDisplayType === "hyperlinkModified" ? (openBlock(), createElementBlock("div", _hoisted_19$1, [_cache[3] || (_cache[3] = createElementVNode("span", { class: "change-type" }, "Changed hyperlink to ", -1)), createElementVNode("span", _hoisted_20$1, "\"" + toDisplayString(comment.trackedChangeText) + "\"", 1)])) : comment.trackedChangeDisplayType === "paragraphSplit" ? (openBlock(), createElementBlock("div", _hoisted_21$1, [..._cache[4] || (_cache[4] = [createElementVNode("span", { class: "change-type" }, "Added new line", -1)])])) : comment.trackedChangeDisplayType === "tableInsert" ? (openBlock(), createElementBlock("div", _hoisted_22$1, [..._cache[5] || (_cache[5] = [createElementVNode("span", { class: "change-type" }, "Added table", -1)])])) : comment.trackedChangeDisplayType === "tableDelete" ? (openBlock(), createElementBlock("div", _hoisted_23$1, [..._cache[6] || (_cache[6] = [createElementVNode("span", { class: "change-type" }, "Deleted table", -1)])])) : comment.trackedChangeType === "trackFormat" ? (openBlock(), createElementBlock("div", _hoisted_24, [_cache[7] || (_cache[7] = createElementVNode("span", { class: "change-type" }, "Format: ", -1)), createElementVNode("span", _hoisted_25, toDisplayString(comment.trackedChangeText), 1)])) : comment.trackedChangeType === "both" ? (openBlock(), createElementBlock("div", _hoisted_26, [
14418
+ }), 128))])) : createCommentVNode("", true)])) : comment.trackedChangeDisplayType === "hyperlinkAdded" ? (openBlock(), createElementBlock("div", _hoisted_17$2, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "change-type" }, "Added hyperlink ", -1)), createElementVNode("span", _hoisted_18$2, "\"" + toDisplayString(comment.trackedChangeText) + "\"", 1)])) : comment.trackedChangeDisplayType === "hyperlinkModified" ? (openBlock(), createElementBlock("div", _hoisted_19$1, [_cache[3] || (_cache[3] = createElementVNode("span", { class: "change-type" }, "Changed hyperlink to ", -1)), createElementVNode("span", _hoisted_20$1, "\"" + toDisplayString(comment.trackedChangeText) + "\"", 1)])) : comment.trackedChangeDisplayType === "paragraphSplit" ? (openBlock(), createElementBlock("div", _hoisted_21$1, [..._cache[4] || (_cache[4] = [createElementVNode("span", { class: "change-type" }, "Added new line", -1)])])) : comment.trackedChangeDisplayType === "tableInsert" ? (openBlock(), createElementBlock("div", _hoisted_22$1, [..._cache[5] || (_cache[5] = [createElementVNode("span", { class: "change-type" }, "Added table", -1)])])) : comment.trackedChangeDisplayType === "tableDelete" ? (openBlock(), createElementBlock("div", _hoisted_23$1, [..._cache[6] || (_cache[6] = [createElementVNode("span", { class: "change-type" }, "Deleted table", -1)])])) : comment.trackedChangeType === "trackFormat" ? (openBlock(), createElementBlock("div", _hoisted_24, [_cache[7] || (_cache[7] = createElementVNode("span", { class: "change-type" }, "Format: ", -1)), createElementVNode("span", _hoisted_25, toDisplayString(comment.trackedChangeText), 1)])) : comment.trackedChangeType === "both" ? (openBlock(), createElementBlock("div", _hoisted_26, [
14389
14419
  _cache[8] || (_cache[8] = createElementVNode("span", { class: "change-type" }, "Replaced ", -1)),
14390
14420
  createElementVNode("span", _hoisted_27, "\"" + toDisplayString(comment.deletedText) + "\"", 1),
14391
14421
  _cache[9] || (_cache[9] = createElementVNode("span", { class: "change-type" }, " with ", -1)),
@@ -14495,7 +14525,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14495
14525
  ], 64))], 14, _hoisted_1$26)), [[_directive_click_outside, handleClickOutside]]);
14496
14526
  };
14497
14527
  }
14498
- }, [["__scopeId", "data-v-c189ab35"]]);
14528
+ }, [["__scopeId", "data-v-5ace8cef"]]);
14499
14529
  //#endregion
14500
14530
  //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
14501
14531
  var _hoisted_1$25 = [
@@ -18985,6 +19015,11 @@ var _hoisted_17$1 = {
18985
19015
  key: 5,
18986
19016
  class: "input-row go-to-anchor clickable"
18987
19017
  };
19018
+ var _hoisted_18$1 = {
19019
+ key: 6,
19020
+ role: "status",
19021
+ class: "sd-error"
19022
+ };
18988
19023
  var LinkInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
18989
19024
  __name: "LinkInput",
18990
19025
  props: {
@@ -19182,61 +19217,71 @@ var LinkInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
19182
19217
  hyperlinkTarget: props.hyperlinkTarget
19183
19218
  });
19184
19219
  };
19185
- const navigateToAnchor = (anchorUrl) => {
19186
- if (props.goToAnchor) props.goToAnchor(anchorUrl);
19220
+ const navigationError = ref("");
19221
+ const navigateToAnchor = async (anchorUrl) => {
19222
+ navigationError.value = "";
19223
+ try {
19224
+ if (await props.goToAnchor?.(anchorUrl) === false) navigationError.value = "Reference target is unavailable";
19225
+ } catch {
19226
+ navigationError.value = "Reference target is unavailable";
19227
+ }
19187
19228
  };
19188
19229
  return (_ctx, _cache) => {
19189
- return openBlock(), createElementBlock("div", { class: normalizeClass(["link-input-ctn", { "high-contrast": unref(isHighContrastMode) }]) }, [isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_1$19, "Page anchor")) : isViewingMode.value ? (openBlock(), createElementBlock("div", _hoisted_2$16, "Link details")) : isEditing.value ? (openBlock(), createElementBlock("div", _hoisted_3$13, "Edit link")) : (openBlock(), createElementBlock("div", _hoisted_4$8, "Add link")), __props.showInput && !isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_5$6, [
19190
- createElementVNode("div", _hoisted_6$5, [_cache[5] || (_cache[5] = createElementVNode("div", { class: "input-icon text-input-icon" }, "T", -1)), withDirectives(createElementVNode("input", {
19191
- type: "text",
19192
- name: "text",
19193
- placeholder: "Text",
19194
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => text.value = $event),
19195
- readonly: isViewingMode.value,
19196
- onKeydown: withKeys(withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"])
19197
- }, null, 40, _hoisted_7$3), [[vModelText, text.value]])]),
19198
- createElementVNode("div", _hoisted_8$3, [
19199
- createElementVNode("div", {
19200
- class: "input-icon",
19201
- innerHTML: unref(toolbarIcons).linkInput
19202
- }, null, 8, _hoisted_9$2),
19203
- withDirectives(createElementVNode("input", {
19230
+ return openBlock(), createElementBlock("div", { class: normalizeClass(["link-input-ctn", { "high-contrast": unref(isHighContrastMode) }]) }, [
19231
+ isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_1$19, "Page anchor")) : isViewingMode.value ? (openBlock(), createElementBlock("div", _hoisted_2$16, "Link details")) : isEditing.value ? (openBlock(), createElementBlock("div", _hoisted_3$13, "Edit link")) : (openBlock(), createElementBlock("div", _hoisted_4$8, "Add link")),
19232
+ __props.showInput && !isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_5$6, [
19233
+ createElementVNode("div", _hoisted_6$5, [_cache[5] || (_cache[5] = createElementVNode("div", { class: "input-icon text-input-icon" }, "T", -1)), withDirectives(createElementVNode("input", {
19204
19234
  type: "text",
19205
- name: "link",
19206
- placeholder: "Type or paste a link",
19207
- class: normalizeClass({ "sd-error": urlError.value }),
19208
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => rawUrl.value = $event),
19235
+ name: "text",
19236
+ placeholder: "Text",
19237
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => text.value = $event),
19209
19238
  readonly: isViewingMode.value,
19210
- onInput: _cache[2] || (_cache[2] = ($event) => commandError.value = ""),
19211
- onKeydown: [withKeys(withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"]), _cache[3] || (_cache[3] = ($event) => urlError.value = false)]
19212
- }, null, 42, _hoisted_10$2), [[vModelText, rawUrl.value]]),
19213
- createElementVNode("div", {
19214
- class: normalizeClass(["open-link-icon", { "sd-disabled": !validUrl.value }]),
19215
- innerHTML: unref(toolbarIcons).openLink,
19216
- onClick: openLink,
19217
- "data-item": "btn-link-open"
19218
- }, null, 10, _hoisted_11$2)
19219
- ]),
19220
- !isViewingMode.value ? (openBlock(), createElementBlock("div", _hoisted_12$1, [isEditing.value ? (openBlock(), createElementBlock("button", {
19221
- key: 0,
19222
- class: "remove-btn",
19223
- onClick: handleRemove,
19224
- disabled: isSubmitting.value,
19225
- "data-item": "btn-link-remove"
19226
- }, [createElementVNode("div", {
19227
- class: "remove-btn__icon",
19228
- innerHTML: unref(toolbarIcons).removeLink
19229
- }, null, 8, _hoisted_14$1), _cache[6] || (_cache[6] = createTextVNode(" Remove ", -1))], 8, _hoisted_13$1)) : createCommentVNode("", true), createElementVNode("button", {
19230
- class: normalizeClass(["sd-submit-btn", { "disable-btn": isDisabled.value }]),
19231
- onClick: handleSubmit,
19232
- disabled: isSubmitting.value,
19233
- "data-item": "btn-link-apply"
19234
- }, " Apply ", 10, _hoisted_15$1)])) : createCommentVNode("", true),
19235
- commandError.value ? (openBlock(), createElementBlock("div", _hoisted_16$1, toDisplayString(commandError.value), 1)) : createCommentVNode("", true)
19236
- ])) : isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_17$1, [createElementVNode("a", { onClick: _cache[4] || (_cache[4] = withModifiers(($event) => navigateToAnchor(rawUrl.value), ["stop", "prevent"])) }, "Go to " + toDisplayString(rawUrl.value.startsWith("#_") ? rawUrl.value.substring(2) : rawUrl.value), 1)])) : createCommentVNode("", true)], 2);
19237
- };
19238
- }
19239
- }, [["__scopeId", "data-v-498a6e6e"]]);
19239
+ onKeydown: withKeys(withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"])
19240
+ }, null, 40, _hoisted_7$3), [[vModelText, text.value]])]),
19241
+ createElementVNode("div", _hoisted_8$3, [
19242
+ createElementVNode("div", {
19243
+ class: "input-icon",
19244
+ innerHTML: unref(toolbarIcons).linkInput
19245
+ }, null, 8, _hoisted_9$2),
19246
+ withDirectives(createElementVNode("input", {
19247
+ type: "text",
19248
+ name: "link",
19249
+ placeholder: "Type or paste a link",
19250
+ class: normalizeClass({ "sd-error": urlError.value }),
19251
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => rawUrl.value = $event),
19252
+ readonly: isViewingMode.value,
19253
+ onInput: _cache[2] || (_cache[2] = ($event) => commandError.value = ""),
19254
+ onKeydown: [withKeys(withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"]), _cache[3] || (_cache[3] = ($event) => urlError.value = false)]
19255
+ }, null, 42, _hoisted_10$2), [[vModelText, rawUrl.value]]),
19256
+ createElementVNode("div", {
19257
+ class: normalizeClass(["open-link-icon", { "sd-disabled": !validUrl.value }]),
19258
+ innerHTML: unref(toolbarIcons).openLink,
19259
+ onClick: openLink,
19260
+ "data-item": "btn-link-open"
19261
+ }, null, 10, _hoisted_11$2)
19262
+ ]),
19263
+ !isViewingMode.value ? (openBlock(), createElementBlock("div", _hoisted_12$1, [isEditing.value ? (openBlock(), createElementBlock("button", {
19264
+ key: 0,
19265
+ class: "remove-btn",
19266
+ onClick: handleRemove,
19267
+ disabled: isSubmitting.value,
19268
+ "data-item": "btn-link-remove"
19269
+ }, [createElementVNode("div", {
19270
+ class: "remove-btn__icon",
19271
+ innerHTML: unref(toolbarIcons).removeLink
19272
+ }, null, 8, _hoisted_14$1), _cache[6] || (_cache[6] = createTextVNode(" Remove ", -1))], 8, _hoisted_13$1)) : createCommentVNode("", true), createElementVNode("button", {
19273
+ class: normalizeClass(["sd-submit-btn", { "disable-btn": isDisabled.value }]),
19274
+ onClick: handleSubmit,
19275
+ disabled: isSubmitting.value,
19276
+ "data-item": "btn-link-apply"
19277
+ }, " Apply ", 10, _hoisted_15$1)])) : createCommentVNode("", true),
19278
+ commandError.value ? (openBlock(), createElementBlock("div", _hoisted_16$1, toDisplayString(commandError.value), 1)) : createCommentVNode("", true)
19279
+ ])) : isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_17$1, [createElementVNode("a", { onClick: _cache[4] || (_cache[4] = withModifiers(($event) => navigateToAnchor(rawUrl.value), ["stop", "prevent"])) }, "Go to " + toDisplayString(rawUrl.value.startsWith("#_") ? rawUrl.value.substring(2) : rawUrl.value), 1)])) : createCommentVNode("", true),
19280
+ navigationError.value ? (openBlock(), createElementBlock("div", _hoisted_18$1, toDisplayString(navigationError.value), 1)) : createCommentVNode("", true)
19281
+ ], 2);
19282
+ };
19283
+ }
19284
+ }, [["__scopeId", "data-v-360db842"]]);
19240
19285
  //#endregion
19241
19286
  //#region src/internal/toolbar/built-in/scroll-helpers.js
19242
19287
  function getScrollableParent(element) {
@@ -19356,7 +19401,8 @@ function scrollToElement(targetElement, options = {
19356
19401
  * which keeps anchor navigation scoped to body targets.
19357
19402
  * @typedef {Object} BookmarkGetResult
19358
19403
  * @property {{ story?: { kind?: string, storyType?: string } }} [address]
19359
- * @property {{ from?: { blockId?: string } }} [range]
19404
+ * @property {{ from?: { blockId?: string, offset?: number } }} [range]
19405
+ * @property {{ colFirst: number, colLast: number }} [tableColumn]
19360
19406
  */
19361
19407
  /**
19362
19408
  * The narrow Document API subset this composable reads. The host facade
@@ -19369,7 +19415,7 @@ function scrollToElement(targetElement, options = {
19369
19415
  * @property {{ list?: () => BlocksListResult | null | undefined } | null} [blocks]
19370
19416
  * @property {{ match?: (query: { select: { type: 'text', pattern: string, caseSensitive: boolean }, require: 'any' }) => QueryMatchResult | null | undefined } | null} [query]
19371
19417
  * @property {{ list?: () => HyperlinksListResult | Promise<HyperlinksListResult | null | undefined> | null | undefined, get?: (input: { storyId: string, hyperlinkNodeId: string }) => HyperlinkGetResult | Promise<HyperlinkGetResult | null | undefined> | null | undefined } | null} [hyperlinks]
19372
- * @property {{ get?: (input: { target: { kind: 'entity', entityType: 'bookmark', name: string } }) => BookmarkGetResult | Promise<BookmarkGetResult | null | undefined> | null | undefined } | null} [bookmarks]
19418
+ * @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]
19373
19419
  */
19374
19420
  /**
19375
19421
  * The `v2-link-click` payload the shell relays from the v2 host's
@@ -19686,6 +19732,11 @@ function textTargetFromQueryMatch(doc, text, blockId) {
19686
19732
  function isTocEntryLinkElement(element) {
19687
19733
  return Boolean(element && typeof element.closest === "function" && element.closest(".superdoc-toc-entry"));
19688
19734
  }
19735
+ /** @param {Element | null | undefined} element */
19736
+ function isNoteCrossReferenceLinkElement(element) {
19737
+ const kind = element?.getAttribute("data-sd-note-cross-reference");
19738
+ return (kind === "ref" || kind === "noteRef") && Boolean(element?.closest("[data-sd-note-role=\"body\"]"));
19739
+ }
19689
19740
  /**
19690
19741
  * @param {Object} options
19691
19742
  * @param {() => SurfaceManager | null | undefined} options.getSurfaceManager
@@ -19798,7 +19849,7 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
19798
19849
  * editing/suggesting via `placeCaret`.
19799
19850
  * @param {string} blockId
19800
19851
  */
19801
- async function placeCaretAtHeadingStart(blockId) {
19852
+ async function placeCaretAtBookmark(blockId, offset) {
19802
19853
  const setSelectionTarget = getActiveEditor()?.authoring?.setSelectionTarget;
19803
19854
  if (typeof setSelectionTarget !== "function") return;
19804
19855
  const story = {
@@ -19808,7 +19859,7 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
19808
19859
  const anchor = {
19809
19860
  kind: "text",
19810
19861
  blockId,
19811
- offset: 0,
19862
+ offset,
19812
19863
  story
19813
19864
  };
19814
19865
  const target = {
@@ -19829,59 +19880,88 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
19829
19880
  * Navigate to a body bookmark through its model address. A mounted-anchor
19830
19881
  * fallback is reserved for runtimes without a callable bookmark model.
19831
19882
  * @param {string | null | undefined} anchorUrl
19832
- * @param {{ placeCaret?: boolean }} [options]
19883
+ * @param {{ placeCaret?: boolean, revalidateCaretAfterReveal?: boolean }} [options]
19833
19884
  */
19834
- async function navigateToAnchor(anchorUrl, { placeCaret = false } = {}) {
19835
- if (typeof anchorUrl !== "string" || !anchorUrl.startsWith("#")) return;
19885
+ async function navigateToAnchor(anchorUrl, { placeCaret = false, revalidateCaretAfterReveal = false } = {}) {
19886
+ if (typeof anchorUrl !== "string" || !anchorUrl.startsWith("#")) return false;
19836
19887
  const anchorName = decodeAnchorFragment(anchorUrl.slice(1));
19888
+ const editor = getActiveEditor();
19889
+ const generation = openGeneration;
19837
19890
  /** @type {LinkPopoverDocumentApi | null | undefined} */
19838
- const doc = getActiveEditor()?.doc;
19891
+ const doc = editor?.doc;
19839
19892
  const bookmarkGet = doc?.bookmarks?.get;
19840
19893
  if (typeof bookmarkGet !== "function") {
19841
19894
  const mountedAnchor = findMountedAnchor(getUi()?.viewport?.getHost?.() ?? null, cssEscape(anchorName));
19842
- if (mountedAnchor) scrollToElement(mountedAnchor, {
19895
+ if (!mountedAnchor) return false;
19896
+ scrollToElement(mountedAnchor, {
19843
19897
  block: "start",
19844
19898
  behavior: "instant"
19845
19899
  });
19846
- return;
19900
+ return true;
19847
19901
  }
19848
- /** @type {BookmarkGetResult | null} */
19849
- let bookmark = null;
19850
- try {
19851
- bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
19852
- kind: "entity",
19853
- entityType: "bookmark",
19854
- name: anchorName
19855
- } }));
19856
- bookmark ??= null;
19857
- } catch {
19858
- return;
19902
+ async function readBodyBookmark() {
19903
+ try {
19904
+ const list = doc?.bookmarks?.list;
19905
+ if (typeof list === "function") {
19906
+ if ((await Promise.resolve(list.call(doc.bookmarks)))?.items?.filter((item) => item.name === anchorName).length !== 1) return null;
19907
+ }
19908
+ const bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
19909
+ kind: "entity",
19910
+ entityType: "bookmark",
19911
+ name: anchorName
19912
+ } }));
19913
+ if (editor !== getActiveEditor() || generation !== openGeneration) return null;
19914
+ const story = bookmark?.address?.story;
19915
+ if (story && story.storyType !== "body" || bookmark?.tableColumn) return null;
19916
+ const blockId = bookmark?.range?.from?.blockId;
19917
+ const offset = bookmark?.range?.from?.offset ?? 0;
19918
+ if (typeof blockId !== "string" || !Number.isInteger(offset) || offset < 0) return null;
19919
+ return {
19920
+ blockId,
19921
+ offset
19922
+ };
19923
+ } catch {
19924
+ return null;
19925
+ }
19859
19926
  }
19860
- const story = bookmark?.address?.story;
19861
- if (story && story.storyType !== "body") return;
19862
- const blockId = bookmark?.range?.from?.blockId;
19863
- if (typeof blockId !== "string") return;
19864
- if (placeCaret) await placeCaretAtHeadingStart(blockId);
19927
+ let position = await readBodyBookmark();
19928
+ if (!position) return false;
19929
+ if (placeCaret && !revalidateCaretAfterReveal) await placeCaretAtBookmark(position.blockId, position.offset);
19865
19930
  const viewport = getUi()?.viewport;
19866
19931
  const scrollIntoView = viewport?.scrollIntoView;
19867
- if (typeof scrollIntoView !== "function") return;
19868
- const target = {
19869
- kind: "text",
19870
- blockId,
19871
- range: {
19872
- start: 0,
19873
- end: 0
19874
- }
19875
- };
19932
+ if (typeof scrollIntoView !== "function") return false;
19876
19933
  for (let step = 0; step < MAX_ANCHOR_NAVIGATION_STEPS; step += 1) try {
19877
- if ((await Promise.resolve(scrollIntoView.call(viewport, {
19934
+ const target = {
19935
+ kind: "text",
19936
+ blockId: position.blockId,
19937
+ range: {
19938
+ start: position.offset,
19939
+ end: position.offset
19940
+ }
19941
+ };
19942
+ const result = await Promise.resolve(scrollIntoView.call(viewport, {
19878
19943
  target,
19879
19944
  block: "start",
19880
19945
  behavior: "instant"
19881
- })))?.success !== false) return;
19946
+ }));
19947
+ if (editor !== getActiveEditor() || generation !== openGeneration) return false;
19948
+ if (result?.success !== false) {
19949
+ if (revalidateCaretAfterReveal) {
19950
+ const current = await readBodyBookmark();
19951
+ if (!current) return false;
19952
+ if (current.blockId !== position.blockId || current.offset !== position.offset) {
19953
+ position = current;
19954
+ continue;
19955
+ }
19956
+ if (placeCaret) await placeCaretAtBookmark(current.blockId, current.offset);
19957
+ if (editor !== getActiveEditor() || generation !== openGeneration) return false;
19958
+ }
19959
+ return true;
19960
+ }
19882
19961
  } catch {
19883
- return;
19962
+ return false;
19884
19963
  }
19964
+ return false;
19885
19965
  }
19886
19966
  /**
19887
19967
  * @param {HyperlinkActivationContext} ctx
@@ -20003,8 +20083,13 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20003
20083
  return;
20004
20084
  }
20005
20085
  if (ctx.defaultAction === "navigate") {
20006
- if (ctx.isAnchorLink) navigateToAnchor(ctx.href);
20007
- else if (ctx.href) {
20086
+ if (ctx.isAnchorLink) {
20087
+ const noteReference = isNoteCrossReferenceLinkElement(ctx.element);
20088
+ navigateToAnchor(ctx.href, {
20089
+ placeCaret: noteReference && ctx.documentMode !== "viewing",
20090
+ revalidateCaretAfterReveal: noteReference && ctx.documentMode !== "viewing"
20091
+ });
20092
+ } else if (ctx.href) {
20008
20093
  const target = ctx.target || "_self";
20009
20094
  const features = linkOpenFeaturesForTarget(ctx.rel, target);
20010
20095
  if (features) window.open(ctx.href, target, features);
@@ -20015,9 +20100,10 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20015
20100
  if (getBuiltInEditorDisabled()) return;
20016
20101
  const closePopover = () => closeCurrentPopover("closed");
20017
20102
  /** @param {string | null | undefined} anchorUrl */
20018
- const goToAnchor = (anchorUrl) => {
20019
- closePopover();
20020
- navigateToAnchor(anchorUrl, { placeCaret: true });
20103
+ const goToAnchor = async (anchorUrl) => {
20104
+ const success = await navigateToAnchor(anchorUrl, { placeCaret: ctx.documentMode !== "viewing" });
20105
+ if (success) closePopover();
20106
+ return success;
20021
20107
  };
20022
20108
  const generation = openGeneration;
20023
20109
  /** @param {ResolvedHyperlinkTarget | null} hyperlinkTarget */
@@ -21599,7 +21685,7 @@ var SurfaceDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21599
21685
  }
21600
21686
  function setInitialFocus() {
21601
21687
  if (!dialogRef.value) return;
21602
- const firstFocusable = dialogRef.value.querySelector(FOCUSABLE_SELECTOR);
21688
+ const firstFocusable = dialogRef.value.querySelector("[data-sd-autofocus]") ?? dialogRef.value.querySelector(FOCUSABLE_SELECTOR);
21603
21689
  if (firstFocusable) firstFocusable.focus();
21604
21690
  else dialogRef.value.focus();
21605
21691
  }
@@ -21710,7 +21796,7 @@ var SurfaceDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
21710
21796
  ])) : __props.surface.component ? (openBlock(), createBlock(resolveDynamicComponent(__props.surface.component), normalizeProps(mergeProps({ key: 1 }, mergedComponentProps.value)), null, 16)) : createCommentVNode("", true)])], 12, _hoisted_1$18)], 32);
21711
21797
  };
21712
21798
  }
21713
- }, [["__scopeId", "data-v-582b6534"]]);
21799
+ }, [["__scopeId", "data-v-5cee3b11"]]);
21714
21800
  //#endregion
21715
21801
  //#region src/components/surfaces/SurfaceFloating.vue
21716
21802
  var _hoisted_1$17 = ["aria-labelledby", "aria-label"];
@@ -40852,19 +40938,25 @@ var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
40852
40938
  const contentRef = ref(null);
40853
40939
  const position = ref({
40854
40940
  top: "0px",
40855
- left: "0px"
40941
+ left: "0px",
40942
+ below: false
40856
40943
  });
40857
40944
  let closeTimeout = null;
40858
40945
  let openTimeout = null;
40859
40946
  let autoHideTimeout = null;
40860
- const mergedContentClass = computed$1(() => ["sd-tooltip-content", attrs.class]);
40947
+ const mergedContentClass = computed$1(() => [
40948
+ "sd-tooltip-content",
40949
+ position.value.below && "sd-tooltip-below",
40950
+ attrs.class
40951
+ ]);
40861
40952
  const contentStyle = computed$1(() => ({
40862
40953
  ...props.contentStyle,
40863
40954
  ...attrs.style || {},
40864
40955
  position: "fixed",
40865
40956
  top: position.value.top,
40866
40957
  left: position.value.left,
40867
- zIndex: 2100
40958
+ zIndex: 2100,
40959
+ transformOrigin: position.value.below ? "top center" : "bottom center"
40868
40960
  }));
40869
40961
  const clearCloseTimeout = () => {
40870
40962
  if (closeTimeout) {
@@ -40897,12 +40989,18 @@ var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
40897
40989
  const contentWidth = contentRef.value.offsetWidth;
40898
40990
  const contentHeight = contentRef.value.offsetHeight;
40899
40991
  const viewportWidth = window.innerWidth || document.documentElement.clientWidth || 0;
40992
+ const viewportHeight = window.innerHeight || document.documentElement.clientHeight || 0;
40900
40993
  const gutter = 8;
40901
40994
  let left = triggerRect.left + triggerRect.width / 2 - contentWidth / 2;
40902
40995
  left = Math.max(gutter, Math.min(left, viewportWidth - contentWidth - gutter));
40996
+ const aboveTop = triggerRect.top - contentHeight - 10;
40997
+ const below = aboveTop < gutter;
40998
+ const preferredTop = below ? triggerRect.bottom + 10 : aboveTop;
40999
+ const top = Math.max(gutter, Math.min(preferredTop, viewportHeight - contentHeight - gutter));
40903
41000
  position.value = {
40904
- top: `${triggerRect.top - contentHeight - 10}px`,
40905
- left: `${left}px`
41001
+ top: `${top}px`,
41002
+ left: `${left}px`,
41003
+ below
40906
41004
  };
40907
41005
  };
40908
41006
  const open = async () => {
@@ -41022,7 +41120,7 @@ var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
41022
41120
  }, 8, ["css"])]))], 64);
41023
41121
  };
41024
41122
  }
41025
- }), [["__scopeId", "data-v-1449088a"]]);
41123
+ }), [["__scopeId", "data-v-71c6de4c"]]);
41026
41124
  //#endregion
41027
41125
  //#region src/internal/toolbar/built-in/ButtonGroup.vue
41028
41126
  var _hoisted_1$10 = [
@@ -46452,7 +46550,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46452
46550
  }
46453
46551
  this.userColorMap = /* @__PURE__ */ new Map();
46454
46552
  this.colorIndex = 0;
46455
- this.version = "2.23.1-next.9";
46553
+ this.version = "2.24.0-next.10";
46456
46554
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46457
46555
  this.superdocId = config.superdocId || v4();
46458
46556
  this.colors = this.config.colors ?? [];
@@ -48630,11 +48728,12 @@ var SuperDoc = class extends import_eventemitter3.default {
48630
48728
  async #replaceActiveDocument(source) {
48631
48729
  const activeEditor = this.activeEditor;
48632
48730
  if (isV2ActiveEditorFacade(activeEditor) && typeof activeEditor.replaceFile === "function") {
48633
- const result = await activeEditor.replaceFile(source);
48731
+ const replacementSource = this.#savedDocxToBlob(source);
48732
+ const result = await activeEditor.replaceFile(replacementSource);
48634
48733
  const state = result && typeof result === "object" ? result.state : null;
48635
48734
  const confirmed = state === null || state === "review-ready" || state === "editing-ready";
48636
48735
  if (confirmed) {
48637
- this.#replaceActiveDocumentData(activeEditor, source);
48736
+ this.#replaceActiveDocumentData(activeEditor, replacementSource);
48638
48737
  this.emit("document-replaced", {
48639
48738
  editor: activeEditor,
48640
48739
  host: activeEditor?.host