superdoc 2.25.0-next.4 → 2.25.0-next.6
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/chunks/{create-super-doc-ui-C-oN_R2a.cjs → create-super-doc-ui-ABeUNZlq.cjs} +49 -3
- package/dist/chunks/{create-super-doc-ui-D5waZHl3.es.js → create-super-doc-ui-CCNvH6mr.es.js} +49 -3
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/layout-engine/layout-bridge/src/index.d.ts +1 -1
- package/dist/layout-engine/layout-bridge/src/text-measurement.d.ts +8 -0
- package/dist/layout-engine/painters/dom/src/decoration-geometry.d.ts +17 -0
- package/dist/layout-engine/painters/dom/src/index.d.ts +1 -0
- package/dist/layout-engine/painters/dom/src/renderer.d.ts +0 -31
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui-vue.cjs +1 -1
- package/dist/public/ui-vue.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +1 -4239
- package/dist/style.layered.css +1 -4239
- package/dist/superdoc/src/composables/use-link-popover.d.ts +9 -0
- package/dist/superdoc.cjs +92 -41
- package/dist/superdoc.es.js +92 -41
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +42 -42
- package/package.json +2 -2
|
@@ -48,6 +48,15 @@ export type DocumentMode = import('../core/types/index.js').DocumentMode;
|
|
|
48
48
|
export type Editor = import('../core/types/index.js').Editor;
|
|
49
49
|
export type SuperDocUI = import('../public/ui/types.js').SuperDocUI;
|
|
50
50
|
export type HyperlinkTarget = import('../../../document-api/src/index.js').HyperlinkTarget;
|
|
51
|
+
export type LinkNavigationHost = {
|
|
52
|
+
getHandles?: () => {
|
|
53
|
+
editing?: {
|
|
54
|
+
input?: {
|
|
55
|
+
runAfterPendingInput?: (action: (signal?: AbortSignal) => Promise<boolean>) => Promise<boolean>;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
51
60
|
/**
|
|
52
61
|
* A single-block text-selection target in the Document API `query.match`
|
|
53
62
|
* result shape.
|
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-
|
|
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.
|
|
307
|
+
return "2.25.0-next.6";
|
|
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()
|
|
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-
|
|
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
|
-
|
|
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)
|
|
20124
|
-
|
|
20125
|
-
|
|
20126
|
-
|
|
20127
|
-
|
|
20128
|
-
|
|
20129
|
-
|
|
20130
|
-
|
|
20131
|
-
|
|
20132
|
-
|
|
20133
|
-
|
|
20134
|
-
|
|
20135
|
-
|
|
20136
|
-
|
|
20137
|
-
|
|
20138
|
-
|
|
20139
|
-
if (
|
|
20140
|
-
|
|
20141
|
-
if (
|
|
20142
|
-
|
|
20143
|
-
|
|
20144
|
-
|
|
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
|
-
|
|
20147
|
-
if (editor !== getActiveEditor() || generation !== openGeneration) return false;
|
|
20178
|
+
return true;
|
|
20148
20179
|
}
|
|
20149
|
-
|
|
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-
|
|
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";
|
|
@@ -46568,6 +46598,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46568
46598
|
return this.#surfacesConfig;
|
|
46569
46599
|
}
|
|
46570
46600
|
#surfaceManager;
|
|
46601
|
+
#sourceLifecycleReady;
|
|
46602
|
+
#pendingSourceLifecycle;
|
|
46571
46603
|
/**
|
|
46572
46604
|
* SuperDoc-owned editor runtime registry. This is the internal place to ask
|
|
46573
46605
|
* which mounted editor runtime is active and which runtime owns a DOM event
|
|
@@ -46640,6 +46672,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46640
46672
|
this.whiteboard = null;
|
|
46641
46673
|
this.colors = [];
|
|
46642
46674
|
this.readyEditors = 0;
|
|
46675
|
+
this.#sourceLifecycleReady = false;
|
|
46676
|
+
this.#pendingSourceLifecycle = [];
|
|
46643
46677
|
this.#editorRuntimeRegistry = new EditorRuntimeRegistry();
|
|
46644
46678
|
this.#editorRuntimeRegistryUnsub = null;
|
|
46645
46679
|
this.#applyingRuntimeActiveChange = false;
|
|
@@ -46793,7 +46827,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46793
46827
|
}
|
|
46794
46828
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
46795
46829
|
this.colorIndex = 0;
|
|
46796
|
-
this.version = "2.25.0-next.
|
|
46830
|
+
this.version = "2.25.0-next.6";
|
|
46797
46831
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
46798
46832
|
this.superdocId = config.superdocId || require_uuid.v4();
|
|
46799
46833
|
this.colors = this.config.colors ?? [];
|
|
@@ -46830,6 +46864,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46830
46864
|
* Mount the Vue app, stores, and editor runtime.
|
|
46831
46865
|
*/
|
|
46832
46866
|
#startRuntime() {
|
|
46867
|
+
this.#sourceLifecycleReady = false;
|
|
46868
|
+
this.#pendingSourceLifecycle = [];
|
|
46833
46869
|
this.#initVueApp();
|
|
46834
46870
|
this.readyEditors = 0;
|
|
46835
46871
|
if (!this.app) throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");
|
|
@@ -47865,7 +47901,13 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
47865
47901
|
* Triggered when the superdoc is ready
|
|
47866
47902
|
*/
|
|
47867
47903
|
broadcastReady() {
|
|
47868
|
-
if (this
|
|
47904
|
+
if (this.#destroyed) return;
|
|
47905
|
+
if (this.readyEditors === this.requiredNumberOfEditors) {
|
|
47906
|
+
this.emit("ready", { superdoc: this });
|
|
47907
|
+
if (this.#destroyed) return;
|
|
47908
|
+
this.#sourceLifecycleReady = true;
|
|
47909
|
+
for (const type of this.#pendingSourceLifecycle.splice(0)) this.emit(type);
|
|
47910
|
+
}
|
|
47869
47911
|
}
|
|
47870
47912
|
/**
|
|
47871
47913
|
* Triggered before an editor is created
|
|
@@ -47884,11 +47926,19 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
47884
47926
|
this.#wireFontsChangedRelay(editor);
|
|
47885
47927
|
this.emit("editorCreate", { editor: createDeprecatedEditorProxy(editor) });
|
|
47886
47928
|
}
|
|
47929
|
+
#broadcastSourceLifecycle(type) {
|
|
47930
|
+
if (this.#destroyed) return;
|
|
47931
|
+
if (!this.#sourceLifecycleReady) {
|
|
47932
|
+
this.#pendingSourceLifecycle.push(type);
|
|
47933
|
+
return;
|
|
47934
|
+
}
|
|
47935
|
+
this.emit(type);
|
|
47936
|
+
}
|
|
47887
47937
|
broadcastSourceComplete() {
|
|
47888
|
-
this
|
|
47938
|
+
this.#broadcastSourceLifecycle("source:complete");
|
|
47889
47939
|
}
|
|
47890
47940
|
broadcastSourceSignalsComplete() {
|
|
47891
|
-
this
|
|
47941
|
+
this.#broadcastSourceLifecycle("source:signals-complete");
|
|
47892
47942
|
}
|
|
47893
47943
|
/** Editors whose `fonts-changed` we already relay, so a repeated create wires once. */
|
|
47894
47944
|
#fontsRelayEditors;
|
|
@@ -49150,6 +49200,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
49150
49200
|
destroy() {
|
|
49151
49201
|
require_create_super_doc_ui.closeInteractionHistory(this);
|
|
49152
49202
|
this.#destroyed = true;
|
|
49203
|
+
this.#pendingSourceLifecycle = [];
|
|
49153
49204
|
this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
|
|
49154
49205
|
this.#contentControlClickRoot?.removeEventListener("pointerdown", this.#handleContentControlPointerDown, true);
|
|
49155
49206
|
this.#contentControlClickRoot?.ownerDocument.removeEventListener("pointerup", this.#handleContentControlPointerEnd, true);
|
package/dist/superdoc.es.js
CHANGED
|
@@ -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-
|
|
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.
|
|
305
|
+
return "2.25.0-next.6";
|
|
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()
|
|
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-
|
|
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
|
-
|
|
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)
|
|
20091
|
-
|
|
20092
|
-
|
|
20093
|
-
|
|
20094
|
-
|
|
20095
|
-
|
|
20096
|
-
|
|
20097
|
-
|
|
20098
|
-
|
|
20099
|
-
|
|
20100
|
-
|
|
20101
|
-
|
|
20102
|
-
|
|
20103
|
-
|
|
20104
|
-
|
|
20105
|
-
|
|
20106
|
-
if (
|
|
20107
|
-
|
|
20108
|
-
if (
|
|
20109
|
-
|
|
20110
|
-
|
|
20111
|
-
|
|
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
|
-
|
|
20114
|
-
if (editor !== getActiveEditor() || generation !== openGeneration) return false;
|
|
20145
|
+
return true;
|
|
20115
20146
|
}
|
|
20116
|
-
|
|
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-
|
|
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";
|
|
@@ -46497,6 +46527,8 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46497
46527
|
return this.#surfacesConfig;
|
|
46498
46528
|
}
|
|
46499
46529
|
#surfaceManager;
|
|
46530
|
+
#sourceLifecycleReady;
|
|
46531
|
+
#pendingSourceLifecycle;
|
|
46500
46532
|
/**
|
|
46501
46533
|
* SuperDoc-owned editor runtime registry. This is the internal place to ask
|
|
46502
46534
|
* which mounted editor runtime is active and which runtime owns a DOM event
|
|
@@ -46569,6 +46601,8 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46569
46601
|
this.whiteboard = null;
|
|
46570
46602
|
this.colors = [];
|
|
46571
46603
|
this.readyEditors = 0;
|
|
46604
|
+
this.#sourceLifecycleReady = false;
|
|
46605
|
+
this.#pendingSourceLifecycle = [];
|
|
46572
46606
|
this.#editorRuntimeRegistry = new EditorRuntimeRegistry();
|
|
46573
46607
|
this.#editorRuntimeRegistryUnsub = null;
|
|
46574
46608
|
this.#applyingRuntimeActiveChange = false;
|
|
@@ -46722,7 +46756,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46722
46756
|
}
|
|
46723
46757
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
46724
46758
|
this.colorIndex = 0;
|
|
46725
|
-
this.version = "2.25.0-next.
|
|
46759
|
+
this.version = "2.25.0-next.6";
|
|
46726
46760
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
46727
46761
|
this.superdocId = config.superdocId || v4();
|
|
46728
46762
|
this.colors = this.config.colors ?? [];
|
|
@@ -46759,6 +46793,8 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46759
46793
|
* Mount the Vue app, stores, and editor runtime.
|
|
46760
46794
|
*/
|
|
46761
46795
|
#startRuntime() {
|
|
46796
|
+
this.#sourceLifecycleReady = false;
|
|
46797
|
+
this.#pendingSourceLifecycle = [];
|
|
46762
46798
|
this.#initVueApp();
|
|
46763
46799
|
this.readyEditors = 0;
|
|
46764
46800
|
if (!this.app) throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");
|
|
@@ -47794,7 +47830,13 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
47794
47830
|
* Triggered when the superdoc is ready
|
|
47795
47831
|
*/
|
|
47796
47832
|
broadcastReady() {
|
|
47797
|
-
if (this
|
|
47833
|
+
if (this.#destroyed) return;
|
|
47834
|
+
if (this.readyEditors === this.requiredNumberOfEditors) {
|
|
47835
|
+
this.emit("ready", { superdoc: this });
|
|
47836
|
+
if (this.#destroyed) return;
|
|
47837
|
+
this.#sourceLifecycleReady = true;
|
|
47838
|
+
for (const type of this.#pendingSourceLifecycle.splice(0)) this.emit(type);
|
|
47839
|
+
}
|
|
47798
47840
|
}
|
|
47799
47841
|
/**
|
|
47800
47842
|
* Triggered before an editor is created
|
|
@@ -47813,11 +47855,19 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
47813
47855
|
this.#wireFontsChangedRelay(editor);
|
|
47814
47856
|
this.emit("editorCreate", { editor: createDeprecatedEditorProxy(editor) });
|
|
47815
47857
|
}
|
|
47858
|
+
#broadcastSourceLifecycle(type) {
|
|
47859
|
+
if (this.#destroyed) return;
|
|
47860
|
+
if (!this.#sourceLifecycleReady) {
|
|
47861
|
+
this.#pendingSourceLifecycle.push(type);
|
|
47862
|
+
return;
|
|
47863
|
+
}
|
|
47864
|
+
this.emit(type);
|
|
47865
|
+
}
|
|
47816
47866
|
broadcastSourceComplete() {
|
|
47817
|
-
this
|
|
47867
|
+
this.#broadcastSourceLifecycle("source:complete");
|
|
47818
47868
|
}
|
|
47819
47869
|
broadcastSourceSignalsComplete() {
|
|
47820
|
-
this
|
|
47870
|
+
this.#broadcastSourceLifecycle("source:signals-complete");
|
|
47821
47871
|
}
|
|
47822
47872
|
/** Editors whose `fonts-changed` we already relay, so a repeated create wires once. */
|
|
47823
47873
|
#fontsRelayEditors;
|
|
@@ -49079,6 +49129,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
49079
49129
|
destroy() {
|
|
49080
49130
|
closeInteractionHistory(this);
|
|
49081
49131
|
this.#destroyed = true;
|
|
49132
|
+
this.#pendingSourceLifecycle = [];
|
|
49082
49133
|
this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
|
|
49083
49134
|
this.#contentControlClickRoot?.removeEventListener("pointerdown", this.#handleContentControlPointerDown, true);
|
|
49084
49135
|
this.#contentControlClickRoot?.ownerDocument.removeEventListener("pointerup", this.#handleContentControlPointerEnd, true);
|