superdoc 2.4.0-next.4 → 2.4.0-next.5
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/{FindReplaceSurface-BEW-1NhM.es.js → FindReplaceSurface-B_1Ksbr0.es.js} +1 -1
- package/dist/chunks/{FindReplaceSurface-Dx0llWqP.cjs → FindReplaceSurface-C-I4GcRE.cjs} +1 -1
- package/dist/chunks/{PasswordPromptSurface-BUUVC2ee.cjs → PasswordPromptSurface-Bu5xHm91.cjs} +1 -1
- package/dist/chunks/{PasswordPromptSurface-BA6HHqEa.es.js → PasswordPromptSurface-Bz9_sKhX.es.js} +1 -1
- package/dist/chunks/{PdfViewer-CNOtyS-I.es.js → PdfViewer-CdVGB6Fe.es.js} +2 -2
- package/dist/chunks/{PdfViewer-qpvzwYMz.cjs → PdfViewer-D4eD2dV1.cjs} +2 -2
- package/dist/chunks/{create-super-doc-ui-Dli6Wq70.es.js → create-super-doc-ui-BquF8bnZ.es.js} +71 -62
- package/dist/chunks/{create-super-doc-ui-BHMQEL2y.cjs → create-super-doc-ui-sMXbYzhs.cjs} +76 -61
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/superdoc.cjs +65 -7
- package/dist/superdoc.es.js +65 -7
- package/dist-cdn/superdoc.min.js +35 -35
- package/package.json +2 -2
- /package/dist/chunks/{_plugin-vue_export-helper-BTwbGDKw.cjs → _plugin-vue_export-helper-CZ1Nl59K.cjs} +0 -0
- /package/dist/chunks/{_plugin-vue_export-helper-CInC0bKI.es.js → _plugin-vue_export-helper-DSMAhhwD.es.js} +0 -0
- /package/dist/chunks/{constants-CY3R3_kF.es.js → constants-BfH0br5u.es.js} +0 -0
- /package/dist/chunks/{constants-sbCZ2O_A.cjs → constants-D7TNtyJd.cjs} +0 -0
package/dist/superdoc.es.js
CHANGED
|
@@ -3,9 +3,9 @@ import { t as blank_default } from "./chunks/blank-docx-XRX6Ker2.es.js";
|
|
|
3
3
|
import { t as import_eventemitter3 } from "./chunks/eventemitter3-Bt2s0X0a.es.js";
|
|
4
4
|
import { t as v4_default } from "./chunks/uuid-B2Sqk-3p.es.js";
|
|
5
5
|
import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-C8srOKAO.es.js";
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { a as createV2ReviewMutationReconciler, c as DOM_CLASS_NAMES, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BquF8bnZ.es.js";
|
|
7
|
+
import { t as __plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-DSMAhhwD.es.js";
|
|
8
|
+
import { n as PDF_TO_CSS_UNITS } from "./chunks/constants-BfH0br5u.es.js";
|
|
9
9
|
import * as Vue from "vue";
|
|
10
10
|
import { Fragment, Teleport, Transition, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, effectScope, getCurrentInstance, getCurrentScope, h, hasInjectionContext, inject, isReactive, isRef, markRaw, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeUnmount, onDeactivated, onMounted, onScopeDispose, openBlock, reactive, ref, renderList, renderSlot, resolveDirective, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toRefs, unref, useAttrs, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
11
11
|
import "y-websocket";
|
|
@@ -14734,7 +14734,7 @@ function usePasswordPrompt({ getSurfaceManager, getPasswordPromptConfig, onUnhan
|
|
|
14734
14734
|
})
|
|
14735
14735
|
});
|
|
14736
14736
|
} else {
|
|
14737
|
-
const PasswordPromptSurface = (await import("./chunks/PasswordPromptSurface-
|
|
14737
|
+
const PasswordPromptSurface = (await import("./chunks/PasswordPromptSurface-Bz9_sKhX.es.js")).default;
|
|
14738
14738
|
const surfaceId = `password-prompt-${doc.id}`;
|
|
14739
14739
|
handle = manager.open({
|
|
14740
14740
|
id: surfaceId,
|
|
@@ -15383,7 +15383,7 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
|
|
|
15383
15383
|
} else {
|
|
15384
15384
|
let FindReplaceSurface;
|
|
15385
15385
|
try {
|
|
15386
|
-
FindReplaceSurface = (await import("./chunks/FindReplaceSurface-
|
|
15386
|
+
FindReplaceSurface = (await import("./chunks/FindReplaceSurface-B_1Ksbr0.es.js")).default;
|
|
15387
15387
|
} catch {
|
|
15388
15388
|
opening = false;
|
|
15389
15389
|
return;
|
|
@@ -18062,7 +18062,7 @@ var SuperDoc_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
|
|
|
18062
18062
|
__name: "SuperDoc",
|
|
18063
18063
|
emits: ["selection-update"],
|
|
18064
18064
|
setup(__props, { emit: __emit }) {
|
|
18065
|
-
const PdfViewer = defineAsyncComponent(() => import("./chunks/PdfViewer-
|
|
18065
|
+
const PdfViewer = defineAsyncComponent(() => import("./chunks/PdfViewer-CdVGB6Fe.es.js"));
|
|
18066
18066
|
const getDocumentLoadPassword = (doc) => doc.password ?? proxy.$superdoc.config.password;
|
|
18067
18067
|
const resolveDocumentV2Collaboration = (doc) => {
|
|
18068
18068
|
const rawConfig = doc?.v2Collaboration;
|
|
@@ -38959,6 +38959,11 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
|
|
|
38959
38959
|
function createBuiltInToolbar(config) {
|
|
38960
38960
|
return new BuiltInToolbar(config);
|
|
38961
38961
|
}
|
|
38962
|
+
var STRUCTURED_CONTENT_FRAME_SELECTOR = [
|
|
38963
|
+
"[data-sdt-type=\"structuredContent\"][data-sdt-id]",
|
|
38964
|
+
"[data-sdt-type=\"structuredContent\"][data-sdt-container-id]",
|
|
38965
|
+
"[data-sdt-container-type=\"structuredContent\"][data-sdt-container-id]"
|
|
38966
|
+
].join(", ");
|
|
38962
38967
|
var DEFAULT_AWARENESS_PALETTE = Object.freeze([
|
|
38963
38968
|
"#FF6B6B",
|
|
38964
38969
|
"#4ECDC4",
|
|
@@ -39046,6 +39051,33 @@ function onCollaborationProviderSynced(provider, onSynced) {
|
|
|
39046
39051
|
if (isCollaborationProviderSynced(provider)) finish();
|
|
39047
39052
|
return cleanup;
|
|
39048
39053
|
}
|
|
39054
|
+
function getClickedContentControlId(event, root) {
|
|
39055
|
+
const path = event.composedPath();
|
|
39056
|
+
if (!path.includes(root)) return null;
|
|
39057
|
+
const control = path.find((target$1) => target$1 instanceof HTMLElement && target$1.matches(STRUCTURED_CONTENT_FRAME_SELECTOR));
|
|
39058
|
+
if (!control) return null;
|
|
39059
|
+
const onBlockLabel = path.some((target$1) => target$1 instanceof HTMLElement && target$1.classList.contains(DOM_CLASS_NAMES.BLOCK_SDT_LABEL));
|
|
39060
|
+
const containerId = control.getAttribute("data-sdt-container-id")?.trim() || null;
|
|
39061
|
+
const sdtId = control.getAttribute("data-sdt-id")?.trim() || null;
|
|
39062
|
+
return onBlockLabel ? containerId ?? sdtId : sdtId ?? containerId;
|
|
39063
|
+
}
|
|
39064
|
+
function getContentControlItems(result) {
|
|
39065
|
+
if (!result || typeof result !== "object") return [];
|
|
39066
|
+
const items = result.items;
|
|
39067
|
+
return Array.isArray(items) ? items : [];
|
|
39068
|
+
}
|
|
39069
|
+
function toSdtRef(item) {
|
|
39070
|
+
if (!item || typeof item.id !== "string" || item.kind !== "inline" && item.kind !== "block" || typeof item.controlType !== "string") return null;
|
|
39071
|
+
const tag = item.properties?.tag;
|
|
39072
|
+
const alias = item.properties?.alias;
|
|
39073
|
+
return {
|
|
39074
|
+
id: item.id,
|
|
39075
|
+
controlType: item.controlType,
|
|
39076
|
+
scope: item.kind,
|
|
39077
|
+
...typeof tag === "string" && tag ? { tag } : {},
|
|
39078
|
+
...typeof alias === "string" && alias ? { alias } : {}
|
|
39079
|
+
};
|
|
39080
|
+
}
|
|
39049
39081
|
function isV2ActiveEditorFacade(editor) {
|
|
39050
39082
|
return Boolean(editor && typeof editor === "object" && editor.editorVersion === 2);
|
|
39051
39083
|
}
|
|
@@ -39099,6 +39131,10 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
39099
39131
|
#v2LockUnsub = null;
|
|
39100
39132
|
#pendingV2LockSeed = null;
|
|
39101
39133
|
#mountWrapper = null;
|
|
39134
|
+
#contentControlClickRoot = null;
|
|
39135
|
+
#handleContentControlClick = (event) => {
|
|
39136
|
+
this.#emitContentControlClick(event);
|
|
39137
|
+
};
|
|
39102
39138
|
#ui = null;
|
|
39103
39139
|
#uiConfig = normalizeUiConfig({});
|
|
39104
39140
|
get uiConfig() {
|
|
@@ -39182,8 +39218,28 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
39182
39218
|
const container = typeof config.selector === "string" ? document.querySelector(config.selector) : config.selector;
|
|
39183
39219
|
if (!(container instanceof HTMLElement)) throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");
|
|
39184
39220
|
this.#surfaceManager = new SurfaceManager({ getModuleConfig: () => this.#surfacesConfig });
|
|
39221
|
+
this.#contentControlClickRoot = container;
|
|
39222
|
+
container.addEventListener("click", this.#handleContentControlClick, true);
|
|
39185
39223
|
this.#init(config, container);
|
|
39186
39224
|
}
|
|
39225
|
+
async #emitContentControlClick(event) {
|
|
39226
|
+
const root = this.#contentControlClickRoot;
|
|
39227
|
+
if (!root) return;
|
|
39228
|
+
const id = getClickedContentControlId(event, root);
|
|
39229
|
+
const list = this.activeEditor?.doc?.contentControls?.list;
|
|
39230
|
+
if (!id || typeof list !== "function") return;
|
|
39231
|
+
try {
|
|
39232
|
+
const result = await list();
|
|
39233
|
+
if (this.#destroyed) return;
|
|
39234
|
+
const target$1 = toSdtRef(getContentControlItems(result).find((item) => item.id === id));
|
|
39235
|
+
if (target$1) this.emit("content-control:click", {
|
|
39236
|
+
target: target$1,
|
|
39237
|
+
source: "pointer"
|
|
39238
|
+
});
|
|
39239
|
+
} catch {
|
|
39240
|
+
return;
|
|
39241
|
+
}
|
|
39242
|
+
}
|
|
39187
39243
|
async #init(config, container) {
|
|
39188
39244
|
this.config = {
|
|
39189
39245
|
...this.config,
|
|
@@ -39230,7 +39286,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
39230
39286
|
this.config.colors = shuffleArray(this.config.colors);
|
|
39231
39287
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
39232
39288
|
this.colorIndex = 0;
|
|
39233
|
-
this.version = "2.4.0-next.
|
|
39289
|
+
this.version = "2.4.0-next.5";
|
|
39234
39290
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
39235
39291
|
this.superdocId = config.superdocId || v4_default();
|
|
39236
39292
|
this.colors = this.config.colors ?? [];
|
|
@@ -40758,6 +40814,8 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
40758
40814
|
}
|
|
40759
40815
|
destroy() {
|
|
40760
40816
|
this.#destroyed = true;
|
|
40817
|
+
this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
|
|
40818
|
+
this.#contentControlClickRoot = null;
|
|
40761
40819
|
if (this.#abortUpgrade) {
|
|
40762
40820
|
this.#abortUpgrade();
|
|
40763
40821
|
this.#abortUpgrade = null;
|