@harbour-enterprises/superdoc 0.20.0 → 0.20.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-SpPk10jl.es.js → PdfViewer-BceCsygM.es.js} +1 -1
- package/dist/chunks/{PdfViewer--8KwZWwP.cjs → PdfViewer-BhwyCIho.cjs} +1 -1
- package/dist/chunks/{index-yRUOdLmp.cjs → index-B6tAKGVb.cjs} +3 -3
- package/dist/chunks/{index-BjLjS5O9.es.js → index-C0kV6dM8.es.js} +3 -3
- package/dist/chunks/{super-editor.es-D24_Ox1u.es.js → super-editor.es-BollA_Sr.es.js} +50 -16
- package/dist/chunks/{super-editor.es-CuNhawtn.cjs → super-editor.es-Dzt_HBkR.cjs} +50 -16
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-Cg4SgA5y.js → converter-DyzbfydS.js} +45 -13
- package/dist/super-editor/chunks/{docx-zipper-CDX2fnxb.js → docx-zipper-Bk9SAmal.js} +2 -2
- package/dist/super-editor/chunks/{editor-MKuu81v8.js → editor-BWE7oMgS.js} +6 -4
- package/dist/super-editor/chunks/{toolbar-CpQ7L2K-.js → toolbar-BmHEsvA1.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/src/core/super-converter/helpers/mediaHelpers.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 +51 -17
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -29136,7 +29136,9 @@
|
|
|
29136
29136
|
const cleanNode = (node) => {
|
|
29137
29137
|
if (node.nodeType !== Node.ELEMENT_NODE) return;
|
|
29138
29138
|
[...node.attributes].forEach((attr) => {
|
|
29139
|
-
|
|
29139
|
+
const name = attr.name.toLowerCase();
|
|
29140
|
+
const shouldKeep = SUPPORTED_ATTRS.includes(name) || name.startsWith("data-");
|
|
29141
|
+
if (!shouldKeep) {
|
|
29140
29142
|
node.removeAttribute(attr.name);
|
|
29141
29143
|
}
|
|
29142
29144
|
});
|
|
@@ -30515,13 +30517,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
30515
30517
|
numId = Number(numId);
|
|
30516
30518
|
const { lvlText, numFmt } = ListHelpers.getListDefinitionDetails({ numId, level, listType, editor });
|
|
30517
30519
|
const listNodeJSON = createListItemNodeJSON({ level, lvlText, numFmt, numId, listLevel, contentNode });
|
|
30520
|
+
const nodeTypeName = typeof listType === "string" ? listType : listType?.name;
|
|
30521
|
+
const type2 = nodeTypeName || "orderedList";
|
|
30522
|
+
const attrs = {
|
|
30523
|
+
"list-style-type": numFmt,
|
|
30524
|
+
listId: numId
|
|
30525
|
+
};
|
|
30526
|
+
if (type2 === "orderedList") {
|
|
30527
|
+
attrs.order = level;
|
|
30528
|
+
}
|
|
30518
30529
|
const node = {
|
|
30519
|
-
type:
|
|
30520
|
-
attrs
|
|
30521
|
-
"list-style-type": numFmt,
|
|
30522
|
-
listId: numId,
|
|
30523
|
-
order: level
|
|
30524
|
-
},
|
|
30530
|
+
type: type2,
|
|
30531
|
+
attrs,
|
|
30525
30532
|
content: [listNodeJSON]
|
|
30526
30533
|
};
|
|
30527
30534
|
return editor.schema.nodeFromJSON(node);
|
|
@@ -31911,6 +31918,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
31911
31918
|
}
|
|
31912
31919
|
]
|
|
31913
31920
|
};
|
|
31921
|
+
const sanitizeDocxMediaName = (value, fallback = "image") => {
|
|
31922
|
+
if (!value) return fallback;
|
|
31923
|
+
const sanitized = value.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
31924
|
+
return sanitized || fallback;
|
|
31925
|
+
};
|
|
31926
|
+
const getFallbackImageNameFromDataUri = (src = "", fallback = "image") => {
|
|
31927
|
+
if (!src || typeof src !== "string") return fallback;
|
|
31928
|
+
const [prefix2] = src.split(";");
|
|
31929
|
+
const [, maybeType] = prefix2.split("/");
|
|
31930
|
+
const extension = maybeType?.toLowerCase();
|
|
31931
|
+
return extension ? `${fallback}.${extension}` : fallback;
|
|
31932
|
+
};
|
|
31914
31933
|
const TranslatorTypes = Object.freeze({
|
|
31915
31934
|
NODE: "node",
|
|
31916
31935
|
ATTRIBUTE: "attribute"
|
|
@@ -36571,7 +36590,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36571
36590
|
let imageId = attrs.rId;
|
|
36572
36591
|
const src = attrs.src || attrs.imageSrc;
|
|
36573
36592
|
const { originalWidth, originalHeight } = getPngDimensions(src);
|
|
36574
|
-
|
|
36593
|
+
let imageName;
|
|
36594
|
+
if (params2.node.type === "image") {
|
|
36595
|
+
if (src?.startsWith("data:")) {
|
|
36596
|
+
imageName = getFallbackImageNameFromDataUri(src);
|
|
36597
|
+
} else {
|
|
36598
|
+
imageName = src?.split("/").pop();
|
|
36599
|
+
}
|
|
36600
|
+
} else {
|
|
36601
|
+
imageName = attrs.fieldId;
|
|
36602
|
+
}
|
|
36603
|
+
imageName = sanitizeDocxMediaName(imageName);
|
|
36575
36604
|
let size2 = attrs.size ? {
|
|
36576
36605
|
w: pixelsToEmu(attrs.size.width),
|
|
36577
36606
|
h: pixelsToEmu(attrs.size.height)
|
|
@@ -36601,9 +36630,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36601
36630
|
if (!type2) {
|
|
36602
36631
|
return prepareTextAnnotation(params2);
|
|
36603
36632
|
}
|
|
36604
|
-
const
|
|
36605
|
-
|
|
36606
|
-
|
|
36633
|
+
const sanitizedHash = sanitizeDocxMediaName(attrs.hash, generateDocxRandomId(4));
|
|
36634
|
+
const fileName = `${imageName}_${sanitizedHash}.${type2}`;
|
|
36635
|
+
const relationshipTarget = `media/${fileName}`;
|
|
36636
|
+
const packagePath = `word/${relationshipTarget}`;
|
|
36637
|
+
imageId = addNewImageRelationship(params2, relationshipTarget);
|
|
36638
|
+
params2.media[packagePath] = src;
|
|
36607
36639
|
}
|
|
36608
36640
|
let inlineAttrs = attrs.originalPadding || {
|
|
36609
36641
|
distT: 0,
|
|
@@ -38813,7 +38845,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38813
38845
|
return;
|
|
38814
38846
|
}
|
|
38815
38847
|
}
|
|
38816
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.
|
|
38848
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.20.1") {
|
|
38817
38849
|
const customLocation = "docProps/custom.xml";
|
|
38818
38850
|
if (!docx[customLocation]) {
|
|
38819
38851
|
docx[customLocation] = generateCustomXml();
|
|
@@ -39300,7 +39332,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39300
39332
|
function generateCustomXml() {
|
|
39301
39333
|
return DEFAULT_CUSTOM_XML;
|
|
39302
39334
|
}
|
|
39303
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.
|
|
39335
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.20.1") {
|
|
39304
39336
|
return {
|
|
39305
39337
|
type: "element",
|
|
39306
39338
|
name: "property",
|
|
@@ -41709,7 +41741,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
41709
41741
|
const u8 = await zipEntry.async("uint8array");
|
|
41710
41742
|
const content = ensureXmlString(u8);
|
|
41711
41743
|
this.files.push({ name, content });
|
|
41712
|
-
} else if (name.startsWith("word/media") && name !== "word/media/" || name.startsWith("media") && name !== "media/") {
|
|
41744
|
+
} else if (name.startsWith("word/media") && name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/" || name.startsWith("media") && name !== "media/") {
|
|
41713
41745
|
if (isNode2) {
|
|
41714
41746
|
const buffer2 = await zipEntry.async("nodebuffer");
|
|
41715
41747
|
const fileBase64 = buffer2.toString("base64");
|
|
@@ -56552,7 +56584,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56552
56584
|
* @returns {Object | void} Migration results
|
|
56553
56585
|
*/
|
|
56554
56586
|
processCollaborationMigrations() {
|
|
56555
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
56587
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.20.1");
|
|
56556
56588
|
if (!this.options.ydoc) return;
|
|
56557
56589
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
56558
56590
|
let docVersion = metaMap.get("version");
|
|
@@ -56779,7 +56811,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56779
56811
|
this.initializeCollaborationData();
|
|
56780
56812
|
this.initDefaultStyles();
|
|
56781
56813
|
}
|
|
56782
|
-
if (!this.options.ydoc
|
|
56814
|
+
if (!this.options.ydoc || this.options.markdown || this.options.html) {
|
|
56815
|
+
this.migrateListsToV2();
|
|
56816
|
+
}
|
|
56783
56817
|
this.setDocumentMode(this.options.documentMode);
|
|
56784
56818
|
if (!this.options.ydoc) {
|
|
56785
56819
|
if (!this.options.isChildEditor) {
|
|
@@ -106871,7 +106905,7 @@ ${style2}
|
|
|
106871
106905
|
this.config.colors = shuffleArray(this.config.colors);
|
|
106872
106906
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
106873
106907
|
this.colorIndex = 0;
|
|
106874
|
-
this.version = "0.
|
|
106908
|
+
this.version = "0.20.1";
|
|
106875
106909
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
106876
106910
|
this.superdocId = config2.superdocId || v4();
|
|
106877
106911
|
this.colors = this.config.colors;
|