@harbour-enterprises/superdoc 0.28.3 → 0.29.0-next.2
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-DUpLlOgk.es.js → PdfViewer-ByaA6tu-.es.js} +1 -1
- package/dist/chunks/{PdfViewer-QTV3RJM1.cjs → PdfViewer-POSV5DiN.cjs} +1 -1
- package/dist/chunks/{index-CuXB3dyN.cjs → index-3BBP_H1q.cjs} +3 -3
- package/dist/chunks/{index-DKtyoTAq.es.js → index-C3_BQlO-.es.js} +3 -3
- package/dist/chunks/{index-B3rVM2bJ-BgYPFhrh.cjs → index-F9UTAd9o-FTCIxXZV.cjs} +1 -1
- package/dist/chunks/{index-B3rVM2bJ-B62R9mgx.es.js → index-F9UTAd9o-O789Xvby.es.js} +1 -1
- package/dist/chunks/{super-editor.es-BKCxu5-_.cjs → super-editor.es-Ce1bKea8.cjs} +135 -36
- package/dist/chunks/{super-editor.es-BjTZa-cJ.es.js → super-editor.es-ZQFMn4Mx.es.js} +135 -36
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/images/altText_add.svg +3 -0
- package/dist/images/altText_disclaimer.svg +3 -0
- package/dist/images/altText_done.svg +3 -0
- package/dist/images/altText_spinner.svg +30 -0
- package/dist/images/altText_warning.svg +3 -0
- package/dist/images/annotation-check.svg +11 -0
- package/dist/images/annotation-comment.svg +16 -0
- package/dist/images/annotation-help.svg +26 -0
- package/dist/images/annotation-insert.svg +10 -0
- package/dist/images/annotation-key.svg +11 -0
- package/dist/images/annotation-newparagraph.svg +11 -0
- package/dist/images/annotation-noicon.svg +7 -0
- package/dist/images/annotation-note.svg +42 -0
- package/dist/images/annotation-paperclip.svg +6 -0
- package/dist/images/annotation-paragraph.svg +16 -0
- package/dist/images/annotation-pushpin.svg +7 -0
- package/dist/images/cursor-editorFreeHighlight.svg +6 -0
- package/dist/images/cursor-editorFreeText.svg +3 -0
- package/dist/images/cursor-editorInk.svg +4 -0
- package/dist/images/cursor-editorTextHighlight.svg +8 -0
- package/dist/images/editor-toolbar-delete.svg +5 -0
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/messageBar_closingButton.svg +3 -0
- package/dist/images/messageBar_warning.svg +3 -0
- package/dist/images/toolbarButton-editorHighlight.svg +6 -0
- package/dist/images/toolbarButton-menuArrow.svg +3 -0
- package/dist/style.css +10 -0
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CMtyH2w0.js → converter-C3c63BcJ.js} +95 -29
- package/dist/super-editor/chunks/{docx-zipper-Pgf9i5kI.js → docx-zipper-BYMN0YBQ.js} +1 -1
- package/dist/super-editor/chunks/{editor-C3KgN3zx.js → editor-CTJhnyzP.js} +42 -9
- package/dist/super-editor/chunks/{index-B3rVM2bJ.js → index-F9UTAd9o.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-TXkIPPvk.js → toolbar-6Ayv3LAk.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,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-C3_BQlO-.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -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-3BBP_H1q.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-Ce1bKea8.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-POSV5DiN.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.
|
|
17940
|
+
this.version = "0.29.0-next.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;
|
|
@@ -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-ZQFMn4Mx.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-ByaA6tu-.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.
|
|
17923
|
+
this.version = "0.29.0-next.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-Ce1bKea8.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|
|
@@ -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.
|
|
35609
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-next.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",
|
|
@@ -51857,6 +51933,16 @@ const Collaboration = Extension.create({
|
|
|
51857
51933
|
});
|
|
51858
51934
|
});
|
|
51859
51935
|
return [syncPlugin];
|
|
51936
|
+
},
|
|
51937
|
+
addCommands() {
|
|
51938
|
+
return {
|
|
51939
|
+
addImageToCollaboration: ({ mediaPath, fileData }) => () => {
|
|
51940
|
+
if (!this.options.ydoc || !mediaPath || !fileData) return false;
|
|
51941
|
+
const mediaMap = this.options.ydoc.getMap("media");
|
|
51942
|
+
mediaMap.set(mediaPath, fileData);
|
|
51943
|
+
return true;
|
|
51944
|
+
}
|
|
51945
|
+
};
|
|
51860
51946
|
}
|
|
51861
51947
|
});
|
|
51862
51948
|
const createSyncPlugin = (ydoc, editor) => {
|
|
@@ -53709,7 +53795,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53709
53795
|
{ default: remarkStringify },
|
|
53710
53796
|
{ default: remarkGfm }
|
|
53711
53797
|
] = await Promise.all([
|
|
53712
|
-
Promise.resolve().then(() => require("./index-
|
|
53798
|
+
Promise.resolve().then(() => require("./index-F9UTAd9o-FTCIxXZV.cjs")),
|
|
53713
53799
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
53714
53800
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
53715
53801
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -53927,7 +54013,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53927
54013
|
* @returns {Object | void} Migration results
|
|
53928
54014
|
*/
|
|
53929
54015
|
processCollaborationMigrations() {
|
|
53930
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
54016
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.2");
|
|
53931
54017
|
if (!this.options.ydoc) return;
|
|
53932
54018
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
53933
54019
|
let docVersion = metaMap.get("version");
|
|
@@ -54118,7 +54204,12 @@ initContainerElement_fn = function(options) {
|
|
|
54118
54204
|
options.element.classList.add("sd-super-editor-html");
|
|
54119
54205
|
}
|
|
54120
54206
|
}
|
|
54121
|
-
|
|
54207
|
+
if (options.isHeadless) {
|
|
54208
|
+
options.element = null;
|
|
54209
|
+
return;
|
|
54210
|
+
}
|
|
54211
|
+
options.element = options.element || document.createElement("div");
|
|
54212
|
+
applyStyleIsolationClass(options.element);
|
|
54122
54213
|
};
|
|
54123
54214
|
init_fn = function() {
|
|
54124
54215
|
__privateMethod$1(this, _Editor_instances, createExtensionService_fn).call(this);
|
|
@@ -59001,6 +59092,9 @@ function orderedListSync(editor) {
|
|
|
59001
59092
|
}
|
|
59002
59093
|
});
|
|
59003
59094
|
}
|
|
59095
|
+
const shouldSkipNodeView = (editor) => {
|
|
59096
|
+
return editor.options.isHeadless;
|
|
59097
|
+
};
|
|
59004
59098
|
const ListItem = Node$1.create({
|
|
59005
59099
|
name: "listItem",
|
|
59006
59100
|
content: "paragraph* block*",
|
|
@@ -59027,9 +59121,11 @@ const ListItem = Node$1.create({
|
|
|
59027
59121
|
},
|
|
59028
59122
|
/**
|
|
59029
59123
|
* Important: The listItem node uses a custom node view.
|
|
59030
|
-
*
|
|
59124
|
+
* Skip node view in headless mode for performance.
|
|
59125
|
+
* @returns {import('@core/NodeView.js').NodeView|null}
|
|
59031
59126
|
*/
|
|
59032
59127
|
addNodeView() {
|
|
59128
|
+
if (shouldSkipNodeView(this.editor)) return null;
|
|
59033
59129
|
return ({ node, editor, getPos, decorations }) => {
|
|
59034
59130
|
return new ListItemNodeView(node, getPos, decorations, editor);
|
|
59035
59131
|
};
|
|
@@ -74141,6 +74237,7 @@ class Popover {
|
|
|
74141
74237
|
this.view = view;
|
|
74142
74238
|
this.popover = document.createElement("div");
|
|
74143
74239
|
this.popover.className = "sd-editor-popover";
|
|
74240
|
+
applyStyleIsolationClass(this.popover);
|
|
74144
74241
|
document.body.appendChild(this.popover);
|
|
74145
74242
|
this.tippyInstance = tippy(this.popover, {
|
|
74146
74243
|
trigger: "manual",
|
|
@@ -75557,6 +75654,7 @@ const calculatePageBreaks = (view, editor, sectionData) => {
|
|
|
75557
75654
|
const tempContainer = editor.options.element.cloneNode();
|
|
75558
75655
|
if (!tempContainer) return [];
|
|
75559
75656
|
tempContainer.className = "temp-container super-editor";
|
|
75657
|
+
applyStyleIsolationClass(tempContainer);
|
|
75560
75658
|
const HIDDEN_EDITOR_OFFSET_TOP = 0;
|
|
75561
75659
|
const HIDDEN_EDITOR_OFFSET_LEFT = 0;
|
|
75562
75660
|
tempContainer.style.left = HIDDEN_EDITOR_OFFSET_TOP + "px";
|
|
@@ -76605,6 +76703,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
76605
76703
|
handleEl.style.pointerEvents = "auto";
|
|
76606
76704
|
resizeContainer.appendChild(handleEl);
|
|
76607
76705
|
}
|
|
76706
|
+
applyStyleIsolationClass(resizeContainer);
|
|
76608
76707
|
document.body.appendChild(resizeContainer);
|
|
76609
76708
|
updateHandlePositions(wrapper.firstElementChild);
|
|
76610
76709
|
}
|