superdoc 2.0.0-next.44 → 2.0.0-next.46
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/AGENTS.md +15 -8
- package/dist/chunks/{create-super-doc-ui-DYky1UEo.cjs → create-super-doc-ui-6FUZ9d-y.cjs} +204 -159
- package/dist/chunks/{create-super-doc-ui-BFz0iim0.es.js → create-super-doc-ui-DCFTmVRK.es.js} +205 -160
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
- package/dist/document-api/src/contract/operation-definitions.d.ts +1 -1
- package/dist/public/ui-react.cjs +17 -14
- package/dist/public/ui-react.es.js +17 -14
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +28 -28
- package/dist/style.layered.css +28 -28
- package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +2 -2
- package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +2 -2
- package/dist/superdoc/src/components/surfaces/SurfaceExternalMount.vue.d.ts +2 -2
- package/dist/superdoc/src/composables/use-find-replace.d.ts +2 -2
- package/dist/superdoc/src/core/SuperDoc.d.ts +41 -0
- package/dist/superdoc/src/core/types/index.d.ts +76 -30
- package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +5 -5
- package/dist/superdoc/src/public/browser-document-api.d.ts +53 -0
- package/dist/superdoc/src/public/index.d.cts +4 -0
- package/dist/superdoc/src/public/index.d.ts +2 -0
- package/dist/superdoc/src/public/ui/react.d.ts +18 -7
- package/dist/superdoc/src/public/ui/types.d.ts +81 -12
- package/dist/superdoc/src/public/ui-react.d.ts +4 -3
- package/dist/superdoc/src/public/ui.d.cts +8 -0
- package/dist/superdoc/src/public/ui.d.ts +1 -1
- package/dist/superdoc.cjs +85 -141
- package/dist/superdoc.es.js +85 -141
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +36 -36
- package/package.json +2 -2
package/dist/superdoc.cjs
CHANGED
|
@@ -6,7 +6,7 @@ const require_uuid = require("./chunks/uuid-CFp0WGVU.cjs");
|
|
|
6
6
|
const require_jszip = require("./chunks/jszip-BdUBlUeG.cjs");
|
|
7
7
|
const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-BTwbGDKw.cjs");
|
|
8
8
|
const require_constants = require("./chunks/constants-sbCZ2O_A.cjs");
|
|
9
|
-
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-
|
|
9
|
+
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-6FUZ9d-y.cjs");
|
|
10
10
|
let vue = require("vue");
|
|
11
11
|
vue = require_rolldown_runtime.__toESM(vue);
|
|
12
12
|
require("y-websocket");
|
|
@@ -3096,14 +3096,12 @@ const useCommentsStore = defineStore("comments", () => {
|
|
|
3096
3096
|
const v2TrackedChangesAdapter = (0, vue.shallowRef)(null);
|
|
3097
3097
|
const setV2TrackedChangesAdapter = (adapter) => {
|
|
3098
3098
|
v2TrackedChangesAdapter.value = adapter ?? null;
|
|
3099
|
-
if (!adapter) postDecisionBackgroundReconcileByDocument.clear();
|
|
3100
3099
|
};
|
|
3101
3100
|
const getV2TrackedChangesAdapter = (superdoc) => {
|
|
3102
3101
|
const fromFacade = superdoc?.activeEditor?.v2TrackedChanges ?? null;
|
|
3103
3102
|
if (fromFacade) return fromFacade;
|
|
3104
3103
|
return v2TrackedChangesAdapter.value;
|
|
3105
3104
|
};
|
|
3106
|
-
const postDecisionBackgroundReconcileByDocument = /* @__PURE__ */ new Map();
|
|
3107
3105
|
const init = (config = {}) => {
|
|
3108
3106
|
const updatedConfig = {
|
|
3109
3107
|
...commentsConfig,
|
|
@@ -5197,16 +5195,6 @@ const useCommentsStore = defineStore("comments", () => {
|
|
|
5197
5195
|
removedIds
|
|
5198
5196
|
};
|
|
5199
5197
|
};
|
|
5200
|
-
const waitForPostDecisionReconcileIdle = () => new Promise((resolve) => {
|
|
5201
|
-
setTimeout(() => {
|
|
5202
|
-
const requestIdle = globalThis?.requestIdleCallback;
|
|
5203
|
-
if (typeof requestIdle === "function") {
|
|
5204
|
-
requestIdle(() => resolve(void 0), { timeout: 2e3 });
|
|
5205
|
-
return;
|
|
5206
|
-
}
|
|
5207
|
-
resolve(void 0);
|
|
5208
|
-
}, 3e3);
|
|
5209
|
-
});
|
|
5210
5198
|
const clearV2ActiveTrackedChangeTarget = (adapter, decidedId) => {
|
|
5211
5199
|
if (!decidedId || typeof adapter?.clearActiveTrackedChangeTargetIfMatches !== "function") return;
|
|
5212
5200
|
try {
|
|
@@ -5232,76 +5220,6 @@ const useCommentsStore = defineStore("comments", () => {
|
|
|
5232
5220
|
});
|
|
5233
5221
|
} catch {}
|
|
5234
5222
|
};
|
|
5235
|
-
const tracePostDecisionBackgroundReconcile = (superdoc, event, payload = {}) => {
|
|
5236
|
-
const record = {
|
|
5237
|
-
event,
|
|
5238
|
-
refreshReason: "post-decision-background",
|
|
5239
|
-
blocking: false,
|
|
5240
|
-
...payload
|
|
5241
|
-
};
|
|
5242
|
-
tracePreviewComments(`post-decision-background:${event}`, record);
|
|
5243
|
-
};
|
|
5244
|
-
const schedulePostDecisionBackgroundReconcile = ({ superdoc, trackedChangesAdapter, commentsAdapter, documentId } = {}) => {
|
|
5245
|
-
const normalizedDocumentId = normalizeCommentId(documentId);
|
|
5246
|
-
if (!normalizedDocumentId || !trackedChangesAdapter) return null;
|
|
5247
|
-
const existing = postDecisionBackgroundReconcileByDocument.get(normalizedDocumentId);
|
|
5248
|
-
if (existing) return existing;
|
|
5249
|
-
const reconcilePromise = waitForPostDecisionReconcileIdle().then(async () => {
|
|
5250
|
-
tracePostDecisionBackgroundReconcile(superdoc, "start", { documentId: normalizedDocumentId });
|
|
5251
|
-
const trackedResult = await hydrateTrackedChangesFromV2({
|
|
5252
|
-
superdoc,
|
|
5253
|
-
adapter: trackedChangesAdapter,
|
|
5254
|
-
documentId: normalizedDocumentId,
|
|
5255
|
-
trackedChangesListMode: "background-reconcile",
|
|
5256
|
-
refreshReason: "post-decision-background",
|
|
5257
|
-
blocking: false
|
|
5258
|
-
});
|
|
5259
|
-
if (!trackedResult?.ok) tracePostDecisionBackgroundReconcile(superdoc, "tracked-changes-failed", {
|
|
5260
|
-
documentId: normalizedDocumentId,
|
|
5261
|
-
reason: trackedResult?.reason ?? null,
|
|
5262
|
-
detail: trackedResult?.detail ?? null
|
|
5263
|
-
});
|
|
5264
|
-
if (commentsAdapter && typeof commentsAdapter.refresh === "function" && isCurrentV2CommentsAdapter(commentsAdapter)) {
|
|
5265
|
-
let commentsResult;
|
|
5266
|
-
try {
|
|
5267
|
-
commentsResult = await commentsAdapter.refresh();
|
|
5268
|
-
} catch (err) {
|
|
5269
|
-
commentsResult = {
|
|
5270
|
-
ok: false,
|
|
5271
|
-
reason: "comments-refresh-threw",
|
|
5272
|
-
detail: err?.message ?? String(err)
|
|
5273
|
-
};
|
|
5274
|
-
}
|
|
5275
|
-
if (isCurrentV2CommentsAdapter(commentsAdapter) && commentsResult?.ok) reconcileCommentsFromV2({
|
|
5276
|
-
superdoc,
|
|
5277
|
-
adapter: commentsAdapter,
|
|
5278
|
-
documentId: commentsAdapter.documentId ?? normalizedDocumentId,
|
|
5279
|
-
items: commentsResult.items ?? []
|
|
5280
|
-
});
|
|
5281
|
-
else if (!commentsResult?.ok) tracePostDecisionBackgroundReconcile(superdoc, "comments-failed", {
|
|
5282
|
-
documentId: normalizedDocumentId,
|
|
5283
|
-
reason: commentsResult?.reason ?? null,
|
|
5284
|
-
detail: commentsResult?.detail ?? null
|
|
5285
|
-
});
|
|
5286
|
-
}
|
|
5287
|
-
tracePostDecisionBackgroundReconcile(superdoc, "complete", { documentId: normalizedDocumentId });
|
|
5288
|
-
return { ok: true };
|
|
5289
|
-
}).catch((err) => {
|
|
5290
|
-
tracePostDecisionBackgroundReconcile(superdoc, "failed", {
|
|
5291
|
-
documentId: normalizedDocumentId,
|
|
5292
|
-
detail: err?.message ?? String(err)
|
|
5293
|
-
});
|
|
5294
|
-
return {
|
|
5295
|
-
ok: false,
|
|
5296
|
-
reason: "post-decision-background-failed",
|
|
5297
|
-
detail: err?.message ?? String(err)
|
|
5298
|
-
};
|
|
5299
|
-
}).finally(() => {
|
|
5300
|
-
if (postDecisionBackgroundReconcileByDocument.get(normalizedDocumentId) === reconcilePromise) postDecisionBackgroundReconcileByDocument.delete(normalizedDocumentId);
|
|
5301
|
-
});
|
|
5302
|
-
postDecisionBackgroundReconcileByDocument.set(normalizedDocumentId, reconcilePromise);
|
|
5303
|
-
return reconcilePromise;
|
|
5304
|
-
};
|
|
5305
5223
|
const decideTrackedChangeFromSidebar = ({ superdoc, comment, decision }) => {
|
|
5306
5224
|
if (commentsAreReadOnly$1()) return {
|
|
5307
5225
|
ok: false,
|
|
@@ -5428,12 +5346,6 @@ const useCommentsStore = defineStore("comments", () => {
|
|
|
5428
5346
|
};
|
|
5429
5347
|
if (!reliableDecidedIds.size || !effectiveDocumentId) return runBlockingPostDecisionReconcile();
|
|
5430
5348
|
reliableDecidedIds.forEach((id$1) => clearV2ActiveTrackedChangeTarget(v2Adapter, id$1));
|
|
5431
|
-
schedulePostDecisionBackgroundReconcile({
|
|
5432
|
-
superdoc,
|
|
5433
|
-
trackedChangesAdapter: v2Adapter,
|
|
5434
|
-
commentsAdapter: getV2CommentsAdapter(superdoc),
|
|
5435
|
-
documentId: effectiveDocumentId
|
|
5436
|
-
});
|
|
5437
5349
|
await waitForTrackedDecisionCanonicalPaint({
|
|
5438
5350
|
superdoc,
|
|
5439
5351
|
receipt: outcome.receipt
|
|
@@ -8757,16 +8669,38 @@ var _sfc_main$30 = {
|
|
|
8757
8669
|
};
|
|
8758
8670
|
const getFloatingViewportRange = () => {
|
|
8759
8671
|
const container = floatingCommentsContainer.value;
|
|
8760
|
-
|
|
8761
|
-
if (!container || !viewportRect) return null;
|
|
8672
|
+
if (!container) return null;
|
|
8762
8673
|
const containerRect = container.getBoundingClientRect();
|
|
8763
|
-
if (!Number.isFinite(containerRect.top) || !Number.isFinite(
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8674
|
+
if (!Number.isFinite(containerRect.top) || !Number.isFinite(window.innerHeight)) return null;
|
|
8675
|
+
let visibleClientTop = 0;
|
|
8676
|
+
let visibleClientBottom = window.innerHeight;
|
|
8677
|
+
for (let ancestor = container.parentElement; ancestor; ancestor = ancestor.parentElement) {
|
|
8678
|
+
const overflowY = window.getComputedStyle(ancestor).overflowY;
|
|
8679
|
+
if (![
|
|
8680
|
+
"auto",
|
|
8681
|
+
"scroll",
|
|
8682
|
+
"hidden",
|
|
8683
|
+
"clip"
|
|
8684
|
+
].includes(overflowY)) continue;
|
|
8685
|
+
const ancestorRect = ancestor.getBoundingClientRect();
|
|
8686
|
+
if (!Number.isFinite(ancestorRect.top) || !Number.isFinite(ancestorRect.bottom)) continue;
|
|
8687
|
+
visibleClientTop = Math.max(visibleClientTop, ancestorRect.top);
|
|
8688
|
+
visibleClientBottom = Math.min(visibleClientBottom, ancestorRect.bottom);
|
|
8689
|
+
}
|
|
8690
|
+
if (visibleClientBottom <= visibleClientTop) return null;
|
|
8691
|
+
const parentRect = props.parent?.getBoundingClientRect?.();
|
|
8692
|
+
if (parentRect && Number.isFinite(parentRect.top) && Number.isFinite(parentRect.bottom)) {
|
|
8693
|
+
const intersectedTop = Math.max(visibleClientTop, parentRect.top);
|
|
8694
|
+
const intersectedBottom = Math.min(visibleClientBottom, parentRect.bottom);
|
|
8695
|
+
if (intersectedBottom > intersectedTop) {
|
|
8696
|
+
visibleClientTop = intersectedTop;
|
|
8697
|
+
visibleClientBottom = intersectedBottom;
|
|
8698
|
+
}
|
|
8699
|
+
}
|
|
8700
|
+
return {
|
|
8701
|
+
top: visibleClientTop - containerRect.top,
|
|
8702
|
+
bottom: visibleClientBottom - containerRect.top
|
|
8703
|
+
};
|
|
8770
8704
|
};
|
|
8771
8705
|
const instantAlignmentInstanceKey = (0, vue.computed)(() => {
|
|
8772
8706
|
if (!instantSidebarAlignmentThreadId.value) return null;
|
|
@@ -9374,7 +9308,7 @@ var _sfc_main$30 = {
|
|
|
9374
9308
|
};
|
|
9375
9309
|
}
|
|
9376
9310
|
};
|
|
9377
|
-
var FloatingComments_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$30, [["__scopeId", "data-v-
|
|
9311
|
+
var FloatingComments_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$30, [["__scopeId", "data-v-a1bd2282"]]);
|
|
9378
9312
|
var _hoisted_1$22 = {
|
|
9379
9313
|
class: "superdoc__pdf-comments-layer pdf-comments-layer",
|
|
9380
9314
|
"aria-hidden": "false"
|
|
@@ -13873,6 +13807,7 @@ var _hoisted_1$16 = {
|
|
|
13873
13807
|
var _hoisted_2$13 = ["innerHTML"];
|
|
13874
13808
|
var _hoisted_3$10 = { class: "superdoc__document document" };
|
|
13875
13809
|
var _hoisted_4$7 = { class: "floating-comments" };
|
|
13810
|
+
var UNAVAILABLE_COMMAND_RESULT = false;
|
|
13876
13811
|
var V2_SELECTION_TOOLBAR_SYNC_RETRY_FRAMES = 3;
|
|
13877
13812
|
var V2_TYPING_REVIEW_HYDRATION_IDLE_MS = 6500;
|
|
13878
13813
|
var V2_TYPING_REVIEW_HYDRATION_CEILING_MS = 8e3;
|
|
@@ -13993,19 +13928,19 @@ var _sfc_main$20 = {
|
|
|
13993
13928
|
const v2GeometryEpoch = (0, vue.ref)(null);
|
|
13994
13929
|
let v2GeometryRafHandle = 0;
|
|
13995
13930
|
const activeEditorRef = (0, vue.computed)(() => proxy.$superdoc.activeEditor);
|
|
13996
|
-
|
|
13931
|
+
const getSuperDocUI = () => proxy.$superdoc?.ui ?? null;
|
|
13932
|
+
const UNAVAILABLE_COMMAND_STATE = Object.freeze({
|
|
13933
|
+
enabled: false,
|
|
13934
|
+
active: false,
|
|
13935
|
+
supported: false
|
|
13936
|
+
});
|
|
13997
13937
|
const findReplace = useFindReplace({
|
|
13998
13938
|
getSurfaceManager: () => surfaceManager,
|
|
13999
13939
|
getActiveEditor: () => proxy.$superdoc?.activeEditor,
|
|
14000
13940
|
activeEditorRef,
|
|
14001
13941
|
getFindReplaceConfig: () => proxy.$superdoc?.config?.modules?.surfaces?.findReplace,
|
|
14002
|
-
getSuperDocUI
|
|
13942
|
+
getSuperDocUI
|
|
14003
13943
|
});
|
|
14004
|
-
const getLinkPopoverUi = () => {
|
|
14005
|
-
if (proxy.$superdoc?.toolbar?.ui) return proxy.$superdoc.toolbar.ui;
|
|
14006
|
-
if (!linkPopoverUi && proxy.$superdoc) linkPopoverUi = require_create_super_doc_ui.createSuperDocUI({ superdoc: proxy.$superdoc });
|
|
14007
|
-
return linkPopoverUi;
|
|
14008
|
-
};
|
|
14009
13944
|
const getLinkPopoverSurfaceManager = () => {
|
|
14010
13945
|
if (surfaceManager) return surfaceManager;
|
|
14011
13946
|
if (typeof proxy.$superdoc?.openSurface !== "function") return null;
|
|
@@ -14014,7 +13949,7 @@ var _sfc_main$20 = {
|
|
|
14014
13949
|
const linkPopover = useLinkPopover({
|
|
14015
13950
|
getSurfaceManager: getLinkPopoverSurfaceManager,
|
|
14016
13951
|
getActiveEditor: () => proxy.$superdoc?.activeEditor,
|
|
14017
|
-
getUi:
|
|
13952
|
+
getUi: getSuperDocUI,
|
|
14018
13953
|
getResolver: () => proxy.$superdoc?.config?.modules?.links?.popoverResolver,
|
|
14019
13954
|
getLayerElement: () => layers.value,
|
|
14020
13955
|
emitException: (payload) => {
|
|
@@ -14085,11 +14020,6 @@ var _sfc_main$20 = {
|
|
|
14085
14020
|
} catch (err) {
|
|
14086
14021
|
console.warn("[SuperDoc] v2 command-shortcut unbind failed", err);
|
|
14087
14022
|
}
|
|
14088
|
-
try {
|
|
14089
|
-
entry.ui?.destroy?.();
|
|
14090
|
-
} catch (err) {
|
|
14091
|
-
console.warn("[SuperDoc] v2 command-shortcut UI teardown failed", err);
|
|
14092
|
-
}
|
|
14093
14023
|
};
|
|
14094
14024
|
const resolveV2LinkWorkflowOpener = () => {
|
|
14095
14025
|
const toolbar = proxy.$superdoc?.toolbar;
|
|
@@ -14105,20 +14035,19 @@ var _sfc_main$20 = {
|
|
|
14105
14035
|
if (!documentId) return;
|
|
14106
14036
|
clearV2CommandShortcutBinding(documentId);
|
|
14107
14037
|
if (typeof bindEditShortcuts !== "function") return;
|
|
14108
|
-
const fallbackUi = require_create_super_doc_ui.createSuperDocUI({ superdoc: proxy.$superdoc });
|
|
14109
|
-
const resolveUi = () => proxy.$superdoc?.toolbar?.ui ?? fallbackUi;
|
|
14110
14038
|
const openLinkWorkflow = resolveV2LinkWorkflowOpener();
|
|
14111
14039
|
const unbind = bindEditShortcuts({
|
|
14112
14040
|
commandRoute: {
|
|
14113
|
-
executeAsync: (commandId, payload) =>
|
|
14114
|
-
|
|
14041
|
+
executeAsync: (commandId, payload) => {
|
|
14042
|
+
const ui = getSuperDocUI();
|
|
14043
|
+
if (!ui) return Promise.resolve(UNAVAILABLE_COMMAND_RESULT);
|
|
14044
|
+
return ui.commands.executeAsync(commandId, payload);
|
|
14045
|
+
},
|
|
14046
|
+
getState: (commandId) => getSuperDocUI()?.commands.get(commandId).getState() ?? UNAVAILABLE_COMMAND_STATE
|
|
14115
14047
|
},
|
|
14116
14048
|
...openLinkWorkflow ? { openLinkWorkflow } : {}
|
|
14117
14049
|
});
|
|
14118
|
-
v2CommandShortcutBindings.set(documentId, {
|
|
14119
|
-
unbind,
|
|
14120
|
-
ui: fallbackUi
|
|
14121
|
-
});
|
|
14050
|
+
v2CommandShortcutBindings.set(documentId, { unbind });
|
|
14122
14051
|
};
|
|
14123
14052
|
const clearV2SessionShortcutBinding = (documentId) => {
|
|
14124
14053
|
const entry = v2SessionShortcutBindings.get(documentId);
|
|
@@ -15670,8 +15599,6 @@ var _sfc_main$20 = {
|
|
|
15670
15599
|
passwordPrompt.destroy();
|
|
15671
15600
|
findReplace.destroy();
|
|
15672
15601
|
linkPopover.destroy();
|
|
15673
|
-
linkPopoverUi?.destroy?.();
|
|
15674
|
-
linkPopoverUi = null;
|
|
15675
15602
|
cancelScheduledV2DomSelectionSync();
|
|
15676
15603
|
cancelScheduledV2SelectionToolbarSync();
|
|
15677
15604
|
for (const documentId of Array.from(v2Runtimes.keys())) clearV2RuntimeRegistration(documentId);
|
|
@@ -16188,7 +16115,7 @@ var _sfc_main$20 = {
|
|
|
16188
16115
|
};
|
|
16189
16116
|
}
|
|
16190
16117
|
};
|
|
16191
|
-
var SuperDoc_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$20, [["__scopeId", "data-v-
|
|
16118
|
+
var SuperDoc_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$20, [["__scopeId", "data-v-41f40a40"]]);
|
|
16192
16119
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
16193
16120
|
var PINIA_DEVTOOLS_PLUGIN_ID = "dev.esm.pinia";
|
|
16194
16121
|
var piniaDevtoolsSuppressionState = {
|
|
@@ -33996,24 +33923,31 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
33996
33923
|
const uiFontFamily = (this.config?.uiDisplayFallbackFont || "").toString().trim() || "Arial, Helvetica, sans-serif";
|
|
33997
33924
|
this.toolbarContainer.style.setProperty("--sd-ui-font-family", uiFontFamily);
|
|
33998
33925
|
}
|
|
33999
|
-
|
|
34000
|
-
|
|
34001
|
-
|
|
34002
|
-
|
|
34003
|
-
|
|
34004
|
-
|
|
33926
|
+
try {
|
|
33927
|
+
this.#initController();
|
|
33928
|
+
this.#initToolbarGroups();
|
|
33929
|
+
this.#makeToolbarItems();
|
|
33930
|
+
this.#bindHostEvents();
|
|
33931
|
+
this._lastFontOptionsSignature = this.#fontOptionsSignature();
|
|
33932
|
+
if (!this.toolbarContainer) {
|
|
33933
|
+
this.updateToolbarState();
|
|
33934
|
+
return;
|
|
33935
|
+
}
|
|
33936
|
+
this.app = (0, vue.createApp)(Toolbar_default);
|
|
33937
|
+
this.app.directive("click-outside", v_click_outside_default);
|
|
33938
|
+
this.app.config.globalProperties.$toolbar = this;
|
|
33939
|
+
this.toolbar = this.app.mount(this.toolbarContainer);
|
|
34005
33940
|
this.updateToolbarState();
|
|
34006
|
-
|
|
33941
|
+
} catch (error) {
|
|
33942
|
+
try {
|
|
33943
|
+
this.destroy();
|
|
33944
|
+
} catch {}
|
|
33945
|
+
throw error;
|
|
34007
33946
|
}
|
|
34008
|
-
this.app = (0, vue.createApp)(Toolbar_default);
|
|
34009
|
-
this.app.directive("click-outside", v_click_outside_default);
|
|
34010
|
-
this.app.config.globalProperties.$toolbar = this;
|
|
34011
|
-
this.toolbar = this.app.mount(this.toolbarContainer);
|
|
34012
|
-
this.updateToolbarState();
|
|
34013
33947
|
}
|
|
34014
33948
|
#initController() {
|
|
34015
|
-
|
|
34016
|
-
|
|
33949
|
+
this.ui = this.superdoc?.ui ?? null;
|
|
33950
|
+
if (!this.ui) return;
|
|
34017
33951
|
this.snapshot = this.ui.toolbar.getSnapshot();
|
|
34018
33952
|
this._unsubscribeController = this.ui.toolbar.subscribe(() => {
|
|
34019
33953
|
this.snapshot = this.ui.toolbar.getSnapshot();
|
|
@@ -34034,9 +33968,6 @@ var BuiltInToolbar = class extends require_eventemitter3.import_eventemitter3.de
|
|
|
34034
33968
|
reg.unregister?.();
|
|
34035
33969
|
} catch {}
|
|
34036
33970
|
this._customCommandRegs.clear();
|
|
34037
|
-
try {
|
|
34038
|
-
this.ui?.destroy?.();
|
|
34039
|
-
} catch {}
|
|
34040
33971
|
this.ui = null;
|
|
34041
33972
|
this.snapshot = null;
|
|
34042
33973
|
}
|
|
@@ -34657,6 +34588,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
34657
34588
|
#v2LockUnsub = null;
|
|
34658
34589
|
#pendingV2LockSeed = null;
|
|
34659
34590
|
#mountWrapper = null;
|
|
34591
|
+
#ui = null;
|
|
34660
34592
|
#surfaceManager;
|
|
34661
34593
|
#editorRuntimeRegistry = new EditorRuntimeRegistry();
|
|
34662
34594
|
#editorRuntimeRegistryUnsub = null;
|
|
@@ -34763,7 +34695,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
34763
34695
|
this.config.colors = shuffleArray(this.config.colors);
|
|
34764
34696
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
34765
34697
|
this.colorIndex = 0;
|
|
34766
|
-
this.version = "2.0.0-next.
|
|
34698
|
+
this.version = "2.0.0-next.46";
|
|
34767
34699
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
34768
34700
|
this.superdocId = config.superdocId || require_uuid.v4_default();
|
|
34769
34701
|
this.colors = this.config.colors ?? [];
|
|
@@ -34815,6 +34747,13 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
34815
34747
|
get requiredNumberOfEditors() {
|
|
34816
34748
|
return this.#requireSuperdocStore("requiredNumberOfEditors").documents.filter((d) => d.type === DOCX).length;
|
|
34817
34749
|
}
|
|
34750
|
+
get ui() {
|
|
34751
|
+
if (!this.#ui) {
|
|
34752
|
+
this.#ui = require_create_super_doc_ui.createSuperDocUI({ superdoc: this });
|
|
34753
|
+
if (this.#destroyed) this.#ui.destroy();
|
|
34754
|
+
}
|
|
34755
|
+
return this.#ui;
|
|
34756
|
+
}
|
|
34818
34757
|
get state() {
|
|
34819
34758
|
return {
|
|
34820
34759
|
documents: this.#requireSuperdocStore("state").documents,
|
|
@@ -35522,10 +35461,12 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
35522
35461
|
return this.#fontsApi;
|
|
35523
35462
|
}
|
|
35524
35463
|
#clearActiveEditorProjection() {
|
|
35464
|
+
const hadActiveEditor = this.activeEditor !== null;
|
|
35525
35465
|
this.#teardownV2FontsRelay();
|
|
35526
35466
|
this.activeEditor = null;
|
|
35527
35467
|
if (this.toolbar?.setActiveEditor) this.toolbar.setActiveEditor(null);
|
|
35528
35468
|
else if (this.toolbar) this.toolbar.activeEditor = null;
|
|
35469
|
+
if (hadActiveEditor) this.emit("active-editor-change");
|
|
35529
35470
|
}
|
|
35530
35471
|
#v2FontsUnsub = null;
|
|
35531
35472
|
#teardownV2FontsRelay() {
|
|
@@ -35560,9 +35501,11 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
35560
35501
|
#setActiveEditorCompatibilityProjection(editor) {
|
|
35561
35502
|
if (isV2ActiveEditorFacade(editor)) {
|
|
35562
35503
|
if (!this.#applyingRuntimeActiveChange && this.#editorRuntimeRegistry.getActive()) this.#editorRuntimeRegistry.setActive(null, "set-active-v2-facade");
|
|
35504
|
+
const previous = this.activeEditor;
|
|
35563
35505
|
this.activeEditor = editor;
|
|
35564
35506
|
this.#wireV2FontsRelay(editor);
|
|
35565
35507
|
this.toolbar?.setActiveEditor?.(editor);
|
|
35508
|
+
if (previous !== this.activeEditor) this.emit("active-editor-change");
|
|
35566
35509
|
return;
|
|
35567
35510
|
}
|
|
35568
35511
|
this.#clearActiveEditorProjection();
|
|
@@ -36281,6 +36224,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
36281
36224
|
delete this.app.config.globalProperties.$config;
|
|
36282
36225
|
delete this.app.config.globalProperties.$superdoc;
|
|
36283
36226
|
}
|
|
36227
|
+
this.#ui?.destroy();
|
|
36284
36228
|
this.#cleanupCollaboration();
|
|
36285
36229
|
this.#editorRuntimeRegistryUnsub?.();
|
|
36286
36230
|
this.#editorRuntimeRegistryUnsub = null;
|