@harbour-enterprises/superdoc 0.6.1 → 0.6.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/{super-editor.es-8AR-vN66.js → super-editor.es-BTmZ_2zD.js} +41 -7
- package/dist/chunks/super-editor.es-BTmZ_2zD.js.map +1 -0
- package/dist/super-editor/chunks/{converter-DLphK5U8.js → converter-B7GusDEf.js} +40 -6
- package/dist/super-editor/chunks/{converter-DLphK5U8.js.map → converter-B7GusDEf.js.map} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-B2A-XAtj.js → docx-zipper-DYdjsUFH.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-B2A-XAtj.js.map → docx-zipper-DYdjsUFH.js.map} +1 -1
- package/dist/super-editor/chunks/{editor-BvOUEJvW.js → editor-CcYXJ8d_.js} +4 -4
- package/dist/super-editor/chunks/{editor-BvOUEJvW.js.map → editor-CcYXJ8d_.js.map} +1 -1
- package/dist/super-editor/chunks/{toolbar-B-0wA64c.js → toolbar-DEn07baV.js} +3 -3
- package/dist/super-editor/chunks/{toolbar-B-0wA64c.js.map → toolbar-DEn07baV.js.map} +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/super-converter/exporter.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/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.es.js +3 -3
- package/package.json +1 -1
- package/dist/chunks/super-editor.es-8AR-vN66.js.map +0 -1
|
@@ -1811,7 +1811,7 @@ const FileOptions = buffer$1.FileOptions;
|
|
|
1811
1811
|
const INSPECT_MAX_BYTES = buffer$1.INSPECT_MAX_BYTES;
|
|
1812
1812
|
const SlowBuffer = buffer$1.SlowBuffer;
|
|
1813
1813
|
const TranscodeEncoding = buffer$1.TranscodeEncoding;
|
|
1814
|
-
const atob = buffer$1.atob;
|
|
1814
|
+
const atob$1 = buffer$1.atob;
|
|
1815
1815
|
const btoa = buffer$1.btoa;
|
|
1816
1816
|
const constants$1 = buffer$1.constants;
|
|
1817
1817
|
const isAscii = buffer$1.isAscii;
|
|
@@ -1830,7 +1830,7 @@ const dist = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
|
|
|
1830
1830
|
INSPECT_MAX_BYTES,
|
|
1831
1831
|
SlowBuffer,
|
|
1832
1832
|
TranscodeEncoding,
|
|
1833
|
-
atob,
|
|
1833
|
+
atob: atob$1,
|
|
1834
1834
|
btoa,
|
|
1835
1835
|
constants: constants$1,
|
|
1836
1836
|
default: Buffer$B,
|
|
@@ -50463,15 +50463,49 @@ function translateMark(mark) {
|
|
|
50463
50463
|
}
|
|
50464
50464
|
return markElement;
|
|
50465
50465
|
}
|
|
50466
|
+
function getPngDimensions(base64) {
|
|
50467
|
+
const type2 = base64.split(";")[0].split("/")[1];
|
|
50468
|
+
if (!base64 || type2 !== "png") {
|
|
50469
|
+
return {
|
|
50470
|
+
originalWidth: void 0,
|
|
50471
|
+
originalHeight: void 0
|
|
50472
|
+
};
|
|
50473
|
+
}
|
|
50474
|
+
let header = base64.split(",")[1].slice(0, 50);
|
|
50475
|
+
let uint8 = Uint8Array.from(atob(header), (c) => c.charCodeAt(0));
|
|
50476
|
+
let dataView = new DataView(uint8.buffer, 0, 28);
|
|
50477
|
+
return {
|
|
50478
|
+
originalWidth: dataView.getInt32(16),
|
|
50479
|
+
originalHeight: dataView.getInt32(20)
|
|
50480
|
+
};
|
|
50481
|
+
}
|
|
50482
|
+
function getScaledSize(originalWidth, originalHeight, maxWidth, maxHeight) {
|
|
50483
|
+
let scaledWidth = originalWidth;
|
|
50484
|
+
let scaledHeight = originalHeight;
|
|
50485
|
+
let ratio = Math.min(maxWidth / originalWidth, maxHeight / originalHeight);
|
|
50486
|
+
scaledWidth = Math.round(scaledWidth * ratio);
|
|
50487
|
+
scaledHeight = Math.round(scaledHeight * ratio);
|
|
50488
|
+
return { scaledWidth, scaledHeight };
|
|
50489
|
+
}
|
|
50466
50490
|
function translateImageNode(params, imageSize) {
|
|
50467
50491
|
const {
|
|
50468
50492
|
node: { attrs = {}, marks = [] }
|
|
50469
50493
|
} = params;
|
|
50470
50494
|
let imageId = attrs.rId;
|
|
50471
|
-
const
|
|
50495
|
+
const { originalWidth, originalHeight } = getPngDimensions(attrs.imageSrc);
|
|
50496
|
+
let size = attrs.size ? {
|
|
50472
50497
|
w: pixelsToEmu(attrs.size.width),
|
|
50473
50498
|
h: pixelsToEmu(attrs.size.height)
|
|
50474
50499
|
} : imageSize;
|
|
50500
|
+
if (originalWidth && originalHeight) {
|
|
50501
|
+
const boxWidthPx = emuToPixels(size.w);
|
|
50502
|
+
const boxHeightPx = emuToPixels(size.h);
|
|
50503
|
+
const { scaledWidth, scaledHeight } = getScaledSize(originalWidth, originalHeight, boxWidthPx, boxHeightPx);
|
|
50504
|
+
size = {
|
|
50505
|
+
w: pixelsToEmu(scaledWidth),
|
|
50506
|
+
h: pixelsToEmu(scaledHeight)
|
|
50507
|
+
};
|
|
50508
|
+
}
|
|
50475
50509
|
if (params.node.type === "image" && !imageId) {
|
|
50476
50510
|
const path2 = attrs.src?.split("word/")[1];
|
|
50477
50511
|
imageId = addNewImageRelationship(params, path2);
|
|
@@ -52855,7 +52889,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
52855
52889
|
return;
|
|
52856
52890
|
}
|
|
52857
52891
|
}
|
|
52858
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.
|
|
52892
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.2") {
|
|
52859
52893
|
const customLocation = "docProps/custom.xml";
|
|
52860
52894
|
if (!docx[customLocation]) {
|
|
52861
52895
|
docx[customLocation] = generateCustomXml();
|
|
@@ -53102,7 +53136,7 @@ function storeSuperdocVersion(docx) {
|
|
|
53102
53136
|
function generateCustomXml() {
|
|
53103
53137
|
return DEFAULT_CUSTOM_XML;
|
|
53104
53138
|
}
|
|
53105
|
-
function generateSuperdocVersion(version2 = "0.6.
|
|
53139
|
+
function generateSuperdocVersion(version2 = "0.6.2") {
|
|
53106
53140
|
return {
|
|
53107
53141
|
type: "element",
|
|
53108
53142
|
name: "property",
|
|
@@ -53174,4 +53208,4 @@ export {
|
|
|
53174
53208
|
twipsToLines as y,
|
|
53175
53209
|
pixelsToTwips as z
|
|
53176
53210
|
};
|
|
53177
|
-
//# sourceMappingURL=converter-
|
|
53211
|
+
//# sourceMappingURL=converter-B7GusDEf.js.map
|