@harbour-enterprises/superdoc 0.14.9 → 0.14.10
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/{super-editor.es-CRo90k3Y.cjs → super-editor.es-D2ZGswk-.cjs} +216 -44
- package/dist/chunks/{super-editor.es-Chr_NZUl.es.js → super-editor.es-GusbWHfd.es.js} +216 -44
- 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-CCqKj0f_.js} +193 -45
- package/dist/super-editor/chunks/{docx-zipper-DpKkn-tn.js → docx-zipper-ekKB1ke6.js} +1 -1
- package/dist/super-editor/chunks/{editor-DCx_vuYP.js → editor-CCZuUhkY.js} +32 -21
- package/dist/super-editor/chunks/{toolbar-CDzVNwBH.js → toolbar-CpaI75X4.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/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +4 -4
- package/dist/superdoc.es.js +5 -5
- package/dist/superdoc.umd.js +219 -47
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/superdoc.umd.js
CHANGED
|
@@ -26600,7 +26600,7 @@
|
|
|
26600
26600
|
seen.add(m.type);
|
|
26601
26601
|
const { attributes = {} } = element;
|
|
26602
26602
|
const newMark = { type: m.type };
|
|
26603
|
-
if (attributes["w:val"]
|
|
26603
|
+
if (attributes["w:val"] === "0" || attributes["w:val"] === "none") {
|
|
26604
26604
|
return;
|
|
26605
26605
|
}
|
|
26606
26606
|
if (m.mark) newMark.type = m.mark;
|
|
@@ -26658,7 +26658,8 @@
|
|
|
26658
26658
|
underline: () => attributes["w:val"],
|
|
26659
26659
|
bold: () => attributes?.["w:val"] || null,
|
|
26660
26660
|
italic: () => attributes?.["w:val"] || null,
|
|
26661
|
-
highlight: () => getHighLightValue(attributes)
|
|
26661
|
+
highlight: () => getHighLightValue(attributes),
|
|
26662
|
+
strike: () => getStrikeValue(attributes)
|
|
26662
26663
|
};
|
|
26663
26664
|
if (!(markType in markValueMapper)) {
|
|
26664
26665
|
console.debug("❗️❗️ No value mapper for:", markType, "Attributes:", attributes);
|
|
@@ -26701,6 +26702,9 @@
|
|
|
26701
26702
|
if (isValidHexColor(attributes?.["w:val"])) return `#${attributes["w:val"]}`;
|
|
26702
26703
|
return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
|
|
26703
26704
|
}
|
|
26705
|
+
function getStrikeValue(attributes) {
|
|
26706
|
+
return attributes?.["w:val"] === "1" ? attributes["w:val"] : null;
|
|
26707
|
+
}
|
|
26704
26708
|
function parseProperties(node2, docx) {
|
|
26705
26709
|
const marks = [];
|
|
26706
26710
|
const unknownMarks = [];
|
|
@@ -27839,9 +27843,9 @@
|
|
|
27839
27843
|
const { elements } = def2;
|
|
27840
27844
|
const listData = elements[0];
|
|
27841
27845
|
const numberingElements = listData.elements;
|
|
27842
|
-
const abstractDefinitions = numberingElements
|
|
27843
|
-
const numDefinitions = numberingElements
|
|
27844
|
-
const numDefinition = numDefinitions
|
|
27846
|
+
const abstractDefinitions = numberingElements?.filter((style2) => style2.name === "w:abstractNum");
|
|
27847
|
+
const numDefinitions = numberingElements?.filter((style2) => style2.name === "w:num");
|
|
27848
|
+
const numDefinition = numDefinitions?.find((style2) => style2.attributes["w:numId"] == numId);
|
|
27845
27849
|
const abstractNumId = numDefinition?.elements[0].attributes["w:val"];
|
|
27846
27850
|
let listDefinitionForThisNumId = abstractDefinitions?.find(
|
|
27847
27851
|
(style2) => style2.attributes["w:abstractNumId"] === abstractNumId
|
|
@@ -29709,6 +29713,24 @@
|
|
|
29709
29713
|
editor.emit("list-definitions-change", { change, numbering: newNumbering, editor });
|
|
29710
29714
|
return { abstract: newAbstractDef, definition: newNumDef };
|
|
29711
29715
|
};
|
|
29716
|
+
const changeNumIdSameAbstract = (numId, level, listType, editor) => {
|
|
29717
|
+
const newId = getNewListId(editor, "definitions");
|
|
29718
|
+
const { abstract } = ListHelpers.getListDefinitionDetails({ numId, level, listType, editor });
|
|
29719
|
+
const numbering = editor.converter.numbering;
|
|
29720
|
+
const newNumbering = { ...numbering };
|
|
29721
|
+
const newAbstractId = getNewListId(editor, "abstracts");
|
|
29722
|
+
const newAbstractDef = {
|
|
29723
|
+
...abstract,
|
|
29724
|
+
attributes: {
|
|
29725
|
+
...abstract.attributes,
|
|
29726
|
+
"w:abstractNumId": String(newAbstractId)
|
|
29727
|
+
}
|
|
29728
|
+
};
|
|
29729
|
+
newNumbering.abstracts[newAbstractId] = newAbstractDef;
|
|
29730
|
+
const newNumDef = getBasicNumIdTag(newId, newAbstractId);
|
|
29731
|
+
newNumbering.definitions[newId] = newNumDef;
|
|
29732
|
+
return newId;
|
|
29733
|
+
};
|
|
29712
29734
|
const getBasicNumIdTag = (numId, abstractId) => {
|
|
29713
29735
|
return {
|
|
29714
29736
|
type: "element",
|
|
@@ -29743,7 +29765,7 @@
|
|
|
29743
29765
|
const listNumberingType = listDefinition?.elements?.find((item) => item.name === "w:numFmt")?.attributes["w:val"];
|
|
29744
29766
|
let customFormat;
|
|
29745
29767
|
if (numFmt === "custom") customFormat = numFmtTag?.attributes?.["w:format"];
|
|
29746
|
-
return { start: start2, numFmt, lvlText, listNumberingType, customFormat, abstract };
|
|
29768
|
+
return { start: start2, numFmt, lvlText, listNumberingType, customFormat, abstract, abstractId };
|
|
29747
29769
|
};
|
|
29748
29770
|
const removeListDefinitions = (listId, editor) => {
|
|
29749
29771
|
const { numbering } = editor.converter;
|
|
@@ -29910,6 +29932,7 @@
|
|
|
29910
29932
|
createSchemaOrderedListNode,
|
|
29911
29933
|
createListItemNodeJSON,
|
|
29912
29934
|
addInlineTextMarks,
|
|
29935
|
+
changeNumIdSameAbstract,
|
|
29913
29936
|
// Base list definitions
|
|
29914
29937
|
baseOrderedListDef,
|
|
29915
29938
|
baseBulletList
|
|
@@ -30110,6 +30133,113 @@
|
|
|
30110
30133
|
newList.appendChild(newLi);
|
|
30111
30134
|
return newList;
|
|
30112
30135
|
}
|
|
30136
|
+
function unflattenListsInHtml(html) {
|
|
30137
|
+
const parser = new DOMParser();
|
|
30138
|
+
const doc2 = parser.parseFromString(html, "text/html");
|
|
30139
|
+
const allNodes = [...doc2.body.children];
|
|
30140
|
+
const listSequences = [];
|
|
30141
|
+
let currentSequence = null;
|
|
30142
|
+
allNodes.forEach((node2, index2) => {
|
|
30143
|
+
const isFlattenList = node2.tagName && (node2.tagName === "OL" || node2.tagName === "UL") && node2.hasAttribute("data-list-id");
|
|
30144
|
+
if (isFlattenList) {
|
|
30145
|
+
const listId = node2.getAttribute("data-list-id");
|
|
30146
|
+
if (currentSequence && currentSequence.id === listId) {
|
|
30147
|
+
currentSequence.lists.push({ element: node2, index: index2 });
|
|
30148
|
+
} else {
|
|
30149
|
+
currentSequence = {
|
|
30150
|
+
id: listId,
|
|
30151
|
+
lists: [{ element: node2, index: index2 }]
|
|
30152
|
+
};
|
|
30153
|
+
listSequences.push(currentSequence);
|
|
30154
|
+
}
|
|
30155
|
+
} else {
|
|
30156
|
+
currentSequence = null;
|
|
30157
|
+
}
|
|
30158
|
+
});
|
|
30159
|
+
listSequences.reverse().forEach((sequence) => {
|
|
30160
|
+
const sequenceLists = sequence.lists;
|
|
30161
|
+
if (sequenceLists.length === 0) {
|
|
30162
|
+
return;
|
|
30163
|
+
}
|
|
30164
|
+
const items = sequenceLists.map(({ element: list }) => {
|
|
30165
|
+
const liElement = list.querySelector("li");
|
|
30166
|
+
if (!liElement) return null;
|
|
30167
|
+
return {
|
|
30168
|
+
element: liElement,
|
|
30169
|
+
level: parseInt(liElement.getAttribute("data-level") || "0"),
|
|
30170
|
+
numFmt: liElement.getAttribute("data-num-fmt") || "bullet",
|
|
30171
|
+
listLevel: JSON.parse(liElement.getAttribute("data-list-level") || "[1]")
|
|
30172
|
+
};
|
|
30173
|
+
}).filter((item) => item !== null);
|
|
30174
|
+
if (items.length === 0) {
|
|
30175
|
+
return;
|
|
30176
|
+
}
|
|
30177
|
+
const rootList = buildNestedList({ items });
|
|
30178
|
+
const firstOriginalList = sequenceLists[0].element;
|
|
30179
|
+
firstOriginalList?.parentNode?.insertBefore(rootList, firstOriginalList);
|
|
30180
|
+
sequenceLists.forEach(({ element: list }) => {
|
|
30181
|
+
if (list.parentNode) list.parentNode.removeChild(list);
|
|
30182
|
+
});
|
|
30183
|
+
});
|
|
30184
|
+
return doc2.body.innerHTML;
|
|
30185
|
+
}
|
|
30186
|
+
function buildNestedList({ items }) {
|
|
30187
|
+
if (!items.length) {
|
|
30188
|
+
return null;
|
|
30189
|
+
}
|
|
30190
|
+
const [rootItem] = items;
|
|
30191
|
+
const doc2 = rootItem.element.ownerDocument;
|
|
30192
|
+
const isOrderedList = rootItem.numFmt && !["bullet", "none"].includes(rootItem.numFmt);
|
|
30193
|
+
const rootList = doc2.createElement(isOrderedList ? "ol" : "ul");
|
|
30194
|
+
if (isOrderedList && rootItem.listLevel?.[0] && rootItem.listLevel[0] > 1) {
|
|
30195
|
+
rootList.setAttribute("start", rootItem.listLevel[0]);
|
|
30196
|
+
}
|
|
30197
|
+
const lastLevelItem = /* @__PURE__ */ new Map();
|
|
30198
|
+
items.forEach((item) => {
|
|
30199
|
+
const { element: liElement, level, numFmt, listLevel } = item;
|
|
30200
|
+
const cleanLi = cleanListItem(liElement.cloneNode(true));
|
|
30201
|
+
if (level === 0) {
|
|
30202
|
+
rootList.append(cleanLi);
|
|
30203
|
+
lastLevelItem.set(0, cleanLi);
|
|
30204
|
+
} else {
|
|
30205
|
+
const parentLi = lastLevelItem.get(level - 1);
|
|
30206
|
+
if (!parentLi) {
|
|
30207
|
+
rootList.append(cleanLi);
|
|
30208
|
+
lastLevelItem.set(level, cleanLi);
|
|
30209
|
+
return;
|
|
30210
|
+
}
|
|
30211
|
+
let nestedList = null;
|
|
30212
|
+
[...parentLi.children].forEach((child) => {
|
|
30213
|
+
if (child.tagName && (child.tagName === "OL" || child.tagName === "UL")) {
|
|
30214
|
+
nestedList = child;
|
|
30215
|
+
}
|
|
30216
|
+
});
|
|
30217
|
+
if (!nestedList) {
|
|
30218
|
+
const listType = numFmt && !["bullet", "none"].includes(numFmt) ? "ol" : "ul";
|
|
30219
|
+
nestedList = doc2.createElement(listType);
|
|
30220
|
+
parentLi.append(nestedList);
|
|
30221
|
+
}
|
|
30222
|
+
nestedList.append(cleanLi);
|
|
30223
|
+
lastLevelItem.set(level, cleanLi);
|
|
30224
|
+
}
|
|
30225
|
+
});
|
|
30226
|
+
return rootList;
|
|
30227
|
+
}
|
|
30228
|
+
function cleanListItem(listItem) {
|
|
30229
|
+
const attrs = [
|
|
30230
|
+
"data-num-id",
|
|
30231
|
+
"data-level",
|
|
30232
|
+
"data-num-fmt",
|
|
30233
|
+
"data-lvl-text",
|
|
30234
|
+
"data-list-level",
|
|
30235
|
+
"data-marker-type",
|
|
30236
|
+
"aria-label"
|
|
30237
|
+
];
|
|
30238
|
+
attrs.forEach((attr) => {
|
|
30239
|
+
listItem.removeAttribute(attr);
|
|
30240
|
+
});
|
|
30241
|
+
return listItem;
|
|
30242
|
+
}
|
|
30113
30243
|
class InputRule {
|
|
30114
30244
|
constructor(config) {
|
|
30115
30245
|
__publicField$2(this, "match");
|
|
@@ -31314,6 +31444,7 @@
|
|
|
31314
31444
|
let imageId = attrs.rId;
|
|
31315
31445
|
const src = attrs.src || attrs.imageSrc;
|
|
31316
31446
|
const { originalWidth, originalHeight } = getPngDimensions(src);
|
|
31447
|
+
const imageName = params2.node.type === "image" ? src?.split("word/media/")[1] : attrs.fieldId?.replace("-", "_");
|
|
31317
31448
|
let size2 = attrs.size ? {
|
|
31318
31449
|
w: pixelsToEmu(attrs.size.width),
|
|
31319
31450
|
h: pixelsToEmu(attrs.size.height)
|
|
@@ -31343,11 +31474,9 @@
|
|
|
31343
31474
|
if (!type2) {
|
|
31344
31475
|
return prepareTextAnnotation(params2);
|
|
31345
31476
|
}
|
|
31346
|
-
const
|
|
31347
|
-
const cleanUrl = attrs.fieldId.replace("-", "_");
|
|
31348
|
-
const imageUrl = `media/${cleanUrl}_${hash2}.${type2}`;
|
|
31477
|
+
const imageUrl = `media/${imageName}_${attrs.hash}.${type2}`;
|
|
31349
31478
|
imageId = addNewImageRelationship(params2, imageUrl);
|
|
31350
|
-
params2.media[`${
|
|
31479
|
+
params2.media[`${imageName}_${attrs.hash}.${type2}`] = src;
|
|
31351
31480
|
}
|
|
31352
31481
|
let inlineAttrs = attrs.originalPadding || {
|
|
31353
31482
|
distT: 0,
|
|
@@ -31472,8 +31601,7 @@
|
|
|
31472
31601
|
name: "wp:docPr",
|
|
31473
31602
|
attributes: {
|
|
31474
31603
|
id: attrs.id || 0,
|
|
31475
|
-
name: attrs.alt
|
|
31476
|
-
descr: attrs.title
|
|
31604
|
+
name: attrs.alt || `Picture ${imageName}`
|
|
31477
31605
|
}
|
|
31478
31606
|
},
|
|
31479
31607
|
{
|
|
@@ -31507,7 +31635,7 @@
|
|
|
31507
31635
|
name: "pic:cNvPr",
|
|
31508
31636
|
attributes: {
|
|
31509
31637
|
id: attrs.id || 0,
|
|
31510
|
-
name: attrs.title
|
|
31638
|
+
name: attrs.title || `Picture ${imageName}`
|
|
31511
31639
|
}
|
|
31512
31640
|
},
|
|
31513
31641
|
{
|
|
@@ -31617,12 +31745,31 @@
|
|
|
31617
31745
|
state2 = applyMarksToHtmlAnnotation(state2, allMarks);
|
|
31618
31746
|
}
|
|
31619
31747
|
const htmlAnnotationNode = state2.doc.toJSON();
|
|
31748
|
+
const listTypes = ["bulletList", "orderedList"];
|
|
31749
|
+
const { editor } = params2;
|
|
31750
|
+
const seenLists = /* @__PURE__ */ new Map();
|
|
31751
|
+
state2.doc.descendants((node2, pos) => {
|
|
31752
|
+
if (listTypes.includes(node2.type.name)) {
|
|
31753
|
+
const listItem = node2.firstChild;
|
|
31754
|
+
const { attrs: attrs2 } = listItem;
|
|
31755
|
+
const { level, numId } = attrs2;
|
|
31756
|
+
if (!seenLists.has(numId)) {
|
|
31757
|
+
const newNumId = ListHelpers.changeNumIdSameAbstract(numId, level, node2.type.name, editor);
|
|
31758
|
+
listItem.attrs.numId = newNumId;
|
|
31759
|
+
seenLists.set(numId, newNumId);
|
|
31760
|
+
} else {
|
|
31761
|
+
const newNumId = seenLists.get(numId);
|
|
31762
|
+
listItem.attrs.numId = newNumId;
|
|
31763
|
+
}
|
|
31764
|
+
}
|
|
31765
|
+
});
|
|
31766
|
+
const elements = translateChildNodes({
|
|
31767
|
+
...params2,
|
|
31768
|
+
node: htmlAnnotationNode
|
|
31769
|
+
});
|
|
31620
31770
|
return {
|
|
31621
31771
|
name: "htmlAnnotation",
|
|
31622
|
-
elements
|
|
31623
|
-
...params2,
|
|
31624
|
-
node: htmlAnnotationNode
|
|
31625
|
-
})
|
|
31772
|
+
elements
|
|
31626
31773
|
};
|
|
31627
31774
|
}
|
|
31628
31775
|
function prepareImageAnnotation(params2, imageSize) {
|
|
@@ -32759,6 +32906,7 @@
|
|
|
32759
32906
|
}
|
|
32760
32907
|
const { attrs: marksAsAttrs, marks } = parseAnnotationMarks(sdtContent);
|
|
32761
32908
|
const allAttrs = { ...attrs, ...marksAsAttrs };
|
|
32909
|
+
allAttrs.hash = generateDocxRandomId(4);
|
|
32762
32910
|
if (!attrs.fieldId || !attrs.displayLabel) {
|
|
32763
32911
|
return { nodes: [], consumed: 0 };
|
|
32764
32912
|
}
|
|
@@ -33754,7 +33902,7 @@
|
|
|
33754
33902
|
return;
|
|
33755
33903
|
}
|
|
33756
33904
|
}
|
|
33757
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.
|
|
33905
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.10") {
|
|
33758
33906
|
const customLocation = "docProps/custom.xml";
|
|
33759
33907
|
if (!docx[customLocation]) {
|
|
33760
33908
|
docx[customLocation] = generateCustomXml();
|
|
@@ -34142,7 +34290,6 @@
|
|
|
34142
34290
|
newRels.push(rel);
|
|
34143
34291
|
});
|
|
34144
34292
|
relationships.elements = [...relationships.elements, ...newRels];
|
|
34145
|
-
this.convertedXml["word/_rels/document.xml.rels"] = relsData;
|
|
34146
34293
|
};
|
|
34147
34294
|
exportProcessMediaFiles_fn = async function(media, editor) {
|
|
34148
34295
|
const processedData = {};
|
|
@@ -34186,7 +34333,7 @@
|
|
|
34186
34333
|
{ name: "w:i", type: "italic" },
|
|
34187
34334
|
{ name: "w:iCs", type: "italic" },
|
|
34188
34335
|
{ name: "w:u", type: "underline", mark: "underline", property: "underlineType" },
|
|
34189
|
-
{ name: "w:strike", type: "strike" },
|
|
34336
|
+
{ name: "w:strike", type: "strike", mark: "strike" },
|
|
34190
34337
|
{ name: "w:color", type: "color", mark: "textStyle", property: "color" },
|
|
34191
34338
|
{ name: "w:sz", type: "fontSize", mark: "textStyle", property: "fontSize" },
|
|
34192
34339
|
{ name: "w:szCs", type: "fontSize", mark: "textStyle", property: "fontSize" },
|
|
@@ -34230,7 +34377,7 @@
|
|
|
34230
34377
|
function generateCustomXml() {
|
|
34231
34378
|
return DEFAULT_CUSTOM_XML;
|
|
34232
34379
|
}
|
|
34233
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.14.
|
|
34380
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.14.10") {
|
|
34234
34381
|
return {
|
|
34235
34382
|
type: "element",
|
|
34236
34383
|
name: "property",
|
|
@@ -49491,6 +49638,9 @@
|
|
|
49491
49638
|
const migrateParagraphFieldsListsV2 = async (annotationValues = [], editor) => {
|
|
49492
49639
|
const annotations = getAllFieldAnnotations(editor.state);
|
|
49493
49640
|
const newValues = [];
|
|
49641
|
+
if (!annotations.length) {
|
|
49642
|
+
return annotationValues;
|
|
49643
|
+
}
|
|
49494
49644
|
for (const annotation of annotations) {
|
|
49495
49645
|
const type2 = annotation.node?.attrs?.type;
|
|
49496
49646
|
const matchedAnnotation = annotationValues.find((v) => v.input_id === annotation.node.attrs.fieldId);
|
|
@@ -50117,9 +50267,6 @@
|
|
|
50117
50267
|
const attributes = typeof nameOrAttributes === "string" ? attributesOrUndefined : nameOrAttributes;
|
|
50118
50268
|
return isActive(this.state, name, attributes);
|
|
50119
50269
|
}
|
|
50120
|
-
/**
|
|
50121
|
-
* Get the document as JSON.
|
|
50122
|
-
*/
|
|
50123
50270
|
/**
|
|
50124
50271
|
* Get the editor content as JSON
|
|
50125
50272
|
* @returns {Object} Editor content as JSON
|
|
@@ -50127,18 +50274,20 @@
|
|
|
50127
50274
|
getJSON() {
|
|
50128
50275
|
return this.state.doc.toJSON();
|
|
50129
50276
|
}
|
|
50130
|
-
/**
|
|
50131
|
-
* Get HTML string of the document
|
|
50132
|
-
*/
|
|
50133
50277
|
/**
|
|
50134
50278
|
* Get the editor content as HTML
|
|
50135
50279
|
* @returns {string} Editor content as HTML
|
|
50136
50280
|
*/
|
|
50137
|
-
getHTML() {
|
|
50138
|
-
const
|
|
50281
|
+
getHTML({ unflattenLists = false } = {}) {
|
|
50282
|
+
const tempDocument = document.implementation.createHTMLDocument();
|
|
50283
|
+
const container = tempDocument.createElement("div");
|
|
50139
50284
|
const fragment = DOMSerializer.fromSchema(this.schema).serializeFragment(this.state.doc.content);
|
|
50140
|
-
|
|
50141
|
-
|
|
50285
|
+
container.appendChild(fragment);
|
|
50286
|
+
let html = container.innerHTML;
|
|
50287
|
+
if (unflattenLists) {
|
|
50288
|
+
html = unflattenListsInHtml(html);
|
|
50289
|
+
}
|
|
50290
|
+
return html;
|
|
50142
50291
|
}
|
|
50143
50292
|
/**
|
|
50144
50293
|
* Create a child editor linked to this editor.
|
|
@@ -50150,9 +50299,6 @@
|
|
|
50150
50299
|
createChildEditor(options2) {
|
|
50151
50300
|
return createLinkedChildEditor(this, options2);
|
|
50152
50301
|
}
|
|
50153
|
-
/**
|
|
50154
|
-
* Get page styles
|
|
50155
|
-
*/
|
|
50156
50302
|
/**
|
|
50157
50303
|
* Get page styles
|
|
50158
50304
|
* @returns {Object} Page styles
|
|
@@ -50317,7 +50463,7 @@
|
|
|
50317
50463
|
* @returns {Object | void} Migration results
|
|
50318
50464
|
*/
|
|
50319
50465
|
processCollaborationMigrations() {
|
|
50320
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.14.
|
|
50466
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.14.10");
|
|
50321
50467
|
if (!this.options.ydoc) return;
|
|
50322
50468
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
50323
50469
|
let docVersion = metaMap.get("version");
|
|
@@ -50447,7 +50593,8 @@
|
|
|
50447
50593
|
*/
|
|
50448
50594
|
async migrateParagraphFields(annotationValues = []) {
|
|
50449
50595
|
if (!Array.isArray(annotationValues) || !annotationValues.length) return annotationValues;
|
|
50450
|
-
|
|
50596
|
+
const result = await migrateParagraphFieldsListsV2(annotationValues, this);
|
|
50597
|
+
return result;
|
|
50451
50598
|
}
|
|
50452
50599
|
/**
|
|
50453
50600
|
* Annotate the document with the given annotation values.
|
|
@@ -52849,7 +52996,7 @@
|
|
|
52849
52996
|
renderDOM: (attrs) => {
|
|
52850
52997
|
if (attrs.level === void 0 || attrs.level === null) return {};
|
|
52851
52998
|
return {
|
|
52852
|
-
"data-level":
|
|
52999
|
+
"data-level": attrs.level
|
|
52853
53000
|
};
|
|
52854
53001
|
}
|
|
52855
53002
|
},
|
|
@@ -57139,6 +57286,10 @@
|
|
|
57139
57286
|
generatorIndex: {
|
|
57140
57287
|
rendered: false,
|
|
57141
57288
|
default: null
|
|
57289
|
+
},
|
|
57290
|
+
hash: {
|
|
57291
|
+
rendered: false,
|
|
57292
|
+
default: null
|
|
57142
57293
|
}
|
|
57143
57294
|
};
|
|
57144
57295
|
},
|
|
@@ -57248,6 +57399,7 @@
|
|
|
57248
57399
|
currentMarks = currentMarks.length ? [...currentMarks] : null;
|
|
57249
57400
|
let formatAttrs = getFormatAttrsFromMarks(currentMarks);
|
|
57250
57401
|
let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
|
|
57402
|
+
attrs.hash = generateDocxRandomId(4);
|
|
57251
57403
|
let node2 = schema.nodes[this.name].create({
|
|
57252
57404
|
...attrs,
|
|
57253
57405
|
...formatAttrs,
|
|
@@ -57285,6 +57437,7 @@
|
|
|
57285
57437
|
let newPosFrom = tr.mapping.map(from2);
|
|
57286
57438
|
let newPosTo = tr.mapping.map(to);
|
|
57287
57439
|
let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
|
|
57440
|
+
attrs.hash = generateDocxRandomId(4);
|
|
57288
57441
|
let node2 = schema.nodes[this.name].create({
|
|
57289
57442
|
...attrs,
|
|
57290
57443
|
defaultDisplayLabel
|
|
@@ -57951,7 +58104,7 @@
|
|
|
57951
58104
|
}
|
|
57952
58105
|
},
|
|
57953
58106
|
alt: {
|
|
57954
|
-
default:
|
|
58107
|
+
default: "Uploaded picture"
|
|
57955
58108
|
},
|
|
57956
58109
|
id: { rendered: false },
|
|
57957
58110
|
title: {
|
|
@@ -57998,11 +58151,16 @@
|
|
|
57998
58151
|
},
|
|
57999
58152
|
marginOffset: {
|
|
58000
58153
|
default: {},
|
|
58001
|
-
renderDOM: ({ marginOffset }) => {
|
|
58154
|
+
renderDOM: ({ marginOffset, anchorData }) => {
|
|
58155
|
+
const relativeFromPageV = anchorData?.vRelativeFrom === "page";
|
|
58156
|
+
const maxMarginV = 500;
|
|
58002
58157
|
const { left: left2 = 0, top: top2 = 0 } = marginOffset ?? {};
|
|
58003
58158
|
let style2 = "";
|
|
58004
58159
|
if (left2) style2 += `margin-left: ${left2}px;`;
|
|
58005
|
-
if (top2)
|
|
58160
|
+
if (top2) {
|
|
58161
|
+
if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
|
|
58162
|
+
else style2 += `margin-top: ${top2}px;`;
|
|
58163
|
+
}
|
|
58006
58164
|
return { style: style2 };
|
|
58007
58165
|
}
|
|
58008
58166
|
},
|
|
@@ -65008,6 +65166,7 @@
|
|
|
65008
65166
|
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>';
|
|
65009
65167
|
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>';
|
|
65010
65168
|
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>';
|
|
65169
|
+
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';
|
|
65011
65170
|
const toolbarIcons = {
|
|
65012
65171
|
undo: rotateLeftIconSvg,
|
|
65013
65172
|
redo: rotateRightIconSvg,
|
|
@@ -65054,7 +65213,8 @@
|
|
|
65054
65213
|
search: magnifyingGlassSvg,
|
|
65055
65214
|
cut: scissorsIconSvg,
|
|
65056
65215
|
copy: copyIconSvg,
|
|
65057
|
-
paste: pasteIconSvg
|
|
65216
|
+
paste: pasteIconSvg,
|
|
65217
|
+
strikethrough: strikethroughSvg
|
|
65058
65218
|
};
|
|
65059
65219
|
const _hoisted_1$4$2 = { class: "toolbar-icon" };
|
|
65060
65220
|
const _hoisted_2$3$2 = ["innerHTML"];
|
|
@@ -74706,11 +74866,11 @@ ${style2}
|
|
|
74706
74866
|
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
|
74707
74867
|
const styleMap = {
|
|
74708
74868
|
left: {
|
|
74709
|
-
minWidth: "
|
|
74869
|
+
minWidth: "120px",
|
|
74710
74870
|
justifyContent: "flex-start"
|
|
74711
74871
|
},
|
|
74712
74872
|
right: {
|
|
74713
|
-
minWidth: "
|
|
74873
|
+
minWidth: "120px",
|
|
74714
74874
|
justifyContent: "flex-end"
|
|
74715
74875
|
},
|
|
74716
74876
|
default: {
|
|
@@ -74943,7 +75103,7 @@ ${style2}
|
|
|
74943
75103
|
};
|
|
74944
75104
|
}
|
|
74945
75105
|
};
|
|
74946
|
-
const ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-
|
|
75106
|
+
const ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-a40b6226"]]);
|
|
74947
75107
|
const _sfc_main$k = {
|
|
74948
75108
|
__name: "Toolbar",
|
|
74949
75109
|
emits: ["command", "toggle", "select"],
|
|
@@ -77056,6 +77216,16 @@ ${style2}
|
|
|
77056
77216
|
ariaLabel: "Underline"
|
|
77057
77217
|
}
|
|
77058
77218
|
});
|
|
77219
|
+
const strikethrough = useToolbarItem({
|
|
77220
|
+
type: "button",
|
|
77221
|
+
name: "strikethrough",
|
|
77222
|
+
command: "toggleStrike",
|
|
77223
|
+
icon: toolbarIcons2.strikethrough,
|
|
77224
|
+
tooltip: toolbarTexts2.strikethrough,
|
|
77225
|
+
attributes: {
|
|
77226
|
+
ariaLabel: "Strikethrough"
|
|
77227
|
+
}
|
|
77228
|
+
});
|
|
77059
77229
|
const highlight = useToolbarItem({
|
|
77060
77230
|
type: "dropdown",
|
|
77061
77231
|
name: "highlight",
|
|
@@ -77679,6 +77849,7 @@ ${style2}
|
|
|
77679
77849
|
bold,
|
|
77680
77850
|
italic,
|
|
77681
77851
|
underline,
|
|
77852
|
+
strikethrough,
|
|
77682
77853
|
colorButton,
|
|
77683
77854
|
highlight,
|
|
77684
77855
|
separator,
|
|
@@ -77769,6 +77940,7 @@ ${style2}
|
|
|
77769
77940
|
italic: "Italic",
|
|
77770
77941
|
underline: "Underline",
|
|
77771
77942
|
highlight: "Highlight color",
|
|
77943
|
+
strikethrough: "Strikethrough",
|
|
77772
77944
|
color: "Text color",
|
|
77773
77945
|
search: "Search",
|
|
77774
77946
|
link: "Link",
|
|
@@ -96077,7 +96249,7 @@ ${style2}
|
|
|
96077
96249
|
this.config.colors = shuffleArray(this.config.colors);
|
|
96078
96250
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
96079
96251
|
this.colorIndex = 0;
|
|
96080
|
-
this.version = "0.14.
|
|
96252
|
+
this.version = "0.14.10";
|
|
96081
96253
|
console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
96082
96254
|
this.superdocId = config.superdocId || v4();
|
|
96083
96255
|
this.colors = this.config.colors;
|
|
@@ -96489,7 +96661,7 @@ ${style2}
|
|
|
96489
96661
|
* Get the HTML content of all editors
|
|
96490
96662
|
* @returns {Array<string>} The HTML content of all editors
|
|
96491
96663
|
*/
|
|
96492
|
-
getHTML() {
|
|
96664
|
+
getHTML(options2 = {}) {
|
|
96493
96665
|
const editors = [];
|
|
96494
96666
|
this.superdocStore.documents.forEach((doc2) => {
|
|
96495
96667
|
const editor = doc2.getEditor();
|
|
@@ -96497,7 +96669,7 @@ ${style2}
|
|
|
96497
96669
|
editors.push(editor);
|
|
96498
96670
|
}
|
|
96499
96671
|
});
|
|
96500
|
-
return editors.map((editor) => editor.getHTML());
|
|
96672
|
+
return editors.map((editor) => editor.getHTML(options2));
|
|
96501
96673
|
}
|
|
96502
96674
|
/**
|
|
96503
96675
|
* Lock the current superdoc
|