superdoc 1.15.0-next.2 → 1.15.0-next.3
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/{SuperConverter-CC6mcWnc.es.js → SuperConverter-DBiUGLo-.es.js} +42 -10
- package/dist/chunks/{SuperConverter-BevYhIoX.cjs → SuperConverter-XD7hP7T-.cjs} +42 -10
- package/dist/chunks/{src-BeR3aE72.cjs → src-13FP8ddK.cjs} +221 -48
- package/dist/chunks/{src-BrAeXFXo.es.js → src-C_wxBbkT.es.js} +221 -48
- package/dist/style.css +22 -22
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/src/components/SuperEditor.vue.d.ts.map +1 -1
- package/dist/super-editor/src/core/presentation-editor/pointer-events/EditorInputManager.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/image/image.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/types/node-attributes.d.ts +2 -0
- package/dist/super-editor/src/extensions/types/node-attributes.d.ts.map +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +263 -58
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -16502,6 +16502,29 @@ var extractEffectExtent = (node) => {
|
|
|
16502
16502
|
bottom
|
|
16503
16503
|
};
|
|
16504
16504
|
};
|
|
16505
|
+
var buildClipPathFromSrcRect = (srcRectAttrs = {}) => {
|
|
16506
|
+
const edges = {
|
|
16507
|
+
left: srcRectAttrs.l,
|
|
16508
|
+
top: srcRectAttrs.t,
|
|
16509
|
+
right: srcRectAttrs.r,
|
|
16510
|
+
bottom: srcRectAttrs.b
|
|
16511
|
+
};
|
|
16512
|
+
let hasValue = false;
|
|
16513
|
+
let hasPositive = false;
|
|
16514
|
+
const percentEdges = {};
|
|
16515
|
+
for (const [edge, value] of Object.entries(edges)) {
|
|
16516
|
+
if (value == null) continue;
|
|
16517
|
+
const numeric = Number(value);
|
|
16518
|
+
if (!Number.isFinite(numeric)) continue;
|
|
16519
|
+
hasValue = true;
|
|
16520
|
+
if (numeric < 0) return null;
|
|
16521
|
+
const percent = Math.max(0, Math.min(100, numeric / 1e3));
|
|
16522
|
+
if (percent > 0) hasPositive = true;
|
|
16523
|
+
percentEdges[edge] = percent;
|
|
16524
|
+
}
|
|
16525
|
+
if (!hasValue || !hasPositive) return null;
|
|
16526
|
+
return `inset(${percentEdges.top ?? 0}% ${percentEdges.right ?? 0}% ${percentEdges.bottom ?? 0}% ${percentEdges.left ?? 0}%)`;
|
|
16527
|
+
};
|
|
16505
16528
|
function handleImageNode(node, params, isAnchor) {
|
|
16506
16529
|
if (!node) return null;
|
|
16507
16530
|
const { docx, filename, converter } = params;
|
|
@@ -16621,7 +16644,9 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16621
16644
|
if (!blip) return null;
|
|
16622
16645
|
const stretch = blipFill?.elements?.find((el) => el.name === "a:stretch");
|
|
16623
16646
|
const fillRect = stretch?.elements?.find((el) => el.name === "a:fillRect");
|
|
16624
|
-
const
|
|
16647
|
+
const srcRect = blipFill?.elements?.find((el) => el.name === "a:srcRect");
|
|
16648
|
+
const srcRectAttrs = srcRect?.attributes || {};
|
|
16649
|
+
const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
|
|
16625
16650
|
const srcRectHasNegativeValues = [
|
|
16626
16651
|
"l",
|
|
16627
16652
|
"t",
|
|
@@ -16631,7 +16656,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16631
16656
|
const val = srcRectAttrs[attr];
|
|
16632
16657
|
return val != null && parseFloat(val) < 0;
|
|
16633
16658
|
});
|
|
16634
|
-
const shouldCover = Boolean(stretch && fillRect) && !srcRectHasNegativeValues;
|
|
16659
|
+
const shouldCover = Boolean(stretch && fillRect) && !srcRectHasNegativeValues && !clipPath;
|
|
16635
16660
|
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
16636
16661
|
if (spPr) {
|
|
16637
16662
|
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
@@ -16698,6 +16723,8 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16698
16723
|
...wrap$1.type === "Square" && wrap$1.attrs.wrapText ? { wrapText: wrap$1.attrs.wrapText } : {},
|
|
16699
16724
|
wrapTopAndBottom: wrap$1.type === "TopAndBottom",
|
|
16700
16725
|
shouldCover,
|
|
16726
|
+
...clipPath ? { clipPath } : {},
|
|
16727
|
+
rawSrcRect: srcRect,
|
|
16701
16728
|
originalPadding: {
|
|
16702
16729
|
distT: attributes["distT"],
|
|
16703
16730
|
distB: attributes["distB"],
|
|
@@ -22404,6 +22431,7 @@ const translateImageNode = (params) => {
|
|
|
22404
22431
|
effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
|
|
22405
22432
|
}
|
|
22406
22433
|
}
|
|
22434
|
+
const rawSrcRect = attrs.rawSrcRect;
|
|
22407
22435
|
const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
22408
22436
|
const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
22409
22437
|
return {
|
|
@@ -22468,13 +22496,17 @@ const translateImageNode = (params) => {
|
|
|
22468
22496
|
},
|
|
22469
22497
|
{
|
|
22470
22498
|
name: "pic:blipFill",
|
|
22471
|
-
elements: [
|
|
22472
|
-
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
|
|
22476
|
-
|
|
22477
|
-
|
|
22499
|
+
elements: [
|
|
22500
|
+
{
|
|
22501
|
+
name: "a:blip",
|
|
22502
|
+
attributes: { "r:embed": imageId }
|
|
22503
|
+
},
|
|
22504
|
+
...rawSrcRect ? [rawSrcRect] : [],
|
|
22505
|
+
{
|
|
22506
|
+
name: "a:stretch",
|
|
22507
|
+
elements: [{ name: "a:fillRect" }]
|
|
22508
|
+
}
|
|
22509
|
+
]
|
|
22478
22510
|
},
|
|
22479
22511
|
{
|
|
22480
22512
|
name: "pic:spPr",
|
|
@@ -33719,7 +33751,7 @@ var SuperConverter = class SuperConverter {
|
|
|
33719
33751
|
static getStoredSuperdocVersion(docx) {
|
|
33720
33752
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
33721
33753
|
}
|
|
33722
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.
|
|
33754
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.3") {
|
|
33723
33755
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
33724
33756
|
}
|
|
33725
33757
|
static generateWordTimestamp() {
|
|
@@ -16514,6 +16514,29 @@ var extractEffectExtent = (node) => {
|
|
|
16514
16514
|
bottom
|
|
16515
16515
|
};
|
|
16516
16516
|
};
|
|
16517
|
+
var buildClipPathFromSrcRect = (srcRectAttrs = {}) => {
|
|
16518
|
+
const edges = {
|
|
16519
|
+
left: srcRectAttrs.l,
|
|
16520
|
+
top: srcRectAttrs.t,
|
|
16521
|
+
right: srcRectAttrs.r,
|
|
16522
|
+
bottom: srcRectAttrs.b
|
|
16523
|
+
};
|
|
16524
|
+
let hasValue = false;
|
|
16525
|
+
let hasPositive = false;
|
|
16526
|
+
const percentEdges = {};
|
|
16527
|
+
for (const [edge, value] of Object.entries(edges)) {
|
|
16528
|
+
if (value == null) continue;
|
|
16529
|
+
const numeric = Number(value);
|
|
16530
|
+
if (!Number.isFinite(numeric)) continue;
|
|
16531
|
+
hasValue = true;
|
|
16532
|
+
if (numeric < 0) return null;
|
|
16533
|
+
const percent = Math.max(0, Math.min(100, numeric / 1e3));
|
|
16534
|
+
if (percent > 0) hasPositive = true;
|
|
16535
|
+
percentEdges[edge] = percent;
|
|
16536
|
+
}
|
|
16537
|
+
if (!hasValue || !hasPositive) return null;
|
|
16538
|
+
return `inset(${percentEdges.top ?? 0}% ${percentEdges.right ?? 0}% ${percentEdges.bottom ?? 0}% ${percentEdges.left ?? 0}%)`;
|
|
16539
|
+
};
|
|
16517
16540
|
function handleImageNode(node, params, isAnchor) {
|
|
16518
16541
|
if (!node) return null;
|
|
16519
16542
|
const { docx, filename, converter } = params;
|
|
@@ -16633,7 +16656,9 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16633
16656
|
if (!blip) return null;
|
|
16634
16657
|
const stretch = blipFill?.elements?.find((el) => el.name === "a:stretch");
|
|
16635
16658
|
const fillRect = stretch?.elements?.find((el) => el.name === "a:fillRect");
|
|
16636
|
-
const
|
|
16659
|
+
const srcRect = blipFill?.elements?.find((el) => el.name === "a:srcRect");
|
|
16660
|
+
const srcRectAttrs = srcRect?.attributes || {};
|
|
16661
|
+
const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
|
|
16637
16662
|
const srcRectHasNegativeValues = [
|
|
16638
16663
|
"l",
|
|
16639
16664
|
"t",
|
|
@@ -16643,7 +16668,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16643
16668
|
const val = srcRectAttrs[attr];
|
|
16644
16669
|
return val != null && parseFloat(val) < 0;
|
|
16645
16670
|
});
|
|
16646
|
-
const shouldCover = Boolean(stretch && fillRect) && !srcRectHasNegativeValues;
|
|
16671
|
+
const shouldCover = Boolean(stretch && fillRect) && !srcRectHasNegativeValues && !clipPath;
|
|
16647
16672
|
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
16648
16673
|
if (spPr) {
|
|
16649
16674
|
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
@@ -16710,6 +16735,8 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16710
16735
|
...wrap$1.type === "Square" && wrap$1.attrs.wrapText ? { wrapText: wrap$1.attrs.wrapText } : {},
|
|
16711
16736
|
wrapTopAndBottom: wrap$1.type === "TopAndBottom",
|
|
16712
16737
|
shouldCover,
|
|
16738
|
+
...clipPath ? { clipPath } : {},
|
|
16739
|
+
rawSrcRect: srcRect,
|
|
16713
16740
|
originalPadding: {
|
|
16714
16741
|
distT: attributes["distT"],
|
|
16715
16742
|
distB: attributes["distB"],
|
|
@@ -22411,6 +22438,7 @@ const translateImageNode = (params) => {
|
|
|
22411
22438
|
effectExtentAttrs.b = require_helpers.pixelsToEmu(transformData.sizeExtension.bottom);
|
|
22412
22439
|
}
|
|
22413
22440
|
}
|
|
22441
|
+
const rawSrcRect = attrs.rawSrcRect;
|
|
22414
22442
|
const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
22415
22443
|
const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
22416
22444
|
return {
|
|
@@ -22475,13 +22503,17 @@ const translateImageNode = (params) => {
|
|
|
22475
22503
|
},
|
|
22476
22504
|
{
|
|
22477
22505
|
name: "pic:blipFill",
|
|
22478
|
-
elements: [
|
|
22479
|
-
|
|
22480
|
-
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
|
|
22484
|
-
|
|
22506
|
+
elements: [
|
|
22507
|
+
{
|
|
22508
|
+
name: "a:blip",
|
|
22509
|
+
attributes: { "r:embed": imageId }
|
|
22510
|
+
},
|
|
22511
|
+
...rawSrcRect ? [rawSrcRect] : [],
|
|
22512
|
+
{
|
|
22513
|
+
name: "a:stretch",
|
|
22514
|
+
elements: [{ name: "a:fillRect" }]
|
|
22515
|
+
}
|
|
22516
|
+
]
|
|
22485
22517
|
},
|
|
22486
22518
|
{
|
|
22487
22519
|
name: "pic:spPr",
|
|
@@ -33737,7 +33769,7 @@ var SuperConverter = class SuperConverter {
|
|
|
33737
33769
|
static getStoredSuperdocVersion(docx) {
|
|
33738
33770
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
33739
33771
|
}
|
|
33740
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.
|
|
33772
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.3") {
|
|
33741
33773
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
33742
33774
|
}
|
|
33743
33775
|
static generateWordTimestamp() {
|