@harbour-enterprises/superdoc 1.0.0-next.6 → 1.0.0-next.8

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-BYeEi4Kx.es.js → PdfViewer-BpJTAUeT.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CF4W_li8.cjs → PdfViewer-DVL0SRPs.cjs} +1 -1
  3. package/dist/chunks/{index-BcHbK1Ip.cjs → index-D-MAmimV.cjs} +3 -3
  4. package/dist/chunks/{index-CKb2zoi7-BEMsbmpK.cjs → index-DQd4iefd-BfbLCMZZ.cjs} +1 -1
  5. package/dist/chunks/{index-CKb2zoi7-aboErZCf.es.js → index-DQd4iefd-qCZ-Mcie.es.js} +1 -1
  6. package/dist/chunks/{index-CocFivpQ.es.js → index-WYp7dt-q.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-C7JZxENm.es.js → super-editor.es-BDJ97wfW.es.js} +363 -264
  8. package/dist/chunks/{super-editor.es-TXxmZOAu.cjs → super-editor.es-DzMe-1gi.cjs} +363 -264
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CyZvCMe8.js → converter-BH40Zd-y.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DPV5rnMJ.js → docx-zipper-DP41TnQj.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-uiCiCr8n.js → editor-C81JiIaN.js} +330 -252
  13. package/dist/super-editor/chunks/{index-CKb2zoi7.js → index-DQd4iefd.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-Icc3CdW0.js → toolbar-BmUYOo96.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +40 -19
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +365 -266
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -42428,7 +42428,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42428
42428
  static getStoredSuperdocVersion(docx) {
42429
42429
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42430
42430
  }
42431
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.6") {
42431
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.8") {
42432
42432
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42433
42433
  }
42434
42434
  /**
@@ -62683,9 +62683,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62683
62683
  const { from: from2, to, empty: empty2 } = state2.selection;
62684
62684
  if (typeof document !== "undefined" && document.getSelection) {
62685
62685
  const currentDomSelection = document.getSelection();
62686
- const selectedLength = currentDomSelection?.toString?.().length;
62687
- const isCollapsed = currentDomSelection?.isCollapsed;
62688
- if (!isCollapsed && selectedLength === 1) {
62686
+ if (currentDomSelection?.baseNode?.data?.length === 1) {
62689
62687
  return false;
62690
62688
  }
62691
62689
  }
@@ -67513,7 +67511,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67513
67511
  const shouldSkipNodeView = (editor) => {
67514
67512
  return isHeadless(editor);
67515
67513
  };
67516
- const summaryVersion = "1.0.0-next.6";
67514
+ const summaryVersion = "1.0.0-next.8";
67517
67515
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67518
67516
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67519
67517
  function mapAttributes(attrs) {
@@ -68302,7 +68300,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68302
68300
  { default: remarkStringify2 },
68303
68301
  { default: remarkGfm2 }
68304
68302
  ] = await Promise.all([
68305
- Promise.resolve().then(() => indexCKb2zoi7),
68303
+ Promise.resolve().then(() => indexDQd4iefd),
68306
68304
  Promise.resolve().then(() => indexDRCvimau),
68307
68305
  Promise.resolve().then(() => indexC_x_N6Uh),
68308
68306
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68507,7 +68505,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68507
68505
  * Process collaboration migrations
68508
68506
  */
68509
68507
  processCollaborationMigrations() {
68510
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.6");
68508
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.8");
68511
68509
  if (!this.options.ydoc) return;
68512
68510
  const metaMap = this.options.ydoc.getMap("meta");
68513
68511
  let docVersion = metaMap.get("version");
@@ -75869,6 +75867,271 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75869
75867
  }
75870
75868
  }
75871
75869
  }
75870
+ const WRAP_TYPES$1 = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
75871
+ const WRAP_TEXT_VALUES$1 = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
75872
+ const H_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["column", "page", "margin"]);
75873
+ const V_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
75874
+ const H_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["left", "center", "right"]);
75875
+ const V_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
75876
+ const getAttrs$1 = (node2) => {
75877
+ return isPlainObject$2$1(node2.attrs) ? node2.attrs : {};
75878
+ };
75879
+ const normalizeWrapType$1 = (value) => {
75880
+ if (typeof value !== "string") return void 0;
75881
+ return WRAP_TYPES$1.has(value) ? value : void 0;
75882
+ };
75883
+ const normalizeWrapText$1 = (value) => {
75884
+ if (typeof value !== "string") return void 0;
75885
+ return WRAP_TEXT_VALUES$1.has(value) ? value : void 0;
75886
+ };
75887
+ const normalizePolygon$1 = (value) => {
75888
+ if (!Array.isArray(value)) return void 0;
75889
+ const polygon = [];
75890
+ value.forEach((point2) => {
75891
+ if (!Array.isArray(point2) || point2.length < 2) return;
75892
+ const x2 = pickNumber(point2[0]);
75893
+ const y2 = pickNumber(point2[1]);
75894
+ if (x2 == null || y2 == null) return;
75895
+ polygon.push([x2, y2]);
75896
+ });
75897
+ return polygon.length > 0 ? polygon : void 0;
75898
+ };
75899
+ const normalizeWrap$2 = (value) => {
75900
+ if (!isPlainObject$2$1(value)) {
75901
+ return void 0;
75902
+ }
75903
+ const type2 = normalizeWrapType$1(value.type);
75904
+ if (!type2 || type2 === "Inline") {
75905
+ return void 0;
75906
+ }
75907
+ const wrap2 = { type: type2 };
75908
+ const attrs = isPlainObject$2$1(value.attrs) ? value.attrs : {};
75909
+ const wrapText = normalizeWrapText$1(attrs.wrapText);
75910
+ if (wrapText) {
75911
+ wrap2.wrapText = wrapText;
75912
+ }
75913
+ const distTop = pickNumber(attrs.distTop ?? attrs.distT);
75914
+ if (distTop != null) wrap2.distTop = distTop;
75915
+ const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
75916
+ if (distBottom != null) wrap2.distBottom = distBottom;
75917
+ const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
75918
+ if (distLeft != null) wrap2.distLeft = distLeft;
75919
+ const distRight = pickNumber(attrs.distRight ?? attrs.distR);
75920
+ if (distRight != null) wrap2.distRight = distRight;
75921
+ const polygon = normalizePolygon$1(attrs.polygon);
75922
+ if (polygon) {
75923
+ wrap2.polygon = polygon;
75924
+ }
75925
+ const behindDoc = toBoolean$3(attrs.behindDoc);
75926
+ if (behindDoc != null) {
75927
+ wrap2.behindDoc = behindDoc;
75928
+ }
75929
+ return wrap2;
75930
+ };
75931
+ const normalizeAnchorRelative$1 = (value, allowed) => {
75932
+ if (typeof value !== "string") return void 0;
75933
+ return allowed.has(value) ? value : void 0;
75934
+ };
75935
+ const normalizeAnchorAlign$1 = (value, allowed) => {
75936
+ if (typeof value !== "string") return void 0;
75937
+ return allowed.has(value) ? value : void 0;
75938
+ };
75939
+ const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
75940
+ const raw = isPlainObject$2$1(value) ? value : void 0;
75941
+ const marginOffset = isPlainObject$2$1(attrs.marginOffset) ? attrs.marginOffset : void 0;
75942
+ const simplePos = isPlainObject$2$1(attrs.simplePos) ? attrs.simplePos : void 0;
75943
+ const originalAttrs = isPlainObject$2$1(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
75944
+ const isAnchored = attrs.isAnchor === true || Boolean(raw);
75945
+ const anchor = {};
75946
+ if (isAnchored) {
75947
+ anchor.isAnchored = true;
75948
+ }
75949
+ const hRelative = normalizeAnchorRelative$1(raw?.hRelativeFrom, H_RELATIVE_VALUES$1);
75950
+ if (hRelative) anchor.hRelativeFrom = hRelative;
75951
+ const vRelative = normalizeAnchorRelative$1(raw?.vRelativeFrom, V_RELATIVE_VALUES$1);
75952
+ if (vRelative) anchor.vRelativeFrom = vRelative;
75953
+ const alignH = normalizeAnchorAlign$1(raw?.alignH, H_ALIGN_VALUES$1);
75954
+ if (alignH) anchor.alignH = alignH;
75955
+ const alignV = normalizeAnchorAlign$1(raw?.alignV, V_ALIGN_VALUES$1);
75956
+ if (alignV) anchor.alignV = alignV;
75957
+ const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
75958
+ if (offsetH != null) anchor.offsetH = offsetH;
75959
+ const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
75960
+ if (offsetV != null) anchor.offsetV = offsetV;
75961
+ const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
75962
+ if (behindDoc != null) anchor.behindDoc = behindDoc;
75963
+ const hasData = anchor.isAnchored || anchor.hRelativeFrom != null || anchor.vRelativeFrom != null || anchor.alignH != null || anchor.alignV != null || anchor.offsetH != null || anchor.offsetV != null || anchor.behindDoc != null;
75964
+ return hasData ? anchor : void 0;
75965
+ };
75966
+ const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node2, geometry, drawingKind, extraProps) => {
75967
+ const normalizedWrap = normalizeWrap$2(rawAttrs.wrap);
75968
+ const baseAnchor = normalizeAnchorData$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
75969
+ const pos = positions.get(node2);
75970
+ const attrsWithPm = { ...rawAttrs };
75971
+ if (pos) {
75972
+ attrsWithPm.pmStart = pos.start;
75973
+ attrsWithPm.pmEnd = pos.end;
75974
+ }
75975
+ const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
75976
+ const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
75977
+ return {
75978
+ kind: "drawing",
75979
+ id: nextBlockId("drawing"),
75980
+ drawingKind,
75981
+ padding: toBoxSpacing$1(rawAttrs.padding),
75982
+ margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
75983
+ anchor: baseAnchor,
75984
+ wrap: normalizedWrap,
75985
+ zIndex: finalZIndex,
75986
+ drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
75987
+ drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
75988
+ attrs: attrsWithPm,
75989
+ geometry,
75990
+ shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
75991
+ fillColor: normalizeFillColor(rawAttrs.fillColor),
75992
+ strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
75993
+ strokeWidth: coerceNumber(rawAttrs.strokeWidth),
75994
+ textContent: normalizeTextContent(rawAttrs.textContent),
75995
+ textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
75996
+ textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
75997
+ textInsets: normalizeTextInsets(rawAttrs.textInsets),
75998
+ ...extraProps
75999
+ };
76000
+ };
76001
+ function vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions) {
76002
+ const rawAttrs = getAttrs$1(node2);
76003
+ const geometry = {
76004
+ width: coercePositiveNumber(rawAttrs.width, 1),
76005
+ height: coercePositiveNumber(rawAttrs.height, 1),
76006
+ rotation: coerceNumber(rawAttrs.rotation) ?? 0,
76007
+ flipH: coerceBoolean(rawAttrs.flipH) ?? false,
76008
+ flipV: coerceBoolean(rawAttrs.flipV) ?? false
76009
+ };
76010
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
76011
+ }
76012
+ function shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions) {
76013
+ const rawAttrs = getAttrs$1(node2);
76014
+ const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
76015
+ const size2 = normalizeShapeSize(rawAttrs.size);
76016
+ const width = size2?.width ?? groupTransform?.width ?? 1;
76017
+ const height = size2?.height ?? groupTransform?.height ?? 1;
76018
+ const geometry = {
76019
+ width: coercePositiveNumber(width, 1),
76020
+ height: coercePositiveNumber(height, 1),
76021
+ rotation: coerceNumber(rawAttrs.rotation) ?? 0,
76022
+ flipH: coerceBoolean(rawAttrs.flipH) ?? false,
76023
+ flipV: coerceBoolean(rawAttrs.flipV) ?? false
76024
+ };
76025
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "shapeGroup", {
76026
+ groupTransform,
76027
+ shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
76028
+ size: size2
76029
+ });
76030
+ }
76031
+ function shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions) {
76032
+ const rawAttrs = getAttrs$1(node2);
76033
+ const geometry = {
76034
+ width: coercePositiveNumber(rawAttrs.width, 1),
76035
+ height: coercePositiveNumber(rawAttrs.height, 1),
76036
+ rotation: coerceNumber(rawAttrs.rotation) ?? 0,
76037
+ flipH: coerceBoolean(rawAttrs.flipH) ?? false,
76038
+ flipV: coerceBoolean(rawAttrs.flipV) ?? false
76039
+ };
76040
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
76041
+ }
76042
+ function shapeTextboxNodeToDrawingBlock(node2, nextBlockId, positions) {
76043
+ const rawAttrs = getAttrs$1(node2);
76044
+ const geometry = {
76045
+ width: coercePositiveNumber(rawAttrs.width, 1),
76046
+ height: coercePositiveNumber(rawAttrs.height, 1),
76047
+ rotation: coerceNumber(rawAttrs.rotation) ?? 0,
76048
+ flipH: coerceBoolean(rawAttrs.flipH) ?? false,
76049
+ flipV: coerceBoolean(rawAttrs.flipV) ?? false
76050
+ };
76051
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
76052
+ }
76053
+ function handleVectorShapeNode(node2, context) {
76054
+ const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
76055
+ const drawingBlock = vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions);
76056
+ if (drawingBlock) {
76057
+ blocks2.push(drawingBlock);
76058
+ recordBlockKind(drawingBlock.kind);
76059
+ }
76060
+ }
76061
+ function handleShapeGroupNode(node2, context) {
76062
+ const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
76063
+ const drawingBlock = shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions);
76064
+ if (drawingBlock) {
76065
+ blocks2.push(drawingBlock);
76066
+ recordBlockKind(drawingBlock.kind);
76067
+ }
76068
+ }
76069
+ function handleShapeContainerNode(node2, context) {
76070
+ const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
76071
+ const drawingBlock = shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions);
76072
+ if (drawingBlock) {
76073
+ blocks2.push(drawingBlock);
76074
+ recordBlockKind(drawingBlock.kind);
76075
+ }
76076
+ }
76077
+ function handleShapeTextboxNode(node2, context) {
76078
+ const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
76079
+ const drawingBlock = shapeTextboxNodeToDrawingBlock(node2, nextBlockId, positions);
76080
+ if (drawingBlock) {
76081
+ blocks2.push(drawingBlock);
76082
+ recordBlockKind(drawingBlock.kind);
76083
+ }
76084
+ }
76085
+ const getAttrs = (node2) => {
76086
+ return isPlainObject$2$1(node2.attrs) ? { ...node2.attrs } : {};
76087
+ };
76088
+ const parseFullWidth = (value) => {
76089
+ if (typeof value === "string") {
76090
+ const trimmed = value.trim();
76091
+ if (trimmed.endsWith("%")) {
76092
+ return { width: trimmed === "100%" ? 1 : null, isFullWidth: trimmed === "100%" };
76093
+ }
76094
+ return { width: pickNumber(trimmed) ?? null, isFullWidth: false };
76095
+ }
76096
+ return { width: pickNumber(value) ?? null, isFullWidth: false };
76097
+ };
76098
+ function contentBlockNodeToDrawingBlock(node2, nextBlockId, positions) {
76099
+ const rawAttrs = getAttrs(node2);
76100
+ const indentLeft = pickNumber(rawAttrs.hrIndentLeft);
76101
+ const indentRight = pickNumber(rawAttrs.hrIndentRight);
76102
+ if (rawAttrs.horizontalRule !== true) {
76103
+ return null;
76104
+ }
76105
+ const size2 = isPlainObject$2$1(rawAttrs.size) ? rawAttrs.size : void 0;
76106
+ const { width, isFullWidth } = parseFullWidth(size2?.width);
76107
+ const height = pickNumber(size2?.height);
76108
+ if (!height || height <= 0) {
76109
+ return null;
76110
+ }
76111
+ if (!isFullWidth && (!width || width <= 0)) {
76112
+ return null;
76113
+ }
76114
+ if (isFullWidth) {
76115
+ rawAttrs.isFullWidth = true;
76116
+ }
76117
+ if (indentLeft != null || indentRight != null) {
76118
+ rawAttrs.hrIndentLeft = indentLeft;
76119
+ rawAttrs.hrIndentRight = indentRight;
76120
+ }
76121
+ if (typeof rawAttrs.background === "string" && rawAttrs.background.trim()) {
76122
+ rawAttrs.fillColor = rawAttrs.background;
76123
+ }
76124
+ const geometry = {
76125
+ width: isFullWidth ? 1 : width ?? 1,
76126
+ height,
76127
+ rotation: 0,
76128
+ flipH: false,
76129
+ flipV: false
76130
+ };
76131
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape", {
76132
+ strokeColor: null
76133
+ });
76134
+ }
75872
76135
  const extractValue = (value) => {
75873
76136
  if (value && typeof value === "object" && "value" in value) {
75874
76137
  return value.value;
@@ -76592,6 +76855,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76592
76855
  }
76593
76856
  return;
76594
76857
  }
76858
+ if (node2.type === "contentBlock") {
76859
+ const attrs = node2.attrs ?? {};
76860
+ if (attrs.horizontalRule === true) {
76861
+ flushParagraph();
76862
+ const indent2 = paragraphAttrs?.indent;
76863
+ const hrIndentLeft = typeof indent2?.left === "number" ? indent2.left : void 0;
76864
+ const hrIndentRight = typeof indent2?.right === "number" ? indent2.right : void 0;
76865
+ const hasIndent = typeof hrIndentLeft === "number" && hrIndentLeft !== 0 || typeof hrIndentRight === "number" && hrIndentRight !== 0;
76866
+ const hrNode = hasIndent ? { ...node2, attrs: { ...attrs, hrIndentLeft, hrIndentRight } } : node2;
76867
+ const convert2 = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
76868
+ const drawingBlock = convert2(hrNode, nextBlockId, positions);
76869
+ if (drawingBlock) {
76870
+ blocks2.push(drawingBlock);
76871
+ }
76872
+ }
76873
+ return;
76874
+ }
76595
76875
  if (node2.type === "vectorShape") {
76596
76876
  flushParagraph();
76597
76877
  if (converters?.vectorShapeNodeToDrawingBlock) {
@@ -76804,12 +77084,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76804
77084
  });
76805
77085
  sectionState.currentParagraphIndex++;
76806
77086
  }
76807
- const WRAP_TYPES$1 = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
76808
- const WRAP_TEXT_VALUES$1 = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
76809
- const H_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["column", "page", "margin"]);
76810
- const V_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
76811
- const H_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["left", "center", "right"]);
76812
- const V_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
77087
+ const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
77088
+ const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
77089
+ const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
77090
+ const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
77091
+ const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
77092
+ const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
76813
77093
  const isPlainObject$4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
76814
77094
  const isAllowedObjectFit = (value) => {
76815
77095
  return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
@@ -76827,15 +77107,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76827
77107
  });
76828
77108
  return Object.keys(result).length > 0 ? result : void 0;
76829
77109
  }
76830
- const normalizeWrapType$1 = (value) => {
77110
+ const normalizeWrapType = (value) => {
76831
77111
  if (typeof value !== "string") return void 0;
76832
- return WRAP_TYPES$1.has(value) ? value : void 0;
77112
+ return WRAP_TYPES.has(value) ? value : void 0;
76833
77113
  };
76834
- const normalizeWrapText$1 = (value) => {
77114
+ const normalizeWrapText = (value) => {
76835
77115
  if (typeof value !== "string") return void 0;
76836
- return WRAP_TEXT_VALUES$1.has(value) ? value : void 0;
77116
+ return WRAP_TEXT_VALUES.has(value) ? value : void 0;
76837
77117
  };
76838
- const normalizePolygon$1 = (value) => {
77118
+ const normalizePolygon = (value) => {
76839
77119
  if (!Array.isArray(value)) return void 0;
76840
77120
  const polygon = [];
76841
77121
  value.forEach((point2) => {
@@ -76861,17 +77141,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76861
77141
  }
76862
77142
  return void 0;
76863
77143
  };
76864
- const normalizeWrap$2 = (value) => {
77144
+ const normalizeWrap$1 = (value) => {
76865
77145
  if (!isPlainObject$4(value)) {
76866
77146
  return void 0;
76867
77147
  }
76868
- const type2 = normalizeWrapType$1(value.type);
77148
+ const type2 = normalizeWrapType(value.type);
76869
77149
  if (!type2) {
76870
77150
  return void 0;
76871
77151
  }
76872
77152
  const wrap2 = { type: type2 };
76873
77153
  const attrs = isPlainObject$4(value.attrs) ? value.attrs : {};
76874
- const wrapText = normalizeWrapText$1(attrs.wrapText);
77154
+ const wrapText = normalizeWrapText(attrs.wrapText);
76875
77155
  if (wrapText) {
76876
77156
  wrap2.wrapText = wrapText;
76877
77157
  }
@@ -76883,7 +77163,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76883
77163
  if (distLeft != null) wrap2.distLeft = distLeft;
76884
77164
  const distRight = pickNumber(attrs.distRight ?? attrs.distR);
76885
77165
  if (distRight != null) wrap2.distRight = distRight;
76886
- const polygon = normalizePolygon$1(attrs.polygon);
77166
+ const polygon = normalizePolygon(attrs.polygon);
76887
77167
  if (polygon) {
76888
77168
  wrap2.polygon = polygon;
76889
77169
  }
@@ -76893,15 +77173,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76893
77173
  }
76894
77174
  return wrap2;
76895
77175
  };
76896
- const normalizeAnchorRelative$1 = (value, allowed) => {
77176
+ const normalizeAnchorRelative = (value, allowed) => {
76897
77177
  if (typeof value !== "string") return void 0;
76898
77178
  return allowed.has(value) ? value : void 0;
76899
77179
  };
76900
- const normalizeAnchorAlign$1 = (value, allowed) => {
77180
+ const normalizeAnchorAlign = (value, allowed) => {
76901
77181
  if (typeof value !== "string") return void 0;
76902
77182
  return allowed.has(value) ? value : void 0;
76903
77183
  };
76904
- const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
77184
+ const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
76905
77185
  const raw = isPlainObject$4(value) ? value : void 0;
76906
77186
  const marginOffset = isPlainObject$4(attrs.marginOffset) ? attrs.marginOffset : void 0;
76907
77187
  const simplePos = isPlainObject$4(attrs.simplePos) ? attrs.simplePos : void 0;
@@ -76911,13 +77191,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76911
77191
  if (isAnchored) {
76912
77192
  anchor.isAnchored = true;
76913
77193
  }
76914
- const hRelative = normalizeAnchorRelative$1(raw?.hRelativeFrom, H_RELATIVE_VALUES$1);
77194
+ const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
76915
77195
  if (hRelative) anchor.hRelativeFrom = hRelative;
76916
- const vRelative = normalizeAnchorRelative$1(raw?.vRelativeFrom, V_RELATIVE_VALUES$1);
77196
+ const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
76917
77197
  if (vRelative) anchor.vRelativeFrom = vRelative;
76918
- const alignH = normalizeAnchorAlign$1(raw?.alignH, H_ALIGN_VALUES$1);
77198
+ const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
76919
77199
  if (alignH) anchor.alignH = alignH;
76920
- const alignV = normalizeAnchorAlign$1(raw?.alignV, V_ALIGN_VALUES$1);
77200
+ const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
76921
77201
  if (alignV) anchor.alignV = alignV;
76922
77202
  const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
76923
77203
  if (offsetH != null) anchor.offsetH = offsetH;
@@ -76943,8 +77223,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76943
77223
  const width = typeof size2.width === "number" && Number.isFinite(size2.width) ? size2.width : void 0;
76944
77224
  const height = typeof size2.height === "number" && Number.isFinite(size2.height) ? size2.height : void 0;
76945
77225
  const explicitDisplay = typeof attrs.display === "string" ? attrs.display : void 0;
76946
- const normalizedWrap = normalizeWrap$2(attrs.wrap);
76947
- let anchor = normalizeAnchorData$1(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
77226
+ const normalizedWrap = normalizeWrap$1(attrs.wrap);
77227
+ let anchor = normalizeAnchorData(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
76948
77228
  if (!anchor && normalizedWrap) {
76949
77229
  anchor = { isAnchored: true };
76950
77230
  if (normalizedWrap.behindDoc != null) {
@@ -76986,221 +77266,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76986
77266
  recordBlockKind(imageBlock.kind);
76987
77267
  }
76988
77268
  }
76989
- const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
76990
- const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
76991
- const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
76992
- const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
76993
- const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
76994
- const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
76995
- const getAttrs = (node2) => {
76996
- return isPlainObject$2$1(node2.attrs) ? node2.attrs : {};
76997
- };
76998
- const normalizeWrapType = (value) => {
76999
- if (typeof value !== "string") return void 0;
77000
- return WRAP_TYPES.has(value) ? value : void 0;
77001
- };
77002
- const normalizeWrapText = (value) => {
77003
- if (typeof value !== "string") return void 0;
77004
- return WRAP_TEXT_VALUES.has(value) ? value : void 0;
77005
- };
77006
- const normalizePolygon = (value) => {
77007
- if (!Array.isArray(value)) return void 0;
77008
- const polygon = [];
77009
- value.forEach((point2) => {
77010
- if (!Array.isArray(point2) || point2.length < 2) return;
77011
- const x2 = pickNumber(point2[0]);
77012
- const y2 = pickNumber(point2[1]);
77013
- if (x2 == null || y2 == null) return;
77014
- polygon.push([x2, y2]);
77015
- });
77016
- return polygon.length > 0 ? polygon : void 0;
77017
- };
77018
- const normalizeWrap$1 = (value) => {
77019
- if (!isPlainObject$2$1(value)) {
77020
- return void 0;
77021
- }
77022
- const type2 = normalizeWrapType(value.type);
77023
- if (!type2 || type2 === "Inline") {
77024
- return void 0;
77025
- }
77026
- const wrap2 = { type: type2 };
77027
- const attrs = isPlainObject$2$1(value.attrs) ? value.attrs : {};
77028
- const wrapText = normalizeWrapText(attrs.wrapText);
77029
- if (wrapText) {
77030
- wrap2.wrapText = wrapText;
77031
- }
77032
- const distTop = pickNumber(attrs.distTop ?? attrs.distT);
77033
- if (distTop != null) wrap2.distTop = distTop;
77034
- const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
77035
- if (distBottom != null) wrap2.distBottom = distBottom;
77036
- const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
77037
- if (distLeft != null) wrap2.distLeft = distLeft;
77038
- const distRight = pickNumber(attrs.distRight ?? attrs.distR);
77039
- if (distRight != null) wrap2.distRight = distRight;
77040
- const polygon = normalizePolygon(attrs.polygon);
77041
- if (polygon) {
77042
- wrap2.polygon = polygon;
77043
- }
77044
- const behindDoc = toBoolean$3(attrs.behindDoc);
77045
- if (behindDoc != null) {
77046
- wrap2.behindDoc = behindDoc;
77047
- }
77048
- return wrap2;
77049
- };
77050
- const normalizeAnchorRelative = (value, allowed) => {
77051
- if (typeof value !== "string") return void 0;
77052
- return allowed.has(value) ? value : void 0;
77053
- };
77054
- const normalizeAnchorAlign = (value, allowed) => {
77055
- if (typeof value !== "string") return void 0;
77056
- return allowed.has(value) ? value : void 0;
77057
- };
77058
- const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
77059
- const raw = isPlainObject$2$1(value) ? value : void 0;
77060
- const marginOffset = isPlainObject$2$1(attrs.marginOffset) ? attrs.marginOffset : void 0;
77061
- const simplePos = isPlainObject$2$1(attrs.simplePos) ? attrs.simplePos : void 0;
77062
- const originalAttrs = isPlainObject$2$1(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
77063
- const isAnchored = attrs.isAnchor === true || Boolean(raw);
77064
- const anchor = {};
77065
- if (isAnchored) {
77066
- anchor.isAnchored = true;
77067
- }
77068
- const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
77069
- if (hRelative) anchor.hRelativeFrom = hRelative;
77070
- const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
77071
- if (vRelative) anchor.vRelativeFrom = vRelative;
77072
- const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
77073
- if (alignH) anchor.alignH = alignH;
77074
- const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
77075
- if (alignV) anchor.alignV = alignV;
77076
- const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
77077
- if (offsetH != null) anchor.offsetH = offsetH;
77078
- const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
77079
- if (offsetV != null) anchor.offsetV = offsetV;
77080
- const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
77081
- if (behindDoc != null) anchor.behindDoc = behindDoc;
77082
- const hasData = anchor.isAnchored || anchor.hRelativeFrom != null || anchor.vRelativeFrom != null || anchor.alignH != null || anchor.alignV != null || anchor.offsetH != null || anchor.offsetV != null || anchor.behindDoc != null;
77083
- return hasData ? anchor : void 0;
77084
- };
77085
- const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node2, geometry, drawingKind, extraProps) => {
77086
- const normalizedWrap = normalizeWrap$1(rawAttrs.wrap);
77087
- const baseAnchor = normalizeAnchorData(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
77088
- const pos = positions.get(node2);
77089
- const attrsWithPm = { ...rawAttrs };
77090
- if (pos) {
77091
- attrsWithPm.pmStart = pos.start;
77092
- attrsWithPm.pmEnd = pos.end;
77093
- }
77094
- const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
77095
- const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
77096
- return {
77097
- kind: "drawing",
77098
- id: nextBlockId("drawing"),
77099
- drawingKind,
77100
- padding: toBoxSpacing$1(rawAttrs.padding),
77101
- margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
77102
- anchor: baseAnchor,
77103
- wrap: normalizedWrap,
77104
- zIndex: finalZIndex,
77105
- drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
77106
- drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
77107
- attrs: attrsWithPm,
77108
- geometry,
77109
- shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
77110
- fillColor: normalizeFillColor(rawAttrs.fillColor),
77111
- strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
77112
- strokeWidth: coerceNumber(rawAttrs.strokeWidth),
77113
- textContent: normalizeTextContent(rawAttrs.textContent),
77114
- textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
77115
- textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
77116
- textInsets: normalizeTextInsets(rawAttrs.textInsets),
77117
- ...extraProps
77118
- };
77119
- };
77120
- function vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions) {
77121
- const rawAttrs = getAttrs(node2);
77122
- const geometry = {
77123
- width: coercePositiveNumber(rawAttrs.width, 1),
77124
- height: coercePositiveNumber(rawAttrs.height, 1),
77125
- rotation: coerceNumber(rawAttrs.rotation) ?? 0,
77126
- flipH: coerceBoolean(rawAttrs.flipH) ?? false,
77127
- flipV: coerceBoolean(rawAttrs.flipV) ?? false
77128
- };
77129
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
77130
- }
77131
- function shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions) {
77132
- const rawAttrs = getAttrs(node2);
77133
- const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
77134
- const size2 = normalizeShapeSize(rawAttrs.size);
77135
- const width = size2?.width ?? groupTransform?.width ?? 1;
77136
- const height = size2?.height ?? groupTransform?.height ?? 1;
77137
- const geometry = {
77138
- width: coercePositiveNumber(width, 1),
77139
- height: coercePositiveNumber(height, 1),
77140
- rotation: coerceNumber(rawAttrs.rotation) ?? 0,
77141
- flipH: coerceBoolean(rawAttrs.flipH) ?? false,
77142
- flipV: coerceBoolean(rawAttrs.flipV) ?? false
77143
- };
77144
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "shapeGroup", {
77145
- groupTransform,
77146
- shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
77147
- size: size2
77148
- });
77149
- }
77150
- function shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions) {
77151
- const rawAttrs = getAttrs(node2);
77152
- const geometry = {
77153
- width: coercePositiveNumber(rawAttrs.width, 1),
77154
- height: coercePositiveNumber(rawAttrs.height, 1),
77155
- rotation: coerceNumber(rawAttrs.rotation) ?? 0,
77156
- flipH: coerceBoolean(rawAttrs.flipH) ?? false,
77157
- flipV: coerceBoolean(rawAttrs.flipV) ?? false
77158
- };
77159
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
77160
- }
77161
- function shapeTextboxNodeToDrawingBlock(node2, nextBlockId, positions) {
77162
- const rawAttrs = getAttrs(node2);
77163
- const geometry = {
77164
- width: coercePositiveNumber(rawAttrs.width, 1),
77165
- height: coercePositiveNumber(rawAttrs.height, 1),
77166
- rotation: coerceNumber(rawAttrs.rotation) ?? 0,
77167
- flipH: coerceBoolean(rawAttrs.flipH) ?? false,
77168
- flipV: coerceBoolean(rawAttrs.flipV) ?? false
77169
- };
77170
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
77171
- }
77172
- function handleVectorShapeNode(node2, context) {
77173
- const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
77174
- const drawingBlock = vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions);
77175
- if (drawingBlock) {
77176
- blocks2.push(drawingBlock);
77177
- recordBlockKind(drawingBlock.kind);
77178
- }
77179
- }
77180
- function handleShapeGroupNode(node2, context) {
77181
- const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
77182
- const drawingBlock = shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions);
77183
- if (drawingBlock) {
77184
- blocks2.push(drawingBlock);
77185
- recordBlockKind(drawingBlock.kind);
77186
- }
77187
- }
77188
- function handleShapeContainerNode(node2, context) {
77189
- const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
77190
- const drawingBlock = shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions);
77191
- if (drawingBlock) {
77192
- blocks2.push(drawingBlock);
77193
- recordBlockKind(drawingBlock.kind);
77194
- }
77195
- }
77196
- function handleShapeTextboxNode(node2, context) {
77197
- const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
77198
- const drawingBlock = shapeTextboxNodeToDrawingBlock(node2, nextBlockId, positions);
77199
- if (drawingBlock) {
77200
- blocks2.push(drawingBlock);
77201
- recordBlockKind(drawingBlock.kind);
77202
- }
77203
- }
77204
77269
  const hydrateTableStyleAttrs = (tableNode, context) => {
77205
77270
  const hydration = {};
77206
77271
  const tableProps = tableNode.attrs?.tableProperties ?? null;
@@ -78006,6 +78071,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78006
78071
  hyperlinkConfig,
78007
78072
  themeColors,
78008
78073
  {
78074
+ contentBlockNodeToDrawingBlock,
78009
78075
  imageNodeToBlock,
78010
78076
  vectorShapeNodeToDrawingBlock,
78011
78077
  shapeGroupNodeToDrawingBlock,
@@ -87790,9 +87856,13 @@ ${l}
87790
87856
  const maxWidth = Math.max(0, columns.width - (marginLeft + marginRight));
87791
87857
  let width = measure.width;
87792
87858
  let height = measure.height;
87793
- if (width > maxWidth && maxWidth > 0) {
87794
- const scale = maxWidth / width;
87795
- width = maxWidth;
87859
+ const attrs = block.attrs;
87860
+ const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
87861
+ const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
87862
+ const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
87863
+ if (width > maxWidthForBlock && maxWidthForBlock > 0) {
87864
+ const scale = maxWidthForBlock / width;
87865
+ width = maxWidthForBlock;
87796
87866
  height *= scale;
87797
87867
  }
87798
87868
  let state2 = ensurePage();
@@ -87811,7 +87881,7 @@ ${l}
87811
87881
  kind: "drawing",
87812
87882
  blockId: block.id,
87813
87883
  drawingKind: block.drawingKind,
87814
- x: columnX(state2.columnIndex) + marginLeft,
87884
+ x: columnX(state2.columnIndex) + marginLeft + indentLeft,
87815
87885
  y: state2.cursorY + marginTop,
87816
87886
  width,
87817
87887
  height,
@@ -94653,10 +94723,18 @@ ${l}
94653
94723
  };
94654
94724
  }
94655
94725
  const geometry = ensureDrawingGeometry(block.geometry);
94726
+ const attrs = block.attrs;
94727
+ const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
94728
+ const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
94729
+ const hasFullWidth = attrs?.isFullWidth === true && constraints.maxWidth > 0;
94730
+ const fullWidthMax = hasFullWidth ? Math.max(1, constraints.maxWidth - indentLeft - indentRight) : void 0;
94731
+ if (fullWidthMax != null) {
94732
+ geometry.width = fullWidthMax;
94733
+ }
94656
94734
  const rotatedBounds = calculateRotatedBounds(geometry);
94657
94735
  const naturalWidth = Math.max(1, rotatedBounds.width);
94658
94736
  const naturalHeight = Math.max(1, rotatedBounds.height);
94659
- const maxWidth = constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth;
94737
+ const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth);
94660
94738
  const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
94661
94739
  const maxHeight = hasNegativeVerticalPosition || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
94662
94740
  const widthScale = maxWidth / naturalWidth;
@@ -133770,9 +133848,9 @@ ${style2}
133770
133848
  action: (editor2) => {
133771
133849
  editor2.commands.createDocumentSection();
133772
133850
  },
133773
- showWhen: (context2) => {
133774
- const { trigger: trigger2 } = context2;
133775
- return trigger2 === TRIGGERS.click;
133851
+ // TODO: Temporarily disabled - restore original: `return trigger === TRIGGERS.click;`
133852
+ showWhen: () => {
133853
+ return false;
133776
133854
  }
133777
133855
  },
133778
133856
  {
@@ -134110,19 +134188,31 @@ ${style2}
134110
134188
  return;
134111
134189
  }
134112
134190
  event.preventDefault();
134113
- moveCursorToMouseEvent(event, props.editor);
134191
+ const editorState = props.editor?.state;
134192
+ const hasRangeSelection = editorState?.selection?.from !== editorState?.selection?.to;
134193
+ let isClickInsideSelection = false;
134194
+ if (hasRangeSelection && Number.isFinite(event.clientX) && Number.isFinite(event.clientY)) {
134195
+ const hit = props.editor?.posAtCoords?.({ left: event.clientX, top: event.clientY });
134196
+ if (typeof hit?.pos === "number") {
134197
+ const { from: from2, to } = editorState.selection;
134198
+ isClickInsideSelection = hit.pos >= from2 && hit.pos <= to;
134199
+ }
134200
+ }
134201
+ if (!isClickInsideSelection) {
134202
+ moveCursorToMouseEvent(event, props.editor);
134203
+ }
134114
134204
  try {
134115
134205
  const context = await getEditorContext(props.editor, event);
134116
134206
  currentContext.value = context;
134117
134207
  sections.value = getItems({ ...context, trigger: "click" });
134118
134208
  selectedId.value = flattenedItems.value[0]?.id || null;
134119
134209
  searchQuery.value = "";
134120
- const state2 = props.editor.state;
134121
- if (!state2) return;
134210
+ const currentState = props.editor.state;
134211
+ if (!currentState) return;
134122
134212
  props.editor.dispatch(
134123
- state2.tr.setMeta(SlashMenuPluginKey, {
134213
+ currentState.tr.setMeta(SlashMenuPluginKey, {
134124
134214
  type: "open",
134125
- pos: context?.pos ?? state2.selection.from,
134215
+ pos: context?.pos ?? currentState.selection.from,
134126
134216
  clientX: event.clientX,
134127
134217
  clientY: event.clientY
134128
134218
  })
@@ -134135,12 +134225,21 @@ ${style2}
134135
134225
  if (props.editor) {
134136
134226
  item.action ? await item.action(props.editor, currentContext.value) : null;
134137
134227
  if (item.component) {
134138
- menuRef.value;
134228
+ const menuElement = menuRef.value;
134139
134229
  const componentProps = getPropsByItemId(item.id, props);
134140
- props.openPopover(markRaw(item.component), componentProps, {
134141
- left: menuPosition.value.left,
134142
- top: menuPosition.value.top
134143
- });
134230
+ let popoverPosition = { left: menuPosition.value.left, top: menuPosition.value.top };
134231
+ if (menuElement) {
134232
+ const menuRect = menuElement.getBoundingClientRect();
134233
+ const container = menuElement.closest(".super-editor");
134234
+ if (container) {
134235
+ const containerRect = container.getBoundingClientRect();
134236
+ popoverPosition = {
134237
+ left: `${menuRect.left - containerRect.left}px`,
134238
+ top: `${menuRect.top - containerRect.top}px`
134239
+ };
134240
+ }
134241
+ }
134242
+ props.openPopover(markRaw(item.component), componentProps, popoverPosition);
134144
134243
  closeMenu({ restoreCursor: false });
134145
134244
  } else {
134146
134245
  const shouldRestoreCursor = item.id !== "paste";
@@ -153745,7 +153844,7 @@ ${style2}
153745
153844
  this.config.colors = shuffleArray(this.config.colors);
153746
153845
  this.userColorMap = /* @__PURE__ */ new Map();
153747
153846
  this.colorIndex = 0;
153748
- this.version = "1.0.0-next.6";
153847
+ this.version = "1.0.0-next.8";
153749
153848
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
153750
153849
  this.superdocId = config2.superdocId || v4();
153751
153850
  this.colors = this.config.colors;
@@ -156218,7 +156317,7 @@ ${style2}
156218
156317
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
156219
156318
  );
156220
156319
  }
156221
- const indexCKb2zoi7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
156320
+ const indexDQd4iefd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
156222
156321
  __proto__: null,
156223
156322
  unified
156224
156323
  }, Symbol.toStringTag, { value: "Module" }));