superdoc 2.25.0-next.5 → 2.25.0-next.7

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/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-B-A8sK47.cjs");
4
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-ABeUNZlq.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-BUdjGKyl.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.25.0-next.5";
307
+ return "2.25.0-next.7";
308
308
  } catch {
309
309
  return "unknown";
310
310
  }
@@ -9236,8 +9236,10 @@ var useCommentsStore = defineStore("comments", () => {
9236
9236
  };
9237
9237
  const activeId = normalizeCommentId(activeComment.value);
9238
9238
  if (activeId && droppedIds.has(activeId)) clearActiveCommentSelection();
9239
+ const adapter = getV2CommentsAdapter(superdoc);
9239
9240
  removedComments.forEach((comment) => {
9240
9241
  const payload = typeof comment.getValues === "function" ? comment.getValues() : comment;
9242
+ if (isCurrentV2CommentsAdapter(adapter) && adapter.isPendingCommentCreation?.(payload?.commentId)) return;
9241
9243
  const event = {
9242
9244
  type: COMMENT_EVENTS.DELETED,
9243
9245
  comment: payload,
@@ -15755,7 +15757,9 @@ var _sfc_main$31 = {
15755
15757
  viewportRevision.value;
15756
15758
  const viewport = getFloatingViewportRange();
15757
15759
  if (!viewport) return null;
15758
- const rail = container.getBoundingClientRect(), stage = props.parent?.getBoundingClientRect?.();
15760
+ const rail = container.getBoundingClientRect();
15761
+ const stage = typeof presentation.readPaintOrigin === "function" ? presentation.readPaintOrigin() : props.parent?.getBoundingClientRect?.();
15762
+ if (!stage || !Number.isFinite(stage.left) || !Number.isFinite(stage.top)) return null;
15759
15763
  const instances = committedInstances.value ?? [];
15760
15764
  return {
15761
15765
  activeThreadId: activeComment.value == null ? null : String(activeComment.value),
@@ -16316,7 +16320,7 @@ var _sfc_main$31 = {
16316
16320
  "data-comment-page-index": pos.pageIndex ?? "",
16317
16321
  class: require__plugin_vue_export_helper.normalizeClass([{ "is-direct-decision-continuity-target": pos.id === directDecisionContinuityTargetId.value }, "comment-placeholder"]),
16318
16322
  style: require__plugin_vue_export_helper.normalizeStyle({
16319
- top: (pos.isOffscreenReviewCard ? pos.top - sidebarOffsetY.value : pos.top) + "px",
16323
+ top: (pos.isOffscreenReviewCard && !committedPresentation.value ? pos.top - sidebarOffsetY.value : pos.top) + "px",
16320
16324
  height: pos.height + "px",
16321
16325
  transition: disableInstantLayoutTransitions.value ? "none" : void 0
16322
16326
  })
@@ -16344,7 +16348,7 @@ var _sfc_main$31 = {
16344
16348
  };
16345
16349
  }
16346
16350
  };
16347
- var FloatingComments_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$31, [["__scopeId", "data-v-f0b1fd79"]]);
16351
+ var FloatingComments_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$31, [["__scopeId", "data-v-028441bf"]]);
16348
16352
  //#endregion
16349
16353
  //#region src/components/CommentsLayer/PdfCommentsLayer.vue
16350
16354
  var _hoisted_1$23 = {
@@ -19519,6 +19523,7 @@ function scrollToElement(targetElement, options = {
19519
19523
  /** @typedef {import('../core/types/index.js').Editor} Editor */
19520
19524
  /** @typedef {import('../public/ui/types.js').SuperDocUI} SuperDocUI */
19521
19525
  /** @typedef {import('@superdoc/document-api').HyperlinkTarget} HyperlinkTarget */
19526
+ /** @typedef {{ getHandles?: () => { editing?: { input?: { runAfterPendingInput?: (action: (signal?: AbortSignal) => Promise<boolean>) => Promise<boolean> } } } }} LinkNavigationHost */
19522
19527
  /**
19523
19528
  * A single-block text-selection target in the Document API `query.match`
19524
19529
  * result shape.
@@ -20077,6 +20082,26 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20077
20082
  const anchorName = decodeAnchorFragment(anchorUrl.slice(1));
20078
20083
  const editor = getActiveEditor();
20079
20084
  const generation = openGeneration;
20085
+ /** @param {AbortSignal} [signal] */
20086
+ const navigate = (signal) => navigateAnchorInEditor(anchorName, editor, generation, placeCaret, revalidateCaretAfterReveal, signal);
20087
+ if (revalidateCaretAfterReveal) try {
20088
+ const input = (editor?.host)?.getHandles?.()?.editing?.input;
20089
+ if (typeof input?.runAfterPendingInput === "function") return await input.runAfterPendingInput(navigate);
20090
+ } catch {
20091
+ return false;
20092
+ }
20093
+ return navigate();
20094
+ }
20095
+ /**
20096
+ * @param {string} anchorName
20097
+ * @param {Editor | null | undefined} editor
20098
+ * @param {number} generation
20099
+ * @param {boolean} placeCaret
20100
+ * @param {boolean} revalidateCaretAfterReveal
20101
+ * @param {AbortSignal} [signal]
20102
+ */
20103
+ async function navigateAnchorInEditor(anchorName, editor, generation, placeCaret, revalidateCaretAfterReveal, signal) {
20104
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20080
20105
  /** @type {LinkPopoverDocumentApi | null | undefined} */
20081
20106
  const doc = editor?.doc;
20082
20107
  const bookmarkGet = doc?.bookmarks?.get;
@@ -20093,14 +20118,16 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20093
20118
  try {
20094
20119
  const list = doc?.bookmarks?.list;
20095
20120
  if (typeof list === "function") {
20096
- if ((await Promise.resolve(list.call(doc.bookmarks)))?.items?.filter((item) => item.name === anchorName).length !== 1) return null;
20121
+ const catalog = await Promise.resolve(list.call(doc.bookmarks));
20122
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return null;
20123
+ if (catalog?.items?.filter((item) => item.name === anchorName).length !== 1) return null;
20097
20124
  }
20098
20125
  const bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
20099
20126
  kind: "entity",
20100
20127
  entityType: "bookmark",
20101
20128
  name: anchorName
20102
20129
  } }));
20103
- if (editor !== getActiveEditor() || generation !== openGeneration) return null;
20130
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return null;
20104
20131
  const story = bookmark?.address?.story;
20105
20132
  if (story && story.storyType !== "body" || bookmark?.tableColumn) return null;
20106
20133
  const blockId = bookmark?.range?.from?.blockId;
@@ -20115,41 +20142,44 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20115
20142
  }
20116
20143
  }
20117
20144
  let position = await readBodyBookmark();
20118
- if (!position) return false;
20145
+ if (!position || signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20119
20146
  if (placeCaret && !revalidateCaretAfterReveal) await placeCaretAtBookmark(position.blockId, position.offset);
20120
20147
  const viewport = getUi()?.viewport;
20121
20148
  const scrollIntoView = viewport?.scrollIntoView;
20122
20149
  if (typeof scrollIntoView !== "function") return false;
20123
- for (let step = 0; step < MAX_ANCHOR_NAVIGATION_STEPS; step += 1) try {
20124
- const target = {
20125
- kind: "text",
20126
- blockId: position.blockId,
20127
- range: {
20128
- start: position.offset,
20129
- end: position.offset
20130
- }
20131
- };
20132
- const result = await Promise.resolve(scrollIntoView.call(viewport, {
20133
- target,
20134
- block: "start",
20135
- behavior: "instant"
20136
- }));
20137
- if (editor !== getActiveEditor() || generation !== openGeneration) return false;
20138
- if (result?.success !== false) {
20139
- if (revalidateCaretAfterReveal) {
20140
- const current = await readBodyBookmark();
20141
- if (!current) return false;
20142
- if (current.blockId !== position.blockId || current.offset !== position.offset) {
20143
- position = current;
20144
- continue;
20150
+ for (let step = 0; step < MAX_ANCHOR_NAVIGATION_STEPS; step += 1) {
20151
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20152
+ try {
20153
+ const target = {
20154
+ kind: "text",
20155
+ blockId: position.blockId,
20156
+ range: {
20157
+ start: position.offset,
20158
+ end: position.offset
20159
+ }
20160
+ };
20161
+ const result = await Promise.resolve(scrollIntoView.call(viewport, {
20162
+ target,
20163
+ block: "start",
20164
+ behavior: "instant"
20165
+ }));
20166
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20167
+ if (result?.success !== false) {
20168
+ if (revalidateCaretAfterReveal) {
20169
+ const current = await readBodyBookmark();
20170
+ if (!current || signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20171
+ if (current.blockId !== position.blockId || current.offset !== position.offset) {
20172
+ position = current;
20173
+ continue;
20174
+ }
20175
+ if (placeCaret) await placeCaretAtBookmark(current.blockId, current.offset);
20176
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20145
20177
  }
20146
- if (placeCaret) await placeCaretAtBookmark(current.blockId, current.offset);
20147
- if (editor !== getActiveEditor() || generation !== openGeneration) return false;
20178
+ return true;
20148
20179
  }
20149
- return true;
20180
+ } catch {
20181
+ return false;
20150
20182
  }
20151
- } catch {
20152
- return false;
20153
20183
  }
20154
20184
  return false;
20155
20185
  }
@@ -22923,7 +22953,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
22923
22953
  if (typeof selectionTargets?.apply !== "function") return createV2AuthoringFailure("selection-target-unavailable", "editing.selectionTargets.apply is not available");
22924
22954
  let result;
22925
22955
  try {
22926
- result = selectionTargets.apply(selectionTarget);
22956
+ result = await (selectionTargets.applyAndWait ?? selectionTargets.apply).call(selectionTargets, selectionTarget);
22927
22957
  } catch (error) {
22928
22958
  const message = error instanceof Error ? error.message : String(error);
22929
22959
  return createV2AuthoringFailure("selection-target-threw", message);
@@ -24978,7 +25008,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
24978
25008
  ], 46, _hoisted_1$17);
24979
25009
  };
24980
25010
  }
24981
- }, [["__scopeId", "data-v-c57da6ae"]]);
25011
+ }, [["__scopeId", "data-v-c843616f"]]);
24982
25012
  //#endregion
24983
25013
  //#region src/core/create-app.js
24984
25014
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -46797,7 +46827,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46797
46827
  }
46798
46828
  this.userColorMap = /* @__PURE__ */ new Map();
46799
46829
  this.colorIndex = 0;
46800
- this.version = "2.25.0-next.5";
46830
+ this.version = "2.25.0-next.7";
46801
46831
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46802
46832
  this.superdocId = config.superdocId || require_uuid.v4();
46803
46833
  this.colors = this.config.colors ?? [];
@@ -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-CrH79xw6.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-CCNvH6mr.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 vModelText, A as onActivated, B as renderSlot, C as isRef$1, D as normalizeClass, E as nextTick, F as openBlock, G as toRaw$2, H as resolveDynamicComponent, I as provide$1, J as unref, K as toRef, L as reactive, M as onDeactivated, N as onMounted, O as normalizeProps, P as onScopeDispose$1, Q as vModelSelect, R as ref, S as isReactive$1, T as mergeProps, U as shallowRef$1, V as resolveDirective, W as toDisplayString, X as useSlots, Y as useAttrs, Z as vModelCheckbox, _ as getCurrentInstance, a as computed$1, b as hasInjectionContext, c as createCommentVNode, d as createStaticVNode, et as watch$1, f as createTextVNode, g as effectScope, h as defineComponent, i as Transition, it as withModifiers, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, m as defineAsyncComponent, n as Fragment, nt as withDirectives, o as createApp, p as createVNode, q as toRefs, r as Teleport, rt as withKeys, s as createBlock, t as _plugin_vue_export_helper_default, tt as withCtx, u as createElementVNode, v as getCurrentScope, w as markRaw, x as inject$1, y as h, z as renderList } from "./chunks/_plugin-vue_export-helper-7ZiLY07t.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.25.0-next.5";
305
+ return "2.25.0-next.7";
306
306
  } catch {
307
307
  return "unknown";
308
308
  }
@@ -9234,8 +9234,10 @@ var useCommentsStore = defineStore("comments", () => {
9234
9234
  };
9235
9235
  const activeId = normalizeCommentId(activeComment.value);
9236
9236
  if (activeId && droppedIds.has(activeId)) clearActiveCommentSelection();
9237
+ const adapter = getV2CommentsAdapter(superdoc);
9237
9238
  removedComments.forEach((comment) => {
9238
9239
  const payload = typeof comment.getValues === "function" ? comment.getValues() : comment;
9240
+ if (isCurrentV2CommentsAdapter(adapter) && adapter.isPendingCommentCreation?.(payload?.commentId)) return;
9239
9241
  const event = {
9240
9242
  type: COMMENT_EVENTS.DELETED,
9241
9243
  comment: payload,
@@ -15745,7 +15747,9 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15745
15747
  viewportRevision.value;
15746
15748
  const viewport = getFloatingViewportRange();
15747
15749
  if (!viewport) return null;
15748
- const rail = container.getBoundingClientRect(), stage = props.parent?.getBoundingClientRect?.();
15750
+ const rail = container.getBoundingClientRect();
15751
+ const stage = typeof presentation.readPaintOrigin === "function" ? presentation.readPaintOrigin() : props.parent?.getBoundingClientRect?.();
15752
+ if (!stage || !Number.isFinite(stage.left) || !Number.isFinite(stage.top)) return null;
15749
15753
  const instances = committedInstances.value ?? [];
15750
15754
  return {
15751
15755
  activeThreadId: activeComment.value == null ? null : String(activeComment.value),
@@ -16306,7 +16310,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
16306
16310
  "data-comment-page-index": pos.pageIndex ?? "",
16307
16311
  class: normalizeClass([{ "is-direct-decision-continuity-target": pos.id === directDecisionContinuityTargetId.value }, "comment-placeholder"]),
16308
16312
  style: normalizeStyle({
16309
- top: (pos.isOffscreenReviewCard ? pos.top - sidebarOffsetY.value : pos.top) + "px",
16313
+ top: (pos.isOffscreenReviewCard && !committedPresentation.value ? pos.top - sidebarOffsetY.value : pos.top) + "px",
16310
16314
  height: pos.height + "px",
16311
16315
  transition: disableInstantLayoutTransitions.value ? "none" : void 0
16312
16316
  })
@@ -16333,7 +16337,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
16333
16337
  }), 128))], 4)], 36);
16334
16338
  };
16335
16339
  }
16336
- }, [["__scopeId", "data-v-f0b1fd79"]]);
16340
+ }, [["__scopeId", "data-v-028441bf"]]);
16337
16341
  //#endregion
16338
16342
  //#region src/components/CommentsLayer/PdfCommentsLayer.vue
16339
16343
  var _hoisted_1$23 = {
@@ -19486,6 +19490,7 @@ function scrollToElement(targetElement, options = {
19486
19490
  /** @typedef {import('../core/types/index.js').Editor} Editor */
19487
19491
  /** @typedef {import('../public/ui/types.js').SuperDocUI} SuperDocUI */
19488
19492
  /** @typedef {import('@superdoc/document-api').HyperlinkTarget} HyperlinkTarget */
19493
+ /** @typedef {{ getHandles?: () => { editing?: { input?: { runAfterPendingInput?: (action: (signal?: AbortSignal) => Promise<boolean>) => Promise<boolean> } } } }} LinkNavigationHost */
19489
19494
  /**
19490
19495
  * A single-block text-selection target in the Document API `query.match`
19491
19496
  * result shape.
@@ -20044,6 +20049,26 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20044
20049
  const anchorName = decodeAnchorFragment(anchorUrl.slice(1));
20045
20050
  const editor = getActiveEditor();
20046
20051
  const generation = openGeneration;
20052
+ /** @param {AbortSignal} [signal] */
20053
+ const navigate = (signal) => navigateAnchorInEditor(anchorName, editor, generation, placeCaret, revalidateCaretAfterReveal, signal);
20054
+ if (revalidateCaretAfterReveal) try {
20055
+ const input = (editor?.host)?.getHandles?.()?.editing?.input;
20056
+ if (typeof input?.runAfterPendingInput === "function") return await input.runAfterPendingInput(navigate);
20057
+ } catch {
20058
+ return false;
20059
+ }
20060
+ return navigate();
20061
+ }
20062
+ /**
20063
+ * @param {string} anchorName
20064
+ * @param {Editor | null | undefined} editor
20065
+ * @param {number} generation
20066
+ * @param {boolean} placeCaret
20067
+ * @param {boolean} revalidateCaretAfterReveal
20068
+ * @param {AbortSignal} [signal]
20069
+ */
20070
+ async function navigateAnchorInEditor(anchorName, editor, generation, placeCaret, revalidateCaretAfterReveal, signal) {
20071
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20047
20072
  /** @type {LinkPopoverDocumentApi | null | undefined} */
20048
20073
  const doc = editor?.doc;
20049
20074
  const bookmarkGet = doc?.bookmarks?.get;
@@ -20060,14 +20085,16 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20060
20085
  try {
20061
20086
  const list = doc?.bookmarks?.list;
20062
20087
  if (typeof list === "function") {
20063
- if ((await Promise.resolve(list.call(doc.bookmarks)))?.items?.filter((item) => item.name === anchorName).length !== 1) return null;
20088
+ const catalog = await Promise.resolve(list.call(doc.bookmarks));
20089
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return null;
20090
+ if (catalog?.items?.filter((item) => item.name === anchorName).length !== 1) return null;
20064
20091
  }
20065
20092
  const bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
20066
20093
  kind: "entity",
20067
20094
  entityType: "bookmark",
20068
20095
  name: anchorName
20069
20096
  } }));
20070
- if (editor !== getActiveEditor() || generation !== openGeneration) return null;
20097
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return null;
20071
20098
  const story = bookmark?.address?.story;
20072
20099
  if (story && story.storyType !== "body" || bookmark?.tableColumn) return null;
20073
20100
  const blockId = bookmark?.range?.from?.blockId;
@@ -20082,41 +20109,44 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getActivati
20082
20109
  }
20083
20110
  }
20084
20111
  let position = await readBodyBookmark();
20085
- if (!position) return false;
20112
+ if (!position || signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20086
20113
  if (placeCaret && !revalidateCaretAfterReveal) await placeCaretAtBookmark(position.blockId, position.offset);
20087
20114
  const viewport = getUi()?.viewport;
20088
20115
  const scrollIntoView = viewport?.scrollIntoView;
20089
20116
  if (typeof scrollIntoView !== "function") return false;
20090
- for (let step = 0; step < MAX_ANCHOR_NAVIGATION_STEPS; step += 1) try {
20091
- const target = {
20092
- kind: "text",
20093
- blockId: position.blockId,
20094
- range: {
20095
- start: position.offset,
20096
- end: position.offset
20097
- }
20098
- };
20099
- const result = await Promise.resolve(scrollIntoView.call(viewport, {
20100
- target,
20101
- block: "start",
20102
- behavior: "instant"
20103
- }));
20104
- if (editor !== getActiveEditor() || generation !== openGeneration) return false;
20105
- if (result?.success !== false) {
20106
- if (revalidateCaretAfterReveal) {
20107
- const current = await readBodyBookmark();
20108
- if (!current) return false;
20109
- if (current.blockId !== position.blockId || current.offset !== position.offset) {
20110
- position = current;
20111
- continue;
20117
+ for (let step = 0; step < MAX_ANCHOR_NAVIGATION_STEPS; step += 1) {
20118
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20119
+ try {
20120
+ const target = {
20121
+ kind: "text",
20122
+ blockId: position.blockId,
20123
+ range: {
20124
+ start: position.offset,
20125
+ end: position.offset
20126
+ }
20127
+ };
20128
+ const result = await Promise.resolve(scrollIntoView.call(viewport, {
20129
+ target,
20130
+ block: "start",
20131
+ behavior: "instant"
20132
+ }));
20133
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20134
+ if (result?.success !== false) {
20135
+ if (revalidateCaretAfterReveal) {
20136
+ const current = await readBodyBookmark();
20137
+ if (!current || signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20138
+ if (current.blockId !== position.blockId || current.offset !== position.offset) {
20139
+ position = current;
20140
+ continue;
20141
+ }
20142
+ if (placeCaret) await placeCaretAtBookmark(current.blockId, current.offset);
20143
+ if (signal?.aborted || editor !== getActiveEditor() || generation !== openGeneration) return false;
20112
20144
  }
20113
- if (placeCaret) await placeCaretAtBookmark(current.blockId, current.offset);
20114
- if (editor !== getActiveEditor() || generation !== openGeneration) return false;
20145
+ return true;
20115
20146
  }
20116
- return true;
20147
+ } catch {
20148
+ return false;
20117
20149
  }
20118
- } catch {
20119
- return false;
20120
20150
  }
20121
20151
  return false;
20122
20152
  }
@@ -22882,7 +22912,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
22882
22912
  if (typeof selectionTargets?.apply !== "function") return createV2AuthoringFailure("selection-target-unavailable", "editing.selectionTargets.apply is not available");
22883
22913
  let result;
22884
22914
  try {
22885
- result = selectionTargets.apply(selectionTarget);
22915
+ result = await (selectionTargets.applyAndWait ?? selectionTargets.apply).call(selectionTargets, selectionTarget);
22886
22916
  } catch (error) {
22887
22917
  const message = error instanceof Error ? error.message : String(error);
22888
22918
  return createV2AuthoringFailure("selection-target-threw", message);
@@ -24937,7 +24967,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
24937
24967
  ], 46, _hoisted_1$17);
24938
24968
  };
24939
24969
  }
24940
- }, [["__scopeId", "data-v-c57da6ae"]]);
24970
+ }, [["__scopeId", "data-v-c843616f"]]);
24941
24971
  //#endregion
24942
24972
  //#region src/core/create-app.js
24943
24973
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -46726,7 +46756,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46726
46756
  }
46727
46757
  this.userColorMap = /* @__PURE__ */ new Map();
46728
46758
  this.colorIndex = 0;
46729
- this.version = "2.25.0-next.5";
46759
+ this.version = "2.25.0-next.7";
46730
46760
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46731
46761
  this.superdocId = config.superdocId || v4();
46732
46762
  this.colors = this.config.colors ?? [];