@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.
Files changed (44) hide show
  1. package/dist/chunks/{PdfViewer-DOihIaKT.cjs → PdfViewer-B7X4xur3.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BkHpL2td.es.js → PdfViewer-BL9hLN-A.es.js} +1 -1
  3. package/dist/chunks/{index-BG7aufxd.es.js → index-CCTDIDk7.es.js} +3 -3
  4. package/dist/chunks/{index-Bky221GX.cjs → index-CCVmXx2r.cjs} +3 -3
  5. package/dist/chunks/{index-p_HoYQ4L-YNisXWt0.es.js → index-x0B8ORNX--SLHZ7wS.es.js} +1 -1
  6. package/dist/chunks/{index-p_HoYQ4L-BvUq1_h3.cjs → index-x0B8ORNX-D9kjqjf9.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-DA-FFY2A.cjs → super-editor.es-BkV-6f5K.cjs} +404 -12
  8. package/dist/chunks/{super-editor.es-vCpzMs9V.es.js → super-editor.es-LUVoGFZl.es.js} +404 -12
  9. package/dist/style.css +45 -3
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-C0Fd9g-U.js → converter-Bt0gPwYj.js} +149 -7
  12. package/dist/super-editor/chunks/{docx-zipper-BqIh8tzQ.js → docx-zipper-JVCnlDBn.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-Dg538FVw.js → editor-BF7w_sd7.js} +257 -7
  14. package/dist/super-editor/chunks/{index-p_HoYQ4L.js → index-x0B8ORNX.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-Des2y7IP.js → toolbar-CI9lB3KI.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/style.css +45 -3
  21. package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts.map +1 -1
  22. package/dist/super-editor/super-editor/src/core/super-converter/relationship-helpers.d.ts.map +1 -1
  23. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts.map +1 -1
  24. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts +6 -0
  25. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts.map +1 -1
  26. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts.map +1 -1
  27. package/dist/super-editor/super-editor/src/extensions/index.d.ts +2 -1
  28. package/dist/super-editor/super-editor/src/extensions/index.d.ts.map +1 -1
  29. package/dist/super-editor/super-editor/src/extensions/search/prosemirror-search-patched.d.ts.map +1 -1
  30. package/dist/super-editor/super-editor/src/extensions/shape-group/ShapeGroupView.d.ts +22 -0
  31. package/dist/super-editor/super-editor/src/extensions/shape-group/ShapeGroupView.d.ts.map +1 -0
  32. package/dist/super-editor/super-editor/src/extensions/shape-group/index.d.ts +3 -0
  33. package/dist/super-editor/super-editor/src/extensions/shape-group/index.d.ts.map +1 -0
  34. package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts +3 -0
  35. package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts.map +1 -0
  36. package/dist/super-editor/super-editor.es.js +6 -6
  37. package/dist/super-editor/toolbar.es.js +2 -2
  38. package/dist/super-editor.cjs +1 -1
  39. package/dist/super-editor.es.js +1 -1
  40. package/dist/superdoc.cjs +2 -2
  41. package/dist/superdoc.es.js +2 -2
  42. package/dist/superdoc.umd.js +406 -14
  43. package/dist/superdoc.umd.js.map +1 -1
  44. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-BQxRC6G7.cjs");
4
- const superdoc = require("./index-Bky221GX.cjs");
4
+ const superdoc = require("./index-CCVmXx2r.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, y as h, O as Transition, $ as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, v as createVNode, x as unref } from "./vue-D1vcEBAQ.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-BG7aufxd.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CCTDIDk7.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-vCpzMs9V.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-LUVoGFZl.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-D4gv5QOO.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -17201,7 +17201,7 @@ const _sfc_main = {
17201
17201
  __name: "SuperDoc",
17202
17202
  emits: ["selection-update"],
17203
17203
  setup(__props, { emit: __emit }) {
17204
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BkHpL2td.es.js"));
17204
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BL9hLN-A.es.js"));
17205
17205
  const superdocStore = useSuperdocStore();
17206
17206
  const commentsStore = useCommentsStore();
17207
17207
  const {
@@ -17965,7 +17965,7 @@ class SuperDoc extends EventEmitter {
17965
17965
  this.config.colors = shuffleArray(this.config.colors);
17966
17966
  this.userColorMap = /* @__PURE__ */ new Map();
17967
17967
  this.colorIndex = 0;
17968
- this.version = "0.29.0-next.13";
17968
+ this.version = "0.29.0-next.15";
17969
17969
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17970
17970
  this.superdocId = config.superdocId || v4();
17971
17971
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-DA-FFY2A.cjs");
2
+ const superEditor_es = require("./super-editor.es-BkV-6f5K.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-BvTILlBo.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -17218,7 +17218,7 @@ const _sfc_main = {
17218
17218
  __name: "SuperDoc",
17219
17219
  emits: ["selection-update"],
17220
17220
  setup(__props, { emit: __emit }) {
17221
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DOihIaKT.cjs")));
17221
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-B7X4xur3.cjs")));
17222
17222
  const superdocStore = useSuperdocStore();
17223
17223
  const commentsStore = useCommentsStore();
17224
17224
  const {
@@ -17982,7 +17982,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
17982
17982
  this.config.colors = shuffleArray(this.config.colors);
17983
17983
  this.userColorMap = /* @__PURE__ */ new Map();
17984
17984
  this.colorIndex = 0;
17985
- this.version = "0.29.0-next.13";
17985
+ this.version = "0.29.0-next.15";
17986
17986
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17987
17987
  this.superdocId = config.superdocId || uuid.v4();
17988
17988
  this.colors = this.config.colors;
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-vCpzMs9V.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-LUVoGFZl.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-DA-FFY2A.cjs");
3
+ const superEditor_es = require("./super-editor.es-BkV-6f5K.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -28453,6 +28453,7 @@ function extractFillColor(spPr, style2) {
28453
28453
  }
28454
28454
  const DRAWING_XML_TAG = "w:drawing";
28455
28455
  const SHAPE_URI = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
28456
+ const GROUP_URI = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
28456
28457
  function handleImageNode(node, params2, isAnchor) {
28457
28458
  const { docx, filename } = params2;
28458
28459
  const { attributes } = node;
@@ -28570,7 +28571,7 @@ function handleImageNode(node, params2, isAnchor) {
28570
28571
  const graphic = node.elements.find((el) => el.name === "a:graphic");
28571
28572
  const graphicData = graphic?.elements.find((el) => el.name === "a:graphicData");
28572
28573
  const { uri: uri2 } = graphicData?.attributes || {};
28573
- if (!!uri2 && uri2 === SHAPE_URI) {
28574
+ if (uri2 === SHAPE_URI) {
28574
28575
  const shapeMarginOffset = {
28575
28576
  left: positionHValue,
28576
28577
  horizontal: positionHValue,
@@ -28578,6 +28579,14 @@ function handleImageNode(node, params2, isAnchor) {
28578
28579
  };
28579
28580
  return handleShapeDrawing(params2, node, graphicData, size2, padding, shapeMarginOffset);
28580
28581
  }
28582
+ if (uri2 === GROUP_URI) {
28583
+ const shapeMarginOffset = {
28584
+ left: positionHValue,
28585
+ horizontal: positionHValue,
28586
+ top: positionVValue
28587
+ };
28588
+ return handleShapeGroup(params2, node, graphicData, size2, padding, shapeMarginOffset);
28589
+ }
28581
28590
  const picture = graphicData?.elements.find((el) => el.name === "pic:pic");
28582
28591
  if (!picture || !picture.elements) return null;
28583
28592
  const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
@@ -28667,6 +28676,114 @@ const handleShapeDrawing = (params2, node, graphicData, size2, padding, marginOf
28667
28676
  }
28668
28677
  return buildShapePlaceholder(node, size2, padding, marginOffset, "textbox");
28669
28678
  };
28679
+ const handleShapeGroup = (params2, node, graphicData, size2, padding, marginOffset) => {
28680
+ const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
28681
+ if (!wgp) {
28682
+ return buildShapePlaceholder(node, size2, padding, marginOffset, "group");
28683
+ }
28684
+ const grpSpPr = wgp.elements.find((el) => el.name === "wpg:grpSpPr");
28685
+ const xfrm = grpSpPr?.elements?.find((el) => el.name === "a:xfrm");
28686
+ const groupTransform = {};
28687
+ if (xfrm) {
28688
+ const off2 = xfrm.elements?.find((el) => el.name === "a:off");
28689
+ const ext = xfrm.elements?.find((el) => el.name === "a:ext");
28690
+ const chOff = xfrm.elements?.find((el) => el.name === "a:chOff");
28691
+ const chExt = xfrm.elements?.find((el) => el.name === "a:chExt");
28692
+ if (off2) {
28693
+ groupTransform.x = emuToPixels(off2.attributes?.["x"] || 0);
28694
+ groupTransform.y = emuToPixels(off2.attributes?.["y"] || 0);
28695
+ }
28696
+ if (ext) {
28697
+ groupTransform.width = emuToPixels(ext.attributes?.["cx"] || 0);
28698
+ groupTransform.height = emuToPixels(ext.attributes?.["cy"] || 0);
28699
+ }
28700
+ if (chOff) {
28701
+ groupTransform.childX = emuToPixels(chOff.attributes?.["x"] || 0);
28702
+ groupTransform.childY = emuToPixels(chOff.attributes?.["y"] || 0);
28703
+ groupTransform.childOriginXEmu = parseFloat(chOff.attributes?.["x"] || 0);
28704
+ groupTransform.childOriginYEmu = parseFloat(chOff.attributes?.["y"] || 0);
28705
+ }
28706
+ if (chExt) {
28707
+ groupTransform.childWidth = emuToPixels(chExt.attributes?.["cx"] || 0);
28708
+ groupTransform.childHeight = emuToPixels(chExt.attributes?.["cy"] || 0);
28709
+ }
28710
+ }
28711
+ const childShapes = wgp.elements.filter((el) => el.name === "wps:wsp");
28712
+ const shapes = childShapes.map((wsp) => {
28713
+ const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
28714
+ if (!spPr) return null;
28715
+ const prstGeom = spPr.elements?.find((el) => el.name === "a:prstGeom");
28716
+ const shapeKind = prstGeom?.attributes?.["prst"];
28717
+ const shapeXfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
28718
+ const shapeOff = shapeXfrm?.elements?.find((el) => el.name === "a:off");
28719
+ const shapeExt = shapeXfrm?.elements?.find((el) => el.name === "a:ext");
28720
+ const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
28721
+ const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
28722
+ const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
28723
+ const rawHeight = shapeExt?.attributes?.["cy"] ? parseFloat(shapeExt.attributes["cy"]) : 914400;
28724
+ let x2, y2, width, height;
28725
+ if (groupTransform.childWidth && groupTransform.childHeight) {
28726
+ const scaleX = groupTransform.width / groupTransform.childWidth;
28727
+ const scaleY = groupTransform.height / groupTransform.childHeight;
28728
+ const childOriginX = groupTransform.childOriginXEmu || 0;
28729
+ const childOriginY = groupTransform.childOriginYEmu || 0;
28730
+ x2 = groupTransform.x + emuToPixels((rawX - childOriginX) * scaleX);
28731
+ y2 = groupTransform.y + emuToPixels((rawY - childOriginY) * scaleY);
28732
+ width = emuToPixels(rawWidth * scaleX);
28733
+ height = emuToPixels(rawHeight * scaleY);
28734
+ } else {
28735
+ x2 = emuToPixels(rawX);
28736
+ y2 = emuToPixels(rawY);
28737
+ width = emuToPixels(rawWidth);
28738
+ height = emuToPixels(rawHeight);
28739
+ }
28740
+ const rotation = shapeXfrm?.attributes?.["rot"] ? rotToDegrees(shapeXfrm.attributes["rot"]) : 0;
28741
+ const flipH = shapeXfrm?.attributes?.["flipH"] === "1";
28742
+ const flipV = shapeXfrm?.attributes?.["flipV"] === "1";
28743
+ const style2 = wsp.elements?.find((el) => el.name === "wps:style");
28744
+ const fillColor = extractFillColor(spPr, style2);
28745
+ const strokeColor = extractStrokeColor(spPr, style2);
28746
+ const strokeWidth = extractStrokeWidth(spPr);
28747
+ const cNvPr = wsp.elements?.find((el) => el.name === "wps:cNvPr");
28748
+ const shapeId = cNvPr?.attributes?.["id"];
28749
+ const shapeName = cNvPr?.attributes?.["name"];
28750
+ return {
28751
+ shapeType: "vectorShape",
28752
+ attrs: {
28753
+ kind: shapeKind,
28754
+ x: x2,
28755
+ y: y2,
28756
+ width,
28757
+ height,
28758
+ rotation,
28759
+ flipH,
28760
+ flipV,
28761
+ fillColor,
28762
+ strokeColor,
28763
+ strokeWidth,
28764
+ shapeId,
28765
+ shapeName
28766
+ }
28767
+ };
28768
+ }).filter(Boolean);
28769
+ const schemaAttrs = {};
28770
+ const drawingNode = params2.nodes?.[0];
28771
+ if (drawingNode?.name === DRAWING_XML_TAG) {
28772
+ schemaAttrs.drawingContent = drawingNode;
28773
+ }
28774
+ const result = {
28775
+ type: "shapeGroup",
28776
+ attrs: {
28777
+ ...schemaAttrs,
28778
+ groupTransform,
28779
+ shapes,
28780
+ size: size2,
28781
+ padding,
28782
+ marginOffset
28783
+ }
28784
+ };
28785
+ return result;
28786
+ };
28670
28787
  const getRectangleShape = (params2, node) => {
28671
28788
  const schemaAttrs = {};
28672
28789
  const [drawingNode] = params2.nodes;
@@ -29109,6 +29226,30 @@ function translateVectorShape(params2) {
29109
29226
  };
29110
29227
  return wrapTextInRun(alternateContent);
29111
29228
  }
29229
+ function translateShapeGroup(params2) {
29230
+ const { node } = params2;
29231
+ const { drawingContent } = node.attrs;
29232
+ if (drawingContent) {
29233
+ const drawing = {
29234
+ name: "w:drawing",
29235
+ elements: [...drawingContent.elements || []]
29236
+ };
29237
+ const choice = {
29238
+ name: "mc:Choice",
29239
+ attributes: { Requires: "wpg" },
29240
+ elements: [drawing]
29241
+ };
29242
+ const alternateContent = {
29243
+ name: "mc:AlternateContent",
29244
+ elements: [choice]
29245
+ };
29246
+ return wrapTextInRun(alternateContent);
29247
+ }
29248
+ return wrapTextInRun({
29249
+ name: "w:drawing",
29250
+ elements: []
29251
+ });
29252
+ }
29112
29253
  function translateAnchorNode(params2) {
29113
29254
  const { attrs } = params2.node;
29114
29255
  const anchorElements = [];
@@ -29272,11 +29413,11 @@ function translateAnchorNode(params2) {
29272
29413
  };
29273
29414
  }
29274
29415
  const XML_NODE_NAME$f = "wp:anchor";
29275
- const SD_NODE_NAME$c = ["image"];
29416
+ const SD_NODE_NAME$c = ["image", "shapeGroup", "vectorShape", "contentBlock"];
29276
29417
  const validXmlAttributes$a = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
29277
29418
  function encode$l(params2) {
29278
29419
  const { node } = params2.extraParams;
29279
- if (!node || !node.type) {
29420
+ if (!node || !node.name) {
29280
29421
  return null;
29281
29422
  }
29282
29423
  return handleAnchorNode(params2);
@@ -29313,11 +29454,11 @@ function translateInlineNode(params2) {
29313
29454
  };
29314
29455
  }
29315
29456
  const XML_NODE_NAME$e = "wp:inline";
29316
- const SD_NODE_NAME$b = ["image"];
29457
+ const SD_NODE_NAME$b = ["image", "shapeGroup", "vectorShape", "contentBlock"];
29317
29458
  const validXmlAttributes$9 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
29318
29459
  function encode$k(params2) {
29319
29460
  const { node } = params2.extraParams;
29320
- if (!node || !node.type) {
29461
+ if (!node || !node.name) {
29321
29462
  return null;
29322
29463
  }
29323
29464
  return handleInlineNode(params2);
@@ -32738,6 +32879,7 @@ const bookmarkEndNodeHandlerEntity = {
32738
32879
  };
32739
32880
  const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
32740
32881
  "wps",
32882
+ "wpg",
32741
32883
  "wp14",
32742
32884
  "w14",
32743
32885
  "w15",
@@ -34398,6 +34540,7 @@ function exportSchemaToJson(params2) {
34398
34540
  shapeTextbox: translator,
34399
34541
  contentBlock: translator,
34400
34542
  vectorShape: translateVectorShape,
34543
+ shapeGroup: translateShapeGroup,
34401
34544
  structuredContent: translator$r,
34402
34545
  structuredContentBlock: translator$r,
34403
34546
  documentPartObject: translator$r,
@@ -35410,7 +35553,6 @@ const mergeRelationshipElements = (existingRelationships = [], newRelationships
35410
35553
  const currentId = attributes.Id || "";
35411
35554
  attributes.Target = attributes?.Target?.replace(/&/g, "&");
35412
35555
  const existingTarget = existingRelationships.find((el) => el.attributes.Target === attributes.Target);
35413
- attributes.Target?.startsWith("media/");
35414
35556
  const isNewHyperlink = attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && currentId.length > 6;
35415
35557
  const isNewHeadFoot = (attributes.Type === HEADER_RELATIONSHIP_TYPE || attributes.Type === FOOTER_RELATIONSHIP_TYPE) && currentId.length > 6;
35416
35558
  const hasSeenId = currentId && seenIds.has(currentId);
@@ -35639,7 +35781,7 @@ const _SuperConverter = class _SuperConverter2 {
35639
35781
  static getStoredSuperdocVersion(docx) {
35640
35782
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35641
35783
  }
35642
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-next.13") {
35784
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-next.15") {
35643
35785
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35644
35786
  }
35645
35787
  /**
@@ -53828,7 +53970,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53828
53970
  { default: remarkStringify },
53829
53971
  { default: remarkGfm }
53830
53972
  ] = await Promise.all([
53831
- Promise.resolve().then(() => require("./index-p_HoYQ4L-BvUq1_h3.cjs")),
53973
+ Promise.resolve().then(() => require("./index-x0B8ORNX-D9kjqjf9.cjs")),
53832
53974
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
53833
53975
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
53834
53976
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -54046,7 +54188,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
54046
54188
  * @returns {Object | void} Migration results
54047
54189
  */
54048
54190
  processCollaborationMigrations() {
54049
- console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.13");
54191
+ console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.15");
54050
54192
  if (!this.options.ydoc) return;
54051
54193
  const metaMap = this.options.ydoc.getMap("meta");
54052
54194
  let docVersion = metaMap.get("version");
@@ -70105,6 +70247,255 @@ const VectorShape = Node$1.create({
70105
70247
  };
70106
70248
  }
70107
70249
  });
70250
+ class ShapeGroupView {
70251
+ constructor(props) {
70252
+ __publicField$1(this, "node");
70253
+ __publicField$1(this, "view");
70254
+ __publicField$1(this, "getPos");
70255
+ __publicField$1(this, "decorations");
70256
+ __publicField$1(this, "innerDecorations");
70257
+ __publicField$1(this, "editor");
70258
+ __publicField$1(this, "extension");
70259
+ __publicField$1(this, "htmlAttributes");
70260
+ __publicField$1(this, "root");
70261
+ this.node = props.node;
70262
+ this.view = props.editor.view;
70263
+ this.getPos = props.getPos;
70264
+ this.decorations = props.decorations;
70265
+ this.innerDecorations = props.innerDecorations;
70266
+ this.editor = props.editor;
70267
+ this.extension = props.extension;
70268
+ this.htmlAttributes = props.htmlAttributes;
70269
+ this.mount();
70270
+ }
70271
+ mount() {
70272
+ this.buildView();
70273
+ }
70274
+ get dom() {
70275
+ return this.root;
70276
+ }
70277
+ get contentDOM() {
70278
+ return null;
70279
+ }
70280
+ createElement() {
70281
+ const attrs = this.node.attrs;
70282
+ const { groupTransform, shapes, size: size2 } = attrs;
70283
+ const container = document.createElement("div");
70284
+ container.classList.add("sd-shape-group");
70285
+ container.setAttribute("data-shape-group", "");
70286
+ const width = size2?.width || groupTransform?.width || 300;
70287
+ const height = size2?.height || groupTransform?.height || 200;
70288
+ container.style.width = `${width}px`;
70289
+ container.style.height = `${height}px`;
70290
+ container.style.position = "relative";
70291
+ container.style.display = "inline-block";
70292
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
70293
+ svg.setAttribute("version", "1.1");
70294
+ svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
70295
+ svg.setAttribute("width", width.toString());
70296
+ svg.setAttribute("height", height.toString());
70297
+ svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
70298
+ svg.style.display = "block";
70299
+ if (shapes && Array.isArray(shapes)) {
70300
+ shapes.forEach((shape) => {
70301
+ if (shape.shapeType === "vectorShape") {
70302
+ const shapeElement = this.createShapeElement(shape, groupTransform);
70303
+ if (shapeElement) {
70304
+ svg.appendChild(shapeElement);
70305
+ }
70306
+ }
70307
+ });
70308
+ }
70309
+ container.appendChild(svg);
70310
+ return { element: container };
70311
+ }
70312
+ createShapeElement(shape, groupTransform) {
70313
+ const attrs = shape.attrs;
70314
+ if (!attrs) return null;
70315
+ const x2 = attrs.x || 0;
70316
+ const y2 = attrs.y || 0;
70317
+ const width = attrs.width || 100;
70318
+ const height = attrs.height || 100;
70319
+ const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
70320
+ const transforms = [];
70321
+ transforms.push(`translate(${x2}, ${y2})`);
70322
+ if (attrs.rotation !== 0) {
70323
+ transforms.push(`rotate(${attrs.rotation} ${width / 2} ${height / 2})`);
70324
+ }
70325
+ if (attrs.flipH) {
70326
+ transforms.push(`scale(-1, 1) translate(${-width}, 0)`);
70327
+ }
70328
+ if (attrs.flipV) {
70329
+ transforms.push(`scale(1, -1) translate(0, ${-height})`);
70330
+ }
70331
+ if (transforms.length > 0) {
70332
+ g.setAttribute("transform", transforms.join(" "));
70333
+ }
70334
+ const shapeKind = attrs.kind || "rect";
70335
+ const fillColor = attrs.fillColor || "#5b9bd5";
70336
+ const strokeColor = attrs.strokeColor || "#000000";
70337
+ const strokeWidth = attrs.strokeWidth || 1;
70338
+ try {
70339
+ const svgContent = k({
70340
+ preset: shapeKind,
70341
+ styleOverrides: {
70342
+ fill: fillColor || "none",
70343
+ stroke: strokeColor || "none",
70344
+ strokeWidth: strokeWidth || 0
70345
+ },
70346
+ width,
70347
+ height
70348
+ });
70349
+ if (svgContent) {
70350
+ const tempDiv = document.createElement("div");
70351
+ tempDiv.innerHTML = svgContent;
70352
+ const svgElement = tempDiv.querySelector("svg");
70353
+ if (svgElement) {
70354
+ Array.from(svgElement.children).forEach((child) => {
70355
+ const clonedChild = child.cloneNode(true);
70356
+ if (clonedChild.tagName === "ellipse") {
70357
+ clonedChild.setAttribute("cx", (width / 2).toString());
70358
+ clonedChild.setAttribute("cy", (height / 2).toString());
70359
+ clonedChild.setAttribute("rx", (width / 2).toString());
70360
+ clonedChild.setAttribute("ry", (height / 2).toString());
70361
+ } else if (clonedChild.tagName === "circle") {
70362
+ if (width !== height) {
70363
+ const ellipse = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
70364
+ ellipse.setAttribute("cx", (width / 2).toString());
70365
+ ellipse.setAttribute("cy", (height / 2).toString());
70366
+ ellipse.setAttribute("rx", (width / 2).toString());
70367
+ ellipse.setAttribute("ry", (height / 2).toString());
70368
+ Array.from(clonedChild.attributes).forEach((attr) => {
70369
+ if (!["cx", "cy", "r"].includes(attr.name)) {
70370
+ ellipse.setAttribute(attr.name, attr.value);
70371
+ }
70372
+ });
70373
+ g.appendChild(ellipse);
70374
+ return;
70375
+ } else {
70376
+ clonedChild.setAttribute("cx", (width / 2).toString());
70377
+ clonedChild.setAttribute("cy", (height / 2).toString());
70378
+ clonedChild.setAttribute("r", (width / 2).toString());
70379
+ }
70380
+ } else if (clonedChild.tagName === "rect") {
70381
+ clonedChild.setAttribute("width", width.toString());
70382
+ clonedChild.setAttribute("height", height.toString());
70383
+ } else if (clonedChild.tagName === "path" && svgElement.hasAttribute("viewBox")) {
70384
+ const viewBox = svgElement.getAttribute("viewBox").split(" ").map(Number);
70385
+ if (viewBox.length === 4) {
70386
+ const [, , vbWidth, vbHeight] = viewBox;
70387
+ const scaleX = width / vbWidth;
70388
+ const scaleY = height / vbHeight;
70389
+ if (scaleX !== 1 || scaleY !== 1) {
70390
+ const pathTransform = `scale(${scaleX}, ${scaleY})`;
70391
+ const existingTransform = clonedChild.getAttribute("transform");
70392
+ clonedChild.setAttribute(
70393
+ "transform",
70394
+ existingTransform ? `${existingTransform} ${pathTransform}` : pathTransform
70395
+ );
70396
+ }
70397
+ }
70398
+ } else if (clonedChild.hasAttribute("width")) {
70399
+ clonedChild.setAttribute("width", width.toString());
70400
+ }
70401
+ if (clonedChild.hasAttribute("height") && clonedChild.tagName !== "ellipse") {
70402
+ clonedChild.setAttribute("height", height.toString());
70403
+ }
70404
+ g.appendChild(clonedChild);
70405
+ });
70406
+ }
70407
+ }
70408
+ } catch (error) {
70409
+ console.warn("Failed to generate shape SVG:", error);
70410
+ const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
70411
+ rect.setAttribute("width", width.toString());
70412
+ rect.setAttribute("height", height.toString());
70413
+ rect.setAttribute("fill", fillColor);
70414
+ rect.setAttribute("stroke", strokeColor);
70415
+ rect.setAttribute("stroke-width", strokeWidth.toString());
70416
+ g.appendChild(rect);
70417
+ }
70418
+ return g;
70419
+ }
70420
+ buildView() {
70421
+ const { element } = this.createElement();
70422
+ this.root = element;
70423
+ }
70424
+ update() {
70425
+ return false;
70426
+ }
70427
+ }
70428
+ const ShapeGroup = Node$1.create({
70429
+ name: "shapeGroup",
70430
+ group: "inline",
70431
+ inline: true,
70432
+ atom: true,
70433
+ addOptions() {
70434
+ return {
70435
+ htmlAttributes: {
70436
+ contenteditable: false
70437
+ }
70438
+ };
70439
+ },
70440
+ addAttributes() {
70441
+ return {
70442
+ groupTransform: {
70443
+ default: {},
70444
+ renderDOM: () => ({})
70445
+ },
70446
+ shapes: {
70447
+ default: [],
70448
+ renderDOM: () => ({})
70449
+ },
70450
+ size: {
70451
+ default: null,
70452
+ renderDOM: (attrs) => {
70453
+ if (!attrs.size) return {};
70454
+ const sizeData = {};
70455
+ if (attrs.size.width) sizeData["data-width"] = attrs.size.width;
70456
+ if (attrs.size.height) sizeData["data-height"] = attrs.size.height;
70457
+ return sizeData;
70458
+ }
70459
+ },
70460
+ padding: {
70461
+ default: null,
70462
+ renderDOM: (attrs) => {
70463
+ if (!attrs.padding) return {};
70464
+ const paddingData = {};
70465
+ if (attrs.padding.top != null) paddingData["data-padding-top"] = attrs.padding.top;
70466
+ if (attrs.padding.right != null) paddingData["data-padding-right"] = attrs.padding.right;
70467
+ if (attrs.padding.bottom != null) paddingData["data-padding-bottom"] = attrs.padding.bottom;
70468
+ if (attrs.padding.left != null) paddingData["data-padding-left"] = attrs.padding.left;
70469
+ return paddingData;
70470
+ }
70471
+ },
70472
+ marginOffset: {
70473
+ default: null,
70474
+ renderDOM: (attrs) => {
70475
+ if (!attrs.marginOffset) return {};
70476
+ const offsetData = {};
70477
+ if (attrs.marginOffset.horizontal != null) offsetData["data-offset-x"] = attrs.marginOffset.horizontal;
70478
+ if (attrs.marginOffset.top != null) offsetData["data-offset-y"] = attrs.marginOffset.top;
70479
+ return offsetData;
70480
+ }
70481
+ },
70482
+ drawingContent: {
70483
+ rendered: false
70484
+ }
70485
+ };
70486
+ },
70487
+ parseDOM() {
70488
+ return false;
70489
+ },
70490
+ renderDOM({ htmlAttributes }) {
70491
+ return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-shape-group": "" })];
70492
+ },
70493
+ addNodeView() {
70494
+ return (props) => {
70495
+ return new ShapeGroupView({ ...props });
70496
+ };
70497
+ }
70498
+ });
70108
70499
  const TextStyle = Mark2.create({
70109
70500
  name: "textStyle",
70110
70501
  addOptions() {
@@ -76345,6 +76736,7 @@ function validRegExp(source) {
76345
76736
  }
76346
76737
  }
76347
76738
  const TextContentCache = /* @__PURE__ */ new WeakMap();
76739
+ const transparentInlineNodes = /* @__PURE__ */ new Set(["run", "bookmarkStart"]);
76348
76740
  function textContent(node) {
76349
76741
  let cached = TextContentCache.get(node);
76350
76742
  if (cached) return cached;
@@ -76353,7 +76745,7 @@ function textContent(node) {
76353
76745
  let child = node.child(i);
76354
76746
  if (child.isText) content += child.text;
76355
76747
  else if (child.isLeaf) content += "";
76356
- else if (child.type && child.type.name === "run") content += textContent(child);
76748
+ else if (child.type && transparentInlineNodes.has(child.type.name)) content += textContent(child);
76357
76749
  else content += " " + textContent(child) + " ";
76358
76750
  }
76359
76751
  TextContentCache.set(node, content);
@@ -76404,7 +76796,6 @@ function mapIndexWithinNode(node, start2, index2) {
76404
76796
  }
76405
76797
  return start2 + node.content.size;
76406
76798
  }
76407
- const transparentInlineNodes = /* @__PURE__ */ new Set(["run"]);
76408
76799
  function scanTextblocks(node, from2, to, f2, nodeStart = 0) {
76409
76800
  const isTransparentInline = node.inlineContent && node.type && transparentInlineNodes.has(node.type.name);
76410
76801
  if (node.inlineContent && !isTransparentInline) {
@@ -77002,7 +77393,8 @@ const getStarterExtensions = () => {
77002
77393
  NodeResizer,
77003
77394
  CustomSelection,
77004
77395
  TextTransform,
77005
- VectorShape
77396
+ VectorShape,
77397
+ ShapeGroup
77006
77398
  ];
77007
77399
  };
77008
77400
  const sanitizeNumber = (value, defaultNumber) => {