superdoc 2.13.0-next.1 → 2.13.0-next.11
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-BWWWNPP8.cjs → create-super-doc-ui-DNfQTF2k.cjs} +66 -6
- package/dist/chunks/{create-super-doc-ui-FnwgTkUv.es.js → create-super-doc-ui-XWtQHPGP.es.js} +66 -6
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/blocks/blocks.d.ts +3 -1
- package/dist/document-api/src/blocks/find-text.d.ts +3 -0
- package/dist/document-api/src/content-controls/content-controls.types.d.ts +1 -1
- package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
- package/dist/document-api/src/contract/operation-definitions.d.ts +11 -1
- package/dist/document-api/src/contract/operation-registry.d.ts +7 -2
- package/dist/document-api/src/index.d.ts +7 -6
- package/dist/document-api/src/invoke/invoke.d.ts +2 -1
- package/dist/document-api/src/types/blocks.types.d.ts +38 -0
- package/dist/document-api/src/types/mutation-plan.types.d.ts +28 -4
- package/dist/document-api/src/types/table-operations.types.d.ts +2 -0
- package/dist/layout-engine/dom-contract/src/data-attrs.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/page-content.d.ts +3 -2
- package/dist/layout-engine/painters/dom/src/renderer.d.ts +1 -0
- package/dist/public/collaboration-worker.cjs +9 -0
- package/dist/public/collaboration-worker.es.js +8 -0
- 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 +26 -26
- package/dist/style.layered.css +26 -26
- package/dist/superdoc/src/composables/use-viewport-fit.d.ts +1 -0
- package/dist/superdoc/src/core/collaboration/collaboration-exception.d.ts +2 -0
- package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +16 -5
- package/dist/superdoc/src/core/theme/create-theme.d.ts +32 -20
- package/dist/superdoc/src/core/types/index.d.ts +59 -71
- package/dist/superdoc/src/public/collaboration-worker.d.cts +18 -0
- package/dist/superdoc/src/public/collaboration-worker.d.ts +48 -0
- package/dist/superdoc/src/public/export-types.d.ts +23 -0
- package/dist/superdoc/src/public/index.d.cts +12 -0
- package/dist/superdoc/src/public/index.d.ts +3 -0
- package/dist/superdoc/src/public/ui/types.d.ts +18 -9
- package/dist/superdoc.cjs +384 -267
- package/dist/superdoc.es.js +384 -267
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +37 -37
- package/package.json +13 -2
package/dist/superdoc.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
|
|
|
4
4
|
const require_eventemitter3 = require("./chunks/eventemitter3-C_TAnXOl.cjs");
|
|
5
5
|
const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
|
|
6
6
|
const require_jszip = require("./chunks/jszip-D8mAFF-r.cjs");
|
|
7
|
-
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-
|
|
7
|
+
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-DNfQTF2k.cjs");
|
|
8
8
|
const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-SDR04tiH.cjs");
|
|
9
9
|
const require_constants = require("./chunks/constants-DpXuDx_g.cjs");
|
|
10
10
|
let vue = require("vue");
|
|
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
|
|
|
316
316
|
var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
317
317
|
function getSuperdocVersion() {
|
|
318
318
|
try {
|
|
319
|
-
return "2.13.0-next.
|
|
319
|
+
return "2.13.0-next.11";
|
|
320
320
|
} catch {
|
|
321
321
|
return "unknown";
|
|
322
322
|
}
|
|
@@ -5311,6 +5311,274 @@ function storeToRefs(store) {
|
|
|
5311
5311
|
return refs;
|
|
5312
5312
|
}
|
|
5313
5313
|
//#endregion
|
|
5314
|
+
//#region src/core/collaboration/resolve-v2-collaboration-target.ts
|
|
5315
|
+
/** Select the public spelling before validation; do not merge settings from different rooms. */
|
|
5316
|
+
function readCollaborationConfig(input) {
|
|
5317
|
+
return input.collaboration !== void 0 ? input.collaboration : input.v2Collaboration;
|
|
5318
|
+
}
|
|
5319
|
+
/**
|
|
5320
|
+
* Redact a connection URL for safe inclusion in diagnostics and artifacts.
|
|
5321
|
+
*
|
|
5322
|
+
* Strips the query string, fragment, and any embedded credentials (userinfo)
|
|
5323
|
+
* because those commonly carry auth tokens. Falls back to a coarse string scrub
|
|
5324
|
+
* when the value is not a parseable absolute URL so a malformed value with an
|
|
5325
|
+
* inline `?token=...` still cannot leak.
|
|
5326
|
+
*/
|
|
5327
|
+
function redactCollaborationUrl(url) {
|
|
5328
|
+
if (typeof url !== "string" || url.length === 0) return "<none>";
|
|
5329
|
+
try {
|
|
5330
|
+
const parsed = new URL(url);
|
|
5331
|
+
parsed.search = "";
|
|
5332
|
+
parsed.hash = "";
|
|
5333
|
+
parsed.username = "";
|
|
5334
|
+
parsed.password = "";
|
|
5335
|
+
const redactedQuery = url.includes("?") ? "?<redacted>" : "";
|
|
5336
|
+
return `${parsed.toString().replace(/\?$/, "")}${redactedQuery}`;
|
|
5337
|
+
} catch {
|
|
5338
|
+
const withoutCredentials = url.replace(/\/\/[^/@]+@/, "//");
|
|
5339
|
+
const cut = withoutCredentials.search(/[?#]/);
|
|
5340
|
+
if (cut === -1) return withoutCredentials;
|
|
5341
|
+
return `${withoutCredentials.slice(0, cut)}?<redacted>`;
|
|
5342
|
+
}
|
|
5343
|
+
}
|
|
5344
|
+
function normalizeNonEmptyString(value) {
|
|
5345
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
5346
|
+
}
|
|
5347
|
+
function normalizeWebsocketUrl(value) {
|
|
5348
|
+
if (typeof value !== "string" || value.length === 0) return null;
|
|
5349
|
+
try {
|
|
5350
|
+
const parsed = new URL(value);
|
|
5351
|
+
return parsed.protocol === "ws:" || parsed.protocol === "wss:" ? value : null;
|
|
5352
|
+
} catch {
|
|
5353
|
+
return null;
|
|
5354
|
+
}
|
|
5355
|
+
}
|
|
5356
|
+
function normalizeHttpUrl(value, baseUrl) {
|
|
5357
|
+
if (typeof value !== "string") return null;
|
|
5358
|
+
const normalized = value.trim();
|
|
5359
|
+
if (normalized.length === 0) return null;
|
|
5360
|
+
try {
|
|
5361
|
+
const parsed = new URL(normalized);
|
|
5362
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:" ? normalized : null;
|
|
5363
|
+
} catch {
|
|
5364
|
+
if (typeof baseUrl !== "string" || baseUrl.trim().length === 0) return null;
|
|
5365
|
+
try {
|
|
5366
|
+
const parsed = new URL(normalized, baseUrl);
|
|
5367
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:" ? parsed.href : null;
|
|
5368
|
+
} catch {
|
|
5369
|
+
return null;
|
|
5370
|
+
}
|
|
5371
|
+
}
|
|
5372
|
+
}
|
|
5373
|
+
function normalizeParams(value) {
|
|
5374
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
5375
|
+
const params = {};
|
|
5376
|
+
for (const [key, raw] of Object.entries(value)) if (typeof raw === "string") params[key] = raw;
|
|
5377
|
+
return Object.keys(params).length > 0 ? params : void 0;
|
|
5378
|
+
}
|
|
5379
|
+
function normalizeRoomMode(value) {
|
|
5380
|
+
if (value === void 0) return "join";
|
|
5381
|
+
return value === "join" || value === "create" ? value : null;
|
|
5382
|
+
}
|
|
5383
|
+
function invalidRoomMode() {
|
|
5384
|
+
return {
|
|
5385
|
+
ok: false,
|
|
5386
|
+
reason: "invalid-room-mode",
|
|
5387
|
+
message: "SuperDoc v2 collaboration roomMode must be either \"join\" or \"create\"."
|
|
5388
|
+
};
|
|
5389
|
+
}
|
|
5390
|
+
/** Provider-family token recognized on a v2Collaboration config object. */
|
|
5391
|
+
function readProviderType(candidate) {
|
|
5392
|
+
const raw = candidate.providerType;
|
|
5393
|
+
return typeof raw === "string" && raw.length > 0 ? raw.toLowerCase() : null;
|
|
5394
|
+
}
|
|
5395
|
+
/**
|
|
5396
|
+
* Detect whether a legacy collaboration block names a provider family that the
|
|
5397
|
+
* shipped single-doc v2 runtime cannot drive. Returns the offending family name
|
|
5398
|
+
* (for diagnostics) or `null` when the block carries no recognizable family.
|
|
5399
|
+
*/
|
|
5400
|
+
function detectUnsupportedLegacyFamily(legacy) {
|
|
5401
|
+
if (!legacy || typeof legacy !== "object") return null;
|
|
5402
|
+
const providerType = typeof legacy.providerType === "string" ? legacy.providerType.toLowerCase() : "";
|
|
5403
|
+
if (providerType === "hocuspocus") return "hocuspocus";
|
|
5404
|
+
if (providerType === "liveblocks") return "liveblocks";
|
|
5405
|
+
if (providerType === "superdoc") return "superdoc";
|
|
5406
|
+
if (legacy.ydoc != null || legacy.provider != null) return "external-ydoc-provider";
|
|
5407
|
+
return null;
|
|
5408
|
+
}
|
|
5409
|
+
/** Resolve a websocket-backed family (y-websocket / Hocuspocus). */
|
|
5410
|
+
function resolveWebsocketFamily(family, candidate) {
|
|
5411
|
+
const documentId = normalizeNonEmptyString(candidate.documentId);
|
|
5412
|
+
if (!documentId) return {
|
|
5413
|
+
ok: false,
|
|
5414
|
+
reason: "invalid-document-id",
|
|
5415
|
+
message: `SuperDoc v2 collaboration requires a non-empty collaboration.documentId for the "${family}" provider.`
|
|
5416
|
+
};
|
|
5417
|
+
const rawUrl = candidate.url ?? candidate.serverUrl;
|
|
5418
|
+
const serverUrl = normalizeWebsocketUrl(rawUrl);
|
|
5419
|
+
if (!serverUrl) return {
|
|
5420
|
+
ok: false,
|
|
5421
|
+
reason: "invalid-server-url",
|
|
5422
|
+
message: `SuperDoc v2 collaboration requires a valid ws:// or wss:// URL for the "${family}" provider (received: ${redactCollaborationUrl(rawUrl)}).`
|
|
5423
|
+
};
|
|
5424
|
+
const params = normalizeParams(candidate.params);
|
|
5425
|
+
const token = family === "hocuspocus" && typeof candidate.token === "function" ? candidate.token : family === "hocuspocus" ? normalizeNonEmptyString(candidate.token) : null;
|
|
5426
|
+
const roomMode = normalizeRoomMode(candidate.roomMode);
|
|
5427
|
+
if (!roomMode) return invalidRoomMode();
|
|
5428
|
+
return {
|
|
5429
|
+
ok: true,
|
|
5430
|
+
target: {
|
|
5431
|
+
providerFamily: family,
|
|
5432
|
+
documentId,
|
|
5433
|
+
roomMode,
|
|
5434
|
+
serverUrl,
|
|
5435
|
+
...params ? { params } : {},
|
|
5436
|
+
...token ? { token } : {}
|
|
5437
|
+
}
|
|
5438
|
+
};
|
|
5439
|
+
}
|
|
5440
|
+
function resolveProviderExtension(candidate) {
|
|
5441
|
+
const adapterId = normalizeNonEmptyString(candidate.adapterId);
|
|
5442
|
+
if (!adapterId) return {
|
|
5443
|
+
ok: false,
|
|
5444
|
+
reason: "invalid-adapter-id",
|
|
5445
|
+
message: "SuperDoc v2 provider extensions require a non-empty v2Collaboration.adapterId."
|
|
5446
|
+
};
|
|
5447
|
+
const documentId = normalizeNonEmptyString(candidate.documentId);
|
|
5448
|
+
if (!documentId) return {
|
|
5449
|
+
ok: false,
|
|
5450
|
+
reason: "invalid-document-id",
|
|
5451
|
+
message: "SuperDoc v2 provider extensions require a non-empty v2Collaboration.documentId."
|
|
5452
|
+
};
|
|
5453
|
+
const roomMode = normalizeRoomMode(candidate.roomMode);
|
|
5454
|
+
if (!roomMode) return invalidRoomMode();
|
|
5455
|
+
if (Object.prototype.hasOwnProperty.call(candidate, "providerOptions")) try {
|
|
5456
|
+
structuredClone(candidate.providerOptions);
|
|
5457
|
+
} catch {
|
|
5458
|
+
return {
|
|
5459
|
+
ok: false,
|
|
5460
|
+
reason: "invalid-provider-options",
|
|
5461
|
+
message: "SuperDoc v2 provider extension options must be structured-clone-safe."
|
|
5462
|
+
};
|
|
5463
|
+
}
|
|
5464
|
+
const token = typeof candidate.token === "function" ? candidate.token : normalizeNonEmptyString(candidate.token);
|
|
5465
|
+
return {
|
|
5466
|
+
ok: true,
|
|
5467
|
+
target: {
|
|
5468
|
+
providerFamily: "extension",
|
|
5469
|
+
adapterId,
|
|
5470
|
+
documentId,
|
|
5471
|
+
roomMode,
|
|
5472
|
+
...Object.prototype.hasOwnProperty.call(candidate, "providerOptions") ? { providerOptions: candidate.providerOptions } : {},
|
|
5473
|
+
...token ? { token } : {}
|
|
5474
|
+
}
|
|
5475
|
+
};
|
|
5476
|
+
}
|
|
5477
|
+
/** Resolve the Liveblocks family (exactly one of publicApiKey / authEndpoint). */
|
|
5478
|
+
function resolveLiveblocksFamily(candidate, authEndpointBaseUrl) {
|
|
5479
|
+
const documentId = normalizeNonEmptyString(candidate.documentId ?? candidate.roomId);
|
|
5480
|
+
if (!documentId) return {
|
|
5481
|
+
ok: false,
|
|
5482
|
+
reason: "invalid-document-id",
|
|
5483
|
+
message: "SuperDoc v2 collaboration requires a non-empty collaboration.documentId (or roomId) for the \"liveblocks\" provider."
|
|
5484
|
+
};
|
|
5485
|
+
const publicApiKey = normalizeNonEmptyString(candidate.publicApiKey);
|
|
5486
|
+
const roomMode = normalizeRoomMode(candidate.roomMode);
|
|
5487
|
+
if (!roomMode) return invalidRoomMode();
|
|
5488
|
+
const authEndpointRaw = candidate.authEndpoint;
|
|
5489
|
+
const hasAuthEndpoint = typeof authEndpointRaw === "string" && authEndpointRaw.length > 0;
|
|
5490
|
+
if (!publicApiKey && !hasAuthEndpoint) return {
|
|
5491
|
+
ok: false,
|
|
5492
|
+
reason: "missing-auth",
|
|
5493
|
+
message: "SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."
|
|
5494
|
+
};
|
|
5495
|
+
if (publicApiKey && hasAuthEndpoint) return {
|
|
5496
|
+
ok: false,
|
|
5497
|
+
reason: "mixed-auth",
|
|
5498
|
+
message: "SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."
|
|
5499
|
+
};
|
|
5500
|
+
if (publicApiKey) return {
|
|
5501
|
+
ok: true,
|
|
5502
|
+
target: {
|
|
5503
|
+
providerFamily: "liveblocks",
|
|
5504
|
+
documentId,
|
|
5505
|
+
roomMode,
|
|
5506
|
+
publicApiKey
|
|
5507
|
+
}
|
|
5508
|
+
};
|
|
5509
|
+
const authEndpoint = normalizeHttpUrl(authEndpointRaw, authEndpointBaseUrl);
|
|
5510
|
+
if (!authEndpoint) return {
|
|
5511
|
+
ok: false,
|
|
5512
|
+
reason: "invalid-auth-endpoint",
|
|
5513
|
+
message: "SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."
|
|
5514
|
+
};
|
|
5515
|
+
return {
|
|
5516
|
+
ok: true,
|
|
5517
|
+
target: {
|
|
5518
|
+
providerFamily: "liveblocks",
|
|
5519
|
+
documentId,
|
|
5520
|
+
roomMode,
|
|
5521
|
+
authEndpoint
|
|
5522
|
+
}
|
|
5523
|
+
};
|
|
5524
|
+
}
|
|
5525
|
+
/**
|
|
5526
|
+
* Resolve a constructor-time or upgrade-time collaboration request into a
|
|
5527
|
+
* supported v2 room target, or a stable redacted diagnostic.
|
|
5528
|
+
*/
|
|
5529
|
+
function resolveV2CollaborationTarget(input) {
|
|
5530
|
+
const { legacyCollaboration, documentType, documentCount, authEndpointBaseUrl } = input;
|
|
5531
|
+
const v2Collaboration = readCollaborationConfig(input);
|
|
5532
|
+
if (typeof documentCount === "number" && documentCount > 1) return {
|
|
5533
|
+
ok: false,
|
|
5534
|
+
reason: "unsupported-multi-document",
|
|
5535
|
+
message: `SuperDoc v2 collaboration supports exactly one document per room; received ${documentCount}.`
|
|
5536
|
+
};
|
|
5537
|
+
if (documentType != null && documentType !== "application/vnd.openxmlformats-officedocument.wordprocessingml.document") return {
|
|
5538
|
+
ok: false,
|
|
5539
|
+
reason: "unsupported-document-type",
|
|
5540
|
+
message: "SuperDoc v2 collaboration supports DOCX documents only."
|
|
5541
|
+
};
|
|
5542
|
+
if (!(v2Collaboration != null && typeof v2Collaboration === "object")) {
|
|
5543
|
+
const family = detectUnsupportedLegacyFamily(legacyCollaboration);
|
|
5544
|
+
if (family) {
|
|
5545
|
+
const reason = family === "external-ydoc-provider" ? "unsupported-legacy-provider" : "unsupported-provider-family";
|
|
5546
|
+
const redactedUrl = redactCollaborationUrl(legacyCollaboration?.url);
|
|
5547
|
+
return {
|
|
5548
|
+
ok: false,
|
|
5549
|
+
reason,
|
|
5550
|
+
message: family === "external-ydoc-provider" ? "SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a collaboration target (e.g. { providerType, documentId, url }) instead." : `SuperDoc v2 collaboration does not accept "${family}" through the legacy modules.collaboration block (server: ${redactedUrl}). Configure it as a document.collaboration target ({ providerType: "${family}", documentId, ... }) instead.`
|
|
5551
|
+
};
|
|
5552
|
+
}
|
|
5553
|
+
return {
|
|
5554
|
+
ok: false,
|
|
5555
|
+
reason: "missing-target",
|
|
5556
|
+
message: "SuperDoc v2 collaboration requires a collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."
|
|
5557
|
+
};
|
|
5558
|
+
}
|
|
5559
|
+
const candidate = v2Collaboration;
|
|
5560
|
+
if (Object.prototype.hasOwnProperty.call(candidate, "createIfMissing")) return {
|
|
5561
|
+
ok: false,
|
|
5562
|
+
reason: "invalid-room-mode",
|
|
5563
|
+
message: "SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: \"create\" for creation or roomMode: \"join\" for normal opens."
|
|
5564
|
+
};
|
|
5565
|
+
if (candidate.ydoc != null || candidate.provider != null) return {
|
|
5566
|
+
ok: false,
|
|
5567
|
+
reason: "unsupported-legacy-provider",
|
|
5568
|
+
message: "SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."
|
|
5569
|
+
};
|
|
5570
|
+
const providerType = readProviderType(candidate);
|
|
5571
|
+
if (providerType === null || providerType === "y-websocket") return resolveWebsocketFamily("y-websocket", candidate);
|
|
5572
|
+
if (providerType === "hocuspocus") return resolveWebsocketFamily("hocuspocus", candidate);
|
|
5573
|
+
if (providerType === "liveblocks") return resolveLiveblocksFamily(candidate, authEndpointBaseUrl);
|
|
5574
|
+
if (providerType === "extension") return resolveProviderExtension(candidate);
|
|
5575
|
+
return {
|
|
5576
|
+
ok: false,
|
|
5577
|
+
reason: "unsupported-provider-family",
|
|
5578
|
+
message: `SuperDoc v2 collaboration does not support the "${providerType}" provider family. Supported families are y-websocket, hocuspocus, liveblocks, and extension.`
|
|
5579
|
+
};
|
|
5580
|
+
}
|
|
5581
|
+
//#endregion
|
|
5314
5582
|
//#region src/core/helpers/file.js
|
|
5315
5583
|
/**
|
|
5316
5584
|
* @typedef {Object} UploadWrapper
|
|
@@ -5434,6 +5702,14 @@ var GENERIC_BINARY_MIME = "application/octet-stream";
|
|
|
5434
5702
|
* @returns {DocumentEntry|any} A normalized entry, or the original value when it is unsupported or unchanged
|
|
5435
5703
|
*/
|
|
5436
5704
|
var normalizeDocumentEntry = (entry) => {
|
|
5705
|
+
if (entry && typeof entry === "object" && Object.prototype.hasOwnProperty.call(entry, "collaboration")) {
|
|
5706
|
+
const source = { ...entry };
|
|
5707
|
+
delete source.collaboration;
|
|
5708
|
+
entry = {
|
|
5709
|
+
...source,
|
|
5710
|
+
v2Collaboration: readCollaborationConfig(entry)
|
|
5711
|
+
};
|
|
5712
|
+
}
|
|
5437
5713
|
if (isDocumentByteSource(entry)) return {
|
|
5438
5714
|
type: DOCX,
|
|
5439
5715
|
data: documentByteSourceToUint8Array(entry),
|
|
@@ -5455,6 +5731,7 @@ var normalizeDocumentEntry = (entry) => {
|
|
|
5455
5731
|
});
|
|
5456
5732
|
else if (hasGenericType && inferredType && typeof Blob === "function" && maybeFile instanceof Blob) data = new Blob([maybeFile], { type });
|
|
5457
5733
|
return {
|
|
5734
|
+
...entry.v2Collaboration !== void 0 ? { v2Collaboration: entry.v2Collaboration } : {},
|
|
5458
5735
|
type,
|
|
5459
5736
|
data,
|
|
5460
5737
|
name
|
|
@@ -14423,6 +14700,47 @@ var normalizePdfPageMeasurement = (measured, scaleFactor, zoomFactor) => {
|
|
|
14423
14700
|
if (Number.isFinite(scaleFactor) && scaleFactor > 0) return measured / scaleFactor * require_constants.PDF_TO_CSS_UNITS;
|
|
14424
14701
|
return zoomFactor > 0 ? measured / zoomFactor : measured;
|
|
14425
14702
|
};
|
|
14703
|
+
var resolveV2WidestPageWidth = (snapshot) => {
|
|
14704
|
+
if (!snapshot || typeof snapshot !== "object") return 0;
|
|
14705
|
+
const published = snapshot.widestPageWidthPx;
|
|
14706
|
+
if (typeof published === "number" && Number.isFinite(published)) return published;
|
|
14707
|
+
let widestPage = 0;
|
|
14708
|
+
const pages = snapshot.pages;
|
|
14709
|
+
if (Array.isArray(pages)) for (const page of pages) {
|
|
14710
|
+
const width = page?.base?.widthPx;
|
|
14711
|
+
if (typeof width === "number" && Number.isFinite(width) && width > widestPage) widestPage = width;
|
|
14712
|
+
}
|
|
14713
|
+
return widestPage;
|
|
14714
|
+
};
|
|
14715
|
+
var resolveEditorPageWidth = (editor) => {
|
|
14716
|
+
if (!editor) return null;
|
|
14717
|
+
let widestPage = 0;
|
|
14718
|
+
try {
|
|
14719
|
+
widestPage = resolveV2WidestPageWidth(editor.pageMetrics?.getSnapshot?.());
|
|
14720
|
+
} catch {
|
|
14721
|
+
widestPage = 0;
|
|
14722
|
+
}
|
|
14723
|
+
if (widestPage > 0) return widestPage;
|
|
14724
|
+
try {
|
|
14725
|
+
const pages = editor.getPages?.();
|
|
14726
|
+
if (Array.isArray(pages)) for (const page of pages) {
|
|
14727
|
+
const width = page?.size?.w;
|
|
14728
|
+
if (typeof width === "number" && Number.isFinite(width) && width > widestPage) widestPage = width;
|
|
14729
|
+
}
|
|
14730
|
+
} catch {
|
|
14731
|
+
widestPage = 0;
|
|
14732
|
+
}
|
|
14733
|
+
if (widestPage > 0) return widestPage;
|
|
14734
|
+
let pageStyles = null;
|
|
14735
|
+
try {
|
|
14736
|
+
pageStyles = editor.getPageStyles?.() ?? null;
|
|
14737
|
+
} catch {
|
|
14738
|
+
pageStyles = null;
|
|
14739
|
+
}
|
|
14740
|
+
const pageWidthInches = pageStyles?.pageSize?.width;
|
|
14741
|
+
if (typeof pageWidthInches === "number" && Number.isFinite(pageWidthInches) && pageWidthInches > 0) return pageWidthInches * CSS_PX_PER_INCH;
|
|
14742
|
+
return null;
|
|
14743
|
+
};
|
|
14426
14744
|
/**
|
|
14427
14745
|
* Viewport fit tracking. Maintains pure viewport metrics (available width,
|
|
14428
14746
|
* document base width, fit zoom), stores them for `getViewportMetrics()`,
|
|
@@ -14447,29 +14765,6 @@ var normalizePdfPageMeasurement = (measured, scaleFactor, zoomFactor) => {
|
|
|
14447
14765
|
* unmount hook).
|
|
14448
14766
|
*/
|
|
14449
14767
|
function useViewportFit({ getSuperdoc, superdocContainerWidth, isReady, activeZoom, zoomMode, viewportMetrics, showCommentsSidebar, rightSidebarRef, superdocRoot, documents }) {
|
|
14450
|
-
const resolveEditorPageWidth = (editor) => {
|
|
14451
|
-
if (!editor) return null;
|
|
14452
|
-
let widestPage = 0;
|
|
14453
|
-
try {
|
|
14454
|
-
const pages = editor.getPages?.();
|
|
14455
|
-
if (Array.isArray(pages)) for (const page of pages) {
|
|
14456
|
-
const width = page?.size?.w;
|
|
14457
|
-
if (typeof width === "number" && Number.isFinite(width) && width > widestPage) widestPage = width;
|
|
14458
|
-
}
|
|
14459
|
-
} catch {
|
|
14460
|
-
widestPage = 0;
|
|
14461
|
-
}
|
|
14462
|
-
if (widestPage > 0) return widestPage;
|
|
14463
|
-
let pageStyles = null;
|
|
14464
|
-
try {
|
|
14465
|
-
pageStyles = editor.getPageStyles?.() ?? null;
|
|
14466
|
-
} catch {
|
|
14467
|
-
pageStyles = null;
|
|
14468
|
-
}
|
|
14469
|
-
const pageWidthInches = pageStyles?.pageSize?.width;
|
|
14470
|
-
if (typeof pageWidthInches === "number" && Number.isFinite(pageWidthInches) && pageWidthInches > 0) return pageWidthInches * CSS_PX_PER_INCH;
|
|
14471
|
-
return null;
|
|
14472
|
-
};
|
|
14473
14768
|
const resolvePdfPageWidth = () => {
|
|
14474
14769
|
if (!(documents?.value ?? []).some((doc) => doc?.type === "application/pdf")) return null;
|
|
14475
14770
|
const root = superdocRoot.value;
|
|
@@ -20472,228 +20767,31 @@ function unmarkRuntimeRoot(root) {
|
|
|
20472
20767
|
root.removeAttribute(RUNTIME_ROOT_ATTRIBUTE);
|
|
20473
20768
|
}
|
|
20474
20769
|
//#endregion
|
|
20475
|
-
//#region src/core/collaboration/
|
|
20476
|
-
|
|
20477
|
-
|
|
20478
|
-
|
|
20479
|
-
|
|
20480
|
-
|
|
20481
|
-
|
|
20482
|
-
|
|
20483
|
-
|
|
20484
|
-
|
|
20485
|
-
|
|
20486
|
-
|
|
20487
|
-
|
|
20488
|
-
|
|
20489
|
-
|
|
20490
|
-
|
|
20491
|
-
|
|
20492
|
-
|
|
20493
|
-
return `${parsed.toString().replace(/\?$/, "")}${redactedQuery}`;
|
|
20494
|
-
} catch {
|
|
20495
|
-
const withoutCredentials = url.replace(/\/\/[^/@]+@/, "//");
|
|
20496
|
-
const cut = withoutCredentials.search(/[?#]/);
|
|
20497
|
-
if (cut === -1) return withoutCredentials;
|
|
20498
|
-
return `${withoutCredentials.slice(0, cut)}?<redacted>`;
|
|
20499
|
-
}
|
|
20500
|
-
}
|
|
20501
|
-
function normalizeNonEmptyString(value) {
|
|
20502
|
-
return typeof value === "string" && value.length > 0 ? value : null;
|
|
20503
|
-
}
|
|
20504
|
-
function normalizeWebsocketUrl(value) {
|
|
20505
|
-
if (typeof value !== "string" || value.length === 0) return null;
|
|
20506
|
-
try {
|
|
20507
|
-
const parsed = new URL(value);
|
|
20508
|
-
return parsed.protocol === "ws:" || parsed.protocol === "wss:" ? value : null;
|
|
20509
|
-
} catch {
|
|
20510
|
-
return null;
|
|
20511
|
-
}
|
|
20512
|
-
}
|
|
20513
|
-
function normalizeHttpUrl(value, baseUrl) {
|
|
20514
|
-
if (typeof value !== "string") return null;
|
|
20515
|
-
const normalized = value.trim();
|
|
20516
|
-
if (normalized.length === 0) return null;
|
|
20517
|
-
try {
|
|
20518
|
-
const parsed = new URL(normalized);
|
|
20519
|
-
return parsed.protocol === "http:" || parsed.protocol === "https:" ? normalized : null;
|
|
20520
|
-
} catch {
|
|
20521
|
-
if (typeof baseUrl !== "string" || baseUrl.trim().length === 0) return null;
|
|
20522
|
-
try {
|
|
20523
|
-
const parsed = new URL(normalized, baseUrl);
|
|
20524
|
-
return parsed.protocol === "http:" || parsed.protocol === "https:" ? parsed.href : null;
|
|
20525
|
-
} catch {
|
|
20526
|
-
return null;
|
|
20527
|
-
}
|
|
20528
|
-
}
|
|
20529
|
-
}
|
|
20530
|
-
function normalizeParams(value) {
|
|
20531
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
20532
|
-
const params = {};
|
|
20533
|
-
for (const [key, raw] of Object.entries(value)) if (typeof raw === "string") params[key] = raw;
|
|
20534
|
-
return Object.keys(params).length > 0 ? params : void 0;
|
|
20535
|
-
}
|
|
20536
|
-
function normalizeRoomMode(value) {
|
|
20537
|
-
if (value === void 0) return "join";
|
|
20538
|
-
return value === "join" || value === "create" ? value : null;
|
|
20539
|
-
}
|
|
20540
|
-
function invalidRoomMode() {
|
|
20541
|
-
return {
|
|
20542
|
-
ok: false,
|
|
20543
|
-
reason: "invalid-room-mode",
|
|
20544
|
-
message: "SuperDoc v2 collaboration roomMode must be either \"join\" or \"create\"."
|
|
20545
|
-
};
|
|
20546
|
-
}
|
|
20547
|
-
/** Provider-family token recognized on a v2Collaboration config object. */
|
|
20548
|
-
function readProviderType(candidate) {
|
|
20549
|
-
const raw = candidate.providerType;
|
|
20550
|
-
return typeof raw === "string" && raw.length > 0 ? raw.toLowerCase() : null;
|
|
20551
|
-
}
|
|
20552
|
-
/**
|
|
20553
|
-
* Detect whether a legacy collaboration block names a provider family that the
|
|
20554
|
-
* shipped single-doc v2 runtime cannot drive. Returns the offending family name
|
|
20555
|
-
* (for diagnostics) or `null` when the block carries no recognizable family.
|
|
20556
|
-
*/
|
|
20557
|
-
function detectUnsupportedLegacyFamily(legacy) {
|
|
20558
|
-
if (!legacy || typeof legacy !== "object") return null;
|
|
20559
|
-
const providerType = typeof legacy.providerType === "string" ? legacy.providerType.toLowerCase() : "";
|
|
20560
|
-
if (providerType === "hocuspocus") return "hocuspocus";
|
|
20561
|
-
if (providerType === "liveblocks") return "liveblocks";
|
|
20562
|
-
if (providerType === "superdoc") return "superdoc";
|
|
20563
|
-
if (legacy.ydoc != null || legacy.provider != null) return "external-ydoc-provider";
|
|
20564
|
-
return null;
|
|
20565
|
-
}
|
|
20566
|
-
/** Resolve a websocket-backed family (y-websocket / Hocuspocus). */
|
|
20567
|
-
function resolveWebsocketFamily(family, candidate) {
|
|
20568
|
-
const documentId = normalizeNonEmptyString(candidate.documentId);
|
|
20569
|
-
if (!documentId) return {
|
|
20570
|
-
ok: false,
|
|
20571
|
-
reason: "invalid-document-id",
|
|
20572
|
-
message: `SuperDoc v2 collaboration requires a non-empty v2Collaboration.documentId for the "${family}" provider.`
|
|
20573
|
-
};
|
|
20574
|
-
const rawUrl = candidate.url ?? candidate.serverUrl;
|
|
20575
|
-
const serverUrl = normalizeWebsocketUrl(rawUrl);
|
|
20576
|
-
if (!serverUrl) return {
|
|
20577
|
-
ok: false,
|
|
20578
|
-
reason: "invalid-server-url",
|
|
20579
|
-
message: `SuperDoc v2 collaboration requires a valid ws:// or wss:// URL for the "${family}" provider (received: ${redactCollaborationUrl(rawUrl)}).`
|
|
20580
|
-
};
|
|
20581
|
-
const params = normalizeParams(candidate.params);
|
|
20582
|
-
const token = family === "hocuspocus" ? normalizeNonEmptyString(candidate.token) : null;
|
|
20583
|
-
const roomMode = normalizeRoomMode(candidate.roomMode);
|
|
20584
|
-
if (!roomMode) return invalidRoomMode();
|
|
20585
|
-
return {
|
|
20586
|
-
ok: true,
|
|
20587
|
-
target: {
|
|
20588
|
-
providerFamily: family,
|
|
20589
|
-
documentId,
|
|
20590
|
-
roomMode,
|
|
20591
|
-
serverUrl,
|
|
20592
|
-
...params ? { params } : {},
|
|
20593
|
-
...token ? { token } : {}
|
|
20594
|
-
}
|
|
20595
|
-
};
|
|
20596
|
-
}
|
|
20597
|
-
/** Resolve the Liveblocks family (exactly one of publicApiKey / authEndpoint). */
|
|
20598
|
-
function resolveLiveblocksFamily(candidate, authEndpointBaseUrl) {
|
|
20599
|
-
const documentId = normalizeNonEmptyString(candidate.documentId ?? candidate.roomId);
|
|
20600
|
-
if (!documentId) return {
|
|
20601
|
-
ok: false,
|
|
20602
|
-
reason: "invalid-document-id",
|
|
20603
|
-
message: "SuperDoc v2 collaboration requires a non-empty v2Collaboration.documentId (or roomId) for the \"liveblocks\" provider."
|
|
20604
|
-
};
|
|
20605
|
-
const publicApiKey = normalizeNonEmptyString(candidate.publicApiKey);
|
|
20606
|
-
const roomMode = normalizeRoomMode(candidate.roomMode);
|
|
20607
|
-
if (!roomMode) return invalidRoomMode();
|
|
20608
|
-
const authEndpointRaw = candidate.authEndpoint;
|
|
20609
|
-
const hasAuthEndpoint = typeof authEndpointRaw === "string" && authEndpointRaw.length > 0;
|
|
20610
|
-
if (!publicApiKey && !hasAuthEndpoint) return {
|
|
20611
|
-
ok: false,
|
|
20612
|
-
reason: "missing-auth",
|
|
20613
|
-
message: "SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."
|
|
20614
|
-
};
|
|
20615
|
-
if (publicApiKey && hasAuthEndpoint) return {
|
|
20616
|
-
ok: false,
|
|
20617
|
-
reason: "mixed-auth",
|
|
20618
|
-
message: "SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."
|
|
20619
|
-
};
|
|
20620
|
-
if (publicApiKey) return {
|
|
20621
|
-
ok: true,
|
|
20622
|
-
target: {
|
|
20623
|
-
providerFamily: "liveblocks",
|
|
20624
|
-
documentId,
|
|
20625
|
-
roomMode,
|
|
20626
|
-
publicApiKey
|
|
20627
|
-
}
|
|
20628
|
-
};
|
|
20629
|
-
const authEndpoint = normalizeHttpUrl(authEndpointRaw, authEndpointBaseUrl);
|
|
20630
|
-
if (!authEndpoint) return {
|
|
20631
|
-
ok: false,
|
|
20632
|
-
reason: "invalid-auth-endpoint",
|
|
20633
|
-
message: "SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."
|
|
20634
|
-
};
|
|
20635
|
-
return {
|
|
20636
|
-
ok: true,
|
|
20637
|
-
target: {
|
|
20638
|
-
providerFamily: "liveblocks",
|
|
20639
|
-
documentId,
|
|
20640
|
-
roomMode,
|
|
20641
|
-
authEndpoint
|
|
20642
|
-
}
|
|
20643
|
-
};
|
|
20644
|
-
}
|
|
20645
|
-
/**
|
|
20646
|
-
* Resolve a constructor-time or upgrade-time collaboration request into a
|
|
20647
|
-
* supported v2 room target, or a stable redacted diagnostic.
|
|
20648
|
-
*/
|
|
20649
|
-
function resolveV2CollaborationTarget(input) {
|
|
20650
|
-
const { v2Collaboration, legacyCollaboration, documentType, documentCount, authEndpointBaseUrl } = input;
|
|
20651
|
-
if (typeof documentCount === "number" && documentCount > 1) return {
|
|
20652
|
-
ok: false,
|
|
20653
|
-
reason: "unsupported-multi-document",
|
|
20654
|
-
message: `SuperDoc v2 collaboration supports exactly one document per room; received ${documentCount}.`
|
|
20655
|
-
};
|
|
20656
|
-
if (documentType != null && documentType !== "application/vnd.openxmlformats-officedocument.wordprocessingml.document") return {
|
|
20657
|
-
ok: false,
|
|
20658
|
-
reason: "unsupported-document-type",
|
|
20659
|
-
message: "SuperDoc v2 collaboration supports DOCX documents only."
|
|
20660
|
-
};
|
|
20661
|
-
if (!(v2Collaboration != null && typeof v2Collaboration === "object")) {
|
|
20662
|
-
const family = detectUnsupportedLegacyFamily(legacyCollaboration);
|
|
20663
|
-
if (family) {
|
|
20664
|
-
const reason = family === "external-ydoc-provider" ? "unsupported-legacy-provider" : "unsupported-provider-family";
|
|
20665
|
-
const redactedUrl = redactCollaborationUrl(legacyCollaboration?.url);
|
|
20666
|
-
return {
|
|
20667
|
-
ok: false,
|
|
20668
|
-
reason,
|
|
20669
|
-
message: family === "external-ydoc-provider" ? "SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a v2Collaboration target (e.g. { providerType, documentId, url }) instead." : `SuperDoc v2 collaboration does not accept "${family}" through the legacy modules.collaboration block (server: ${redactedUrl}). Configure it as a v2Collaboration target ({ providerType: "${family}", documentId, ... }) instead.`
|
|
20670
|
-
};
|
|
20671
|
-
}
|
|
20672
|
-
return {
|
|
20673
|
-
ok: false,
|
|
20674
|
-
reason: "missing-target",
|
|
20675
|
-
message: "SuperDoc v2 collaboration requires a v2Collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."
|
|
20676
|
-
};
|
|
20770
|
+
//#region src/core/collaboration/collaboration-exception.ts
|
|
20771
|
+
function createCollaborationException(code, documentId) {
|
|
20772
|
+
let collaborationReason;
|
|
20773
|
+
let message;
|
|
20774
|
+
switch (code) {
|
|
20775
|
+
case "collaboration-access-denied":
|
|
20776
|
+
collaborationReason = "access-denied";
|
|
20777
|
+
message = "The collaboration server rejected access to this room.";
|
|
20778
|
+
break;
|
|
20779
|
+
case "collaboration-connection-failed":
|
|
20780
|
+
collaborationReason = "connection-failed";
|
|
20781
|
+
message = "The collaboration connection failed.";
|
|
20782
|
+
break;
|
|
20783
|
+
case "collaboration-sync-timeout":
|
|
20784
|
+
collaborationReason = "sync-timeout";
|
|
20785
|
+
message = "The collaboration room did not finish synchronizing in time.";
|
|
20786
|
+
break;
|
|
20787
|
+
default: return null;
|
|
20677
20788
|
}
|
|
20678
|
-
const candidate = v2Collaboration;
|
|
20679
|
-
if (Object.prototype.hasOwnProperty.call(candidate, "createIfMissing")) return {
|
|
20680
|
-
ok: false,
|
|
20681
|
-
reason: "invalid-room-mode",
|
|
20682
|
-
message: "SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: \"create\" for creation or roomMode: \"join\" for normal opens."
|
|
20683
|
-
};
|
|
20684
|
-
if (candidate.ydoc != null || candidate.provider != null) return {
|
|
20685
|
-
ok: false,
|
|
20686
|
-
reason: "unsupported-legacy-provider",
|
|
20687
|
-
message: "SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a v2Collaboration target ({ providerType, documentId, url | publicApiKey | authEndpoint }) instead."
|
|
20688
|
-
};
|
|
20689
|
-
const providerType = readProviderType(candidate);
|
|
20690
|
-
if (providerType === null || providerType === "y-websocket") return resolveWebsocketFamily("y-websocket", candidate);
|
|
20691
|
-
if (providerType === "hocuspocus") return resolveWebsocketFamily("hocuspocus", candidate);
|
|
20692
|
-
if (providerType === "liveblocks") return resolveLiveblocksFamily(candidate, authEndpointBaseUrl);
|
|
20693
20789
|
return {
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20790
|
+
error: new Error(message),
|
|
20791
|
+
code,
|
|
20792
|
+
collaborationReason,
|
|
20793
|
+
documentId,
|
|
20794
|
+
editor: null
|
|
20697
20795
|
};
|
|
20698
20796
|
}
|
|
20699
20797
|
//#endregion
|
|
@@ -21888,6 +21986,10 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
21888
21986
|
const clearV2RuntimeRegistration = (documentId) => {
|
|
21889
21987
|
clearV2CommandShortcutBinding(documentId);
|
|
21890
21988
|
clearV2SessionShortcutBinding(documentId);
|
|
21989
|
+
const document = getDocument(documentId);
|
|
21990
|
+
const provider = document?.provider ?? null;
|
|
21991
|
+
if (provider && proxy.$superdoc.provider === provider) proxy.$superdoc.provider = void 0;
|
|
21992
|
+
if (document && provider?.sendStateless) document.provider = null;
|
|
21891
21993
|
const entry = v2Runtimes.get(documentId);
|
|
21892
21994
|
if (!entry) return;
|
|
21893
21995
|
proxy.$superdoc.unregisterEditorRuntime(entry.runtimeId);
|
|
@@ -22076,7 +22178,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22076
22178
|
clearV2EditorFailure(payload.documentId ?? null);
|
|
22077
22179
|
clearV2AuthorRequired(payload.documentId ?? null);
|
|
22078
22180
|
clearV2EditRejected(payload.documentId ?? null);
|
|
22079
|
-
const { host, mount, documentId, capabilities, editCommands, bindEditShortcuts, bindSessionShortcuts, commentsAdapter, trackedChangesAdapter, contextMenu, documentApi, documentMutationReadiness, documentApiUnavailableReason, pageMetrics, pageLayout, pageFurniture, presence, lock, fonts, replaceFile, upgradeToCollaboration, documentOpenToken } = payload;
|
|
22181
|
+
const { host, mount, documentId, capabilities, editCommands, bindEditShortcuts, bindSessionShortcuts, commentsAdapter, trackedChangesAdapter, contextMenu, documentApi, documentMutationReadiness, documentApiUnavailableReason, pageMetrics, pageLayout, pageFurniture, presence, lock, collaborationProvider, fonts, replaceFile, upgradeToCollaboration, documentOpenToken } = payload;
|
|
22080
22182
|
documentOpenTelemetry?.trackDocumentOpen(documentOpenToken ?? null, documentId ?? null);
|
|
22081
22183
|
const saveV2Bytes = async (saveOptions = {}) => {
|
|
22082
22184
|
if (!host || typeof host.save !== "function") throw new Error("v2-editor: save unavailable");
|
|
@@ -22351,6 +22453,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22351
22453
|
pageFurniture: pageFurniture ?? null,
|
|
22352
22454
|
presence: presence ?? null,
|
|
22353
22455
|
lock: lock ?? null,
|
|
22456
|
+
provider: collaborationProvider ?? null,
|
|
22354
22457
|
reviewWindow: {
|
|
22355
22458
|
getDiagnostics: () => v2ReviewWindowController.getDiagnostics(),
|
|
22356
22459
|
getSnapshot: () => v2ReviewWindowController.getSnapshot?.() ?? null,
|
|
@@ -22385,6 +22488,11 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22385
22488
|
proxy.$superdoc.setActiveEditor(facade);
|
|
22386
22489
|
syncV2EditRejectedActiveDocument();
|
|
22387
22490
|
}
|
|
22491
|
+
if (collaborationProvider) {
|
|
22492
|
+
const provider = (0, vue.markRaw)(collaborationProvider);
|
|
22493
|
+
proxy.$superdoc.provider = provider;
|
|
22494
|
+
if (doc) doc.provider = provider;
|
|
22495
|
+
}
|
|
22388
22496
|
proxy.$superdoc.broadcastEditorCreate(facade);
|
|
22389
22497
|
installV2CommandShortcutBinding({
|
|
22390
22498
|
documentId,
|
|
@@ -22902,7 +23010,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22902
23010
|
case "worker-init-failed": return "SuperDoc could not load the document editor because the browser worker failed to start.";
|
|
22903
23011
|
case "input-too-large-for-inline-review": return "SuperDoc could not load the document editor because this document is too large to open without the browser worker.";
|
|
22904
23012
|
case "collaboration-unsupported-huge-document": return "SuperDoc could not load the document editor because large documents cannot be opened with collaboration enabled yet.";
|
|
22905
|
-
case "collaboration-v1-config-unsupported": return "SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.
|
|
23013
|
+
case "collaboration-v1-config-unsupported": return "SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.collaboration with a v2 room instead.";
|
|
22906
23014
|
case "collaboration-room-format-unsupported": return "SuperDoc v2 cannot open this collaboration state because it is not stored in the SuperDoc v2 room format. No changes were made.";
|
|
22907
23015
|
case "collaboration-room-format-conflict": return "SuperDoc v2 found conflicting room formats in one collaboration document. No changes were made.";
|
|
22908
23016
|
case "collaboration-room-corrupt": return "SuperDoc v2 found a structurally invalid collaboration room. No changes were made.";
|
|
@@ -22920,7 +23028,8 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22920
23028
|
const reason = typeof payload?.reason === "string" && payload.reason.length > 0 ? payload.reason : "open-failed";
|
|
22921
23029
|
const detail = normalizeV2EditorFailureDetail(payload?.detail);
|
|
22922
23030
|
const documentId = typeof payload?.documentId === "string" && payload.documentId.length > 0 ? payload.documentId : null;
|
|
22923
|
-
const
|
|
23031
|
+
const collaborationException = createCollaborationException(reason, documentId);
|
|
23032
|
+
const message = collaborationException?.error.message ?? getV2EditorFailureMessage(reason);
|
|
22924
23033
|
const workerFailure = payload?.workerFailure && typeof payload.workerFailure === "object" ? payload.workerFailure : null;
|
|
22925
23034
|
setV2EditorFailure(documentId, {
|
|
22926
23035
|
reason,
|
|
@@ -22936,7 +23045,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
22936
23045
|
};
|
|
22937
23046
|
if (reason === "collaboration-v1-config-unsupported" || reason === "collaboration-room-format-unsupported" || reason === "collaboration-room-format-conflict" || reason === "collaboration-room-corrupt" || reason === "collaboration-v2-room-missing" || reason === "collaboration-v2-room-already-exists" || reason === "collaboration-v2-room-initializing" || reason === "collaboration-open-intent-invalid" || reason === "collaboration-config-invalid") console.warn(`[SuperDoc] ${message}`, logContext);
|
|
22938
23047
|
else console.error(`[SuperDoc] ${message}`, logContext);
|
|
22939
|
-
proxy.$superdoc.emit("exception", {
|
|
23048
|
+
proxy.$superdoc.emit("exception", collaborationException ?? {
|
|
22940
23049
|
error: new Error(message),
|
|
22941
23050
|
code: reason,
|
|
22942
23051
|
...documentId ? { documentId } : {},
|
|
@@ -24160,7 +24269,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
|
|
|
24160
24269
|
], 38);
|
|
24161
24270
|
};
|
|
24162
24271
|
}
|
|
24163
|
-
}, [["__scopeId", "data-v-
|
|
24272
|
+
}, [["__scopeId", "data-v-ebe9a1fb"]]);
|
|
24164
24273
|
//#endregion
|
|
24165
24274
|
//#region src/core/create-app.js
|
|
24166
24275
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
@@ -39604,7 +39713,7 @@ var _sfc_main$15 = {
|
|
|
39604
39713
|
const emit = __emit;
|
|
39605
39714
|
const props = __props;
|
|
39606
39715
|
const isOverflowMenuOpened = (0, vue.computed)(() => props.toolbarItem.expand.value);
|
|
39607
|
-
const hasOpenDropdown = (0, vue.
|
|
39716
|
+
const hasOpenDropdown = (0, vue.computed)(() => props.overflowItems.some((item) => item.type === "dropdown" && (0, vue.unref)(item.expand)));
|
|
39608
39717
|
const overflowToolbarItem = (0, vue.computed)(() => ({
|
|
39609
39718
|
...props.toolbarItem,
|
|
39610
39719
|
active: isOverflowMenuOpened.value
|
|
@@ -39650,8 +39759,7 @@ var _sfc_main$15 = {
|
|
|
39650
39759
|
"ui-font-family": props.uiFontFamily,
|
|
39651
39760
|
"from-overflow": "",
|
|
39652
39761
|
onMousedown: (0, vue.unref)(preventEditorFocusTransfer),
|
|
39653
|
-
onCommand: handleCommand
|
|
39654
|
-
onDropdownUpdateShow: _cache[0] || (_cache[0] = ($event) => hasOpenDropdown.value = $event)
|
|
39762
|
+
onCommand: handleCommand
|
|
39655
39763
|
}, null, 8, [
|
|
39656
39764
|
"toolbar-items",
|
|
39657
39765
|
"ui-font-family",
|
|
@@ -39667,7 +39775,7 @@ var _sfc_main$15 = {
|
|
|
39667
39775
|
};
|
|
39668
39776
|
}
|
|
39669
39777
|
};
|
|
39670
|
-
var OverflowMenu_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$15, [["__scopeId", "data-v-
|
|
39778
|
+
var OverflowMenu_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(_sfc_main$15, [["__scopeId", "data-v-5f8ee279"]]);
|
|
39671
39779
|
//#endregion
|
|
39672
39780
|
//#region src/internal/toolbar/built-in/font-typeahead.js
|
|
39673
39781
|
/**
|
|
@@ -45001,10 +45109,6 @@ function contentControlSelectionKey(selection) {
|
|
|
45001
45109
|
function isV2ActiveEditorFacade(editor) {
|
|
45002
45110
|
return Boolean(editor && typeof editor === "object" && editor.editorVersion === 2);
|
|
45003
45111
|
}
|
|
45004
|
-
function isV2FailClosedExportError(error) {
|
|
45005
|
-
const code = error && typeof error === "object" ? error.code : null;
|
|
45006
|
-
return code === "comment-export-missing-story-reference" || code === "v2-worker-comment-export-mode-unsupported";
|
|
45007
|
-
}
|
|
45008
45112
|
function normalizeActiveEditorDocumentId(documentId) {
|
|
45009
45113
|
return typeof documentId === "string" && documentId.length > 0 ? documentId : null;
|
|
45010
45114
|
}
|
|
@@ -45356,7 +45460,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
45356
45460
|
this.config.colors = shuffleArray(this.config.colors);
|
|
45357
45461
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
45358
45462
|
this.colorIndex = 0;
|
|
45359
|
-
this.version = "2.13.0-next.
|
|
45463
|
+
this.version = "2.13.0-next.11";
|
|
45360
45464
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
45361
45465
|
this.superdocId = config.superdocId || require_uuid.v4();
|
|
45362
45466
|
this.colors = this.config.colors ?? [];
|
|
@@ -46010,6 +46114,14 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46010
46114
|
storeDoc.v2Collaboration = value;
|
|
46011
46115
|
}
|
|
46012
46116
|
#toV2CollaborationConfig(target) {
|
|
46117
|
+
if (target.providerFamily === "extension") return {
|
|
46118
|
+
providerType: "extension",
|
|
46119
|
+
adapterId: target.adapterId,
|
|
46120
|
+
documentId: target.documentId,
|
|
46121
|
+
roomMode: target.roomMode,
|
|
46122
|
+
...target.providerOptions !== void 0 ? { providerOptions: target.providerOptions } : {},
|
|
46123
|
+
...target.token ? { token: target.token } : {}
|
|
46124
|
+
};
|
|
46013
46125
|
if (target.providerFamily === "liveblocks") return {
|
|
46014
46126
|
providerType: "liveblocks",
|
|
46015
46127
|
documentId: target.documentId,
|
|
@@ -46218,8 +46330,10 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
46218
46330
|
ydoc: options.ydoc,
|
|
46219
46331
|
provider: options.provider
|
|
46220
46332
|
} : collaborationModule ? { ...collaborationModule } : null;
|
|
46333
|
+
const v2Collaboration = options.v2Collaboration ?? this.#unwrapMaybeRef(configDoc.v2Collaboration) ?? collaborationModule?.v2Collaboration ?? collaborationModule?.v2 ?? null;
|
|
46221
46334
|
const resolution = resolveV2CollaborationTarget({
|
|
46222
|
-
|
|
46335
|
+
collaboration: options.collaboration,
|
|
46336
|
+
v2Collaboration,
|
|
46223
46337
|
legacyCollaboration,
|
|
46224
46338
|
documentType: DOCX,
|
|
46225
46339
|
documentCount: cfg.documents.length,
|
|
@@ -47200,6 +47314,13 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
47200
47314
|
}
|
|
47201
47315
|
if (this.superdocStore.zoomMode === mode) return;
|
|
47202
47316
|
this.superdocStore.zoomMode = mode;
|
|
47317
|
+
if (mode === "fit-width") {
|
|
47318
|
+
const metrics = this.superdocStore.viewportMetrics;
|
|
47319
|
+
if (metrics) {
|
|
47320
|
+
const target = computeAppliedFitZoom(metrics.availableWidth, metrics.documentWidth, resolveFitWidthOptions(this.config.zoom?.fitWidth));
|
|
47321
|
+
if (target !== null) this.superdocStore.activeZoom = target;
|
|
47322
|
+
}
|
|
47323
|
+
}
|
|
47203
47324
|
this.emit("zoomChange", {
|
|
47204
47325
|
zoom: this.getZoom(),
|
|
47205
47326
|
mode
|
|
@@ -47431,7 +47552,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
47431
47552
|
error,
|
|
47432
47553
|
document: doc
|
|
47433
47554
|
});
|
|
47434
|
-
if (isV2Editor
|
|
47555
|
+
if (isV2Editor) throw error;
|
|
47435
47556
|
}
|
|
47436
47557
|
return fallbackDocx();
|
|
47437
47558
|
});
|
|
@@ -47638,10 +47759,6 @@ var COLORS_TO_VARS = {
|
|
|
47638
47759
|
border: "--sd-ui-border"
|
|
47639
47760
|
};
|
|
47640
47761
|
var themeCounter = 0;
|
|
47641
|
-
/**
|
|
47642
|
-
* Generate the className and CSS string from a theme config.
|
|
47643
|
-
* Shared core used by both createTheme and buildTheme.
|
|
47644
|
-
*/
|
|
47645
47762
|
function generateTheme(config) {
|
|
47646
47763
|
const { name, font, radius, shadow, colors, vars } = config;
|
|
47647
47764
|
const className = `sd-theme-${(name ? name.replace(/[^a-zA-Z0-9-_]/g, "-") : null) || `custom-${++themeCounter}`}`;
|
|
@@ -47707,8 +47824,8 @@ function createTheme(config) {
|
|
|
47707
47824
|
}
|
|
47708
47825
|
/**
|
|
47709
47826
|
* Build a SuperDoc theme and return both the class name and raw CSS.
|
|
47710
|
-
*
|
|
47711
|
-
*
|
|
47827
|
+
* This function does not access the DOM. Use it for server rendering or when
|
|
47828
|
+
* your application controls style injection, such as with a CSP nonce.
|
|
47712
47829
|
*
|
|
47713
47830
|
* @example
|
|
47714
47831
|
* ```ts
|