@harbour-enterprises/superdoc 0.19.0-next.5 → 0.19.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/{PdfViewer-DaZtoNpm.cjs → PdfViewer-BlV8_l4e.cjs} +1 -1
- package/dist/chunks/{PdfViewer-C2898kqZ.es.js → PdfViewer-oqYWe1FJ.es.js} +1 -1
- package/dist/chunks/{index-CkJ5hnvC.es.js → index-CeockUQz.es.js} +35 -3
- package/dist/chunks/{index-Di9R4Aas.cjs → index-DHyh73q4.cjs} +35 -3
- package/dist/chunks/{super-editor.es-kuaVTS8t.es.js → super-editor.es-BRBU19lM.es.js} +115 -91
- package/dist/chunks/{super-editor.es-DG-S6GN9.cjs → super-editor.es-bu-RKSWh.cjs} +115 -91
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/stores/superdoc-store.d.ts +3 -0
- package/dist/stores/superdoc-store.d.ts.map +1 -1
- package/dist/style.css +6 -6
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CrJvpQ8J.js → converter-BFq1XXek.js} +18 -7
- package/dist/super-editor/chunks/{docx-zipper-CHHaFCfj.js → docx-zipper-BahUy6FS.js} +1 -1
- package/dist/super-editor/chunks/{editor-DlzGbfD-.js → editor-BdLd21gy.js} +92 -84
- package/dist/super-editor/chunks/{toolbar-DeKOVf4h.js → toolbar-DoJY1zlM.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +6 -6
- package/dist/super-editor/super-editor.es.js +13 -8
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +148 -92
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-DWle4Cai.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-DHyh73q4.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-CXxsqYcP.es.js";
|
|
2
|
-
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-
|
|
2
|
+
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CeockUQz.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
1
|
+
import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BRBU19lM.es.js";
|
|
2
2
|
import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-CXxsqYcP.es.js";
|
|
3
3
|
import { B as Buffer$2 } from "./jszip-B8KIZSNe.es.js";
|
|
4
4
|
import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
|
|
@@ -3959,6 +3959,7 @@ function useDocument(params2, superdocConfig) {
|
|
|
3959
3959
|
}
|
|
3960
3960
|
const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
3961
3961
|
const currentConfig = ref(null);
|
|
3962
|
+
let exceptionHandler = null;
|
|
3962
3963
|
const commentsStore = useCommentsStore();
|
|
3963
3964
|
const documents = ref([]);
|
|
3964
3965
|
const documentBounds = ref([]);
|
|
@@ -3993,6 +3994,13 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
3993
3994
|
scrollTop: 0,
|
|
3994
3995
|
scrollLeft: 0
|
|
3995
3996
|
});
|
|
3997
|
+
const setExceptionHandler = (handler) => {
|
|
3998
|
+
exceptionHandler = typeof handler === "function" ? handler : null;
|
|
3999
|
+
};
|
|
4000
|
+
const emitException = (payload) => {
|
|
4001
|
+
const handler = exceptionHandler || currentConfig.value?.onException;
|
|
4002
|
+
if (typeof handler === "function") handler(payload);
|
|
4003
|
+
};
|
|
3996
4004
|
const init2 = async (config) => {
|
|
3997
4005
|
reset();
|
|
3998
4006
|
currentConfig.value = config;
|
|
@@ -4018,11 +4026,30 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4018
4026
|
const initializeDocuments = async (docsToProcess = []) => {
|
|
4019
4027
|
if (!docsToProcess) return [];
|
|
4020
4028
|
for (let doc of docsToProcess) {
|
|
4029
|
+
if (!doc) {
|
|
4030
|
+
emitException({
|
|
4031
|
+
error: new Error("Received empty document entry during initialization."),
|
|
4032
|
+
stage: "document-init",
|
|
4033
|
+
document: doc
|
|
4034
|
+
});
|
|
4035
|
+
console.warn("[superdoc] Skipping empty document entry.");
|
|
4036
|
+
continue;
|
|
4037
|
+
}
|
|
4021
4038
|
try {
|
|
4022
4039
|
let docWithData = await _initializeDocumentData(doc);
|
|
4040
|
+
if (!docWithData) {
|
|
4041
|
+
emitException({
|
|
4042
|
+
error: new Error("Document could not be initialized with the provided configuration."),
|
|
4043
|
+
stage: "document-init",
|
|
4044
|
+
document: doc
|
|
4045
|
+
});
|
|
4046
|
+
console.warn("[superdoc] Skipping document due to invalid configuration:", doc);
|
|
4047
|
+
continue;
|
|
4048
|
+
}
|
|
4023
4049
|
const smartDoc = useDocument(docWithData, currentConfig.value);
|
|
4024
4050
|
documents.value.push(smartDoc);
|
|
4025
4051
|
} catch (e) {
|
|
4052
|
+
emitException({ error: e, stage: "document-init", document: doc });
|
|
4026
4053
|
console.warn("[superdoc] Error initializing document:", doc, "with error:", e, "Skipping document.");
|
|
4027
4054
|
}
|
|
4028
4055
|
}
|
|
@@ -4066,7 +4093,7 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4066
4093
|
const fileObject = await getFileObject(doc.url, doc.name || "document", doc.type);
|
|
4067
4094
|
return { ...doc, data: fileObject };
|
|
4068
4095
|
}
|
|
4069
|
-
|
|
4096
|
+
return null;
|
|
4070
4097
|
};
|
|
4071
4098
|
const areDocumentsReady = computed(() => {
|
|
4072
4099
|
for (let obj of documents.value.filter((doc) => doc.type === "pdf")) {
|
|
@@ -4116,6 +4143,7 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4116
4143
|
areDocumentsReady,
|
|
4117
4144
|
// Actions
|
|
4118
4145
|
init: init2,
|
|
4146
|
+
setExceptionHandler,
|
|
4119
4147
|
reset,
|
|
4120
4148
|
handlePageReady,
|
|
4121
4149
|
getDocument,
|
|
@@ -17341,7 +17369,7 @@ const _sfc_main = {
|
|
|
17341
17369
|
__name: "SuperDoc",
|
|
17342
17370
|
emits: ["selection-update"],
|
|
17343
17371
|
setup(__props, { emit: __emit }) {
|
|
17344
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17372
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-oqYWe1FJ.es.js"));
|
|
17345
17373
|
const superdocStore = useSuperdocStore();
|
|
17346
17374
|
const commentsStore = useCommentsStore();
|
|
17347
17375
|
const {
|
|
@@ -18092,6 +18120,9 @@ class SuperDoc extends EventEmitter {
|
|
|
18092
18120
|
this.superdocStore = superdocStore;
|
|
18093
18121
|
this.commentsStore = commentsStore;
|
|
18094
18122
|
this.highContrastModeStore = highContrastModeStore;
|
|
18123
|
+
if (typeof this.superdocStore.setExceptionHandler === "function") {
|
|
18124
|
+
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
18125
|
+
}
|
|
18095
18126
|
this.superdocStore.init(this.config);
|
|
18096
18127
|
this.commentsStore.init(this.config.modules.comments);
|
|
18097
18128
|
}
|
|
@@ -18287,6 +18318,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18287
18318
|
};
|
|
18288
18319
|
this.toolbar = new SuperToolbar(config);
|
|
18289
18320
|
this.toolbar.on("superdoc-command", this.onToolbarCommand.bind(this));
|
|
18321
|
+
this.toolbar.on("exception", this.config.onException);
|
|
18290
18322
|
this.once("editorCreate", () => this.toolbar.updateToolbarState());
|
|
18291
18323
|
}
|
|
18292
18324
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-bu-RKSWh.cjs");
|
|
3
3
|
const vue = require("./vue-DWle4Cai.cjs");
|
|
4
4
|
const jszip = require("./jszip-b7l8QkfH.cjs");
|
|
5
5
|
const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
|
|
@@ -3976,6 +3976,7 @@ function useDocument(params2, superdocConfig) {
|
|
|
3976
3976
|
}
|
|
3977
3977
|
const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
3978
3978
|
const currentConfig = vue.ref(null);
|
|
3979
|
+
let exceptionHandler = null;
|
|
3979
3980
|
const commentsStore = useCommentsStore();
|
|
3980
3981
|
const documents = vue.ref([]);
|
|
3981
3982
|
const documentBounds = vue.ref([]);
|
|
@@ -4010,6 +4011,13 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4010
4011
|
scrollTop: 0,
|
|
4011
4012
|
scrollLeft: 0
|
|
4012
4013
|
});
|
|
4014
|
+
const setExceptionHandler = (handler) => {
|
|
4015
|
+
exceptionHandler = typeof handler === "function" ? handler : null;
|
|
4016
|
+
};
|
|
4017
|
+
const emitException = (payload) => {
|
|
4018
|
+
const handler = exceptionHandler || currentConfig.value?.onException;
|
|
4019
|
+
if (typeof handler === "function") handler(payload);
|
|
4020
|
+
};
|
|
4013
4021
|
const init2 = async (config) => {
|
|
4014
4022
|
reset();
|
|
4015
4023
|
currentConfig.value = config;
|
|
@@ -4035,11 +4043,30 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4035
4043
|
const initializeDocuments = async (docsToProcess = []) => {
|
|
4036
4044
|
if (!docsToProcess) return [];
|
|
4037
4045
|
for (let doc of docsToProcess) {
|
|
4046
|
+
if (!doc) {
|
|
4047
|
+
emitException({
|
|
4048
|
+
error: new Error("Received empty document entry during initialization."),
|
|
4049
|
+
stage: "document-init",
|
|
4050
|
+
document: doc
|
|
4051
|
+
});
|
|
4052
|
+
console.warn("[superdoc] Skipping empty document entry.");
|
|
4053
|
+
continue;
|
|
4054
|
+
}
|
|
4038
4055
|
try {
|
|
4039
4056
|
let docWithData = await _initializeDocumentData(doc);
|
|
4057
|
+
if (!docWithData) {
|
|
4058
|
+
emitException({
|
|
4059
|
+
error: new Error("Document could not be initialized with the provided configuration."),
|
|
4060
|
+
stage: "document-init",
|
|
4061
|
+
document: doc
|
|
4062
|
+
});
|
|
4063
|
+
console.warn("[superdoc] Skipping document due to invalid configuration:", doc);
|
|
4064
|
+
continue;
|
|
4065
|
+
}
|
|
4040
4066
|
const smartDoc = useDocument(docWithData, currentConfig.value);
|
|
4041
4067
|
documents.value.push(smartDoc);
|
|
4042
4068
|
} catch (e) {
|
|
4069
|
+
emitException({ error: e, stage: "document-init", document: doc });
|
|
4043
4070
|
console.warn("[superdoc] Error initializing document:", doc, "with error:", e, "Skipping document.");
|
|
4044
4071
|
}
|
|
4045
4072
|
}
|
|
@@ -4083,7 +4110,7 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4083
4110
|
const fileObject = await getFileObject(doc.url, doc.name || "document", doc.type);
|
|
4084
4111
|
return { ...doc, data: fileObject };
|
|
4085
4112
|
}
|
|
4086
|
-
|
|
4113
|
+
return null;
|
|
4087
4114
|
};
|
|
4088
4115
|
const areDocumentsReady = vue.computed(() => {
|
|
4089
4116
|
for (let obj of documents.value.filter((doc) => doc.type === "pdf")) {
|
|
@@ -4133,6 +4160,7 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4133
4160
|
areDocumentsReady,
|
|
4134
4161
|
// Actions
|
|
4135
4162
|
init: init2,
|
|
4163
|
+
setExceptionHandler,
|
|
4136
4164
|
reset,
|
|
4137
4165
|
handlePageReady,
|
|
4138
4166
|
getDocument,
|
|
@@ -17358,7 +17386,7 @@ const _sfc_main = {
|
|
|
17358
17386
|
__name: "SuperDoc",
|
|
17359
17387
|
emits: ["selection-update"],
|
|
17360
17388
|
setup(__props, { emit: __emit }) {
|
|
17361
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17389
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BlV8_l4e.cjs")));
|
|
17362
17390
|
const superdocStore = useSuperdocStore();
|
|
17363
17391
|
const commentsStore = useCommentsStore();
|
|
17364
17392
|
const {
|
|
@@ -18109,6 +18137,9 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18109
18137
|
this.superdocStore = superdocStore;
|
|
18110
18138
|
this.commentsStore = commentsStore;
|
|
18111
18139
|
this.highContrastModeStore = highContrastModeStore;
|
|
18140
|
+
if (typeof this.superdocStore.setExceptionHandler === "function") {
|
|
18141
|
+
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
18142
|
+
}
|
|
18112
18143
|
this.superdocStore.init(this.config);
|
|
18113
18144
|
this.commentsStore.init(this.config.modules.comments);
|
|
18114
18145
|
}
|
|
@@ -18304,6 +18335,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18304
18335
|
};
|
|
18305
18336
|
this.toolbar = new superEditor_es.SuperToolbar(config);
|
|
18306
18337
|
this.toolbar.on("superdoc-command", this.onToolbarCommand.bind(this));
|
|
18338
|
+
this.toolbar.on("exception", this.config.onException);
|
|
18307
18339
|
this.once("editorCreate", () => this.toolbar.updateToolbarState());
|
|
18308
18340
|
}
|
|
18309
18341
|
/**
|
|
@@ -26464,7 +26464,7 @@ function createMeasurementPropertyHandler(xmlName, sdName = null) {
|
|
|
26464
26464
|
encode: (_2, encodedAttrs) => {
|
|
26465
26465
|
return encodedAttrs["value"] != null ? encodedAttrs : void 0;
|
|
26466
26466
|
},
|
|
26467
|
-
decode: function({ node: node2 }
|
|
26467
|
+
decode: function({ node: node2 }) {
|
|
26468
26468
|
const decodedAttrs = this.decodeAttributes({ node: { ...node2, attrs: node2.attrs[sdName] || {} } });
|
|
26469
26469
|
return decodedAttrs["w:w"] != null ? decodedAttrs : void 0;
|
|
26470
26470
|
}
|
|
@@ -26482,7 +26482,10 @@ const createAttributeHandler = (xmlName, sdName = null, transformEncode = null,
|
|
|
26482
26482
|
};
|
|
26483
26483
|
};
|
|
26484
26484
|
function encodeProperties(node2, translatorsByXmlName, asArray = false) {
|
|
26485
|
-
|
|
26485
|
+
if (!node2?.elements || node2.elements.length === 0) {
|
|
26486
|
+
return asArray ? [] : {};
|
|
26487
|
+
}
|
|
26488
|
+
const attributes = asArray ? [] : {};
|
|
26486
26489
|
node2.elements.forEach((el) => {
|
|
26487
26490
|
const translator2 = translatorsByXmlName[el.name];
|
|
26488
26491
|
if (translator2) {
|
|
@@ -26499,6 +26502,9 @@ function encodeProperties(node2, translatorsByXmlName, asArray = false) {
|
|
|
26499
26502
|
return attributes;
|
|
26500
26503
|
}
|
|
26501
26504
|
function decodeProperties(translatorsBySdName, properties) {
|
|
26505
|
+
if (!properties || typeof properties !== "object") {
|
|
26506
|
+
return [];
|
|
26507
|
+
}
|
|
26502
26508
|
const elements = [];
|
|
26503
26509
|
Object.keys(properties).forEach((key) => {
|
|
26504
26510
|
const translator2 = translatorsBySdName[key];
|
|
@@ -27303,7 +27309,7 @@ const _resolveHref = (docx, encodedAttrs) => {
|
|
|
27303
27309
|
}
|
|
27304
27310
|
return href;
|
|
27305
27311
|
};
|
|
27306
|
-
function decode(params2
|
|
27312
|
+
function decode(params2) {
|
|
27307
27313
|
const { node: node2 } = params2;
|
|
27308
27314
|
const linkMark = node2.marks.find((m2) => m2.type === "link");
|
|
27309
27315
|
const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
|
|
@@ -30691,7 +30697,7 @@ const createNodeListHandler = (nodeHandlers) => {
|
|
|
30691
30697
|
}
|
|
30692
30698
|
} catch (error) {
|
|
30693
30699
|
console.debug("Import error", error);
|
|
30694
|
-
editor?.emit("exception", { error });
|
|
30700
|
+
editor?.emit("exception", { error, editor });
|
|
30695
30701
|
converter?.telemetry?.trackStatistic("error", {
|
|
30696
30702
|
type: "processing_error",
|
|
30697
30703
|
message: error.message,
|
|
@@ -30704,7 +30710,7 @@ const createNodeListHandler = (nodeHandlers) => {
|
|
|
30704
30710
|
return processedElements;
|
|
30705
30711
|
} catch (error) {
|
|
30706
30712
|
console.debug("Error during import", error);
|
|
30707
|
-
editor?.emit("exception", { error });
|
|
30713
|
+
editor?.emit("exception", { error, editor });
|
|
30708
30714
|
converter?.telemetry?.trackStatistic("error", {
|
|
30709
30715
|
type: "fatal_error",
|
|
30710
30716
|
message: error.message,
|
|
@@ -31170,8 +31176,13 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
31170
31176
|
return { typeface, panose };
|
|
31171
31177
|
}
|
|
31172
31178
|
getSchema(editor) {
|
|
31173
|
-
|
|
31174
|
-
|
|
31179
|
+
let result;
|
|
31180
|
+
try {
|
|
31181
|
+
this.getDocumentInternalId();
|
|
31182
|
+
result = createDocumentJson({ ...this.convertedXml, media: this.media }, this, editor);
|
|
31183
|
+
} catch (error) {
|
|
31184
|
+
editor?.emit("exception", { error, editor });
|
|
31185
|
+
}
|
|
31175
31186
|
if (result) {
|
|
31176
31187
|
this.savedTagsToRestore.push({ ...result.savedTagsToRestore });
|
|
31177
31188
|
this.pageStyles = result.pageStyles;
|
|
@@ -47562,7 +47573,7 @@ function validateRelationshipsRoot(relsTree, relsKey, results) {
|
|
|
47562
47573
|
}
|
|
47563
47574
|
return { root: root2, wasFixed };
|
|
47564
47575
|
}
|
|
47565
|
-
function cleanupRootChildren(root2
|
|
47576
|
+
function cleanupRootChildren(root2) {
|
|
47566
47577
|
const validChildren = root2.elements?.filter((child) => child?.type === "element" && child.name === "Relationship") || [];
|
|
47567
47578
|
if (root2.elements?.length !== validChildren.length) {
|
|
47568
47579
|
root2.elements = validChildren;
|
|
@@ -48559,85 +48570,89 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
48559
48570
|
getUpdatedDocs = false,
|
|
48560
48571
|
fieldsHighlightColor = null
|
|
48561
48572
|
} = {}) {
|
|
48562
|
-
|
|
48563
|
-
|
|
48564
|
-
|
|
48565
|
-
|
|
48566
|
-
|
|
48567
|
-
|
|
48568
|
-
|
|
48569
|
-
|
|
48570
|
-
|
|
48571
|
-
|
|
48572
|
-
|
|
48573
|
-
|
|
48574
|
-
__privateMethod$1(this, _Editor_instances, validateDocumentExport_fn).call(this);
|
|
48575
|
-
if (exportXmlOnly || exportJsonOnly) return documentXml;
|
|
48576
|
-
const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
|
|
48577
|
-
const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
|
|
48578
|
-
const customSettings = this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]);
|
|
48579
|
-
const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
|
|
48580
|
-
const media = this.converter.addedMedia;
|
|
48581
|
-
const updatedHeadersFooters = {};
|
|
48582
|
-
Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
|
|
48583
|
-
if (name.includes("header") || name.includes("footer")) {
|
|
48584
|
-
const resultXml = this.converter.schemaToXml(json2.elements[0]);
|
|
48585
|
-
updatedHeadersFooters[name] = String(resultXml);
|
|
48586
|
-
}
|
|
48587
|
-
});
|
|
48588
|
-
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
48589
|
-
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
48590
|
-
const updatedDocs = {
|
|
48591
|
-
...this.options.customUpdatedFiles,
|
|
48592
|
-
"word/document.xml": String(documentXml),
|
|
48593
|
-
"docProps/custom.xml": String(customXml),
|
|
48594
|
-
"word/settings.xml": String(customSettings),
|
|
48595
|
-
"word/_rels/document.xml.rels": String(rels),
|
|
48596
|
-
"word/numbering.xml": String(numbering),
|
|
48597
|
-
// Replace & with & in styles.xml as DOCX viewers can't handle it
|
|
48598
|
-
"word/styles.xml": String(styles).replace(/&/gi, "&"),
|
|
48599
|
-
...updatedHeadersFooters
|
|
48600
|
-
};
|
|
48601
|
-
if (comments.length) {
|
|
48602
|
-
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
48603
|
-
const commentsExtendedXml = this.converter.schemaToXml(
|
|
48604
|
-
this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
|
|
48605
|
-
);
|
|
48606
|
-
const commentsExtensibleXml = this.converter.schemaToXml(
|
|
48607
|
-
this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
|
|
48608
|
-
);
|
|
48609
|
-
const commentsIdsXml = this.converter.schemaToXml(
|
|
48610
|
-
this.converter.convertedXml["word/commentsIds.xml"].elements[0]
|
|
48573
|
+
try {
|
|
48574
|
+
const json = __privateMethod$1(this, _Editor_instances, prepareDocumentForExport_fn).call(this, comments);
|
|
48575
|
+
const documentXml = await this.converter.exportToDocx(
|
|
48576
|
+
json,
|
|
48577
|
+
this.schema,
|
|
48578
|
+
this.storage.image.media,
|
|
48579
|
+
isFinalDoc,
|
|
48580
|
+
commentsType,
|
|
48581
|
+
comments,
|
|
48582
|
+
this,
|
|
48583
|
+
exportJsonOnly,
|
|
48584
|
+
fieldsHighlightColor
|
|
48611
48585
|
);
|
|
48612
|
-
|
|
48613
|
-
|
|
48614
|
-
|
|
48615
|
-
|
|
48616
|
-
|
|
48617
|
-
|
|
48618
|
-
|
|
48619
|
-
|
|
48620
|
-
|
|
48621
|
-
|
|
48622
|
-
|
|
48586
|
+
__privateMethod$1(this, _Editor_instances, validateDocumentExport_fn).call(this);
|
|
48587
|
+
if (exportXmlOnly || exportJsonOnly) return documentXml;
|
|
48588
|
+
const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
|
|
48589
|
+
const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
|
|
48590
|
+
const customSettings = this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]);
|
|
48591
|
+
const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
|
|
48592
|
+
const media = this.converter.addedMedia;
|
|
48593
|
+
const updatedHeadersFooters = {};
|
|
48594
|
+
Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
|
|
48595
|
+
if (name.includes("header") || name.includes("footer")) {
|
|
48596
|
+
const resultXml = this.converter.schemaToXml(json2.elements[0]);
|
|
48597
|
+
updatedHeadersFooters[name] = String(resultXml);
|
|
48598
|
+
}
|
|
48599
|
+
});
|
|
48600
|
+
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
48601
|
+
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
48602
|
+
const updatedDocs = {
|
|
48603
|
+
...this.options.customUpdatedFiles,
|
|
48604
|
+
"word/document.xml": String(documentXml),
|
|
48605
|
+
"docProps/custom.xml": String(customXml),
|
|
48606
|
+
"word/settings.xml": String(customSettings),
|
|
48607
|
+
"word/_rels/document.xml.rels": String(rels),
|
|
48608
|
+
"word/numbering.xml": String(numbering),
|
|
48609
|
+
// Replace & with & in styles.xml as DOCX viewers can't handle it
|
|
48610
|
+
"word/styles.xml": String(styles).replace(/&/gi, "&"),
|
|
48611
|
+
...updatedHeadersFooters
|
|
48612
|
+
};
|
|
48613
|
+
if (comments.length) {
|
|
48614
|
+
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
48615
|
+
const commentsExtendedXml = this.converter.schemaToXml(
|
|
48616
|
+
this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
|
|
48617
|
+
);
|
|
48618
|
+
const commentsExtensibleXml = this.converter.schemaToXml(
|
|
48619
|
+
this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
|
|
48620
|
+
);
|
|
48621
|
+
const commentsIdsXml = this.converter.schemaToXml(
|
|
48622
|
+
this.converter.convertedXml["word/commentsIds.xml"].elements[0]
|
|
48623
|
+
);
|
|
48624
|
+
updatedDocs["word/comments.xml"] = String(commentsXml);
|
|
48625
|
+
updatedDocs["word/commentsExtended.xml"] = String(commentsExtendedXml);
|
|
48626
|
+
updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
|
|
48627
|
+
updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
|
|
48628
|
+
}
|
|
48629
|
+
const zipper = new DocxZipper();
|
|
48630
|
+
if (getUpdatedDocs) {
|
|
48631
|
+
updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes(
|
|
48632
|
+
{
|
|
48633
|
+
files: this.options.content
|
|
48634
|
+
},
|
|
48635
|
+
media,
|
|
48636
|
+
true
|
|
48637
|
+
);
|
|
48638
|
+
return updatedDocs;
|
|
48639
|
+
}
|
|
48640
|
+
const result = await zipper.updateZip({
|
|
48641
|
+
docx: this.options.content,
|
|
48642
|
+
updatedDocs,
|
|
48643
|
+
originalDocxFile: this.options.fileSource,
|
|
48623
48644
|
media,
|
|
48624
|
-
|
|
48625
|
-
|
|
48626
|
-
|
|
48645
|
+
fonts: this.options.fonts,
|
|
48646
|
+
isHeadless: this.options.isHeadless
|
|
48647
|
+
});
|
|
48648
|
+
this.options.telemetry?.trackUsage("document_export", {
|
|
48649
|
+
documentType: "docx",
|
|
48650
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
48651
|
+
});
|
|
48652
|
+
return result;
|
|
48653
|
+
} catch (error) {
|
|
48654
|
+
this.emit("exception", { error, editor: this });
|
|
48627
48655
|
}
|
|
48628
|
-
const result = await zipper.updateZip({
|
|
48629
|
-
docx: this.options.content,
|
|
48630
|
-
updatedDocs,
|
|
48631
|
-
originalDocxFile: this.options.fileSource,
|
|
48632
|
-
media,
|
|
48633
|
-
fonts: this.options.fonts,
|
|
48634
|
-
isHeadless: this.options.isHeadless
|
|
48635
|
-
});
|
|
48636
|
-
this.options.telemetry?.trackUsage("document_export", {
|
|
48637
|
-
documentType: "docx",
|
|
48638
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
48639
|
-
});
|
|
48640
|
-
return result;
|
|
48641
48656
|
}
|
|
48642
48657
|
/**
|
|
48643
48658
|
* Destroy the editor and clean up resources
|
|
@@ -48658,7 +48673,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
48658
48673
|
}
|
|
48659
48674
|
this.converter.headerEditors.length = 0;
|
|
48660
48675
|
this.converter.footerEditors.length = 0;
|
|
48661
|
-
} catch {
|
|
48676
|
+
} catch (error) {
|
|
48677
|
+
this.emit("exception", { error, editor: this });
|
|
48662
48678
|
}
|
|
48663
48679
|
}
|
|
48664
48680
|
/**
|
|
@@ -48723,7 +48739,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
48723
48739
|
this.initDefaultStyles();
|
|
48724
48740
|
if (this.options.ydoc && this.options.collaborationProvider) {
|
|
48725
48741
|
updateYdocDocxData(this);
|
|
48726
|
-
this.initializeCollaborationData(
|
|
48742
|
+
this.initializeCollaborationData();
|
|
48727
48743
|
} else {
|
|
48728
48744
|
__privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
48729
48745
|
}
|
|
@@ -48883,7 +48899,6 @@ init_fn = function() {
|
|
|
48883
48899
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
48884
48900
|
this.emit("beforeCreate", { editor: this });
|
|
48885
48901
|
this.on("contentError", this.options.onContentError);
|
|
48886
|
-
this.on("exception", this.options.onException);
|
|
48887
48902
|
this.mount(this.options.element);
|
|
48888
48903
|
this.on("create", this.options.onCreate);
|
|
48889
48904
|
this.on("update", this.options.onUpdate);
|
|
@@ -48901,6 +48916,7 @@ init_fn = function() {
|
|
|
48901
48916
|
this.on("paginationUpdate", this.options.onPaginationUpdate);
|
|
48902
48917
|
this.on("comment-positions", this.options.onCommentLocationsUpdate);
|
|
48903
48918
|
this.on("list-definitions-change", this.options.onListDefinitionsChange);
|
|
48919
|
+
this.on("exception", this.options.onException);
|
|
48904
48920
|
if (!this.options.isHeadless) {
|
|
48905
48921
|
this.initializeCollaborationData();
|
|
48906
48922
|
this.initDefaultStyles();
|
|
@@ -49227,7 +49243,8 @@ endCollaboration_fn = function() {
|
|
|
49227
49243
|
console.debug("🔗 [super-editor] Ending collaboration");
|
|
49228
49244
|
if (this.options.collaborationProvider) this.options.collaborationProvider.disconnect();
|
|
49229
49245
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
49230
|
-
} catch {
|
|
49246
|
+
} catch (error) {
|
|
49247
|
+
this.emit("exception", { error, editor: this });
|
|
49231
49248
|
}
|
|
49232
49249
|
};
|
|
49233
49250
|
validateDocumentInit_fn = function() {
|
|
@@ -58516,6 +58533,7 @@ const startImageUpload = async ({ editor, view, file }) => {
|
|
|
58516
58533
|
file = processedImageResult.file;
|
|
58517
58534
|
} catch (err) {
|
|
58518
58535
|
console.warn("Error processing image:", err);
|
|
58536
|
+
editor.emit("exception", { error: err, editor });
|
|
58519
58537
|
return;
|
|
58520
58538
|
}
|
|
58521
58539
|
await uploadImage({
|
|
@@ -58570,9 +58588,10 @@ async function uploadImage({ editor, view, file, size: size2, uploadHandler }) {
|
|
|
58570
58588
|
view.dispatch(
|
|
58571
58589
|
view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
|
|
58572
58590
|
);
|
|
58573
|
-
} catch {
|
|
58591
|
+
} catch (error) {
|
|
58574
58592
|
let removeMeta = { type: "remove", id };
|
|
58575
58593
|
view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
|
|
58594
|
+
editor.emit("exception", { error, editor });
|
|
58576
58595
|
}
|
|
58577
58596
|
}
|
|
58578
58597
|
function addImageRelationship({ editor, path }) {
|
|
@@ -80111,7 +80130,9 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
80111
80130
|
} else if (typeof command2 === "function") {
|
|
80112
80131
|
command2({ item, argument, option });
|
|
80113
80132
|
} else {
|
|
80114
|
-
|
|
80133
|
+
const error = new Error(`[super-toolbar 🎨] Command not found: ${command2}`);
|
|
80134
|
+
this.emit("exception", { error, editor: this.activeEditor });
|
|
80135
|
+
throw error;
|
|
80115
80136
|
}
|
|
80116
80137
|
this.updateToolbarState();
|
|
80117
80138
|
}
|
|
@@ -81366,6 +81387,9 @@ const _sfc_main$1 = {
|
|
|
81366
81387
|
return { content: docx, media, mediaFiles, fonts };
|
|
81367
81388
|
} catch (err) {
|
|
81368
81389
|
console.debug("Error loading new file data:", err);
|
|
81390
|
+
if (typeof props.options.onException === "function") {
|
|
81391
|
+
props.options.onException({ error: err, editor: null });
|
|
81392
|
+
}
|
|
81369
81393
|
}
|
|
81370
81394
|
};
|
|
81371
81395
|
const initializeData = async () => {
|
|
@@ -81568,7 +81592,7 @@ const _sfc_main$1 = {
|
|
|
81568
81592
|
};
|
|
81569
81593
|
}
|
|
81570
81594
|
};
|
|
81571
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
81595
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-0c36dd72"]]);
|
|
81572
81596
|
const _hoisted_1 = ["innerHTML"];
|
|
81573
81597
|
const _sfc_main = {
|
|
81574
81598
|
__name: "SuperInput",
|