@harbour-enterprises/superdoc 0.29.0-next.13 → 0.29.0-next.15
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-DOihIaKT.cjs → PdfViewer-B7X4xur3.cjs} +1 -1
- package/dist/chunks/{PdfViewer-BkHpL2td.es.js → PdfViewer-BL9hLN-A.es.js} +1 -1
- package/dist/chunks/{index-BG7aufxd.es.js → index-CCTDIDk7.es.js} +3 -3
- package/dist/chunks/{index-Bky221GX.cjs → index-CCVmXx2r.cjs} +3 -3
- package/dist/chunks/{index-p_HoYQ4L-YNisXWt0.es.js → index-x0B8ORNX--SLHZ7wS.es.js} +1 -1
- package/dist/chunks/{index-p_HoYQ4L-BvUq1_h3.cjs → index-x0B8ORNX-D9kjqjf9.cjs} +1 -1
- package/dist/chunks/{super-editor.es-DA-FFY2A.cjs → super-editor.es-BkV-6f5K.cjs} +404 -12
- package/dist/chunks/{super-editor.es-vCpzMs9V.es.js → super-editor.es-LUVoGFZl.es.js} +404 -12
- package/dist/style.css +45 -3
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-C0Fd9g-U.js → converter-Bt0gPwYj.js} +149 -7
- package/dist/super-editor/chunks/{docx-zipper-BqIh8tzQ.js → docx-zipper-JVCnlDBn.js} +1 -1
- package/dist/super-editor/chunks/{editor-Dg538FVw.js → editor-BF7w_sd7.js} +257 -7
- package/dist/super-editor/chunks/{index-p_HoYQ4L.js → index-x0B8ORNX.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Des2y7IP.js → toolbar-CI9lB3KI.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/style.css +45 -3
- package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/relationship-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/index.d.ts +2 -1
- package/dist/super-editor/super-editor/src/extensions/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/search/prosemirror-search-patched.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/shape-group/ShapeGroupView.d.ts +22 -0
- package/dist/super-editor/super-editor/src/extensions/shape-group/ShapeGroupView.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/shape-group/index.d.ts +3 -0
- package/dist/super-editor/super-editor/src/extensions/shape-group/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts +3 -0
- package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts.map +1 -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 +406 -14
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -28454,6 +28454,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
28454
28454
|
}
|
|
28455
28455
|
const DRAWING_XML_TAG = "w:drawing";
|
|
28456
28456
|
const SHAPE_URI = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
|
|
28457
|
+
const GROUP_URI = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
|
|
28457
28458
|
function handleImageNode(node2, params2, isAnchor) {
|
|
28458
28459
|
const { docx, filename } = params2;
|
|
28459
28460
|
const { attributes } = node2;
|
|
@@ -28571,7 +28572,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
28571
28572
|
const graphic = node2.elements.find((el) => el.name === "a:graphic");
|
|
28572
28573
|
const graphicData = graphic?.elements.find((el) => el.name === "a:graphicData");
|
|
28573
28574
|
const { uri: uri2 } = graphicData?.attributes || {};
|
|
28574
|
-
if (
|
|
28575
|
+
if (uri2 === SHAPE_URI) {
|
|
28575
28576
|
const shapeMarginOffset = {
|
|
28576
28577
|
left: positionHValue,
|
|
28577
28578
|
horizontal: positionHValue,
|
|
@@ -28579,6 +28580,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
28579
28580
|
};
|
|
28580
28581
|
return handleShapeDrawing(params2, node2, graphicData, size2, padding, shapeMarginOffset);
|
|
28581
28582
|
}
|
|
28583
|
+
if (uri2 === GROUP_URI) {
|
|
28584
|
+
const shapeMarginOffset = {
|
|
28585
|
+
left: positionHValue,
|
|
28586
|
+
horizontal: positionHValue,
|
|
28587
|
+
top: positionVValue
|
|
28588
|
+
};
|
|
28589
|
+
return handleShapeGroup(params2, node2, graphicData, size2, padding, shapeMarginOffset);
|
|
28590
|
+
}
|
|
28582
28591
|
const picture = graphicData?.elements.find((el) => el.name === "pic:pic");
|
|
28583
28592
|
if (!picture || !picture.elements) return null;
|
|
28584
28593
|
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
@@ -28668,6 +28677,114 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
28668
28677
|
}
|
|
28669
28678
|
return buildShapePlaceholder(node2, size2, padding, marginOffset, "textbox");
|
|
28670
28679
|
};
|
|
28680
|
+
const handleShapeGroup = (params2, node2, graphicData, size2, padding, marginOffset) => {
|
|
28681
|
+
const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
|
|
28682
|
+
if (!wgp) {
|
|
28683
|
+
return buildShapePlaceholder(node2, size2, padding, marginOffset, "group");
|
|
28684
|
+
}
|
|
28685
|
+
const grpSpPr = wgp.elements.find((el) => el.name === "wpg:grpSpPr");
|
|
28686
|
+
const xfrm = grpSpPr?.elements?.find((el) => el.name === "a:xfrm");
|
|
28687
|
+
const groupTransform = {};
|
|
28688
|
+
if (xfrm) {
|
|
28689
|
+
const off2 = xfrm.elements?.find((el) => el.name === "a:off");
|
|
28690
|
+
const ext = xfrm.elements?.find((el) => el.name === "a:ext");
|
|
28691
|
+
const chOff = xfrm.elements?.find((el) => el.name === "a:chOff");
|
|
28692
|
+
const chExt = xfrm.elements?.find((el) => el.name === "a:chExt");
|
|
28693
|
+
if (off2) {
|
|
28694
|
+
groupTransform.x = emuToPixels(off2.attributes?.["x"] || 0);
|
|
28695
|
+
groupTransform.y = emuToPixels(off2.attributes?.["y"] || 0);
|
|
28696
|
+
}
|
|
28697
|
+
if (ext) {
|
|
28698
|
+
groupTransform.width = emuToPixels(ext.attributes?.["cx"] || 0);
|
|
28699
|
+
groupTransform.height = emuToPixels(ext.attributes?.["cy"] || 0);
|
|
28700
|
+
}
|
|
28701
|
+
if (chOff) {
|
|
28702
|
+
groupTransform.childX = emuToPixels(chOff.attributes?.["x"] || 0);
|
|
28703
|
+
groupTransform.childY = emuToPixels(chOff.attributes?.["y"] || 0);
|
|
28704
|
+
groupTransform.childOriginXEmu = parseFloat(chOff.attributes?.["x"] || 0);
|
|
28705
|
+
groupTransform.childOriginYEmu = parseFloat(chOff.attributes?.["y"] || 0);
|
|
28706
|
+
}
|
|
28707
|
+
if (chExt) {
|
|
28708
|
+
groupTransform.childWidth = emuToPixels(chExt.attributes?.["cx"] || 0);
|
|
28709
|
+
groupTransform.childHeight = emuToPixels(chExt.attributes?.["cy"] || 0);
|
|
28710
|
+
}
|
|
28711
|
+
}
|
|
28712
|
+
const childShapes = wgp.elements.filter((el) => el.name === "wps:wsp");
|
|
28713
|
+
const shapes = childShapes.map((wsp) => {
|
|
28714
|
+
const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
|
|
28715
|
+
if (!spPr) return null;
|
|
28716
|
+
const prstGeom = spPr.elements?.find((el) => el.name === "a:prstGeom");
|
|
28717
|
+
const shapeKind = prstGeom?.attributes?.["prst"];
|
|
28718
|
+
const shapeXfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
|
|
28719
|
+
const shapeOff = shapeXfrm?.elements?.find((el) => el.name === "a:off");
|
|
28720
|
+
const shapeExt = shapeXfrm?.elements?.find((el) => el.name === "a:ext");
|
|
28721
|
+
const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
|
|
28722
|
+
const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
|
|
28723
|
+
const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
|
|
28724
|
+
const rawHeight = shapeExt?.attributes?.["cy"] ? parseFloat(shapeExt.attributes["cy"]) : 914400;
|
|
28725
|
+
let x2, y2, width, height;
|
|
28726
|
+
if (groupTransform.childWidth && groupTransform.childHeight) {
|
|
28727
|
+
const scaleX = groupTransform.width / groupTransform.childWidth;
|
|
28728
|
+
const scaleY = groupTransform.height / groupTransform.childHeight;
|
|
28729
|
+
const childOriginX = groupTransform.childOriginXEmu || 0;
|
|
28730
|
+
const childOriginY = groupTransform.childOriginYEmu || 0;
|
|
28731
|
+
x2 = groupTransform.x + emuToPixels((rawX - childOriginX) * scaleX);
|
|
28732
|
+
y2 = groupTransform.y + emuToPixels((rawY - childOriginY) * scaleY);
|
|
28733
|
+
width = emuToPixels(rawWidth * scaleX);
|
|
28734
|
+
height = emuToPixels(rawHeight * scaleY);
|
|
28735
|
+
} else {
|
|
28736
|
+
x2 = emuToPixels(rawX);
|
|
28737
|
+
y2 = emuToPixels(rawY);
|
|
28738
|
+
width = emuToPixels(rawWidth);
|
|
28739
|
+
height = emuToPixels(rawHeight);
|
|
28740
|
+
}
|
|
28741
|
+
const rotation = shapeXfrm?.attributes?.["rot"] ? rotToDegrees(shapeXfrm.attributes["rot"]) : 0;
|
|
28742
|
+
const flipH = shapeXfrm?.attributes?.["flipH"] === "1";
|
|
28743
|
+
const flipV = shapeXfrm?.attributes?.["flipV"] === "1";
|
|
28744
|
+
const style2 = wsp.elements?.find((el) => el.name === "wps:style");
|
|
28745
|
+
const fillColor = extractFillColor(spPr, style2);
|
|
28746
|
+
const strokeColor = extractStrokeColor(spPr, style2);
|
|
28747
|
+
const strokeWidth = extractStrokeWidth(spPr);
|
|
28748
|
+
const cNvPr = wsp.elements?.find((el) => el.name === "wps:cNvPr");
|
|
28749
|
+
const shapeId = cNvPr?.attributes?.["id"];
|
|
28750
|
+
const shapeName = cNvPr?.attributes?.["name"];
|
|
28751
|
+
return {
|
|
28752
|
+
shapeType: "vectorShape",
|
|
28753
|
+
attrs: {
|
|
28754
|
+
kind: shapeKind,
|
|
28755
|
+
x: x2,
|
|
28756
|
+
y: y2,
|
|
28757
|
+
width,
|
|
28758
|
+
height,
|
|
28759
|
+
rotation,
|
|
28760
|
+
flipH,
|
|
28761
|
+
flipV,
|
|
28762
|
+
fillColor,
|
|
28763
|
+
strokeColor,
|
|
28764
|
+
strokeWidth,
|
|
28765
|
+
shapeId,
|
|
28766
|
+
shapeName
|
|
28767
|
+
}
|
|
28768
|
+
};
|
|
28769
|
+
}).filter(Boolean);
|
|
28770
|
+
const schemaAttrs = {};
|
|
28771
|
+
const drawingNode = params2.nodes?.[0];
|
|
28772
|
+
if (drawingNode?.name === DRAWING_XML_TAG) {
|
|
28773
|
+
schemaAttrs.drawingContent = drawingNode;
|
|
28774
|
+
}
|
|
28775
|
+
const result = {
|
|
28776
|
+
type: "shapeGroup",
|
|
28777
|
+
attrs: {
|
|
28778
|
+
...schemaAttrs,
|
|
28779
|
+
groupTransform,
|
|
28780
|
+
shapes,
|
|
28781
|
+
size: size2,
|
|
28782
|
+
padding,
|
|
28783
|
+
marginOffset
|
|
28784
|
+
}
|
|
28785
|
+
};
|
|
28786
|
+
return result;
|
|
28787
|
+
};
|
|
28671
28788
|
const getRectangleShape = (params2, node2) => {
|
|
28672
28789
|
const schemaAttrs = {};
|
|
28673
28790
|
const [drawingNode] = params2.nodes;
|
|
@@ -29110,6 +29227,30 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
29110
29227
|
};
|
|
29111
29228
|
return wrapTextInRun(alternateContent);
|
|
29112
29229
|
}
|
|
29230
|
+
function translateShapeGroup(params2) {
|
|
29231
|
+
const { node: node2 } = params2;
|
|
29232
|
+
const { drawingContent } = node2.attrs;
|
|
29233
|
+
if (drawingContent) {
|
|
29234
|
+
const drawing = {
|
|
29235
|
+
name: "w:drawing",
|
|
29236
|
+
elements: [...drawingContent.elements || []]
|
|
29237
|
+
};
|
|
29238
|
+
const choice = {
|
|
29239
|
+
name: "mc:Choice",
|
|
29240
|
+
attributes: { Requires: "wpg" },
|
|
29241
|
+
elements: [drawing]
|
|
29242
|
+
};
|
|
29243
|
+
const alternateContent = {
|
|
29244
|
+
name: "mc:AlternateContent",
|
|
29245
|
+
elements: [choice]
|
|
29246
|
+
};
|
|
29247
|
+
return wrapTextInRun(alternateContent);
|
|
29248
|
+
}
|
|
29249
|
+
return wrapTextInRun({
|
|
29250
|
+
name: "w:drawing",
|
|
29251
|
+
elements: []
|
|
29252
|
+
});
|
|
29253
|
+
}
|
|
29113
29254
|
function translateAnchorNode(params2) {
|
|
29114
29255
|
const { attrs } = params2.node;
|
|
29115
29256
|
const anchorElements = [];
|
|
@@ -29273,11 +29414,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
29273
29414
|
};
|
|
29274
29415
|
}
|
|
29275
29416
|
const XML_NODE_NAME$f = "wp:anchor";
|
|
29276
|
-
const SD_NODE_NAME$c = ["image"];
|
|
29417
|
+
const SD_NODE_NAME$c = ["image", "shapeGroup", "vectorShape", "contentBlock"];
|
|
29277
29418
|
const validXmlAttributes$a = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
29278
29419
|
function encode$l(params2) {
|
|
29279
29420
|
const { node: node2 } = params2.extraParams;
|
|
29280
|
-
if (!node2 || !node2.
|
|
29421
|
+
if (!node2 || !node2.name) {
|
|
29281
29422
|
return null;
|
|
29282
29423
|
}
|
|
29283
29424
|
return handleAnchorNode(params2);
|
|
@@ -29314,11 +29455,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
29314
29455
|
};
|
|
29315
29456
|
}
|
|
29316
29457
|
const XML_NODE_NAME$e = "wp:inline";
|
|
29317
|
-
const SD_NODE_NAME$b = ["image"];
|
|
29458
|
+
const SD_NODE_NAME$b = ["image", "shapeGroup", "vectorShape", "contentBlock"];
|
|
29318
29459
|
const validXmlAttributes$9 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
29319
29460
|
function encode$k(params2) {
|
|
29320
29461
|
const { node: node2 } = params2.extraParams;
|
|
29321
|
-
if (!node2 || !node2.
|
|
29462
|
+
if (!node2 || !node2.name) {
|
|
29322
29463
|
return null;
|
|
29323
29464
|
}
|
|
29324
29465
|
return handleInlineNode(params2);
|
|
@@ -32739,6 +32880,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32739
32880
|
};
|
|
32740
32881
|
const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
|
|
32741
32882
|
"wps",
|
|
32883
|
+
"wpg",
|
|
32742
32884
|
"wp14",
|
|
32743
32885
|
"w14",
|
|
32744
32886
|
"w15",
|
|
@@ -34399,6 +34541,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34399
34541
|
shapeTextbox: translator,
|
|
34400
34542
|
contentBlock: translator,
|
|
34401
34543
|
vectorShape: translateVectorShape,
|
|
34544
|
+
shapeGroup: translateShapeGroup,
|
|
34402
34545
|
structuredContent: translator$r,
|
|
34403
34546
|
structuredContentBlock: translator$r,
|
|
34404
34547
|
documentPartObject: translator$r,
|
|
@@ -35411,7 +35554,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35411
35554
|
const currentId = attributes.Id || "";
|
|
35412
35555
|
attributes.Target = attributes?.Target?.replace(/&/g, "&");
|
|
35413
35556
|
const existingTarget = existingRelationships.find((el) => el.attributes.Target === attributes.Target);
|
|
35414
|
-
attributes.Target?.startsWith("media/");
|
|
35415
35557
|
const isNewHyperlink = attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && currentId.length > 6;
|
|
35416
35558
|
const isNewHeadFoot = (attributes.Type === HEADER_RELATIONSHIP_TYPE || attributes.Type === FOOTER_RELATIONSHIP_TYPE) && currentId.length > 6;
|
|
35417
35559
|
const hasSeenId = currentId && seenIds.has(currentId);
|
|
@@ -35640,7 +35782,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35640
35782
|
static getStoredSuperdocVersion(docx) {
|
|
35641
35783
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35642
35784
|
}
|
|
35643
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-next.
|
|
35785
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-next.15") {
|
|
35644
35786
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35645
35787
|
}
|
|
35646
35788
|
/**
|
|
@@ -61570,7 +61712,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61570
61712
|
{ default: remarkStringify2 },
|
|
61571
61713
|
{ default: remarkGfm2 }
|
|
61572
61714
|
] = await Promise.all([
|
|
61573
|
-
Promise.resolve().then(() =>
|
|
61715
|
+
Promise.resolve().then(() => indexX0B8ORNX),
|
|
61574
61716
|
Promise.resolve().then(() => indexDRCvimau),
|
|
61575
61717
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
61576
61718
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -61788,7 +61930,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61788
61930
|
* @returns {Object | void} Migration results
|
|
61789
61931
|
*/
|
|
61790
61932
|
processCollaborationMigrations() {
|
|
61791
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.
|
|
61933
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.15");
|
|
61792
61934
|
if (!this.options.ydoc) return;
|
|
61793
61935
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
61794
61936
|
let docVersion = metaMap.get("version");
|
|
@@ -77847,6 +77989,255 @@ ${l}
|
|
|
77847
77989
|
};
|
|
77848
77990
|
}
|
|
77849
77991
|
});
|
|
77992
|
+
class ShapeGroupView {
|
|
77993
|
+
constructor(props) {
|
|
77994
|
+
__publicField$1(this, "node");
|
|
77995
|
+
__publicField$1(this, "view");
|
|
77996
|
+
__publicField$1(this, "getPos");
|
|
77997
|
+
__publicField$1(this, "decorations");
|
|
77998
|
+
__publicField$1(this, "innerDecorations");
|
|
77999
|
+
__publicField$1(this, "editor");
|
|
78000
|
+
__publicField$1(this, "extension");
|
|
78001
|
+
__publicField$1(this, "htmlAttributes");
|
|
78002
|
+
__publicField$1(this, "root");
|
|
78003
|
+
this.node = props.node;
|
|
78004
|
+
this.view = props.editor.view;
|
|
78005
|
+
this.getPos = props.getPos;
|
|
78006
|
+
this.decorations = props.decorations;
|
|
78007
|
+
this.innerDecorations = props.innerDecorations;
|
|
78008
|
+
this.editor = props.editor;
|
|
78009
|
+
this.extension = props.extension;
|
|
78010
|
+
this.htmlAttributes = props.htmlAttributes;
|
|
78011
|
+
this.mount();
|
|
78012
|
+
}
|
|
78013
|
+
mount() {
|
|
78014
|
+
this.buildView();
|
|
78015
|
+
}
|
|
78016
|
+
get dom() {
|
|
78017
|
+
return this.root;
|
|
78018
|
+
}
|
|
78019
|
+
get contentDOM() {
|
|
78020
|
+
return null;
|
|
78021
|
+
}
|
|
78022
|
+
createElement() {
|
|
78023
|
+
const attrs = this.node.attrs;
|
|
78024
|
+
const { groupTransform, shapes, size: size2 } = attrs;
|
|
78025
|
+
const container = document.createElement("div");
|
|
78026
|
+
container.classList.add("sd-shape-group");
|
|
78027
|
+
container.setAttribute("data-shape-group", "");
|
|
78028
|
+
const width = size2?.width || groupTransform?.width || 300;
|
|
78029
|
+
const height = size2?.height || groupTransform?.height || 200;
|
|
78030
|
+
container.style.width = `${width}px`;
|
|
78031
|
+
container.style.height = `${height}px`;
|
|
78032
|
+
container.style.position = "relative";
|
|
78033
|
+
container.style.display = "inline-block";
|
|
78034
|
+
const svg2 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
78035
|
+
svg2.setAttribute("version", "1.1");
|
|
78036
|
+
svg2.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
78037
|
+
svg2.setAttribute("width", width.toString());
|
|
78038
|
+
svg2.setAttribute("height", height.toString());
|
|
78039
|
+
svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
78040
|
+
svg2.style.display = "block";
|
|
78041
|
+
if (shapes && Array.isArray(shapes)) {
|
|
78042
|
+
shapes.forEach((shape) => {
|
|
78043
|
+
if (shape.shapeType === "vectorShape") {
|
|
78044
|
+
const shapeElement = this.createShapeElement(shape, groupTransform);
|
|
78045
|
+
if (shapeElement) {
|
|
78046
|
+
svg2.appendChild(shapeElement);
|
|
78047
|
+
}
|
|
78048
|
+
}
|
|
78049
|
+
});
|
|
78050
|
+
}
|
|
78051
|
+
container.appendChild(svg2);
|
|
78052
|
+
return { element: container };
|
|
78053
|
+
}
|
|
78054
|
+
createShapeElement(shape, groupTransform) {
|
|
78055
|
+
const attrs = shape.attrs;
|
|
78056
|
+
if (!attrs) return null;
|
|
78057
|
+
const x2 = attrs.x || 0;
|
|
78058
|
+
const y2 = attrs.y || 0;
|
|
78059
|
+
const width = attrs.width || 100;
|
|
78060
|
+
const height = attrs.height || 100;
|
|
78061
|
+
const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
78062
|
+
const transforms = [];
|
|
78063
|
+
transforms.push(`translate(${x2}, ${y2})`);
|
|
78064
|
+
if (attrs.rotation !== 0) {
|
|
78065
|
+
transforms.push(`rotate(${attrs.rotation} ${width / 2} ${height / 2})`);
|
|
78066
|
+
}
|
|
78067
|
+
if (attrs.flipH) {
|
|
78068
|
+
transforms.push(`scale(-1, 1) translate(${-width}, 0)`);
|
|
78069
|
+
}
|
|
78070
|
+
if (attrs.flipV) {
|
|
78071
|
+
transforms.push(`scale(1, -1) translate(0, ${-height})`);
|
|
78072
|
+
}
|
|
78073
|
+
if (transforms.length > 0) {
|
|
78074
|
+
g.setAttribute("transform", transforms.join(" "));
|
|
78075
|
+
}
|
|
78076
|
+
const shapeKind = attrs.kind || "rect";
|
|
78077
|
+
const fillColor = attrs.fillColor || "#5b9bd5";
|
|
78078
|
+
const strokeColor = attrs.strokeColor || "#000000";
|
|
78079
|
+
const strokeWidth = attrs.strokeWidth || 1;
|
|
78080
|
+
try {
|
|
78081
|
+
const svgContent = k({
|
|
78082
|
+
preset: shapeKind,
|
|
78083
|
+
styleOverrides: {
|
|
78084
|
+
fill: fillColor || "none",
|
|
78085
|
+
stroke: strokeColor || "none",
|
|
78086
|
+
strokeWidth: strokeWidth || 0
|
|
78087
|
+
},
|
|
78088
|
+
width,
|
|
78089
|
+
height
|
|
78090
|
+
});
|
|
78091
|
+
if (svgContent) {
|
|
78092
|
+
const tempDiv = document.createElement("div");
|
|
78093
|
+
tempDiv.innerHTML = svgContent;
|
|
78094
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
78095
|
+
if (svgElement) {
|
|
78096
|
+
Array.from(svgElement.children).forEach((child) => {
|
|
78097
|
+
const clonedChild = child.cloneNode(true);
|
|
78098
|
+
if (clonedChild.tagName === "ellipse") {
|
|
78099
|
+
clonedChild.setAttribute("cx", (width / 2).toString());
|
|
78100
|
+
clonedChild.setAttribute("cy", (height / 2).toString());
|
|
78101
|
+
clonedChild.setAttribute("rx", (width / 2).toString());
|
|
78102
|
+
clonedChild.setAttribute("ry", (height / 2).toString());
|
|
78103
|
+
} else if (clonedChild.tagName === "circle") {
|
|
78104
|
+
if (width !== height) {
|
|
78105
|
+
const ellipse = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
|
|
78106
|
+
ellipse.setAttribute("cx", (width / 2).toString());
|
|
78107
|
+
ellipse.setAttribute("cy", (height / 2).toString());
|
|
78108
|
+
ellipse.setAttribute("rx", (width / 2).toString());
|
|
78109
|
+
ellipse.setAttribute("ry", (height / 2).toString());
|
|
78110
|
+
Array.from(clonedChild.attributes).forEach((attr) => {
|
|
78111
|
+
if (!["cx", "cy", "r"].includes(attr.name)) {
|
|
78112
|
+
ellipse.setAttribute(attr.name, attr.value);
|
|
78113
|
+
}
|
|
78114
|
+
});
|
|
78115
|
+
g.appendChild(ellipse);
|
|
78116
|
+
return;
|
|
78117
|
+
} else {
|
|
78118
|
+
clonedChild.setAttribute("cx", (width / 2).toString());
|
|
78119
|
+
clonedChild.setAttribute("cy", (height / 2).toString());
|
|
78120
|
+
clonedChild.setAttribute("r", (width / 2).toString());
|
|
78121
|
+
}
|
|
78122
|
+
} else if (clonedChild.tagName === "rect") {
|
|
78123
|
+
clonedChild.setAttribute("width", width.toString());
|
|
78124
|
+
clonedChild.setAttribute("height", height.toString());
|
|
78125
|
+
} else if (clonedChild.tagName === "path" && svgElement.hasAttribute("viewBox")) {
|
|
78126
|
+
const viewBox = svgElement.getAttribute("viewBox").split(" ").map(Number);
|
|
78127
|
+
if (viewBox.length === 4) {
|
|
78128
|
+
const [, , vbWidth, vbHeight] = viewBox;
|
|
78129
|
+
const scaleX = width / vbWidth;
|
|
78130
|
+
const scaleY = height / vbHeight;
|
|
78131
|
+
if (scaleX !== 1 || scaleY !== 1) {
|
|
78132
|
+
const pathTransform = `scale(${scaleX}, ${scaleY})`;
|
|
78133
|
+
const existingTransform = clonedChild.getAttribute("transform");
|
|
78134
|
+
clonedChild.setAttribute(
|
|
78135
|
+
"transform",
|
|
78136
|
+
existingTransform ? `${existingTransform} ${pathTransform}` : pathTransform
|
|
78137
|
+
);
|
|
78138
|
+
}
|
|
78139
|
+
}
|
|
78140
|
+
} else if (clonedChild.hasAttribute("width")) {
|
|
78141
|
+
clonedChild.setAttribute("width", width.toString());
|
|
78142
|
+
}
|
|
78143
|
+
if (clonedChild.hasAttribute("height") && clonedChild.tagName !== "ellipse") {
|
|
78144
|
+
clonedChild.setAttribute("height", height.toString());
|
|
78145
|
+
}
|
|
78146
|
+
g.appendChild(clonedChild);
|
|
78147
|
+
});
|
|
78148
|
+
}
|
|
78149
|
+
}
|
|
78150
|
+
} catch (error) {
|
|
78151
|
+
console.warn("Failed to generate shape SVG:", error);
|
|
78152
|
+
const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
78153
|
+
rect.setAttribute("width", width.toString());
|
|
78154
|
+
rect.setAttribute("height", height.toString());
|
|
78155
|
+
rect.setAttribute("fill", fillColor);
|
|
78156
|
+
rect.setAttribute("stroke", strokeColor);
|
|
78157
|
+
rect.setAttribute("stroke-width", strokeWidth.toString());
|
|
78158
|
+
g.appendChild(rect);
|
|
78159
|
+
}
|
|
78160
|
+
return g;
|
|
78161
|
+
}
|
|
78162
|
+
buildView() {
|
|
78163
|
+
const { element: element2 } = this.createElement();
|
|
78164
|
+
this.root = element2;
|
|
78165
|
+
}
|
|
78166
|
+
update() {
|
|
78167
|
+
return false;
|
|
78168
|
+
}
|
|
78169
|
+
}
|
|
78170
|
+
const ShapeGroup = Node$1.create({
|
|
78171
|
+
name: "shapeGroup",
|
|
78172
|
+
group: "inline",
|
|
78173
|
+
inline: true,
|
|
78174
|
+
atom: true,
|
|
78175
|
+
addOptions() {
|
|
78176
|
+
return {
|
|
78177
|
+
htmlAttributes: {
|
|
78178
|
+
contenteditable: false
|
|
78179
|
+
}
|
|
78180
|
+
};
|
|
78181
|
+
},
|
|
78182
|
+
addAttributes() {
|
|
78183
|
+
return {
|
|
78184
|
+
groupTransform: {
|
|
78185
|
+
default: {},
|
|
78186
|
+
renderDOM: () => ({})
|
|
78187
|
+
},
|
|
78188
|
+
shapes: {
|
|
78189
|
+
default: [],
|
|
78190
|
+
renderDOM: () => ({})
|
|
78191
|
+
},
|
|
78192
|
+
size: {
|
|
78193
|
+
default: null,
|
|
78194
|
+
renderDOM: (attrs) => {
|
|
78195
|
+
if (!attrs.size) return {};
|
|
78196
|
+
const sizeData = {};
|
|
78197
|
+
if (attrs.size.width) sizeData["data-width"] = attrs.size.width;
|
|
78198
|
+
if (attrs.size.height) sizeData["data-height"] = attrs.size.height;
|
|
78199
|
+
return sizeData;
|
|
78200
|
+
}
|
|
78201
|
+
},
|
|
78202
|
+
padding: {
|
|
78203
|
+
default: null,
|
|
78204
|
+
renderDOM: (attrs) => {
|
|
78205
|
+
if (!attrs.padding) return {};
|
|
78206
|
+
const paddingData = {};
|
|
78207
|
+
if (attrs.padding.top != null) paddingData["data-padding-top"] = attrs.padding.top;
|
|
78208
|
+
if (attrs.padding.right != null) paddingData["data-padding-right"] = attrs.padding.right;
|
|
78209
|
+
if (attrs.padding.bottom != null) paddingData["data-padding-bottom"] = attrs.padding.bottom;
|
|
78210
|
+
if (attrs.padding.left != null) paddingData["data-padding-left"] = attrs.padding.left;
|
|
78211
|
+
return paddingData;
|
|
78212
|
+
}
|
|
78213
|
+
},
|
|
78214
|
+
marginOffset: {
|
|
78215
|
+
default: null,
|
|
78216
|
+
renderDOM: (attrs) => {
|
|
78217
|
+
if (!attrs.marginOffset) return {};
|
|
78218
|
+
const offsetData = {};
|
|
78219
|
+
if (attrs.marginOffset.horizontal != null) offsetData["data-offset-x"] = attrs.marginOffset.horizontal;
|
|
78220
|
+
if (attrs.marginOffset.top != null) offsetData["data-offset-y"] = attrs.marginOffset.top;
|
|
78221
|
+
return offsetData;
|
|
78222
|
+
}
|
|
78223
|
+
},
|
|
78224
|
+
drawingContent: {
|
|
78225
|
+
rendered: false
|
|
78226
|
+
}
|
|
78227
|
+
};
|
|
78228
|
+
},
|
|
78229
|
+
parseDOM() {
|
|
78230
|
+
return false;
|
|
78231
|
+
},
|
|
78232
|
+
renderDOM({ htmlAttributes }) {
|
|
78233
|
+
return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-shape-group": "" })];
|
|
78234
|
+
},
|
|
78235
|
+
addNodeView() {
|
|
78236
|
+
return (props) => {
|
|
78237
|
+
return new ShapeGroupView({ ...props });
|
|
78238
|
+
};
|
|
78239
|
+
}
|
|
78240
|
+
});
|
|
77850
78241
|
const TextStyle = Mark.create({
|
|
77851
78242
|
name: "textStyle",
|
|
77852
78243
|
addOptions() {
|
|
@@ -84087,6 +84478,7 @@ ${l}
|
|
|
84087
84478
|
}
|
|
84088
84479
|
}
|
|
84089
84480
|
const TextContentCache = /* @__PURE__ */ new WeakMap();
|
|
84481
|
+
const transparentInlineNodes = /* @__PURE__ */ new Set(["run", "bookmarkStart"]);
|
|
84090
84482
|
function textContent(node2) {
|
|
84091
84483
|
let cached = TextContentCache.get(node2);
|
|
84092
84484
|
if (cached) return cached;
|
|
@@ -84095,7 +84487,7 @@ ${l}
|
|
|
84095
84487
|
let child = node2.child(i2);
|
|
84096
84488
|
if (child.isText) content2 += child.text;
|
|
84097
84489
|
else if (child.isLeaf) content2 += "";
|
|
84098
|
-
else if (child.type && child.type.name
|
|
84490
|
+
else if (child.type && transparentInlineNodes.has(child.type.name)) content2 += textContent(child);
|
|
84099
84491
|
else content2 += " " + textContent(child) + " ";
|
|
84100
84492
|
}
|
|
84101
84493
|
TextContentCache.set(node2, content2);
|
|
@@ -84146,7 +84538,6 @@ ${l}
|
|
|
84146
84538
|
}
|
|
84147
84539
|
return start2 + node2.content.size;
|
|
84148
84540
|
}
|
|
84149
|
-
const transparentInlineNodes = /* @__PURE__ */ new Set(["run"]);
|
|
84150
84541
|
function scanTextblocks(node2, from2, to, f2, nodeStart = 0) {
|
|
84151
84542
|
const isTransparentInline = node2.inlineContent && node2.type && transparentInlineNodes.has(node2.type.name);
|
|
84152
84543
|
if (node2.inlineContent && !isTransparentInline) {
|
|
@@ -84744,7 +85135,8 @@ ${l}
|
|
|
84744
85135
|
NodeResizer,
|
|
84745
85136
|
CustomSelection,
|
|
84746
85137
|
TextTransform,
|
|
84747
|
-
VectorShape
|
|
85138
|
+
VectorShape,
|
|
85139
|
+
ShapeGroup
|
|
84748
85140
|
];
|
|
84749
85141
|
};
|
|
84750
85142
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
@@ -117769,7 +118161,7 @@ ${style2}
|
|
|
117769
118161
|
this.config.colors = shuffleArray(this.config.colors);
|
|
117770
118162
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
117771
118163
|
this.colorIndex = 0;
|
|
117772
|
-
this.version = "0.29.0-next.
|
|
118164
|
+
this.version = "0.29.0-next.15";
|
|
117773
118165
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
117774
118166
|
this.superdocId = config2.superdocId || v4();
|
|
117775
118167
|
this.colors = this.config.colors;
|
|
@@ -120169,7 +120561,7 @@ ${style2}
|
|
|
120169
120561
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
120170
120562
|
);
|
|
120171
120563
|
}
|
|
120172
|
-
const
|
|
120564
|
+
const indexX0B8ORNX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
120173
120565
|
__proto__: null,
|
|
120174
120566
|
unified
|
|
120175
120567
|
}, Symbol.toStringTag, { value: "Module" }));
|