@harbour-enterprises/superdoc 0.14.9 → 0.14.10-rev.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/{index-Oz4X1zyg.cjs → index-BJnbahW5.cjs} +2 -2
- package/dist/chunks/{index-MJ-5Yknb.es.js → index-D-GSlEOx.es.js} +1 -1
- package/dist/chunks/{index-CZuIe8A3.cjs → index-DgitWKaA.cjs} +1 -1
- package/dist/chunks/{index-BMwK7kM5.es.js → index-DyPsU2Hr.es.js} +2 -2
- package/dist/chunks/{super-editor.es-Chr_NZUl.es.js → super-editor.es-BHcsxPlW.es.js} +217 -45
- package/dist/chunks/{super-editor.es-CRo90k3Y.cjs → super-editor.es-BhaKEk3X.cjs} +217 -45
- package/dist/chunks/{url-CRVat8D5.cjs → url-D_eIx0lS.cjs} +1 -1
- package/dist/chunks/{url-Cqg2Hljl.es.js → url-mOsDfBsV.es.js} +1 -1
- package/dist/chunks/{xml-js-D78KIQHL.es.js → xml-js-Bl1Wa-pJ.es.js} +21 -7
- package/dist/chunks/{xml-js-t28wMlyv.cjs → xml-js-Clnb4wCO.cjs} +21 -7
- package/dist/core/SuperDoc.d.ts +1 -1
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B5dGyUBl.js → converter-BGjXkAcv.js} +193 -45
- package/dist/super-editor/chunks/{docx-zipper-DpKkn-tn.js → docx-zipper-CNbjS_KN.js} +1 -1
- package/dist/super-editor/chunks/{editor-DCx_vuYP.js → editor-BPzRkRzo.js} +33 -22
- package/dist/super-editor/chunks/{toolbar-CDzVNwBH.js → toolbar-UUbOJ3oL.js} +8 -6
- package/dist/super-editor/components/toolbar/defaultItems.d.ts.map +1 -1
- package/dist/super-editor/components/toolbar/toolbarIcons.d.ts +1 -0
- package/dist/super-editor/components/toolbar/toolbarTexts.d.ts +1 -0
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Editor.d.ts +3 -10
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts +2 -0
- package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts.map +1 -1
- package/dist/super-editor/core/inputRules/html/html-helpers.d.ts +4 -0
- package/dist/super-editor/core/inputRules/html/html-helpers.d.ts.map +1 -1
- package/dist/super-editor/core/migrations/0.14-listsv2/listsv2migration.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/SuperConverter.d.ts +5 -0
- package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/v2/importer/annotationImporter.d.ts.map +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/extensions/field-annotation/field-annotation.d.ts.map +1 -1
- package/dist/super-editor/extensions/image/image.d.ts.map +1 -1
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +1 -1
- package/dist/super-editor/super-editor.es.js +18 -6
- package/dist/super-editor/tests/e2e/test-app/dist/assets/index-BTMvkUyI.d.ts +3 -0
- package/dist/super-editor/tests/e2e/test-app/dist/assets/index-BTMvkUyI.d.ts.map +1 -0
- package/dist/super-editor/tests/e2e/test-app/vite.config.d.ts +1 -1
- 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 +7 -7
- package/dist/superdoc.es.js +8 -8
- package/dist/superdoc.umd.js +220 -48
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-D5XoMX4C.cjs");
|
|
3
3
|
const vue = require("./vue-tQYF719J.cjs");
|
|
4
|
-
const xmlJs = require("./xml-js-
|
|
5
|
-
const url = require("./url-
|
|
4
|
+
const xmlJs = require("./xml-js-Clnb4wCO.cjs");
|
|
5
|
+
const url = require("./url-D_eIx0lS.cjs");
|
|
6
6
|
function _mergeNamespaces(n, m) {
|
|
7
7
|
for (var i = 0; i < m.length; i++) {
|
|
8
8
|
const e = m[i];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./jszip-CYDYUNnI.es.js";
|
|
2
|
-
import { s as streamHttp, r as require$$1 } from "./index-
|
|
2
|
+
import { s as streamHttp, r as require$$1 } from "./index-DyPsU2Hr.es.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
for (var i = 0; i < m.length; i++) {
|
|
5
5
|
const e = m[i];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace, g as getDefaultExportFromCjs } from "./jszip-CYDYUNnI.es.js";
|
|
2
2
|
import { p as process$1 } from "./vue-lU0o_RlU.es.js";
|
|
3
|
-
import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-
|
|
4
|
-
import { u as url } from "./url-
|
|
3
|
+
import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-Bl1Wa-pJ.es.js";
|
|
4
|
+
import { u as url } from "./url-mOsDfBsV.es.js";
|
|
5
5
|
function _mergeNamespaces(n, m) {
|
|
6
6
|
for (var i = 0; i < m.length; i++) {
|
|
7
7
|
const e = m[i];
|
|
@@ -19205,7 +19205,7 @@ function parseMarks(property2, unknownMarks = [], docx = null) {
|
|
|
19205
19205
|
seen.add(m.type);
|
|
19206
19206
|
const { attributes = {} } = element;
|
|
19207
19207
|
const newMark = { type: m.type };
|
|
19208
|
-
if (attributes["w:val"]
|
|
19208
|
+
if (attributes["w:val"] === "0" || attributes["w:val"] === "none") {
|
|
19209
19209
|
return;
|
|
19210
19210
|
}
|
|
19211
19211
|
if (m.mark) newMark.type = m.mark;
|
|
@@ -19263,7 +19263,8 @@ function getMarkValue(markType, attributes, docx) {
|
|
|
19263
19263
|
underline: () => attributes["w:val"],
|
|
19264
19264
|
bold: () => attributes?.["w:val"] || null,
|
|
19265
19265
|
italic: () => attributes?.["w:val"] || null,
|
|
19266
|
-
highlight: () => getHighLightValue(attributes)
|
|
19266
|
+
highlight: () => getHighLightValue(attributes),
|
|
19267
|
+
strike: () => getStrikeValue(attributes)
|
|
19267
19268
|
};
|
|
19268
19269
|
if (!(markType in markValueMapper)) {
|
|
19269
19270
|
console.debug("❗️❗️ No value mapper for:", markType, "Attributes:", attributes);
|
|
@@ -19306,6 +19307,9 @@ function getHighLightValue(attributes) {
|
|
|
19306
19307
|
if (isValidHexColor(attributes?.["w:val"])) return `#${attributes["w:val"]}`;
|
|
19307
19308
|
return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
|
|
19308
19309
|
}
|
|
19310
|
+
function getStrikeValue(attributes) {
|
|
19311
|
+
return attributes?.["w:val"] === "1" ? attributes["w:val"] : null;
|
|
19312
|
+
}
|
|
19309
19313
|
function parseProperties(node2, docx) {
|
|
19310
19314
|
const marks = [];
|
|
19311
19315
|
const unknownMarks = [];
|
|
@@ -20444,9 +20448,9 @@ const getAbstractDefinition = (numId, docx) => {
|
|
|
20444
20448
|
const { elements } = def;
|
|
20445
20449
|
const listData = elements[0];
|
|
20446
20450
|
const numberingElements = listData.elements;
|
|
20447
|
-
const abstractDefinitions = numberingElements
|
|
20448
|
-
const numDefinitions = numberingElements
|
|
20449
|
-
const numDefinition = numDefinitions
|
|
20451
|
+
const abstractDefinitions = numberingElements?.filter((style2) => style2.name === "w:abstractNum");
|
|
20452
|
+
const numDefinitions = numberingElements?.filter((style2) => style2.name === "w:num");
|
|
20453
|
+
const numDefinition = numDefinitions?.find((style2) => style2.attributes["w:numId"] == numId);
|
|
20450
20454
|
const abstractNumId = numDefinition?.elements[0].attributes["w:val"];
|
|
20451
20455
|
let listDefinitionForThisNumId = abstractDefinitions?.find(
|
|
20452
20456
|
(style2) => style2.attributes["w:abstractNumId"] === abstractNumId
|
|
@@ -22314,6 +22318,24 @@ const generateNewListDefinition = ({ numId, listType, editor }) => {
|
|
|
22314
22318
|
editor.emit("list-definitions-change", { change, numbering: newNumbering, editor });
|
|
22315
22319
|
return { abstract: newAbstractDef, definition: newNumDef };
|
|
22316
22320
|
};
|
|
22321
|
+
const changeNumIdSameAbstract = (numId, level, listType, editor) => {
|
|
22322
|
+
const newId = getNewListId(editor, "definitions");
|
|
22323
|
+
const { abstract } = ListHelpers.getListDefinitionDetails({ numId, level, listType, editor });
|
|
22324
|
+
const numbering = editor.converter.numbering;
|
|
22325
|
+
const newNumbering = { ...numbering };
|
|
22326
|
+
const newAbstractId = getNewListId(editor, "abstracts");
|
|
22327
|
+
const newAbstractDef = {
|
|
22328
|
+
...abstract,
|
|
22329
|
+
attributes: {
|
|
22330
|
+
...abstract.attributes,
|
|
22331
|
+
"w:abstractNumId": String(newAbstractId)
|
|
22332
|
+
}
|
|
22333
|
+
};
|
|
22334
|
+
newNumbering.abstracts[newAbstractId] = newAbstractDef;
|
|
22335
|
+
const newNumDef = getBasicNumIdTag(newId, newAbstractId);
|
|
22336
|
+
newNumbering.definitions[newId] = newNumDef;
|
|
22337
|
+
return newId;
|
|
22338
|
+
};
|
|
22317
22339
|
const getBasicNumIdTag = (numId, abstractId) => {
|
|
22318
22340
|
return {
|
|
22319
22341
|
type: "element",
|
|
@@ -22348,7 +22370,7 @@ const getListDefinitionDetails = ({ numId, level, listType, editor }) => {
|
|
|
22348
22370
|
const listNumberingType = listDefinition?.elements?.find((item) => item.name === "w:numFmt")?.attributes["w:val"];
|
|
22349
22371
|
let customFormat;
|
|
22350
22372
|
if (numFmt === "custom") customFormat = numFmtTag?.attributes?.["w:format"];
|
|
22351
|
-
return { start: start2, numFmt, lvlText, listNumberingType, customFormat, abstract };
|
|
22373
|
+
return { start: start2, numFmt, lvlText, listNumberingType, customFormat, abstract, abstractId };
|
|
22352
22374
|
};
|
|
22353
22375
|
const removeListDefinitions = (listId, editor) => {
|
|
22354
22376
|
const { numbering } = editor.converter;
|
|
@@ -22515,6 +22537,7 @@ const ListHelpers = {
|
|
|
22515
22537
|
createSchemaOrderedListNode,
|
|
22516
22538
|
createListItemNodeJSON,
|
|
22517
22539
|
addInlineTextMarks,
|
|
22540
|
+
changeNumIdSameAbstract,
|
|
22518
22541
|
// Base list definitions
|
|
22519
22542
|
baseOrderedListDef,
|
|
22520
22543
|
baseBulletList
|
|
@@ -22715,6 +22738,113 @@ function createSingleItemList(li, tag, rootNumId, level, editor, NodeInterface)
|
|
|
22715
22738
|
newList.appendChild(newLi);
|
|
22716
22739
|
return newList;
|
|
22717
22740
|
}
|
|
22741
|
+
function unflattenListsInHtml(html) {
|
|
22742
|
+
const parser = new DOMParser();
|
|
22743
|
+
const doc2 = parser.parseFromString(html, "text/html");
|
|
22744
|
+
const allNodes = [...doc2.body.children];
|
|
22745
|
+
const listSequences = [];
|
|
22746
|
+
let currentSequence = null;
|
|
22747
|
+
allNodes.forEach((node2, index2) => {
|
|
22748
|
+
const isFlattenList = node2.tagName && (node2.tagName === "OL" || node2.tagName === "UL") && node2.hasAttribute("data-list-id");
|
|
22749
|
+
if (isFlattenList) {
|
|
22750
|
+
const listId = node2.getAttribute("data-list-id");
|
|
22751
|
+
if (currentSequence && currentSequence.id === listId) {
|
|
22752
|
+
currentSequence.lists.push({ element: node2, index: index2 });
|
|
22753
|
+
} else {
|
|
22754
|
+
currentSequence = {
|
|
22755
|
+
id: listId,
|
|
22756
|
+
lists: [{ element: node2, index: index2 }]
|
|
22757
|
+
};
|
|
22758
|
+
listSequences.push(currentSequence);
|
|
22759
|
+
}
|
|
22760
|
+
} else {
|
|
22761
|
+
currentSequence = null;
|
|
22762
|
+
}
|
|
22763
|
+
});
|
|
22764
|
+
listSequences.reverse().forEach((sequence) => {
|
|
22765
|
+
const sequenceLists = sequence.lists;
|
|
22766
|
+
if (sequenceLists.length === 0) {
|
|
22767
|
+
return;
|
|
22768
|
+
}
|
|
22769
|
+
const items = sequenceLists.map(({ element: list }) => {
|
|
22770
|
+
const liElement = list.querySelector("li");
|
|
22771
|
+
if (!liElement) return null;
|
|
22772
|
+
return {
|
|
22773
|
+
element: liElement,
|
|
22774
|
+
level: parseInt(liElement.getAttribute("data-level") || "0"),
|
|
22775
|
+
numFmt: liElement.getAttribute("data-num-fmt") || "bullet",
|
|
22776
|
+
listLevel: JSON.parse(liElement.getAttribute("data-list-level") || "[1]")
|
|
22777
|
+
};
|
|
22778
|
+
}).filter((item) => item !== null);
|
|
22779
|
+
if (items.length === 0) {
|
|
22780
|
+
return;
|
|
22781
|
+
}
|
|
22782
|
+
const rootList = buildNestedList({ items });
|
|
22783
|
+
const firstOriginalList = sequenceLists[0].element;
|
|
22784
|
+
firstOriginalList?.parentNode?.insertBefore(rootList, firstOriginalList);
|
|
22785
|
+
sequenceLists.forEach(({ element: list }) => {
|
|
22786
|
+
if (list.parentNode) list.parentNode.removeChild(list);
|
|
22787
|
+
});
|
|
22788
|
+
});
|
|
22789
|
+
return doc2.body.innerHTML;
|
|
22790
|
+
}
|
|
22791
|
+
function buildNestedList({ items }) {
|
|
22792
|
+
if (!items.length) {
|
|
22793
|
+
return null;
|
|
22794
|
+
}
|
|
22795
|
+
const [rootItem] = items;
|
|
22796
|
+
const doc2 = rootItem.element.ownerDocument;
|
|
22797
|
+
const isOrderedList = rootItem.numFmt && !["bullet", "none"].includes(rootItem.numFmt);
|
|
22798
|
+
const rootList = doc2.createElement(isOrderedList ? "ol" : "ul");
|
|
22799
|
+
if (isOrderedList && rootItem.listLevel?.[0] && rootItem.listLevel[0] > 1) {
|
|
22800
|
+
rootList.setAttribute("start", rootItem.listLevel[0]);
|
|
22801
|
+
}
|
|
22802
|
+
const lastLevelItem = /* @__PURE__ */ new Map();
|
|
22803
|
+
items.forEach((item) => {
|
|
22804
|
+
const { element: liElement, level, numFmt, listLevel } = item;
|
|
22805
|
+
const cleanLi = cleanListItem(liElement.cloneNode(true));
|
|
22806
|
+
if (level === 0) {
|
|
22807
|
+
rootList.append(cleanLi);
|
|
22808
|
+
lastLevelItem.set(0, cleanLi);
|
|
22809
|
+
} else {
|
|
22810
|
+
const parentLi = lastLevelItem.get(level - 1);
|
|
22811
|
+
if (!parentLi) {
|
|
22812
|
+
rootList.append(cleanLi);
|
|
22813
|
+
lastLevelItem.set(level, cleanLi);
|
|
22814
|
+
return;
|
|
22815
|
+
}
|
|
22816
|
+
let nestedList = null;
|
|
22817
|
+
[...parentLi.children].forEach((child) => {
|
|
22818
|
+
if (child.tagName && (child.tagName === "OL" || child.tagName === "UL")) {
|
|
22819
|
+
nestedList = child;
|
|
22820
|
+
}
|
|
22821
|
+
});
|
|
22822
|
+
if (!nestedList) {
|
|
22823
|
+
const listType = numFmt && !["bullet", "none"].includes(numFmt) ? "ol" : "ul";
|
|
22824
|
+
nestedList = doc2.createElement(listType);
|
|
22825
|
+
parentLi.append(nestedList);
|
|
22826
|
+
}
|
|
22827
|
+
nestedList.append(cleanLi);
|
|
22828
|
+
lastLevelItem.set(level, cleanLi);
|
|
22829
|
+
}
|
|
22830
|
+
});
|
|
22831
|
+
return rootList;
|
|
22832
|
+
}
|
|
22833
|
+
function cleanListItem(listItem) {
|
|
22834
|
+
const attrs = [
|
|
22835
|
+
"data-num-id",
|
|
22836
|
+
"data-level",
|
|
22837
|
+
"data-num-fmt",
|
|
22838
|
+
"data-lvl-text",
|
|
22839
|
+
"data-list-level",
|
|
22840
|
+
"data-marker-type",
|
|
22841
|
+
"aria-label"
|
|
22842
|
+
];
|
|
22843
|
+
attrs.forEach((attr) => {
|
|
22844
|
+
listItem.removeAttribute(attr);
|
|
22845
|
+
});
|
|
22846
|
+
return listItem;
|
|
22847
|
+
}
|
|
22718
22848
|
class InputRule {
|
|
22719
22849
|
constructor(config) {
|
|
22720
22850
|
__publicField$2(this, "match");
|
|
@@ -23919,6 +24049,7 @@ function translateImageNode(params2, imageSize) {
|
|
|
23919
24049
|
let imageId = attrs.rId;
|
|
23920
24050
|
const src = attrs.src || attrs.imageSrc;
|
|
23921
24051
|
const { originalWidth, originalHeight } = getPngDimensions(src);
|
|
24052
|
+
const imageName = params2.node.type === "image" ? src?.split("word/media/")[1] : attrs.fieldId?.replace("-", "_");
|
|
23922
24053
|
let size2 = attrs.size ? {
|
|
23923
24054
|
w: pixelsToEmu(attrs.size.width),
|
|
23924
24055
|
h: pixelsToEmu(attrs.size.height)
|
|
@@ -23948,11 +24079,9 @@ function translateImageNode(params2, imageSize) {
|
|
|
23948
24079
|
if (!type2) {
|
|
23949
24080
|
return prepareTextAnnotation(params2);
|
|
23950
24081
|
}
|
|
23951
|
-
const
|
|
23952
|
-
const cleanUrl = attrs.fieldId.replace("-", "_");
|
|
23953
|
-
const imageUrl = `media/${cleanUrl}_${hash2}.${type2}`;
|
|
24082
|
+
const imageUrl = `media/${imageName}_${attrs.hash}.${type2}`;
|
|
23954
24083
|
imageId = addNewImageRelationship(params2, imageUrl);
|
|
23955
|
-
params2.media[`${
|
|
24084
|
+
params2.media[`${imageName}_${attrs.hash}.${type2}`] = src;
|
|
23956
24085
|
}
|
|
23957
24086
|
let inlineAttrs = attrs.originalPadding || {
|
|
23958
24087
|
distT: 0,
|
|
@@ -24077,8 +24206,7 @@ function translateImageNode(params2, imageSize) {
|
|
|
24077
24206
|
name: "wp:docPr",
|
|
24078
24207
|
attributes: {
|
|
24079
24208
|
id: attrs.id || 0,
|
|
24080
|
-
name: attrs.alt
|
|
24081
|
-
descr: attrs.title
|
|
24209
|
+
name: attrs.alt || `Picture ${imageName}`
|
|
24082
24210
|
}
|
|
24083
24211
|
},
|
|
24084
24212
|
{
|
|
@@ -24112,7 +24240,7 @@ function translateImageNode(params2, imageSize) {
|
|
|
24112
24240
|
name: "pic:cNvPr",
|
|
24113
24241
|
attributes: {
|
|
24114
24242
|
id: attrs.id || 0,
|
|
24115
|
-
name: attrs.title
|
|
24243
|
+
name: attrs.title || `Picture ${imageName}`
|
|
24116
24244
|
}
|
|
24117
24245
|
},
|
|
24118
24246
|
{
|
|
@@ -24222,12 +24350,31 @@ function prepareHtmlAnnotation(params2) {
|
|
|
24222
24350
|
state2 = applyMarksToHtmlAnnotation(state2, allMarks);
|
|
24223
24351
|
}
|
|
24224
24352
|
const htmlAnnotationNode = state2.doc.toJSON();
|
|
24353
|
+
const listTypes = ["bulletList", "orderedList"];
|
|
24354
|
+
const { editor } = params2;
|
|
24355
|
+
const seenLists = /* @__PURE__ */ new Map();
|
|
24356
|
+
state2.doc.descendants((node2, pos) => {
|
|
24357
|
+
if (listTypes.includes(node2.type.name)) {
|
|
24358
|
+
const listItem = node2.firstChild;
|
|
24359
|
+
const { attrs: attrs2 } = listItem;
|
|
24360
|
+
const { level, numId } = attrs2;
|
|
24361
|
+
if (!seenLists.has(numId)) {
|
|
24362
|
+
const newNumId = ListHelpers.changeNumIdSameAbstract(numId, level, node2.type.name, editor);
|
|
24363
|
+
listItem.attrs.numId = newNumId;
|
|
24364
|
+
seenLists.set(numId, newNumId);
|
|
24365
|
+
} else {
|
|
24366
|
+
const newNumId = seenLists.get(numId);
|
|
24367
|
+
listItem.attrs.numId = newNumId;
|
|
24368
|
+
}
|
|
24369
|
+
}
|
|
24370
|
+
});
|
|
24371
|
+
const elements = translateChildNodes({
|
|
24372
|
+
...params2,
|
|
24373
|
+
node: htmlAnnotationNode
|
|
24374
|
+
});
|
|
24225
24375
|
return {
|
|
24226
24376
|
name: "htmlAnnotation",
|
|
24227
|
-
elements
|
|
24228
|
-
...params2,
|
|
24229
|
-
node: htmlAnnotationNode
|
|
24230
|
-
})
|
|
24377
|
+
elements
|
|
24231
24378
|
};
|
|
24232
24379
|
}
|
|
24233
24380
|
function prepareImageAnnotation(params2, imageSize) {
|
|
@@ -25364,6 +25511,7 @@ const handleAnnotationNode = (params2) => {
|
|
|
25364
25511
|
}
|
|
25365
25512
|
const { attrs: marksAsAttrs, marks } = parseAnnotationMarks(sdtContent);
|
|
25366
25513
|
const allAttrs = { ...attrs, ...marksAsAttrs };
|
|
25514
|
+
allAttrs.hash = generateDocxRandomId(4);
|
|
25367
25515
|
if (!attrs.fieldId || !attrs.displayLabel) {
|
|
25368
25516
|
return { nodes: [], consumed: 0 };
|
|
25369
25517
|
}
|
|
@@ -26359,7 +26507,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
26359
26507
|
return;
|
|
26360
26508
|
}
|
|
26361
26509
|
}
|
|
26362
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.
|
|
26510
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.10-rev.2") {
|
|
26363
26511
|
const customLocation = "docProps/custom.xml";
|
|
26364
26512
|
if (!docx[customLocation]) {
|
|
26365
26513
|
docx[customLocation] = generateCustomXml();
|
|
@@ -26747,7 +26895,6 @@ exportProcessNewRelationships_fn = function(rels = []) {
|
|
|
26747
26895
|
newRels.push(rel);
|
|
26748
26896
|
});
|
|
26749
26897
|
relationships.elements = [...relationships.elements, ...newRels];
|
|
26750
|
-
this.convertedXml["word/_rels/document.xml.rels"] = relsData;
|
|
26751
26898
|
};
|
|
26752
26899
|
exportProcessMediaFiles_fn = async function(media, editor) {
|
|
26753
26900
|
const processedData = {};
|
|
@@ -26791,7 +26938,7 @@ __publicField$2(_SuperConverter, "markTypes", [
|
|
|
26791
26938
|
{ name: "w:i", type: "italic" },
|
|
26792
26939
|
{ name: "w:iCs", type: "italic" },
|
|
26793
26940
|
{ name: "w:u", type: "underline", mark: "underline", property: "underlineType" },
|
|
26794
|
-
{ name: "w:strike", type: "strike" },
|
|
26941
|
+
{ name: "w:strike", type: "strike", mark: "strike" },
|
|
26795
26942
|
{ name: "w:color", type: "color", mark: "textStyle", property: "color" },
|
|
26796
26943
|
{ name: "w:sz", type: "fontSize", mark: "textStyle", property: "fontSize" },
|
|
26797
26944
|
{ name: "w:szCs", type: "fontSize", mark: "textStyle", property: "fontSize" },
|
|
@@ -26835,7 +26982,7 @@ function storeSuperdocVersion(docx) {
|
|
|
26835
26982
|
function generateCustomXml() {
|
|
26836
26983
|
return DEFAULT_CUSTOM_XML;
|
|
26837
26984
|
}
|
|
26838
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.14.
|
|
26985
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.14.10-rev.2") {
|
|
26839
26986
|
return {
|
|
26840
26987
|
type: "element",
|
|
26841
26988
|
name: "property",
|
|
@@ -42096,10 +42243,13 @@ const generateMissingListDefinition = (listNode, editor) => {
|
|
|
42096
42243
|
const migrateParagraphFieldsListsV2 = async (annotationValues = [], editor) => {
|
|
42097
42244
|
const annotations = getAllFieldAnnotations(editor.state);
|
|
42098
42245
|
const newValues = [];
|
|
42246
|
+
if (!annotations.length) {
|
|
42247
|
+
return annotationValues;
|
|
42248
|
+
}
|
|
42099
42249
|
for (const annotation of annotations) {
|
|
42100
42250
|
const type2 = annotation.node?.attrs?.type;
|
|
42101
42251
|
const matchedAnnotation = annotationValues.find((v) => v.input_id === annotation.node.attrs.fieldId);
|
|
42102
|
-
if (!type2 || type2 !== "html") {
|
|
42252
|
+
if (!!matchedAnnotation && (!type2 || type2 !== "html")) {
|
|
42103
42253
|
newValues.push(matchedAnnotation);
|
|
42104
42254
|
continue;
|
|
42105
42255
|
}
|
|
@@ -42722,9 +42872,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
42722
42872
|
const attributes = typeof nameOrAttributes === "string" ? attributesOrUndefined : nameOrAttributes;
|
|
42723
42873
|
return isActive(this.state, name, attributes);
|
|
42724
42874
|
}
|
|
42725
|
-
/**
|
|
42726
|
-
* Get the document as JSON.
|
|
42727
|
-
*/
|
|
42728
42875
|
/**
|
|
42729
42876
|
* Get the editor content as JSON
|
|
42730
42877
|
* @returns {Object} Editor content as JSON
|
|
@@ -42732,18 +42879,20 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
42732
42879
|
getJSON() {
|
|
42733
42880
|
return this.state.doc.toJSON();
|
|
42734
42881
|
}
|
|
42735
|
-
/**
|
|
42736
|
-
* Get HTML string of the document
|
|
42737
|
-
*/
|
|
42738
42882
|
/**
|
|
42739
42883
|
* Get the editor content as HTML
|
|
42740
42884
|
* @returns {string} Editor content as HTML
|
|
42741
42885
|
*/
|
|
42742
|
-
getHTML() {
|
|
42743
|
-
const
|
|
42886
|
+
getHTML({ unflattenLists = false } = {}) {
|
|
42887
|
+
const tempDocument = document.implementation.createHTMLDocument();
|
|
42888
|
+
const container = tempDocument.createElement("div");
|
|
42744
42889
|
const fragment = DOMSerializer.fromSchema(this.schema).serializeFragment(this.state.doc.content);
|
|
42745
|
-
|
|
42746
|
-
|
|
42890
|
+
container.appendChild(fragment);
|
|
42891
|
+
let html = container.innerHTML;
|
|
42892
|
+
if (unflattenLists) {
|
|
42893
|
+
html = unflattenListsInHtml(html);
|
|
42894
|
+
}
|
|
42895
|
+
return html;
|
|
42747
42896
|
}
|
|
42748
42897
|
/**
|
|
42749
42898
|
* Create a child editor linked to this editor.
|
|
@@ -42755,9 +42904,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
42755
42904
|
createChildEditor(options2) {
|
|
42756
42905
|
return createLinkedChildEditor(this, options2);
|
|
42757
42906
|
}
|
|
42758
|
-
/**
|
|
42759
|
-
* Get page styles
|
|
42760
|
-
*/
|
|
42761
42907
|
/**
|
|
42762
42908
|
* Get page styles
|
|
42763
42909
|
* @returns {Object} Page styles
|
|
@@ -42922,7 +43068,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
42922
43068
|
* @returns {Object | void} Migration results
|
|
42923
43069
|
*/
|
|
42924
43070
|
processCollaborationMigrations() {
|
|
42925
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.14.
|
|
43071
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.14.10-rev.2");
|
|
42926
43072
|
if (!this.options.ydoc) return;
|
|
42927
43073
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
42928
43074
|
let docVersion = metaMap.get("version");
|
|
@@ -43052,7 +43198,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
43052
43198
|
*/
|
|
43053
43199
|
async migrateParagraphFields(annotationValues = []) {
|
|
43054
43200
|
if (!Array.isArray(annotationValues) || !annotationValues.length) return annotationValues;
|
|
43055
|
-
|
|
43201
|
+
const result = await migrateParagraphFieldsListsV2(annotationValues, this);
|
|
43202
|
+
return result;
|
|
43056
43203
|
}
|
|
43057
43204
|
/**
|
|
43058
43205
|
* Annotate the document with the given annotation values.
|
|
@@ -45454,7 +45601,7 @@ const ListItem = Node$1.create({
|
|
|
45454
45601
|
renderDOM: (attrs) => {
|
|
45455
45602
|
if (attrs.level === void 0 || attrs.level === null) return {};
|
|
45456
45603
|
return {
|
|
45457
|
-
"data-level":
|
|
45604
|
+
"data-level": attrs.level
|
|
45458
45605
|
};
|
|
45459
45606
|
}
|
|
45460
45607
|
},
|
|
@@ -49744,6 +49891,10 @@ const FieldAnnotation = Node$1.create({
|
|
|
49744
49891
|
generatorIndex: {
|
|
49745
49892
|
rendered: false,
|
|
49746
49893
|
default: null
|
|
49894
|
+
},
|
|
49895
|
+
hash: {
|
|
49896
|
+
rendered: false,
|
|
49897
|
+
default: null
|
|
49747
49898
|
}
|
|
49748
49899
|
};
|
|
49749
49900
|
},
|
|
@@ -49853,6 +50004,7 @@ const FieldAnnotation = Node$1.create({
|
|
|
49853
50004
|
currentMarks = currentMarks.length ? [...currentMarks] : null;
|
|
49854
50005
|
let formatAttrs = getFormatAttrsFromMarks(currentMarks);
|
|
49855
50006
|
let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
|
|
50007
|
+
attrs.hash = generateDocxRandomId(4);
|
|
49856
50008
|
let node2 = schema.nodes[this.name].create({
|
|
49857
50009
|
...attrs,
|
|
49858
50010
|
...formatAttrs,
|
|
@@ -49890,6 +50042,7 @@ const FieldAnnotation = Node$1.create({
|
|
|
49890
50042
|
let newPosFrom = tr.mapping.map(from2);
|
|
49891
50043
|
let newPosTo = tr.mapping.map(to);
|
|
49892
50044
|
let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
|
|
50045
|
+
attrs.hash = generateDocxRandomId(4);
|
|
49893
50046
|
let node2 = schema.nodes[this.name].create({
|
|
49894
50047
|
...attrs,
|
|
49895
50048
|
defaultDisplayLabel
|
|
@@ -50556,7 +50709,7 @@ const Image = Node$1.create({
|
|
|
50556
50709
|
}
|
|
50557
50710
|
},
|
|
50558
50711
|
alt: {
|
|
50559
|
-
default:
|
|
50712
|
+
default: "Uploaded picture"
|
|
50560
50713
|
},
|
|
50561
50714
|
id: { rendered: false },
|
|
50562
50715
|
title: {
|
|
@@ -50603,11 +50756,16 @@ const Image = Node$1.create({
|
|
|
50603
50756
|
},
|
|
50604
50757
|
marginOffset: {
|
|
50605
50758
|
default: {},
|
|
50606
|
-
renderDOM: ({ marginOffset }) => {
|
|
50759
|
+
renderDOM: ({ marginOffset, anchorData }) => {
|
|
50760
|
+
const relativeFromPageV = anchorData?.vRelativeFrom === "page";
|
|
50761
|
+
const maxMarginV = 500;
|
|
50607
50762
|
const { left: left2 = 0, top: top2 = 0 } = marginOffset ?? {};
|
|
50608
50763
|
let style2 = "";
|
|
50609
50764
|
if (left2) style2 += `margin-left: ${left2}px;`;
|
|
50610
|
-
if (top2)
|
|
50765
|
+
if (top2) {
|
|
50766
|
+
if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
|
|
50767
|
+
else style2 += `margin-top: ${top2}px;`;
|
|
50768
|
+
}
|
|
50611
50769
|
return { style: style2 };
|
|
50612
50770
|
}
|
|
50613
50771
|
},
|
|
@@ -57613,6 +57771,7 @@ const magnifyingGlassSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0
|
|
|
57613
57771
|
const scissorsIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M278.1 256L444.5 89.6c4.7-4.7 4.7-12.3 0-17-32.8-32.8-86-32.8-118.8 0L210.2 188.1l-24.9-24.9c4.3-10.9 6.7-22.8 6.7-35.3 0-53-43-96-96-96S0 75 0 128s43 96 96 96c4.5 0 9-.3 13.4-.9L142.3 256l-32.9 32.9c-4.4-.6-8.8-.9-13.4-.9-53 0-96 43-96 96s43 96 96 96 96-43 96-96c0-12.5-2.4-24.3-6.7-35.3l24.9-24.9L325.7 439.4c32.8 32.8 86 32.8 118.8 0 4.7-4.7 4.7-12.3 0-17L278.1 256zM96 160c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32zm0 256c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32z"/></svg>';
|
|
57614
57772
|
const copyIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 448v40c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V120c0-13.3 10.7-24 24-24h72v296c0 30.9 25.1 56 56 56h168zm0-344V0H152c-13.3 0-24 10.7-24 24v368c0 13.3 10.7 24 24 24h272c13.3 0 24-10.7 24-24V128H344c-13.2 0-24-10.8-24-24zm121-31L375 7A24 24 0 0 0 358.1 0H352v96h96v-6.1a24 24 0 0 0 -7-17z"/></svg>';
|
|
57615
57773
|
const pasteIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 184c0-30.9 25.1-56 56-56h136V56c0-13.3-10.7-24-24-24h-80.6C204.3 12.9 183.6 0 160 0s-44.3 12.9-55.4 32H24C10.7 32 0 42.7 0 56v336c0 13.3 10.7 24 24 24h104V184zm32-144c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm184 248h104v200c0 13.3-10.7 24-24 24H184c-13.3 0-24-10.7-24-24V184c0-13.3 10.7-24 24-24h136v104c0 13.2 10.8 24 24 24zm104-38.1V256h-96v-96h6.1a24 24 0 0 1 17 7l65.9 65.9a24 24 0 0 1 7 17z"/></svg>';
|
|
57774
|
+
const strikethroughSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"/></svg>\n';
|
|
57616
57775
|
const toolbarIcons = {
|
|
57617
57776
|
undo: rotateLeftIconSvg,
|
|
57618
57777
|
redo: rotateRightIconSvg,
|
|
@@ -57659,7 +57818,8 @@ const toolbarIcons = {
|
|
|
57659
57818
|
search: magnifyingGlassSvg,
|
|
57660
57819
|
cut: scissorsIconSvg,
|
|
57661
57820
|
copy: copyIconSvg,
|
|
57662
|
-
paste: pasteIconSvg
|
|
57821
|
+
paste: pasteIconSvg,
|
|
57822
|
+
strikethrough: strikethroughSvg
|
|
57663
57823
|
};
|
|
57664
57824
|
const _hoisted_1$4$1 = { class: "toolbar-icon" };
|
|
57665
57825
|
const _hoisted_2$3$1 = ["innerHTML"];
|
|
@@ -67311,11 +67471,11 @@ const _sfc_main$1$1 = {
|
|
|
67311
67471
|
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
|
67312
67472
|
const styleMap = {
|
|
67313
67473
|
left: {
|
|
67314
|
-
minWidth: "
|
|
67474
|
+
minWidth: "120px",
|
|
67315
67475
|
justifyContent: "flex-start"
|
|
67316
67476
|
},
|
|
67317
67477
|
right: {
|
|
67318
|
-
minWidth: "
|
|
67478
|
+
minWidth: "120px",
|
|
67319
67479
|
justifyContent: "flex-end"
|
|
67320
67480
|
},
|
|
67321
67481
|
default: {
|
|
@@ -67548,7 +67708,7 @@ const _sfc_main$1$1 = {
|
|
|
67548
67708
|
};
|
|
67549
67709
|
}
|
|
67550
67710
|
};
|
|
67551
|
-
const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-
|
|
67711
|
+
const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-a40b6226"]]);
|
|
67552
67712
|
const _sfc_main$g = {
|
|
67553
67713
|
__name: "Toolbar",
|
|
67554
67714
|
emits: ["command", "toggle", "select"],
|
|
@@ -69661,6 +69821,16 @@ const makeDefaultItems = ({
|
|
|
69661
69821
|
ariaLabel: "Underline"
|
|
69662
69822
|
}
|
|
69663
69823
|
});
|
|
69824
|
+
const strikethrough = useToolbarItem({
|
|
69825
|
+
type: "button",
|
|
69826
|
+
name: "strikethrough",
|
|
69827
|
+
command: "toggleStrike",
|
|
69828
|
+
icon: toolbarIcons2.strikethrough,
|
|
69829
|
+
tooltip: toolbarTexts2.strikethrough,
|
|
69830
|
+
attributes: {
|
|
69831
|
+
ariaLabel: "Strikethrough"
|
|
69832
|
+
}
|
|
69833
|
+
});
|
|
69664
69834
|
const highlight = useToolbarItem({
|
|
69665
69835
|
type: "dropdown",
|
|
69666
69836
|
name: "highlight",
|
|
@@ -70284,6 +70454,7 @@ const makeDefaultItems = ({
|
|
|
70284
70454
|
bold,
|
|
70285
70455
|
italic,
|
|
70286
70456
|
underline,
|
|
70457
|
+
strikethrough,
|
|
70287
70458
|
colorButton,
|
|
70288
70459
|
highlight,
|
|
70289
70460
|
separator,
|
|
@@ -70374,6 +70545,7 @@ const toolbarTexts = {
|
|
|
70374
70545
|
italic: "Italic",
|
|
70375
70546
|
underline: "Underline",
|
|
70376
70547
|
highlight: "Highlight color",
|
|
70548
|
+
strikethrough: "Strikethrough",
|
|
70377
70549
|
color: "Text color",
|
|
70378
70550
|
search: "Search",
|
|
70379
70551
|
link: "Link",
|