@harbour-enterprises/superdoc 0.28.2 → 0.29.0-next.1
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-lAbA0-lT.cjs → PdfViewer-D-eZ2Yov.cjs} +1 -1
- package/dist/chunks/{PdfViewer-DpWYWlWj.es.js → PdfViewer-DkZrQk4g.es.js} +1 -1
- package/dist/chunks/{index-Dw2T2UIP.es.js → index-DJQlES_f.es.js} +3 -3
- package/dist/chunks/{index-Dz5_CDAf-B9kc0ArX.es.js → index-DQ6dCde6-BZTSGgXX.es.js} +1 -1
- package/dist/chunks/{index-Dz5_CDAf-C5D7BTD6.cjs → index-DQ6dCde6-BnMDi7G1.cjs} +1 -1
- package/dist/chunks/{index-ByVhw_G0.cjs → index-zeAsCB89.cjs} +3 -3
- package/dist/chunks/{super-editor.es-7iRvcDFc.cjs → super-editor.es-BV85aAFJ.cjs} +135 -36
- package/dist/chunks/{super-editor.es-DnZ5Ru-q.es.js → super-editor.es-CLErM40t.es.js} +135 -36
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/style.css +10 -0
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-C5g1OhUM.js → converter-iD03MYzC.js} +95 -29
- package/dist/super-editor/chunks/{docx-zipper-D9LLIDXC.js → docx-zipper-nrZgxvR8.js} +1 -1
- package/dist/super-editor/chunks/{editor-CD7hiFDo.js → editor-C7iHgXnE.js} +42 -9
- package/dist/super-editor/chunks/{index-Dz5_CDAf.js → index-DQ6dCde6.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-BC_z_xMq.js → toolbar-DKrq-G-q.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 +10 -0
- package/dist/super-editor/super-editor/src/core/super-converter/relationship-helpers.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/listImporter.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/numberingCache.d.ts +2 -2
- package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts +1 -0
- package/dist/super-editor/super-editor/src/utils/styleIsolation.d.ts +2 -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 +137 -38
- 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-DKMj1I9B.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-zeAsCB89.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-ZWZLQtoU.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-DJQlES_f.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as index, 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, 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-CLErM40t.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-ZWZLQtoU.es.js";
|
|
3
3
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
4
4
|
import { E as EventEmitter } from "./eventemitter3-BWEnUdTY.es.js";
|
|
@@ -17156,7 +17156,7 @@ const _sfc_main = {
|
|
|
17156
17156
|
__name: "SuperDoc",
|
|
17157
17157
|
emits: ["selection-update"],
|
|
17158
17158
|
setup(__props, { emit: __emit }) {
|
|
17159
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17159
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DkZrQk4g.es.js"));
|
|
17160
17160
|
const superdocStore = useSuperdocStore();
|
|
17161
17161
|
const commentsStore = useCommentsStore();
|
|
17162
17162
|
const {
|
|
@@ -17920,7 +17920,7 @@ class SuperDoc extends EventEmitter {
|
|
|
17920
17920
|
this.config.colors = shuffleArray(this.config.colors);
|
|
17921
17921
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
17922
17922
|
this.colorIndex = 0;
|
|
17923
|
-
this.version = "0.28.
|
|
17923
|
+
this.version = "0.28.2";
|
|
17924
17924
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
17925
17925
|
this.superdocId = config.superdocId || v4();
|
|
17926
17926
|
this.colors = this.config.colors;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
+
const superEditor_es = require("./super-editor.es-BV85aAFJ.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-BV85aAFJ.cjs");
|
|
3
3
|
const vue = require("./vue-DKMj1I9B.cjs");
|
|
4
4
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
5
5
|
const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
|
|
@@ -17173,7 +17173,7 @@ const _sfc_main = {
|
|
|
17173
17173
|
__name: "SuperDoc",
|
|
17174
17174
|
emits: ["selection-update"],
|
|
17175
17175
|
setup(__props, { emit: __emit }) {
|
|
17176
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17176
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D-eZ2Yov.cjs")));
|
|
17177
17177
|
const superdocStore = useSuperdocStore();
|
|
17178
17178
|
const commentsStore = useCommentsStore();
|
|
17179
17179
|
const {
|
|
@@ -17937,7 +17937,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
17937
17937
|
this.config.colors = shuffleArray(this.config.colors);
|
|
17938
17938
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
17939
17939
|
this.colorIndex = 0;
|
|
17940
|
-
this.version = "0.28.
|
|
17940
|
+
this.version = "0.28.2";
|
|
17941
17941
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
17942
17942
|
this.superdocId = config.superdocId || uuid.v4();
|
|
17943
17943
|
this.colors = this.config.colors;
|
|
@@ -20608,7 +20608,23 @@ const baseNumbering = {
|
|
|
20608
20608
|
]
|
|
20609
20609
|
};
|
|
20610
20610
|
const docxNumberingCacheStore = /* @__PURE__ */ new WeakMap();
|
|
20611
|
+
const NUMBERING_CACHE_KEY = "numbering-cache";
|
|
20611
20612
|
const LEVELS_MAP_KEY = Symbol("superdoc.numbering.levels");
|
|
20613
|
+
const NUMBERING_CACHE_DOCX_KEY = Symbol("superdoc.numbering.docx");
|
|
20614
|
+
const clearConverterCache = (converter) => {
|
|
20615
|
+
if (!converter) return;
|
|
20616
|
+
delete converter[NUMBERING_CACHE_KEY];
|
|
20617
|
+
delete converter[NUMBERING_CACHE_DOCX_KEY];
|
|
20618
|
+
};
|
|
20619
|
+
const setConverterCache = (converter, cache2, docx) => {
|
|
20620
|
+
if (!converter) return;
|
|
20621
|
+
converter[NUMBERING_CACHE_KEY] = cache2;
|
|
20622
|
+
if (docx && typeof docx === "object") {
|
|
20623
|
+
converter[NUMBERING_CACHE_DOCX_KEY] = docx;
|
|
20624
|
+
} else {
|
|
20625
|
+
delete converter[NUMBERING_CACHE_DOCX_KEY];
|
|
20626
|
+
}
|
|
20627
|
+
};
|
|
20612
20628
|
const createEmptyCache = () => ({
|
|
20613
20629
|
numToAbstractId: /* @__PURE__ */ new Map(),
|
|
20614
20630
|
abstractById: /* @__PURE__ */ new Map(),
|
|
@@ -20680,12 +20696,27 @@ const buildNumberingCache = (docx) => {
|
|
|
20680
20696
|
}
|
|
20681
20697
|
return { numToAbstractId, abstractById, templateById, numToDefinition, numNodesById };
|
|
20682
20698
|
};
|
|
20683
|
-
const ensureNumberingCache = (docx) => {
|
|
20699
|
+
const ensureNumberingCache = (docx, converter) => {
|
|
20700
|
+
if (converter?.[NUMBERING_CACHE_KEY]) {
|
|
20701
|
+
const cachedDocx = converter[NUMBERING_CACHE_DOCX_KEY];
|
|
20702
|
+
if (docx && cachedDocx && cachedDocx !== docx) {
|
|
20703
|
+
clearConverterCache(converter);
|
|
20704
|
+
} else {
|
|
20705
|
+
return converter[NUMBERING_CACHE_KEY];
|
|
20706
|
+
}
|
|
20707
|
+
}
|
|
20684
20708
|
if (!docx || typeof docx !== "object") return createEmptyCache();
|
|
20685
20709
|
const existingCache = docxNumberingCacheStore.get(docx);
|
|
20686
|
-
if (existingCache)
|
|
20710
|
+
if (existingCache) {
|
|
20711
|
+
setConverterCache(converter, existingCache, docx);
|
|
20712
|
+
return existingCache;
|
|
20713
|
+
}
|
|
20687
20714
|
const cache2 = buildNumberingCache(docx);
|
|
20688
|
-
|
|
20715
|
+
if (converter) {
|
|
20716
|
+
setConverterCache(converter, cache2, docx);
|
|
20717
|
+
} else {
|
|
20718
|
+
docxNumberingCacheStore.set(docx, cache2);
|
|
20719
|
+
}
|
|
20689
20720
|
return cache2;
|
|
20690
20721
|
};
|
|
20691
20722
|
const handleListNode = (params2) => {
|
|
@@ -20942,11 +20973,11 @@ const getListNumIdFromStyleRef = (styleId, docx) => {
|
|
|
20942
20973
|
}
|
|
20943
20974
|
return { numId, ilvl };
|
|
20944
20975
|
};
|
|
20945
|
-
const getAbstractDefinition = (numId, docx) => {
|
|
20976
|
+
const getAbstractDefinition = (numId, docx, converter) => {
|
|
20946
20977
|
const numberingXml = docx["word/numbering.xml"];
|
|
20947
20978
|
if (!numberingXml) return {};
|
|
20948
20979
|
if (numId == null) return void 0;
|
|
20949
|
-
const cache2 = ensureNumberingCache(docx);
|
|
20980
|
+
const cache2 = ensureNumberingCache(docx, converter);
|
|
20950
20981
|
const numKey = String(numId);
|
|
20951
20982
|
let listDefinitionForThisNumId = cache2.numToDefinition.get(numKey);
|
|
20952
20983
|
if (!listDefinitionForThisNumId) {
|
|
@@ -24459,10 +24490,11 @@ const getListItemStyleDefinitions = ({ styleId, numId, level, editor, tries }) =
|
|
|
24459
24490
|
if (typeof numId === "string") numId = Number(numId);
|
|
24460
24491
|
if (typeof level === "string") level = Number(level);
|
|
24461
24492
|
const docx = editor?.converter?.convertedXml;
|
|
24462
|
-
const
|
|
24493
|
+
const converter = editor?.converter;
|
|
24494
|
+
const numbering = converter?.numbering;
|
|
24463
24495
|
const styleDefinition = docx ? getStyleTagFromStyleId(styleId, docx) : null;
|
|
24464
24496
|
const stylePpr = styleDefinition?.elements.find((el) => el.name === "w:pPr");
|
|
24465
|
-
let abstractDefinition = docx ? getAbstractDefinition(numId, docx) : null;
|
|
24497
|
+
let abstractDefinition = docx ? getAbstractDefinition(numId, docx, converter) : null;
|
|
24466
24498
|
if (!abstractDefinition) {
|
|
24467
24499
|
const listDef = numbering?.definitions?.[numId];
|
|
24468
24500
|
const abstractId = listDef?.elements?.find((item) => item.name === "w:abstractNumId")?.attributes?.["w:val"];
|
|
@@ -28803,7 +28835,16 @@ const translateImageNode = (params2) => {
|
|
|
28803
28835
|
const { width: w2, height: h2 } = resizeKeepAspectRatio(size2.w, size2.h, maxWidthEmu);
|
|
28804
28836
|
if (w2 && h2) size2 = { w: w2, h: h2 };
|
|
28805
28837
|
}
|
|
28806
|
-
if (
|
|
28838
|
+
if (imageId) {
|
|
28839
|
+
const docx = params2.converter?.convertedXml || {};
|
|
28840
|
+
const rels = docx["word/_rels/document.xml.rels"];
|
|
28841
|
+
const relsTag = rels?.elements?.find((el) => el.name === "Relationships");
|
|
28842
|
+
const hasRelation = relsTag?.elements.find((el) => el.attributes.Id === imageId);
|
|
28843
|
+
const path = src?.split("word/")[1];
|
|
28844
|
+
if (!hasRelation) {
|
|
28845
|
+
addImageRelationshipForId(params2, imageId, path);
|
|
28846
|
+
}
|
|
28847
|
+
} else if (params2.node.type === "image" && !imageId) {
|
|
28807
28848
|
const path = src?.split("word/")[1];
|
|
28808
28849
|
imageId = addNewImageRelationship(params2, path);
|
|
28809
28850
|
} else if (params2.node.type === "fieldAnnotation" && !imageId) {
|
|
@@ -29027,6 +29068,18 @@ function addNewImageRelationship(params2, imagePath) {
|
|
|
29027
29068
|
params2.relationships.push(newRel);
|
|
29028
29069
|
return newId;
|
|
29029
29070
|
}
|
|
29071
|
+
function addImageRelationshipForId(params2, id, imagePath) {
|
|
29072
|
+
const newRel = {
|
|
29073
|
+
type: "element",
|
|
29074
|
+
name: "Relationship",
|
|
29075
|
+
attributes: {
|
|
29076
|
+
Id: id,
|
|
29077
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
|
|
29078
|
+
Target: imagePath
|
|
29079
|
+
}
|
|
29080
|
+
};
|
|
29081
|
+
params2.relationships.push(newRel);
|
|
29082
|
+
}
|
|
29030
29083
|
function translateVectorShape(params2) {
|
|
29031
29084
|
const { node } = params2;
|
|
29032
29085
|
const { drawingContent } = node.attrs;
|
|
@@ -33542,7 +33595,7 @@ const createDocumentJson = (docx, converter, editor) => {
|
|
|
33542
33595
|
comments,
|
|
33543
33596
|
inlineDocumentFonts,
|
|
33544
33597
|
linkedStyles: getStyleDefinitions(docx),
|
|
33545
|
-
numbering: getNumberingDefinitions(docx)
|
|
33598
|
+
numbering: getNumberingDefinitions(docx, converter)
|
|
33546
33599
|
};
|
|
33547
33600
|
}
|
|
33548
33601
|
return null;
|
|
@@ -33941,8 +33994,8 @@ function filterOutRootInlineNodes(content = []) {
|
|
|
33941
33994
|
]);
|
|
33942
33995
|
return content.filter((node) => node && typeof node.type === "string" && !INLINE_TYPES.has(node.type));
|
|
33943
33996
|
}
|
|
33944
|
-
function getNumberingDefinitions(docx) {
|
|
33945
|
-
const cache2 = ensureNumberingCache(docx);
|
|
33997
|
+
function getNumberingDefinitions(docx, converter) {
|
|
33998
|
+
const cache2 = ensureNumberingCache(docx, converter);
|
|
33946
33999
|
const abstractDefinitions = {};
|
|
33947
34000
|
cache2.abstractById.forEach((value, key2) => {
|
|
33948
34001
|
const numericKey = Number(key2);
|
|
@@ -35316,6 +35369,35 @@ const prepareCommentsXmlFilesForExport = ({ convertedXml, defs, commentsWithPara
|
|
|
35316
35369
|
};
|
|
35317
35370
|
const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
|
35318
35371
|
const HEADER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
|
|
35372
|
+
const FOOTER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
|
|
35373
|
+
const REL_ID_NUMERIC_PATTERN = /rId|mi/g;
|
|
35374
|
+
const getLargestRelationshipId = (relationships = []) => {
|
|
35375
|
+
const numericIds = relationships.map((rel) => Number(String(rel?.attributes?.Id ?? "").replace(REL_ID_NUMERIC_PATTERN, ""))).filter((value) => Number.isFinite(value));
|
|
35376
|
+
return numericIds.length ? Math.max(...numericIds) : 0;
|
|
35377
|
+
};
|
|
35378
|
+
const mergeRelationshipElements = (existingRelationships = [], newRelationships = []) => {
|
|
35379
|
+
if (!newRelationships?.length) return existingRelationships;
|
|
35380
|
+
let largestId = getLargestRelationshipId(existingRelationships);
|
|
35381
|
+
const seenIds = new Set(existingRelationships.map((rel) => rel?.attributes?.Id).filter(Boolean));
|
|
35382
|
+
const additions = [];
|
|
35383
|
+
newRelationships.forEach((rel) => {
|
|
35384
|
+
if (!rel?.attributes) return;
|
|
35385
|
+
const attributes = rel.attributes;
|
|
35386
|
+
const currentId = attributes.Id || "";
|
|
35387
|
+
attributes.Target = attributes?.Target?.replace(/&/g, "&");
|
|
35388
|
+
const existingTarget = existingRelationships.find((el) => el.attributes.Target === attributes.Target);
|
|
35389
|
+
const isMedia = attributes.Target?.startsWith("media/");
|
|
35390
|
+
const isNewHyperlink = attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && currentId.length > 6;
|
|
35391
|
+
const isNewHeadFoot = (attributes.Type === HEADER_RELATIONSHIP_TYPE || attributes.Type === FOOTER_RELATIONSHIP_TYPE) && currentId.length > 6;
|
|
35392
|
+
const hasSeenId = currentId && seenIds.has(currentId);
|
|
35393
|
+
const shouldSkip = !isNewHyperlink && !isNewHeadFoot && (hasSeenId || existingTarget);
|
|
35394
|
+
if (shouldSkip) return;
|
|
35395
|
+
attributes.Id = currentId.length > 6 || isMedia ? currentId : `rId${++largestId}`;
|
|
35396
|
+
seenIds.add(attributes.Id);
|
|
35397
|
+
additions.push(rel);
|
|
35398
|
+
});
|
|
35399
|
+
return additions.length ? [...existingRelationships, ...additions] : existingRelationships;
|
|
35400
|
+
};
|
|
35319
35401
|
const FONT_FAMILY_FALLBACKS = Object.freeze({
|
|
35320
35402
|
swiss: "Arial, sans-serif",
|
|
35321
35403
|
roman: "Times New Roman, serif",
|
|
@@ -35524,7 +35606,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35524
35606
|
static getStoredSuperdocVersion(docx) {
|
|
35525
35607
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35526
35608
|
}
|
|
35527
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.28.
|
|
35609
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.28.2") {
|
|
35528
35610
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35529
35611
|
}
|
|
35530
35612
|
/**
|
|
@@ -36030,23 +36112,7 @@ exportProcessHeadersFooters_fn = function({ isFinalDoc = false }) {
|
|
|
36030
36112
|
exportProcessNewRelationships_fn = function(rels = []) {
|
|
36031
36113
|
const relsData = this.convertedXml["word/_rels/document.xml.rels"];
|
|
36032
36114
|
const relationships = relsData.elements.find((x) => x.name === "Relationships");
|
|
36033
|
-
|
|
36034
|
-
const regex = /rId|mi/g;
|
|
36035
|
-
let largestId = Math.max(...relationships.elements.map((el) => Number(el.attributes.Id.replace(regex, ""))));
|
|
36036
|
-
rels.forEach((rel) => {
|
|
36037
|
-
const existingId = rel.attributes.Id;
|
|
36038
|
-
const existingTarget = relationships.elements.find((el) => el.attributes.Target === rel.attributes.Target);
|
|
36039
|
-
const isNewMedia = rel.attributes.Target?.startsWith("media/") && existingId.length > 6;
|
|
36040
|
-
const isNewHyperlink = rel.attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && existingId.length > 6;
|
|
36041
|
-
const isNewHeadFoot = rel.attributes.Type === HEADER_RELATIONSHIP_TYPE && existingId.length > 6;
|
|
36042
|
-
if (existingTarget && !isNewMedia && !isNewHyperlink && !isNewHeadFoot) {
|
|
36043
|
-
return;
|
|
36044
|
-
}
|
|
36045
|
-
rel.attributes.Target = rel.attributes?.Target?.replace(/&/g, "&");
|
|
36046
|
-
rel.attributes.Id = existingId.length > 6 ? existingId : `rId${++largestId}`;
|
|
36047
|
-
newRels.push(rel);
|
|
36048
|
-
});
|
|
36049
|
-
relationships.elements = [...relationships.elements, ...newRels];
|
|
36115
|
+
relationships.elements = mergeRelationshipElements(relationships.elements, rels);
|
|
36050
36116
|
};
|
|
36051
36117
|
exportProcessMediaFiles_fn = async function(media = {}) {
|
|
36052
36118
|
const processedData = {
|
|
@@ -49730,10 +49796,12 @@ const _ExtensionService = class _ExtensionService2 {
|
|
|
49730
49796
|
type: getNodeType(extension.name, this.schema)
|
|
49731
49797
|
};
|
|
49732
49798
|
const addNodeView = getExtensionConfigField(extension, "addNodeView", context);
|
|
49733
|
-
if (!addNodeView) return
|
|
49799
|
+
if (!addNodeView) return null;
|
|
49800
|
+
const nodeViewFunction = addNodeView();
|
|
49801
|
+
if (!nodeViewFunction) return null;
|
|
49734
49802
|
const nodeview = (node, _view, getPos, decorations) => {
|
|
49735
49803
|
const htmlAttributes = Attribute2.getAttributesToRender(node, extensionAttrs);
|
|
49736
|
-
return
|
|
49804
|
+
return nodeViewFunction({
|
|
49737
49805
|
editor,
|
|
49738
49806
|
node,
|
|
49739
49807
|
getPos,
|
|
@@ -49743,7 +49811,7 @@ const _ExtensionService = class _ExtensionService2 {
|
|
|
49743
49811
|
});
|
|
49744
49812
|
};
|
|
49745
49813
|
return [extension.name, nodeview];
|
|
49746
|
-
});
|
|
49814
|
+
}).filter(Boolean);
|
|
49747
49815
|
return Object.fromEntries(entries);
|
|
49748
49816
|
}
|
|
49749
49817
|
};
|
|
@@ -50366,6 +50434,7 @@ const getHighlightColor = ({ activeThreadId, threadId, isInternal, editor }) =>
|
|
|
50366
50434
|
const updateYdocDocxData = async (editor, ydoc) => {
|
|
50367
50435
|
ydoc = ydoc || editor.options.ydoc;
|
|
50368
50436
|
if (!ydoc) return;
|
|
50437
|
+
if (!editor || editor.isDestroyed) return;
|
|
50369
50438
|
const metaMap = ydoc.getMap("meta");
|
|
50370
50439
|
const docxValue = metaMap.get("docx");
|
|
50371
50440
|
let docx = [];
|
|
@@ -50397,6 +50466,11 @@ const updateYdocDocxData = async (editor, ydoc) => {
|
|
|
50397
50466
|
{ event: "docx-update", user: editor.options.user }
|
|
50398
50467
|
);
|
|
50399
50468
|
};
|
|
50469
|
+
const STYLE_ISOLATION_CLASS = "sd-editor-scoped";
|
|
50470
|
+
const applyStyleIsolationClass = (target) => {
|
|
50471
|
+
if (!target || !target.classList) return;
|
|
50472
|
+
target.classList.add(STYLE_ISOLATION_CLASS);
|
|
50473
|
+
};
|
|
50400
50474
|
const PaginationPluginKey = new PluginKey("paginationPlugin");
|
|
50401
50475
|
const initPaginationData = async (editor) => {
|
|
50402
50476
|
if (!editor.converter) return;
|
|
@@ -50432,6 +50506,7 @@ const getSectionHeight = async (editor, data) => {
|
|
|
50432
50506
|
return new Promise((resolve) => {
|
|
50433
50507
|
const editorContainer = document.createElement("div");
|
|
50434
50508
|
editorContainer.className = "super-editor";
|
|
50509
|
+
applyStyleIsolationClass(editorContainer);
|
|
50435
50510
|
editorContainer.style.padding = "0";
|
|
50436
50511
|
editorContainer.style.margin = "0";
|
|
50437
50512
|
const sectionEditor = createHeaderFooterEditor({ editor, data, editorContainer });
|
|
@@ -50459,6 +50534,7 @@ const createHeaderFooterEditor = ({
|
|
|
50459
50534
|
const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
|
|
50460
50535
|
const fontSizeInPixles = fontSizePt * 1.3333;
|
|
50461
50536
|
const lineHeight2 = fontSizeInPixles * 1.2;
|
|
50537
|
+
applyStyleIsolationClass(editorContainer);
|
|
50462
50538
|
Object.assign(editorContainer.style, {
|
|
50463
50539
|
padding: "0",
|
|
50464
50540
|
margin: "0",
|
|
@@ -51849,6 +51925,16 @@ const Collaboration = Extension.create({
|
|
|
51849
51925
|
});
|
|
51850
51926
|
});
|
|
51851
51927
|
return [syncPlugin];
|
|
51928
|
+
},
|
|
51929
|
+
addCommands() {
|
|
51930
|
+
return {
|
|
51931
|
+
addImageToCollaboration: ({ mediaPath, fileData }) => () => {
|
|
51932
|
+
if (!this.options.ydoc || !mediaPath || !fileData) return false;
|
|
51933
|
+
const mediaMap = this.options.ydoc.getMap("media");
|
|
51934
|
+
mediaMap.set(mediaPath, fileData);
|
|
51935
|
+
return true;
|
|
51936
|
+
}
|
|
51937
|
+
};
|
|
51852
51938
|
}
|
|
51853
51939
|
});
|
|
51854
51940
|
const createSyncPlugin = (ydoc, editor) => {
|
|
@@ -53701,7 +53787,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53701
53787
|
{ default: remarkStringify },
|
|
53702
53788
|
{ default: remarkGfm }
|
|
53703
53789
|
] = await Promise.all([
|
|
53704
|
-
Promise.resolve().then(() => require("./index-
|
|
53790
|
+
Promise.resolve().then(() => require("./index-DQ6dCde6-BnMDi7G1.cjs")),
|
|
53705
53791
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
53706
53792
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
53707
53793
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -53919,7 +54005,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53919
54005
|
* @returns {Object | void} Migration results
|
|
53920
54006
|
*/
|
|
53921
54007
|
processCollaborationMigrations() {
|
|
53922
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.28.
|
|
54008
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.28.2");
|
|
53923
54009
|
if (!this.options.ydoc) return;
|
|
53924
54010
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
53925
54011
|
let docVersion = metaMap.get("version");
|
|
@@ -54110,7 +54196,12 @@ initContainerElement_fn = function(options) {
|
|
|
54110
54196
|
options.element.classList.add("sd-super-editor-html");
|
|
54111
54197
|
}
|
|
54112
54198
|
}
|
|
54113
|
-
|
|
54199
|
+
if (options.isHeadless) {
|
|
54200
|
+
options.element = null;
|
|
54201
|
+
return;
|
|
54202
|
+
}
|
|
54203
|
+
options.element = options.element || document.createElement("div");
|
|
54204
|
+
applyStyleIsolationClass(options.element);
|
|
54114
54205
|
};
|
|
54115
54206
|
init_fn = function() {
|
|
54116
54207
|
__privateMethod$1(this, _Editor_instances, createExtensionService_fn).call(this);
|
|
@@ -58993,6 +59084,9 @@ function orderedListSync(editor) {
|
|
|
58993
59084
|
}
|
|
58994
59085
|
});
|
|
58995
59086
|
}
|
|
59087
|
+
const shouldSkipNodeView = (editor) => {
|
|
59088
|
+
return editor.options.isHeadless;
|
|
59089
|
+
};
|
|
58996
59090
|
const ListItem = Node$1.create({
|
|
58997
59091
|
name: "listItem",
|
|
58998
59092
|
content: "paragraph* block*",
|
|
@@ -59019,9 +59113,11 @@ const ListItem = Node$1.create({
|
|
|
59019
59113
|
},
|
|
59020
59114
|
/**
|
|
59021
59115
|
* Important: The listItem node uses a custom node view.
|
|
59022
|
-
*
|
|
59116
|
+
* Skip node view in headless mode for performance.
|
|
59117
|
+
* @returns {import('@core/NodeView.js').NodeView|null}
|
|
59023
59118
|
*/
|
|
59024
59119
|
addNodeView() {
|
|
59120
|
+
if (shouldSkipNodeView(this.editor)) return null;
|
|
59025
59121
|
return ({ node, editor, getPos, decorations }) => {
|
|
59026
59122
|
return new ListItemNodeView(node, getPos, decorations, editor);
|
|
59027
59123
|
};
|
|
@@ -74133,6 +74229,7 @@ class Popover {
|
|
|
74133
74229
|
this.view = view;
|
|
74134
74230
|
this.popover = document.createElement("div");
|
|
74135
74231
|
this.popover.className = "sd-editor-popover";
|
|
74232
|
+
applyStyleIsolationClass(this.popover);
|
|
74136
74233
|
document.body.appendChild(this.popover);
|
|
74137
74234
|
this.tippyInstance = tippy(this.popover, {
|
|
74138
74235
|
trigger: "manual",
|
|
@@ -75549,6 +75646,7 @@ const calculatePageBreaks = (view, editor, sectionData) => {
|
|
|
75549
75646
|
const tempContainer = editor.options.element.cloneNode();
|
|
75550
75647
|
if (!tempContainer) return [];
|
|
75551
75648
|
tempContainer.className = "temp-container super-editor";
|
|
75649
|
+
applyStyleIsolationClass(tempContainer);
|
|
75552
75650
|
const HIDDEN_EDITOR_OFFSET_TOP = 0;
|
|
75553
75651
|
const HIDDEN_EDITOR_OFFSET_LEFT = 0;
|
|
75554
75652
|
tempContainer.style.left = HIDDEN_EDITOR_OFFSET_TOP + "px";
|
|
@@ -76597,6 +76695,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
76597
76695
|
handleEl.style.pointerEvents = "auto";
|
|
76598
76696
|
resizeContainer.appendChild(handleEl);
|
|
76599
76697
|
}
|
|
76698
|
+
applyStyleIsolationClass(resizeContainer);
|
|
76600
76699
|
document.body.appendChild(resizeContainer);
|
|
76601
76700
|
updateHandlePositions(wrapper.firstElementChild);
|
|
76602
76701
|
}
|