@harbour-enterprises/superdoc 0.22.0-next.3 → 0.22.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/{PdfViewer-CvFw8S_D.cjs → PdfViewer-Badqoc1e.cjs} +1 -1
- package/dist/chunks/{PdfViewer-D95oFKMa.es.js → PdfViewer-dsL5uHg1.es.js} +1 -1
- package/dist/chunks/{index-DgH1cx2c.es.js → index-DBNzXf1D.es.js} +2 -2
- package/dist/chunks/{index-Ct4VrAay.cjs → index-DVrbZM76.cjs} +2 -2
- package/dist/chunks/{super-editor.es-WUoM0FI7.es.js → super-editor.es-DruRanWK.es.js} +170 -67
- package/dist/chunks/{super-editor.es-CIDcWgLs.cjs → super-editor.es-p3eqHXlj.cjs} +170 -67
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DBwwYo1I.js → converter-DujfV3Zn.js} +46 -34
- package/dist/super-editor/chunks/{docx-zipper-BCI-3XE9.js → docx-zipper-DccEqL60.js} +73 -12
- package/dist/super-editor/chunks/{editor-W3rw5KHF.js → editor-Dq3xPdti.js} +54 -24
- package/dist/super-editor/chunks/{toolbar-CFfRuTi3.js → toolbar-u5oyT_9K.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/src/core/DocxZipper.d.ts +1 -1
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +1 -0
- package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +5 -0
- package/dist/super-editor/super-editor.es.js +6 -6
- 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 +170 -67
- 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-DVrbZM76.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-DBNzXf1D.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-DruRanWK.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";
|
|
@@ -17392,7 +17392,7 @@ const _sfc_main = {
|
|
|
17392
17392
|
__name: "SuperDoc",
|
|
17393
17393
|
emits: ["selection-update"],
|
|
17394
17394
|
setup(__props, { emit: __emit }) {
|
|
17395
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17395
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-dsL5uHg1.es.js"));
|
|
17396
17396
|
const superdocStore = useSuperdocStore();
|
|
17397
17397
|
const commentsStore = useCommentsStore();
|
|
17398
17398
|
const {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-p3eqHXlj.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");
|
|
@@ -17409,7 +17409,7 @@ const _sfc_main = {
|
|
|
17409
17409
|
__name: "SuperDoc",
|
|
17410
17410
|
emits: ["selection-update"],
|
|
17411
17411
|
setup(__props, { emit: __emit }) {
|
|
17412
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17412
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Badqoc1e.cjs")));
|
|
17413
17413
|
const superdocStore = useSuperdocStore();
|
|
17414
17414
|
const commentsStore = useCommentsStore();
|
|
17415
17415
|
const {
|
|
@@ -30603,6 +30603,51 @@ const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
|
|
|
30603
30603
|
gutter: "0"
|
|
30604
30604
|
})
|
|
30605
30605
|
});
|
|
30606
|
+
const ensureSectionLayoutDefaults = (sectPr, converter) => {
|
|
30607
|
+
if (!sectPr) {
|
|
30608
|
+
return {
|
|
30609
|
+
type: "element",
|
|
30610
|
+
name: "w:sectPr",
|
|
30611
|
+
elements: []
|
|
30612
|
+
};
|
|
30613
|
+
}
|
|
30614
|
+
if (!sectPr.elements) sectPr.elements = [];
|
|
30615
|
+
const ensureChild = (name) => {
|
|
30616
|
+
let child = sectPr.elements.find((n) => n.name === name);
|
|
30617
|
+
if (!child) {
|
|
30618
|
+
child = {
|
|
30619
|
+
type: "element",
|
|
30620
|
+
name,
|
|
30621
|
+
elements: [],
|
|
30622
|
+
attributes: {}
|
|
30623
|
+
};
|
|
30624
|
+
sectPr.elements.push(child);
|
|
30625
|
+
} else {
|
|
30626
|
+
if (!child.elements) child.elements = [];
|
|
30627
|
+
if (!child.attributes) child.attributes = {};
|
|
30628
|
+
}
|
|
30629
|
+
return child;
|
|
30630
|
+
};
|
|
30631
|
+
const pageSize = converter?.pageStyles?.pageSize;
|
|
30632
|
+
const pgSz = ensureChild("w:pgSz");
|
|
30633
|
+
if (pageSize?.width != null) pgSz.attributes["w:w"] = String(inchesToTwips(pageSize.width));
|
|
30634
|
+
if (pageSize?.height != null) pgSz.attributes["w:h"] = String(inchesToTwips(pageSize.height));
|
|
30635
|
+
if (pgSz.attributes["w:w"] == null) pgSz.attributes["w:w"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.width;
|
|
30636
|
+
if (pgSz.attributes["w:h"] == null) pgSz.attributes["w:h"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.height;
|
|
30637
|
+
const pageMargins = converter?.pageStyles?.pageMargins;
|
|
30638
|
+
const pgMar = ensureChild("w:pgMar");
|
|
30639
|
+
if (pageMargins) {
|
|
30640
|
+
Object.entries(pageMargins).forEach(([key2, value]) => {
|
|
30641
|
+
const converted = inchesToTwips(value);
|
|
30642
|
+
if (converted != null) pgMar.attributes[`w:${key2}`] = String(converted);
|
|
30643
|
+
});
|
|
30644
|
+
}
|
|
30645
|
+
Object.entries(DEFAULT_SECTION_PROPS_TWIPS.pageMargins).forEach(([key2, value]) => {
|
|
30646
|
+
const attrKey = `w:${key2}`;
|
|
30647
|
+
if (pgMar.attributes[attrKey] == null) pgMar.attributes[attrKey] = value;
|
|
30648
|
+
});
|
|
30649
|
+
return sectPr;
|
|
30650
|
+
};
|
|
30606
30651
|
const isLineBreakOnlyRun = (node) => {
|
|
30607
30652
|
if (!node) return false;
|
|
30608
30653
|
if (node.type === "lineBreak" || node.type === "hardBreak") return true;
|
|
@@ -30665,6 +30710,7 @@ function translateBodyNode(params2) {
|
|
|
30665
30710
|
} else if (!sectPr.elements) {
|
|
30666
30711
|
sectPr = { ...sectPr, elements: [] };
|
|
30667
30712
|
}
|
|
30713
|
+
sectPr = ensureSectionLayoutDefaults(sectPr, params2.converter);
|
|
30668
30714
|
if (params2.converter) {
|
|
30669
30715
|
const hasHeader = sectPr.elements?.some((n) => n.name === "w:headerReference");
|
|
30670
30716
|
const hasDefaultHeader = params2.converter.headerIds?.default;
|
|
@@ -30678,40 +30724,6 @@ function translateBodyNode(params2) {
|
|
|
30678
30724
|
const defaultFooter = generateDefaultHeaderFooter("footer", params2.converter.footerIds?.default);
|
|
30679
30725
|
sectPr.elements.push(defaultFooter);
|
|
30680
30726
|
}
|
|
30681
|
-
const newMargins = params2.converter.pageStyles?.pageMargins;
|
|
30682
|
-
if (newMargins) {
|
|
30683
|
-
let sectPrMargins = sectPr.elements.find((n) => n.name === "w:pgMar");
|
|
30684
|
-
if (!sectPrMargins) {
|
|
30685
|
-
sectPrMargins = {
|
|
30686
|
-
type: "element",
|
|
30687
|
-
name: "w:pgMar",
|
|
30688
|
-
attributes: {}
|
|
30689
|
-
};
|
|
30690
|
-
sectPr.elements.push(sectPrMargins);
|
|
30691
|
-
} else if (!sectPrMargins.attributes) {
|
|
30692
|
-
sectPrMargins.attributes = {};
|
|
30693
|
-
}
|
|
30694
|
-
Object.entries(newMargins).forEach(([key2, value]) => {
|
|
30695
|
-
const convertedValue = inchesToTwips(value);
|
|
30696
|
-
sectPrMargins.attributes[`w:${key2}`] = convertedValue;
|
|
30697
|
-
});
|
|
30698
|
-
}
|
|
30699
|
-
let sectPrPgSz = sectPr.elements.find((n) => n.name === "w:pgSz");
|
|
30700
|
-
if (!sectPrPgSz) {
|
|
30701
|
-
sectPrPgSz = {
|
|
30702
|
-
type: "element",
|
|
30703
|
-
name: "w:pgSz",
|
|
30704
|
-
attributes: {}
|
|
30705
|
-
};
|
|
30706
|
-
sectPr.elements.push(sectPrPgSz);
|
|
30707
|
-
} else if (!sectPrPgSz.attributes) {
|
|
30708
|
-
sectPrPgSz.attributes = {};
|
|
30709
|
-
}
|
|
30710
|
-
const pageSize = params2.converter.pageStyles?.pageSize;
|
|
30711
|
-
const widthInches = pageSize?.width;
|
|
30712
|
-
const heightInches = pageSize?.height;
|
|
30713
|
-
sectPrPgSz.attributes["w:w"] = widthInches ? String(inchesToTwips(widthInches)) : sectPrPgSz.attributes["w:w"] ?? DEFAULT_SECTION_PROPS_TWIPS.pageSize.width;
|
|
30714
|
-
sectPrPgSz.attributes["w:h"] = heightInches ? String(inchesToTwips(heightInches)) : sectPrPgSz.attributes["w:h"] ?? DEFAULT_SECTION_PROPS_TWIPS.pageSize.height;
|
|
30715
30727
|
}
|
|
30716
30728
|
const elements = translateChildNodes(params2);
|
|
30717
30729
|
if (params2.isHeaderFooter) {
|
|
@@ -36267,14 +36279,19 @@ class DocxZipper {
|
|
|
36267
36279
|
/**
|
|
36268
36280
|
* Update [Content_Types].xml with extensions of new Image annotations
|
|
36269
36281
|
*/
|
|
36270
|
-
async updateContentTypes(docx, media, fromJson) {
|
|
36282
|
+
async updateContentTypes(docx, media, fromJson, updatedDocs = {}) {
|
|
36283
|
+
const additionalPartNames = Object.keys(updatedDocs || {});
|
|
36271
36284
|
const newMediaTypes = Object.keys(media).map((name) => {
|
|
36272
36285
|
return this.getFileExtension(name);
|
|
36273
36286
|
}).filter(Boolean);
|
|
36274
36287
|
const contentTypesPath = "[Content_Types].xml";
|
|
36275
36288
|
let contentTypesXml;
|
|
36276
36289
|
if (fromJson) {
|
|
36277
|
-
|
|
36290
|
+
if (Array.isArray(docx.files)) {
|
|
36291
|
+
contentTypesXml = docx.files.find((file) => file.name === contentTypesPath)?.content || "";
|
|
36292
|
+
} else {
|
|
36293
|
+
contentTypesXml = docx.files?.[contentTypesPath] || "";
|
|
36294
|
+
}
|
|
36278
36295
|
} else contentTypesXml = await docx.file(contentTypesPath).async("string");
|
|
36279
36296
|
let typesString = "";
|
|
36280
36297
|
const defaultMediaTypes = getContentTypesFromXml(contentTypesXml);
|
|
@@ -36300,24 +36317,39 @@ class DocxZipper {
|
|
|
36300
36317
|
const hasCommentsExtensible = types2.elements?.some(
|
|
36301
36318
|
(el) => el.name === "Override" && el.attributes.PartName === "/word/commentsExtensible.xml"
|
|
36302
36319
|
);
|
|
36303
|
-
|
|
36320
|
+
const hasFile = (filename) => {
|
|
36321
|
+
if (!docx?.files) return false;
|
|
36322
|
+
if (!fromJson) return Boolean(docx.files[filename]);
|
|
36323
|
+
if (Array.isArray(docx.files)) return docx.files.some((file) => file.name === filename);
|
|
36324
|
+
return Boolean(docx.files[filename]);
|
|
36325
|
+
};
|
|
36326
|
+
if (hasFile("word/comments.xml")) {
|
|
36304
36327
|
const commentsDef = `<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />`;
|
|
36305
36328
|
if (!hasComments) typesString += commentsDef;
|
|
36306
36329
|
}
|
|
36307
|
-
if (
|
|
36330
|
+
if (hasFile("word/commentsExtended.xml")) {
|
|
36308
36331
|
const commentsExtendedDef = `<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />`;
|
|
36309
36332
|
if (!hasCommentsExtended) typesString += commentsExtendedDef;
|
|
36310
36333
|
}
|
|
36311
|
-
if (
|
|
36334
|
+
if (hasFile("word/commentsIds.xml")) {
|
|
36312
36335
|
const commentsIdsDef = `<Override PartName="/word/commentsIds.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml" />`;
|
|
36313
36336
|
if (!hasCommentsIds) typesString += commentsIdsDef;
|
|
36314
36337
|
}
|
|
36315
|
-
if (
|
|
36338
|
+
if (hasFile("word/commentsExtensible.xml")) {
|
|
36316
36339
|
const commentsExtendedDef = `<Override PartName="/word/commentsExtensible.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml" />`;
|
|
36317
36340
|
if (!hasCommentsExtensible) typesString += commentsExtendedDef;
|
|
36318
36341
|
}
|
|
36319
|
-
|
|
36320
|
-
|
|
36342
|
+
const partNames = new Set(additionalPartNames);
|
|
36343
|
+
if (docx?.files) {
|
|
36344
|
+
if (fromJson && Array.isArray(docx.files)) {
|
|
36345
|
+
docx.files.forEach((file) => partNames.add(file.name));
|
|
36346
|
+
} else {
|
|
36347
|
+
Object.keys(docx.files).forEach((key2) => partNames.add(key2));
|
|
36348
|
+
}
|
|
36349
|
+
}
|
|
36350
|
+
partNames.forEach((name) => {
|
|
36351
|
+
if (name.includes(".rels")) return;
|
|
36352
|
+
if (!name.includes("header") && !name.includes("footer")) return;
|
|
36321
36353
|
const hasExtensible = types2.elements?.some(
|
|
36322
36354
|
(el) => el.name === "Override" && el.attributes.PartName === `/${name}`
|
|
36323
36355
|
);
|
|
@@ -36328,7 +36360,48 @@ class DocxZipper {
|
|
|
36328
36360
|
}
|
|
36329
36361
|
});
|
|
36330
36362
|
const beginningString = '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">';
|
|
36331
|
-
|
|
36363
|
+
let updatedContentTypesXml = contentTypesXml.replace(beginningString, `${beginningString}${typesString}`);
|
|
36364
|
+
let relationshipsXml = updatedDocs["word/_rels/document.xml.rels"];
|
|
36365
|
+
if (!relationshipsXml) {
|
|
36366
|
+
if (fromJson) {
|
|
36367
|
+
if (Array.isArray(docx.files)) {
|
|
36368
|
+
relationshipsXml = docx.files.find((file) => file.name === "word/_rels/document.xml.rels")?.content;
|
|
36369
|
+
} else {
|
|
36370
|
+
relationshipsXml = docx.files?.["word/_rels/document.xml.rels"];
|
|
36371
|
+
}
|
|
36372
|
+
} else {
|
|
36373
|
+
relationshipsXml = await docx.file("word/_rels/document.xml.rels")?.async("string");
|
|
36374
|
+
}
|
|
36375
|
+
}
|
|
36376
|
+
if (relationshipsXml) {
|
|
36377
|
+
try {
|
|
36378
|
+
const relJson = xmljs.xml2js(relationshipsXml, { compact: false });
|
|
36379
|
+
const relationships = relJson.elements?.find((el) => el.name === "Relationships");
|
|
36380
|
+
relationships?.elements?.forEach((rel) => {
|
|
36381
|
+
const type2 = rel.attributes?.Type;
|
|
36382
|
+
const target = rel.attributes?.Target;
|
|
36383
|
+
if (!type2 || !target) return;
|
|
36384
|
+
const isHeader = type2.includes("/header");
|
|
36385
|
+
const isFooter = type2.includes("/footer");
|
|
36386
|
+
if (!isHeader && !isFooter) return;
|
|
36387
|
+
let sanitizedTarget = target.replace(/^\.\//, "");
|
|
36388
|
+
if (sanitizedTarget.startsWith("../")) sanitizedTarget = sanitizedTarget.slice(3);
|
|
36389
|
+
if (sanitizedTarget.startsWith("/")) sanitizedTarget = sanitizedTarget.slice(1);
|
|
36390
|
+
const partName = sanitizedTarget.startsWith("word/") ? sanitizedTarget : `word/${sanitizedTarget}`;
|
|
36391
|
+
partNames.add(partName);
|
|
36392
|
+
});
|
|
36393
|
+
} catch (error) {
|
|
36394
|
+
console.warn("Failed to parse document relationships while updating content types", error);
|
|
36395
|
+
}
|
|
36396
|
+
}
|
|
36397
|
+
partNames.forEach((name) => {
|
|
36398
|
+
if (name.includes(".rels")) return;
|
|
36399
|
+
if (!name.includes("header") && !name.includes("footer")) return;
|
|
36400
|
+
if (updatedContentTypesXml.includes(`PartName="/${name}"`)) return;
|
|
36401
|
+
const type2 = name.includes("header") ? "header" : "footer";
|
|
36402
|
+
const extendedDef = `<Override PartName="/${name}" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.${type2}+xml"/>`;
|
|
36403
|
+
updatedContentTypesXml = updatedContentTypesXml.replace("</Types>", `${extendedDef}</Types>`);
|
|
36404
|
+
});
|
|
36332
36405
|
if (fromJson) return updatedContentTypesXml;
|
|
36333
36406
|
docx.file(contentTypesPath, updatedContentTypesXml);
|
|
36334
36407
|
}
|
|
@@ -36369,7 +36442,7 @@ class DocxZipper {
|
|
|
36369
36442
|
for (const [fontName, fontUintArray] of Object.entries(fonts)) {
|
|
36370
36443
|
zip.file(fontName, fontUintArray);
|
|
36371
36444
|
}
|
|
36372
|
-
await this.updateContentTypes(zip, media);
|
|
36445
|
+
await this.updateContentTypes(zip, media, false, updatedDocs);
|
|
36373
36446
|
return zip;
|
|
36374
36447
|
}
|
|
36375
36448
|
/**
|
|
@@ -36395,7 +36468,7 @@ class DocxZipper {
|
|
|
36395
36468
|
Object.keys(media).forEach((path) => {
|
|
36396
36469
|
unzippedOriginalDocx.file(path, media[path]);
|
|
36397
36470
|
});
|
|
36398
|
-
await this.updateContentTypes(unzippedOriginalDocx, media);
|
|
36471
|
+
await this.updateContentTypes(unzippedOriginalDocx, media, false, updatedDocs);
|
|
36399
36472
|
return unzippedOriginalDocx;
|
|
36400
36473
|
}
|
|
36401
36474
|
}
|
|
@@ -48053,9 +48126,11 @@ const toggleHeaderFooterEditMode = ({ editor, focusedSectionEditor, isEditMode,
|
|
|
48053
48126
|
item.editor.view.dom.setAttribute("documentmode", documentMode);
|
|
48054
48127
|
});
|
|
48055
48128
|
if (isEditMode) {
|
|
48056
|
-
const pm =
|
|
48057
|
-
pm
|
|
48058
|
-
|
|
48129
|
+
const pm = editor.view?.dom || editor.options.element?.querySelector?.(".ProseMirror");
|
|
48130
|
+
if (pm) {
|
|
48131
|
+
pm.classList.add("header-footer-edit");
|
|
48132
|
+
pm.setAttribute("aria-readonly", true);
|
|
48133
|
+
}
|
|
48059
48134
|
}
|
|
48060
48135
|
if (focusedSectionEditor) {
|
|
48061
48136
|
focusedSectionEditor.view.focus();
|
|
@@ -50667,7 +50742,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
50667
50742
|
setDocumentMode(documentMode) {
|
|
50668
50743
|
let cleanedMode = documentMode?.toLowerCase() || "editing";
|
|
50669
50744
|
if (!this.extensionService || !this.state) return;
|
|
50670
|
-
const pm =
|
|
50745
|
+
const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
|
|
50671
50746
|
if (this.options.role === "viewer") cleanedMode = "viewing";
|
|
50672
50747
|
if (this.options.role === "suggester" && cleanedMode === "editing") cleanedMode = "suggesting";
|
|
50673
50748
|
if (cleanedMode === "viewing") {
|
|
@@ -51155,7 +51230,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51155
51230
|
files: this.options.content
|
|
51156
51231
|
},
|
|
51157
51232
|
media,
|
|
51158
|
-
true
|
|
51233
|
+
true,
|
|
51234
|
+
updatedDocs
|
|
51159
51235
|
);
|
|
51160
51236
|
return updatedDocs;
|
|
51161
51237
|
}
|
|
@@ -51641,9 +51717,11 @@ createView_fn = function(element) {
|
|
|
51641
51717
|
isEditMode: false,
|
|
51642
51718
|
documentMode: this.options.documentMode
|
|
51643
51719
|
});
|
|
51644
|
-
const pm =
|
|
51645
|
-
pm
|
|
51646
|
-
|
|
51720
|
+
const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
|
|
51721
|
+
if (pm) {
|
|
51722
|
+
pm.classList.remove("header-footer-edit");
|
|
51723
|
+
pm.setAttribute("aria-readonly", false);
|
|
51724
|
+
}
|
|
51647
51725
|
}
|
|
51648
51726
|
setWordSelection(view, pos);
|
|
51649
51727
|
}
|
|
@@ -53712,6 +53790,16 @@ const shouldAllowNativeContextMenu = (event) => {
|
|
|
53712
53790
|
return prefersNativeMenu(event);
|
|
53713
53791
|
};
|
|
53714
53792
|
const shouldBypassContextMenu = shouldAllowNativeContextMenu;
|
|
53793
|
+
const DEFAULT_SELECTION_STATE = Object.freeze({
|
|
53794
|
+
focused: false,
|
|
53795
|
+
preservedSelection: null,
|
|
53796
|
+
showVisualSelection: false,
|
|
53797
|
+
skipFocusReset: false
|
|
53798
|
+
});
|
|
53799
|
+
const normalizeSelectionState = (state2 = {}) => ({
|
|
53800
|
+
...DEFAULT_SELECTION_STATE,
|
|
53801
|
+
...state2
|
|
53802
|
+
});
|
|
53715
53803
|
const CustomSelectionPluginKey = new PluginKey("CustomSelection");
|
|
53716
53804
|
const handleClickOutside = (event, editor) => {
|
|
53717
53805
|
const editorElem = editor?.options?.element;
|
|
@@ -53749,11 +53837,7 @@ const CustomSelection = Extension.create({
|
|
|
53749
53837
|
const customSelectionPlugin = new Plugin({
|
|
53750
53838
|
key: CustomSelectionPluginKey,
|
|
53751
53839
|
state: {
|
|
53752
|
-
init: () => ({
|
|
53753
|
-
focused: false,
|
|
53754
|
-
preservedSelection: null,
|
|
53755
|
-
showVisualSelection: false
|
|
53756
|
-
}),
|
|
53840
|
+
init: () => ({ ...DEFAULT_SELECTION_STATE }),
|
|
53757
53841
|
apply: (tr, value) => {
|
|
53758
53842
|
const meta = getFocusMeta(tr);
|
|
53759
53843
|
if (meta !== void 0) {
|
|
@@ -53784,7 +53868,8 @@ const CustomSelection = Extension.create({
|
|
|
53784
53868
|
setFocusMeta(view.state.tr, {
|
|
53785
53869
|
focused: true,
|
|
53786
53870
|
preservedSelection: selection,
|
|
53787
|
-
showVisualSelection: true
|
|
53871
|
+
showVisualSelection: true,
|
|
53872
|
+
skipFocusReset: true
|
|
53788
53873
|
})
|
|
53789
53874
|
);
|
|
53790
53875
|
}
|
|
@@ -53805,7 +53890,8 @@ const CustomSelection = Extension.create({
|
|
|
53805
53890
|
setFocusMeta(view.state.tr, {
|
|
53806
53891
|
focused: true,
|
|
53807
53892
|
preservedSelection: selection2,
|
|
53808
|
-
showVisualSelection: true
|
|
53893
|
+
showVisualSelection: true,
|
|
53894
|
+
skipFocusReset: true
|
|
53809
53895
|
})
|
|
53810
53896
|
);
|
|
53811
53897
|
this.editor.setOptions({
|
|
@@ -53828,7 +53914,8 @@ const CustomSelection = Extension.create({
|
|
|
53828
53914
|
setFocusMeta(view.state.tr, {
|
|
53829
53915
|
focused: true,
|
|
53830
53916
|
preservedSelection: selection,
|
|
53831
|
-
showVisualSelection: true
|
|
53917
|
+
showVisualSelection: true,
|
|
53918
|
+
skipFocusReset: false
|
|
53832
53919
|
})
|
|
53833
53920
|
);
|
|
53834
53921
|
this.editor.setOptions({
|
|
@@ -53846,7 +53933,8 @@ const CustomSelection = Extension.create({
|
|
|
53846
53933
|
setFocusMeta(view.state.tr, {
|
|
53847
53934
|
focused: true,
|
|
53848
53935
|
preservedSelection: selection,
|
|
53849
|
-
showVisualSelection: true
|
|
53936
|
+
showVisualSelection: true,
|
|
53937
|
+
skipFocusReset: false
|
|
53850
53938
|
})
|
|
53851
53939
|
);
|
|
53852
53940
|
}
|
|
@@ -53857,7 +53945,8 @@ const CustomSelection = Extension.create({
|
|
|
53857
53945
|
setFocusMeta(view.state.tr, {
|
|
53858
53946
|
focused: false,
|
|
53859
53947
|
preservedSelection: null,
|
|
53860
|
-
showVisualSelection: false
|
|
53948
|
+
showVisualSelection: false,
|
|
53949
|
+
skipFocusReset: false
|
|
53861
53950
|
})
|
|
53862
53951
|
);
|
|
53863
53952
|
if (!selection.empty && !this.editor.options.element?.contains(target)) {
|
|
@@ -53874,12 +53963,20 @@ const CustomSelection = Extension.create({
|
|
|
53874
53963
|
const isElement2 = target instanceof Element;
|
|
53875
53964
|
const isToolbarBtn = isElement2 && isToolbarButton(target);
|
|
53876
53965
|
const isToolbarInp = isElement2 && isToolbarInput(target);
|
|
53966
|
+
const focusState = getFocusState(view.state);
|
|
53967
|
+
if (focusState?.skipFocusReset) {
|
|
53968
|
+
view.dispatch(
|
|
53969
|
+
setFocusMeta(view.state.tr, normalizeSelectionState({ ...focusState, skipFocusReset: false }))
|
|
53970
|
+
);
|
|
53971
|
+
return false;
|
|
53972
|
+
}
|
|
53877
53973
|
if (!isToolbarBtn && !isToolbarInp) {
|
|
53878
53974
|
view.dispatch(
|
|
53879
53975
|
setFocusMeta(view.state.tr, {
|
|
53880
53976
|
focused: false,
|
|
53881
53977
|
preservedSelection: null,
|
|
53882
|
-
showVisualSelection: false
|
|
53978
|
+
showVisualSelection: false,
|
|
53979
|
+
skipFocusReset: false
|
|
53883
53980
|
})
|
|
53884
53981
|
);
|
|
53885
53982
|
}
|
|
@@ -53890,12 +53987,16 @@ const CustomSelection = Extension.create({
|
|
|
53890
53987
|
const isToolbarBtn = isElement2 && isToolbarButton(target);
|
|
53891
53988
|
const isToolbarInp = isElement2 && isToolbarInput(target);
|
|
53892
53989
|
const state2 = getFocusState(view.state);
|
|
53990
|
+
if (state2?.skipFocusReset) {
|
|
53991
|
+
return false;
|
|
53992
|
+
}
|
|
53893
53993
|
if (isToolbarBtn || isToolbarInp) {
|
|
53894
53994
|
view.dispatch(
|
|
53895
53995
|
setFocusMeta(view.state.tr, {
|
|
53896
53996
|
focused: true,
|
|
53897
53997
|
preservedSelection: state2.preservedSelection || view.state.selection,
|
|
53898
|
-
showVisualSelection: true
|
|
53998
|
+
showVisualSelection: true,
|
|
53999
|
+
skipFocusReset: false
|
|
53899
54000
|
})
|
|
53900
54001
|
);
|
|
53901
54002
|
} else {
|
|
@@ -53903,7 +54004,8 @@ const CustomSelection = Extension.create({
|
|
|
53903
54004
|
setFocusMeta(view.state.tr, {
|
|
53904
54005
|
focused: false,
|
|
53905
54006
|
preservedSelection: null,
|
|
53906
|
-
showVisualSelection: false
|
|
54007
|
+
showVisualSelection: false,
|
|
54008
|
+
skipFocusReset: false
|
|
53907
54009
|
})
|
|
53908
54010
|
);
|
|
53909
54011
|
}
|
|
@@ -69678,7 +69780,8 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
69678
69780
|
const prevSelection = prevState.selection;
|
|
69679
69781
|
if (selection.from !== prevSelection.from || selection.to !== prevSelection.to) {
|
|
69680
69782
|
setTimeout(() => {
|
|
69681
|
-
const
|
|
69783
|
+
const searchRoot = editorView?.dom;
|
|
69784
|
+
const selectedResizableWrapper = searchRoot?.querySelector(".sd-editor-resizable-wrapper");
|
|
69682
69785
|
if (selectedResizableWrapper) {
|
|
69683
69786
|
showResizeHandles(view2, selectedResizableWrapper);
|
|
69684
69787
|
} else {
|