@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
@@ -42427,7 +42427,7 @@ const _SuperConverter = class _SuperConverter2 {
42427
42427
  static getStoredSuperdocVersion(docx) {
42428
42428
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42429
42429
  }
42430
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.6") {
42430
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.8") {
42431
42431
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42432
42432
  }
42433
42433
  /**
@@ -54825,9 +54825,7 @@ const deleteSelection = () => ({ state: state2, tr, dispatch }) => {
54825
54825
  const { from: from2, to, empty: empty2 } = state2.selection;
54826
54826
  if (typeof document !== "undefined" && document.getSelection) {
54827
54827
  const currentDomSelection = document.getSelection();
54828
- const selectedLength = currentDomSelection?.toString?.().length;
54829
- const isCollapsed = currentDomSelection?.isCollapsed;
54830
- if (!isCollapsed && selectedLength === 1) {
54828
+ if (currentDomSelection?.baseNode?.data?.length === 1) {
54831
54829
  return false;
54832
54830
  }
54833
54831
  }
@@ -59655,7 +59653,7 @@ const isHeadless = (editor) => {
59655
59653
  const shouldSkipNodeView = (editor) => {
59656
59654
  return isHeadless(editor);
59657
59655
  };
59658
- const summaryVersion = "1.0.0-next.6";
59656
+ const summaryVersion = "1.0.0-next.8";
59659
59657
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59660
59658
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59661
59659
  function mapAttributes(attrs) {
@@ -60444,7 +60442,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60444
60442
  { default: remarkStringify },
60445
60443
  { default: remarkGfm }
60446
60444
  ] = await Promise.all([
60447
- Promise.resolve().then(() => require("./index-CKb2zoi7-BEMsbmpK.cjs")),
60445
+ Promise.resolve().then(() => require("./index-DQd4iefd-BfbLCMZZ.cjs")),
60448
60446
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60449
60447
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60450
60448
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60649,7 +60647,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60649
60647
  * Process collaboration migrations
60650
60648
  */
60651
60649
  processCollaborationMigrations() {
60652
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.6");
60650
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.8");
60653
60651
  if (!this.options.ydoc) return;
60654
60652
  const metaMap = this.options.ydoc.getMap("meta");
60655
60653
  let docVersion = metaMap.get("version");
@@ -68011,6 +68009,271 @@ function handleDocumentPartObjectNode(node, context) {
68011
68009
  }
68012
68010
  }
68013
68011
  }
68012
+ const WRAP_TYPES$1 = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
68013
+ const WRAP_TEXT_VALUES$1 = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
68014
+ const H_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["column", "page", "margin"]);
68015
+ const V_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
68016
+ const H_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["left", "center", "right"]);
68017
+ const V_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
68018
+ const getAttrs$1 = (node) => {
68019
+ return isPlainObject$2(node.attrs) ? node.attrs : {};
68020
+ };
68021
+ const normalizeWrapType$1 = (value) => {
68022
+ if (typeof value !== "string") return void 0;
68023
+ return WRAP_TYPES$1.has(value) ? value : void 0;
68024
+ };
68025
+ const normalizeWrapText$1 = (value) => {
68026
+ if (typeof value !== "string") return void 0;
68027
+ return WRAP_TEXT_VALUES$1.has(value) ? value : void 0;
68028
+ };
68029
+ const normalizePolygon$1 = (value) => {
68030
+ if (!Array.isArray(value)) return void 0;
68031
+ const polygon = [];
68032
+ value.forEach((point) => {
68033
+ if (!Array.isArray(point) || point.length < 2) return;
68034
+ const x2 = pickNumber(point[0]);
68035
+ const y2 = pickNumber(point[1]);
68036
+ if (x2 == null || y2 == null) return;
68037
+ polygon.push([x2, y2]);
68038
+ });
68039
+ return polygon.length > 0 ? polygon : void 0;
68040
+ };
68041
+ const normalizeWrap$2 = (value) => {
68042
+ if (!isPlainObject$2(value)) {
68043
+ return void 0;
68044
+ }
68045
+ const type2 = normalizeWrapType$1(value.type);
68046
+ if (!type2 || type2 === "Inline") {
68047
+ return void 0;
68048
+ }
68049
+ const wrap2 = { type: type2 };
68050
+ const attrs = isPlainObject$2(value.attrs) ? value.attrs : {};
68051
+ const wrapText = normalizeWrapText$1(attrs.wrapText);
68052
+ if (wrapText) {
68053
+ wrap2.wrapText = wrapText;
68054
+ }
68055
+ const distTop = pickNumber(attrs.distTop ?? attrs.distT);
68056
+ if (distTop != null) wrap2.distTop = distTop;
68057
+ const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
68058
+ if (distBottom != null) wrap2.distBottom = distBottom;
68059
+ const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
68060
+ if (distLeft != null) wrap2.distLeft = distLeft;
68061
+ const distRight = pickNumber(attrs.distRight ?? attrs.distR);
68062
+ if (distRight != null) wrap2.distRight = distRight;
68063
+ const polygon = normalizePolygon$1(attrs.polygon);
68064
+ if (polygon) {
68065
+ wrap2.polygon = polygon;
68066
+ }
68067
+ const behindDoc = toBoolean$3(attrs.behindDoc);
68068
+ if (behindDoc != null) {
68069
+ wrap2.behindDoc = behindDoc;
68070
+ }
68071
+ return wrap2;
68072
+ };
68073
+ const normalizeAnchorRelative$1 = (value, allowed) => {
68074
+ if (typeof value !== "string") return void 0;
68075
+ return allowed.has(value) ? value : void 0;
68076
+ };
68077
+ const normalizeAnchorAlign$1 = (value, allowed) => {
68078
+ if (typeof value !== "string") return void 0;
68079
+ return allowed.has(value) ? value : void 0;
68080
+ };
68081
+ const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
68082
+ const raw = isPlainObject$2(value) ? value : void 0;
68083
+ const marginOffset = isPlainObject$2(attrs.marginOffset) ? attrs.marginOffset : void 0;
68084
+ const simplePos = isPlainObject$2(attrs.simplePos) ? attrs.simplePos : void 0;
68085
+ const originalAttrs = isPlainObject$2(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
68086
+ const isAnchored = attrs.isAnchor === true || Boolean(raw);
68087
+ const anchor = {};
68088
+ if (isAnchored) {
68089
+ anchor.isAnchored = true;
68090
+ }
68091
+ const hRelative = normalizeAnchorRelative$1(raw?.hRelativeFrom, H_RELATIVE_VALUES$1);
68092
+ if (hRelative) anchor.hRelativeFrom = hRelative;
68093
+ const vRelative = normalizeAnchorRelative$1(raw?.vRelativeFrom, V_RELATIVE_VALUES$1);
68094
+ if (vRelative) anchor.vRelativeFrom = vRelative;
68095
+ const alignH = normalizeAnchorAlign$1(raw?.alignH, H_ALIGN_VALUES$1);
68096
+ if (alignH) anchor.alignH = alignH;
68097
+ const alignV = normalizeAnchorAlign$1(raw?.alignV, V_ALIGN_VALUES$1);
68098
+ if (alignV) anchor.alignV = alignV;
68099
+ const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
68100
+ if (offsetH != null) anchor.offsetH = offsetH;
68101
+ const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
68102
+ if (offsetV != null) anchor.offsetV = offsetV;
68103
+ const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
68104
+ if (behindDoc != null) anchor.behindDoc = behindDoc;
68105
+ 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;
68106
+ return hasData ? anchor : void 0;
68107
+ };
68108
+ const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node, geometry, drawingKind, extraProps) => {
68109
+ const normalizedWrap = normalizeWrap$2(rawAttrs.wrap);
68110
+ const baseAnchor = normalizeAnchorData$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
68111
+ const pos = positions.get(node);
68112
+ const attrsWithPm = { ...rawAttrs };
68113
+ if (pos) {
68114
+ attrsWithPm.pmStart = pos.start;
68115
+ attrsWithPm.pmEnd = pos.end;
68116
+ }
68117
+ const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
68118
+ const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
68119
+ return {
68120
+ kind: "drawing",
68121
+ id: nextBlockId("drawing"),
68122
+ drawingKind,
68123
+ padding: toBoxSpacing$1(rawAttrs.padding),
68124
+ margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
68125
+ anchor: baseAnchor,
68126
+ wrap: normalizedWrap,
68127
+ zIndex: finalZIndex,
68128
+ drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
68129
+ drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
68130
+ attrs: attrsWithPm,
68131
+ geometry,
68132
+ shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
68133
+ fillColor: normalizeFillColor(rawAttrs.fillColor),
68134
+ strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
68135
+ strokeWidth: coerceNumber(rawAttrs.strokeWidth),
68136
+ textContent: normalizeTextContent(rawAttrs.textContent),
68137
+ textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
68138
+ textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
68139
+ textInsets: normalizeTextInsets(rawAttrs.textInsets),
68140
+ ...extraProps
68141
+ };
68142
+ };
68143
+ function vectorShapeNodeToDrawingBlock(node, nextBlockId, positions) {
68144
+ const rawAttrs = getAttrs$1(node);
68145
+ const geometry = {
68146
+ width: coercePositiveNumber(rawAttrs.width, 1),
68147
+ height: coercePositiveNumber(rawAttrs.height, 1),
68148
+ rotation: coerceNumber(rawAttrs.rotation) ?? 0,
68149
+ flipH: coerceBoolean(rawAttrs.flipH) ?? false,
68150
+ flipV: coerceBoolean(rawAttrs.flipV) ?? false
68151
+ };
68152
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
68153
+ }
68154
+ function shapeGroupNodeToDrawingBlock(node, nextBlockId, positions) {
68155
+ const rawAttrs = getAttrs$1(node);
68156
+ const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
68157
+ const size2 = normalizeShapeSize(rawAttrs.size);
68158
+ const width = size2?.width ?? groupTransform?.width ?? 1;
68159
+ const height = size2?.height ?? groupTransform?.height ?? 1;
68160
+ const geometry = {
68161
+ width: coercePositiveNumber(width, 1),
68162
+ height: coercePositiveNumber(height, 1),
68163
+ rotation: coerceNumber(rawAttrs.rotation) ?? 0,
68164
+ flipH: coerceBoolean(rawAttrs.flipH) ?? false,
68165
+ flipV: coerceBoolean(rawAttrs.flipV) ?? false
68166
+ };
68167
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "shapeGroup", {
68168
+ groupTransform,
68169
+ shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
68170
+ size: size2
68171
+ });
68172
+ }
68173
+ function shapeContainerNodeToDrawingBlock(node, nextBlockId, positions) {
68174
+ const rawAttrs = getAttrs$1(node);
68175
+ const geometry = {
68176
+ width: coercePositiveNumber(rawAttrs.width, 1),
68177
+ height: coercePositiveNumber(rawAttrs.height, 1),
68178
+ rotation: coerceNumber(rawAttrs.rotation) ?? 0,
68179
+ flipH: coerceBoolean(rawAttrs.flipH) ?? false,
68180
+ flipV: coerceBoolean(rawAttrs.flipV) ?? false
68181
+ };
68182
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
68183
+ }
68184
+ function shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions) {
68185
+ const rawAttrs = getAttrs$1(node);
68186
+ const geometry = {
68187
+ width: coercePositiveNumber(rawAttrs.width, 1),
68188
+ height: coercePositiveNumber(rawAttrs.height, 1),
68189
+ rotation: coerceNumber(rawAttrs.rotation) ?? 0,
68190
+ flipH: coerceBoolean(rawAttrs.flipH) ?? false,
68191
+ flipV: coerceBoolean(rawAttrs.flipV) ?? false
68192
+ };
68193
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
68194
+ }
68195
+ function handleVectorShapeNode(node, context) {
68196
+ const { blocks, recordBlockKind, nextBlockId, positions } = context;
68197
+ const drawingBlock = vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
68198
+ if (drawingBlock) {
68199
+ blocks.push(drawingBlock);
68200
+ recordBlockKind(drawingBlock.kind);
68201
+ }
68202
+ }
68203
+ function handleShapeGroupNode(node, context) {
68204
+ const { blocks, recordBlockKind, nextBlockId, positions } = context;
68205
+ const drawingBlock = shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
68206
+ if (drawingBlock) {
68207
+ blocks.push(drawingBlock);
68208
+ recordBlockKind(drawingBlock.kind);
68209
+ }
68210
+ }
68211
+ function handleShapeContainerNode(node, context) {
68212
+ const { blocks, recordBlockKind, nextBlockId, positions } = context;
68213
+ const drawingBlock = shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
68214
+ if (drawingBlock) {
68215
+ blocks.push(drawingBlock);
68216
+ recordBlockKind(drawingBlock.kind);
68217
+ }
68218
+ }
68219
+ function handleShapeTextboxNode(node, context) {
68220
+ const { blocks, recordBlockKind, nextBlockId, positions } = context;
68221
+ const drawingBlock = shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
68222
+ if (drawingBlock) {
68223
+ blocks.push(drawingBlock);
68224
+ recordBlockKind(drawingBlock.kind);
68225
+ }
68226
+ }
68227
+ const getAttrs = (node) => {
68228
+ return isPlainObject$2(node.attrs) ? { ...node.attrs } : {};
68229
+ };
68230
+ const parseFullWidth = (value) => {
68231
+ if (typeof value === "string") {
68232
+ const trimmed = value.trim();
68233
+ if (trimmed.endsWith("%")) {
68234
+ return { width: trimmed === "100%" ? 1 : null, isFullWidth: trimmed === "100%" };
68235
+ }
68236
+ return { width: pickNumber(trimmed) ?? null, isFullWidth: false };
68237
+ }
68238
+ return { width: pickNumber(value) ?? null, isFullWidth: false };
68239
+ };
68240
+ function contentBlockNodeToDrawingBlock(node, nextBlockId, positions) {
68241
+ const rawAttrs = getAttrs(node);
68242
+ const indentLeft = pickNumber(rawAttrs.hrIndentLeft);
68243
+ const indentRight = pickNumber(rawAttrs.hrIndentRight);
68244
+ if (rawAttrs.horizontalRule !== true) {
68245
+ return null;
68246
+ }
68247
+ const size2 = isPlainObject$2(rawAttrs.size) ? rawAttrs.size : void 0;
68248
+ const { width, isFullWidth } = parseFullWidth(size2?.width);
68249
+ const height = pickNumber(size2?.height);
68250
+ if (!height || height <= 0) {
68251
+ return null;
68252
+ }
68253
+ if (!isFullWidth && (!width || width <= 0)) {
68254
+ return null;
68255
+ }
68256
+ if (isFullWidth) {
68257
+ rawAttrs.isFullWidth = true;
68258
+ }
68259
+ if (indentLeft != null || indentRight != null) {
68260
+ rawAttrs.hrIndentLeft = indentLeft;
68261
+ rawAttrs.hrIndentRight = indentRight;
68262
+ }
68263
+ if (typeof rawAttrs.background === "string" && rawAttrs.background.trim()) {
68264
+ rawAttrs.fillColor = rawAttrs.background;
68265
+ }
68266
+ const geometry = {
68267
+ width: isFullWidth ? 1 : width ?? 1,
68268
+ height,
68269
+ rotation: 0,
68270
+ flipH: false,
68271
+ flipV: false
68272
+ };
68273
+ return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape", {
68274
+ strokeColor: null
68275
+ });
68276
+ }
68014
68277
  const extractValue = (value) => {
68015
68278
  if (value && typeof value === "object" && "value" in value) {
68016
68279
  return value.value;
@@ -68734,6 +68997,23 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
68734
68997
  }
68735
68998
  return;
68736
68999
  }
69000
+ if (node.type === "contentBlock") {
69001
+ const attrs = node.attrs ?? {};
69002
+ if (attrs.horizontalRule === true) {
69003
+ flushParagraph();
69004
+ const indent = paragraphAttrs?.indent;
69005
+ const hrIndentLeft = typeof indent?.left === "number" ? indent.left : void 0;
69006
+ const hrIndentRight = typeof indent?.right === "number" ? indent.right : void 0;
69007
+ const hasIndent = typeof hrIndentLeft === "number" && hrIndentLeft !== 0 || typeof hrIndentRight === "number" && hrIndentRight !== 0;
69008
+ const hrNode = hasIndent ? { ...node, attrs: { ...attrs, hrIndentLeft, hrIndentRight } } : node;
69009
+ const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
69010
+ const drawingBlock = convert(hrNode, nextBlockId, positions);
69011
+ if (drawingBlock) {
69012
+ blocks.push(drawingBlock);
69013
+ }
69014
+ }
69015
+ return;
69016
+ }
68737
69017
  if (node.type === "vectorShape") {
68738
69018
  flushParagraph();
68739
69019
  if (converters?.vectorShapeNodeToDrawingBlock) {
@@ -68946,12 +69226,12 @@ function handleParagraphNode(node, context) {
68946
69226
  });
68947
69227
  sectionState.currentParagraphIndex++;
68948
69228
  }
68949
- const WRAP_TYPES$1 = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
68950
- const WRAP_TEXT_VALUES$1 = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
68951
- const H_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["column", "page", "margin"]);
68952
- const V_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
68953
- const H_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["left", "center", "right"]);
68954
- const V_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
69229
+ const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
69230
+ const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
69231
+ const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
69232
+ const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
69233
+ const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
69234
+ const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
68955
69235
  const isPlainObject$4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
68956
69236
  const isAllowedObjectFit = (value) => {
68957
69237
  return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
@@ -68969,15 +69249,15 @@ function toBoxSpacing(spacing) {
68969
69249
  });
68970
69250
  return Object.keys(result).length > 0 ? result : void 0;
68971
69251
  }
68972
- const normalizeWrapType$1 = (value) => {
69252
+ const normalizeWrapType = (value) => {
68973
69253
  if (typeof value !== "string") return void 0;
68974
- return WRAP_TYPES$1.has(value) ? value : void 0;
69254
+ return WRAP_TYPES.has(value) ? value : void 0;
68975
69255
  };
68976
- const normalizeWrapText$1 = (value) => {
69256
+ const normalizeWrapText = (value) => {
68977
69257
  if (typeof value !== "string") return void 0;
68978
- return WRAP_TEXT_VALUES$1.has(value) ? value : void 0;
69258
+ return WRAP_TEXT_VALUES.has(value) ? value : void 0;
68979
69259
  };
68980
- const normalizePolygon$1 = (value) => {
69260
+ const normalizePolygon = (value) => {
68981
69261
  if (!Array.isArray(value)) return void 0;
68982
69262
  const polygon = [];
68983
69263
  value.forEach((point) => {
@@ -69003,17 +69283,17 @@ const toBoolean = (value) => {
69003
69283
  }
69004
69284
  return void 0;
69005
69285
  };
69006
- const normalizeWrap$2 = (value) => {
69286
+ const normalizeWrap$1 = (value) => {
69007
69287
  if (!isPlainObject$4(value)) {
69008
69288
  return void 0;
69009
69289
  }
69010
- const type2 = normalizeWrapType$1(value.type);
69290
+ const type2 = normalizeWrapType(value.type);
69011
69291
  if (!type2) {
69012
69292
  return void 0;
69013
69293
  }
69014
69294
  const wrap2 = { type: type2 };
69015
69295
  const attrs = isPlainObject$4(value.attrs) ? value.attrs : {};
69016
- const wrapText = normalizeWrapText$1(attrs.wrapText);
69296
+ const wrapText = normalizeWrapText(attrs.wrapText);
69017
69297
  if (wrapText) {
69018
69298
  wrap2.wrapText = wrapText;
69019
69299
  }
@@ -69025,7 +69305,7 @@ const normalizeWrap$2 = (value) => {
69025
69305
  if (distLeft != null) wrap2.distLeft = distLeft;
69026
69306
  const distRight = pickNumber(attrs.distRight ?? attrs.distR);
69027
69307
  if (distRight != null) wrap2.distRight = distRight;
69028
- const polygon = normalizePolygon$1(attrs.polygon);
69308
+ const polygon = normalizePolygon(attrs.polygon);
69029
69309
  if (polygon) {
69030
69310
  wrap2.polygon = polygon;
69031
69311
  }
@@ -69035,15 +69315,15 @@ const normalizeWrap$2 = (value) => {
69035
69315
  }
69036
69316
  return wrap2;
69037
69317
  };
69038
- const normalizeAnchorRelative$1 = (value, allowed) => {
69318
+ const normalizeAnchorRelative = (value, allowed) => {
69039
69319
  if (typeof value !== "string") return void 0;
69040
69320
  return allowed.has(value) ? value : void 0;
69041
69321
  };
69042
- const normalizeAnchorAlign$1 = (value, allowed) => {
69322
+ const normalizeAnchorAlign = (value, allowed) => {
69043
69323
  if (typeof value !== "string") return void 0;
69044
69324
  return allowed.has(value) ? value : void 0;
69045
69325
  };
69046
- const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
69326
+ const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
69047
69327
  const raw = isPlainObject$4(value) ? value : void 0;
69048
69328
  const marginOffset = isPlainObject$4(attrs.marginOffset) ? attrs.marginOffset : void 0;
69049
69329
  const simplePos = isPlainObject$4(attrs.simplePos) ? attrs.simplePos : void 0;
@@ -69053,13 +69333,13 @@ const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
69053
69333
  if (isAnchored) {
69054
69334
  anchor.isAnchored = true;
69055
69335
  }
69056
- const hRelative = normalizeAnchorRelative$1(raw?.hRelativeFrom, H_RELATIVE_VALUES$1);
69336
+ const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
69057
69337
  if (hRelative) anchor.hRelativeFrom = hRelative;
69058
- const vRelative = normalizeAnchorRelative$1(raw?.vRelativeFrom, V_RELATIVE_VALUES$1);
69338
+ const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
69059
69339
  if (vRelative) anchor.vRelativeFrom = vRelative;
69060
- const alignH = normalizeAnchorAlign$1(raw?.alignH, H_ALIGN_VALUES$1);
69340
+ const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
69061
69341
  if (alignH) anchor.alignH = alignH;
69062
- const alignV = normalizeAnchorAlign$1(raw?.alignV, V_ALIGN_VALUES$1);
69342
+ const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
69063
69343
  if (alignV) anchor.alignV = alignV;
69064
69344
  const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
69065
69345
  if (offsetH != null) anchor.offsetH = offsetH;
@@ -69085,8 +69365,8 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
69085
69365
  const width = typeof size2.width === "number" && Number.isFinite(size2.width) ? size2.width : void 0;
69086
69366
  const height = typeof size2.height === "number" && Number.isFinite(size2.height) ? size2.height : void 0;
69087
69367
  const explicitDisplay = typeof attrs.display === "string" ? attrs.display : void 0;
69088
- const normalizedWrap = normalizeWrap$2(attrs.wrap);
69089
- let anchor = normalizeAnchorData$1(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
69368
+ const normalizedWrap = normalizeWrap$1(attrs.wrap);
69369
+ let anchor = normalizeAnchorData(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
69090
69370
  if (!anchor && normalizedWrap) {
69091
69371
  anchor = { isAnchored: true };
69092
69372
  if (normalizedWrap.behindDoc != null) {
@@ -69128,221 +69408,6 @@ function handleImageNode(node, context) {
69128
69408
  recordBlockKind(imageBlock.kind);
69129
69409
  }
69130
69410
  }
69131
- const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
69132
- const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
69133
- const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
69134
- const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
69135
- const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
69136
- const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
69137
- const getAttrs = (node) => {
69138
- return isPlainObject$2(node.attrs) ? node.attrs : {};
69139
- };
69140
- const normalizeWrapType = (value) => {
69141
- if (typeof value !== "string") return void 0;
69142
- return WRAP_TYPES.has(value) ? value : void 0;
69143
- };
69144
- const normalizeWrapText = (value) => {
69145
- if (typeof value !== "string") return void 0;
69146
- return WRAP_TEXT_VALUES.has(value) ? value : void 0;
69147
- };
69148
- const normalizePolygon = (value) => {
69149
- if (!Array.isArray(value)) return void 0;
69150
- const polygon = [];
69151
- value.forEach((point) => {
69152
- if (!Array.isArray(point) || point.length < 2) return;
69153
- const x2 = pickNumber(point[0]);
69154
- const y2 = pickNumber(point[1]);
69155
- if (x2 == null || y2 == null) return;
69156
- polygon.push([x2, y2]);
69157
- });
69158
- return polygon.length > 0 ? polygon : void 0;
69159
- };
69160
- const normalizeWrap$1 = (value) => {
69161
- if (!isPlainObject$2(value)) {
69162
- return void 0;
69163
- }
69164
- const type2 = normalizeWrapType(value.type);
69165
- if (!type2 || type2 === "Inline") {
69166
- return void 0;
69167
- }
69168
- const wrap2 = { type: type2 };
69169
- const attrs = isPlainObject$2(value.attrs) ? value.attrs : {};
69170
- const wrapText = normalizeWrapText(attrs.wrapText);
69171
- if (wrapText) {
69172
- wrap2.wrapText = wrapText;
69173
- }
69174
- const distTop = pickNumber(attrs.distTop ?? attrs.distT);
69175
- if (distTop != null) wrap2.distTop = distTop;
69176
- const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
69177
- if (distBottom != null) wrap2.distBottom = distBottom;
69178
- const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
69179
- if (distLeft != null) wrap2.distLeft = distLeft;
69180
- const distRight = pickNumber(attrs.distRight ?? attrs.distR);
69181
- if (distRight != null) wrap2.distRight = distRight;
69182
- const polygon = normalizePolygon(attrs.polygon);
69183
- if (polygon) {
69184
- wrap2.polygon = polygon;
69185
- }
69186
- const behindDoc = toBoolean$3(attrs.behindDoc);
69187
- if (behindDoc != null) {
69188
- wrap2.behindDoc = behindDoc;
69189
- }
69190
- return wrap2;
69191
- };
69192
- const normalizeAnchorRelative = (value, allowed) => {
69193
- if (typeof value !== "string") return void 0;
69194
- return allowed.has(value) ? value : void 0;
69195
- };
69196
- const normalizeAnchorAlign = (value, allowed) => {
69197
- if (typeof value !== "string") return void 0;
69198
- return allowed.has(value) ? value : void 0;
69199
- };
69200
- const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
69201
- const raw = isPlainObject$2(value) ? value : void 0;
69202
- const marginOffset = isPlainObject$2(attrs.marginOffset) ? attrs.marginOffset : void 0;
69203
- const simplePos = isPlainObject$2(attrs.simplePos) ? attrs.simplePos : void 0;
69204
- const originalAttrs = isPlainObject$2(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
69205
- const isAnchored = attrs.isAnchor === true || Boolean(raw);
69206
- const anchor = {};
69207
- if (isAnchored) {
69208
- anchor.isAnchored = true;
69209
- }
69210
- const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
69211
- if (hRelative) anchor.hRelativeFrom = hRelative;
69212
- const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
69213
- if (vRelative) anchor.vRelativeFrom = vRelative;
69214
- const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
69215
- if (alignH) anchor.alignH = alignH;
69216
- const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
69217
- if (alignV) anchor.alignV = alignV;
69218
- const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
69219
- if (offsetH != null) anchor.offsetH = offsetH;
69220
- const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
69221
- if (offsetV != null) anchor.offsetV = offsetV;
69222
- const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
69223
- if (behindDoc != null) anchor.behindDoc = behindDoc;
69224
- 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;
69225
- return hasData ? anchor : void 0;
69226
- };
69227
- const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node, geometry, drawingKind, extraProps) => {
69228
- const normalizedWrap = normalizeWrap$1(rawAttrs.wrap);
69229
- const baseAnchor = normalizeAnchorData(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
69230
- const pos = positions.get(node);
69231
- const attrsWithPm = { ...rawAttrs };
69232
- if (pos) {
69233
- attrsWithPm.pmStart = pos.start;
69234
- attrsWithPm.pmEnd = pos.end;
69235
- }
69236
- const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
69237
- const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
69238
- return {
69239
- kind: "drawing",
69240
- id: nextBlockId("drawing"),
69241
- drawingKind,
69242
- padding: toBoxSpacing$1(rawAttrs.padding),
69243
- margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
69244
- anchor: baseAnchor,
69245
- wrap: normalizedWrap,
69246
- zIndex: finalZIndex,
69247
- drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
69248
- drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
69249
- attrs: attrsWithPm,
69250
- geometry,
69251
- shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
69252
- fillColor: normalizeFillColor(rawAttrs.fillColor),
69253
- strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
69254
- strokeWidth: coerceNumber(rawAttrs.strokeWidth),
69255
- textContent: normalizeTextContent(rawAttrs.textContent),
69256
- textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
69257
- textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
69258
- textInsets: normalizeTextInsets(rawAttrs.textInsets),
69259
- ...extraProps
69260
- };
69261
- };
69262
- function vectorShapeNodeToDrawingBlock(node, nextBlockId, positions) {
69263
- const rawAttrs = getAttrs(node);
69264
- const geometry = {
69265
- width: coercePositiveNumber(rawAttrs.width, 1),
69266
- height: coercePositiveNumber(rawAttrs.height, 1),
69267
- rotation: coerceNumber(rawAttrs.rotation) ?? 0,
69268
- flipH: coerceBoolean(rawAttrs.flipH) ?? false,
69269
- flipV: coerceBoolean(rawAttrs.flipV) ?? false
69270
- };
69271
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
69272
- }
69273
- function shapeGroupNodeToDrawingBlock(node, nextBlockId, positions) {
69274
- const rawAttrs = getAttrs(node);
69275
- const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
69276
- const size2 = normalizeShapeSize(rawAttrs.size);
69277
- const width = size2?.width ?? groupTransform?.width ?? 1;
69278
- const height = size2?.height ?? groupTransform?.height ?? 1;
69279
- const geometry = {
69280
- width: coercePositiveNumber(width, 1),
69281
- height: coercePositiveNumber(height, 1),
69282
- rotation: coerceNumber(rawAttrs.rotation) ?? 0,
69283
- flipH: coerceBoolean(rawAttrs.flipH) ?? false,
69284
- flipV: coerceBoolean(rawAttrs.flipV) ?? false
69285
- };
69286
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "shapeGroup", {
69287
- groupTransform,
69288
- shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
69289
- size: size2
69290
- });
69291
- }
69292
- function shapeContainerNodeToDrawingBlock(node, nextBlockId, positions) {
69293
- const rawAttrs = getAttrs(node);
69294
- const geometry = {
69295
- width: coercePositiveNumber(rawAttrs.width, 1),
69296
- height: coercePositiveNumber(rawAttrs.height, 1),
69297
- rotation: coerceNumber(rawAttrs.rotation) ?? 0,
69298
- flipH: coerceBoolean(rawAttrs.flipH) ?? false,
69299
- flipV: coerceBoolean(rawAttrs.flipV) ?? false
69300
- };
69301
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
69302
- }
69303
- function shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions) {
69304
- const rawAttrs = getAttrs(node);
69305
- const geometry = {
69306
- width: coercePositiveNumber(rawAttrs.width, 1),
69307
- height: coercePositiveNumber(rawAttrs.height, 1),
69308
- rotation: coerceNumber(rawAttrs.rotation) ?? 0,
69309
- flipH: coerceBoolean(rawAttrs.flipH) ?? false,
69310
- flipV: coerceBoolean(rawAttrs.flipV) ?? false
69311
- };
69312
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
69313
- }
69314
- function handleVectorShapeNode(node, context) {
69315
- const { blocks, recordBlockKind, nextBlockId, positions } = context;
69316
- const drawingBlock = vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
69317
- if (drawingBlock) {
69318
- blocks.push(drawingBlock);
69319
- recordBlockKind(drawingBlock.kind);
69320
- }
69321
- }
69322
- function handleShapeGroupNode(node, context) {
69323
- const { blocks, recordBlockKind, nextBlockId, positions } = context;
69324
- const drawingBlock = shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
69325
- if (drawingBlock) {
69326
- blocks.push(drawingBlock);
69327
- recordBlockKind(drawingBlock.kind);
69328
- }
69329
- }
69330
- function handleShapeContainerNode(node, context) {
69331
- const { blocks, recordBlockKind, nextBlockId, positions } = context;
69332
- const drawingBlock = shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
69333
- if (drawingBlock) {
69334
- blocks.push(drawingBlock);
69335
- recordBlockKind(drawingBlock.kind);
69336
- }
69337
- }
69338
- function handleShapeTextboxNode(node, context) {
69339
- const { blocks, recordBlockKind, nextBlockId, positions } = context;
69340
- const drawingBlock = shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
69341
- if (drawingBlock) {
69342
- blocks.push(drawingBlock);
69343
- recordBlockKind(drawingBlock.kind);
69344
- }
69345
- }
69346
69411
  const hydrateTableStyleAttrs = (tableNode, context) => {
69347
69412
  const hydration = {};
69348
69413
  const tableProps = tableNode.attrs?.tableProperties ?? null;
@@ -70148,6 +70213,7 @@ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaul
70148
70213
  hyperlinkConfig,
70149
70214
  themeColors,
70150
70215
  {
70216
+ contentBlockNodeToDrawingBlock,
70151
70217
  imageNodeToBlock,
70152
70218
  vectorShapeNodeToDrawingBlock,
70153
70219
  shapeGroupNodeToDrawingBlock,
@@ -79932,9 +79998,13 @@ function layoutDrawingBlock({
79932
79998
  const maxWidth = Math.max(0, columns.width - (marginLeft + marginRight));
79933
79999
  let width = measure.width;
79934
80000
  let height = measure.height;
79935
- if (width > maxWidth && maxWidth > 0) {
79936
- const scale = maxWidth / width;
79937
- width = maxWidth;
80001
+ const attrs = block.attrs;
80002
+ const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
80003
+ const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
80004
+ const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
80005
+ if (width > maxWidthForBlock && maxWidthForBlock > 0) {
80006
+ const scale = maxWidthForBlock / width;
80007
+ width = maxWidthForBlock;
79938
80008
  height *= scale;
79939
80009
  }
79940
80010
  let state2 = ensurePage();
@@ -79953,7 +80023,7 @@ function layoutDrawingBlock({
79953
80023
  kind: "drawing",
79954
80024
  blockId: block.id,
79955
80025
  drawingKind: block.drawingKind,
79956
- x: columnX(state2.columnIndex) + marginLeft,
80026
+ x: columnX(state2.columnIndex) + marginLeft + indentLeft,
79957
80027
  y: state2.cursorY + marginTop,
79958
80028
  width,
79959
80029
  height,
@@ -86795,10 +86865,18 @@ async function measureDrawingBlock(block, constraints) {
86795
86865
  };
86796
86866
  }
86797
86867
  const geometry = ensureDrawingGeometry(block.geometry);
86868
+ const attrs = block.attrs;
86869
+ const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
86870
+ const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
86871
+ const hasFullWidth = attrs?.isFullWidth === true && constraints.maxWidth > 0;
86872
+ const fullWidthMax = hasFullWidth ? Math.max(1, constraints.maxWidth - indentLeft - indentRight) : void 0;
86873
+ if (fullWidthMax != null) {
86874
+ geometry.width = fullWidthMax;
86875
+ }
86798
86876
  const rotatedBounds = calculateRotatedBounds(geometry);
86799
86877
  const naturalWidth = Math.max(1, rotatedBounds.width);
86800
86878
  const naturalHeight = Math.max(1, rotatedBounds.height);
86801
- const maxWidth = constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth;
86879
+ const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth);
86802
86880
  const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
86803
86881
  const maxHeight = hasNegativeVerticalPosition || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
86804
86882
  const widthScale = maxWidth / naturalWidth;
@@ -125912,9 +125990,9 @@ function getItems(context, customItems = [], includeDefaultItems = true) {
125912
125990
  action: (editor2) => {
125913
125991
  editor2.commands.createDocumentSection();
125914
125992
  },
125915
- showWhen: (context2) => {
125916
- const { trigger: trigger2 } = context2;
125917
- return trigger2 === TRIGGERS.click;
125993
+ // TODO: Temporarily disabled - restore original: `return trigger === TRIGGERS.click;`
125994
+ showWhen: () => {
125995
+ return false;
125918
125996
  }
125919
125997
  },
125920
125998
  {
@@ -126252,19 +126330,31 @@ const _sfc_main$8 = {
126252
126330
  return;
126253
126331
  }
126254
126332
  event.preventDefault();
126255
- moveCursorToMouseEvent(event, props.editor);
126333
+ const editorState = props.editor?.state;
126334
+ const hasRangeSelection = editorState?.selection?.from !== editorState?.selection?.to;
126335
+ let isClickInsideSelection = false;
126336
+ if (hasRangeSelection && Number.isFinite(event.clientX) && Number.isFinite(event.clientY)) {
126337
+ const hit = props.editor?.posAtCoords?.({ left: event.clientX, top: event.clientY });
126338
+ if (typeof hit?.pos === "number") {
126339
+ const { from: from2, to } = editorState.selection;
126340
+ isClickInsideSelection = hit.pos >= from2 && hit.pos <= to;
126341
+ }
126342
+ }
126343
+ if (!isClickInsideSelection) {
126344
+ moveCursorToMouseEvent(event, props.editor);
126345
+ }
126256
126346
  try {
126257
126347
  const context = await getEditorContext(props.editor, event);
126258
126348
  currentContext.value = context;
126259
126349
  sections.value = getItems({ ...context, trigger: "click" });
126260
126350
  selectedId.value = flattenedItems.value[0]?.id || null;
126261
126351
  searchQuery.value = "";
126262
- const state2 = props.editor.state;
126263
- if (!state2) return;
126352
+ const currentState = props.editor.state;
126353
+ if (!currentState) return;
126264
126354
  props.editor.dispatch(
126265
- state2.tr.setMeta(SlashMenuPluginKey, {
126355
+ currentState.tr.setMeta(SlashMenuPluginKey, {
126266
126356
  type: "open",
126267
- pos: context?.pos ?? state2.selection.from,
126357
+ pos: context?.pos ?? currentState.selection.from,
126268
126358
  clientX: event.clientX,
126269
126359
  clientY: event.clientY
126270
126360
  })
@@ -126277,12 +126367,21 @@ const _sfc_main$8 = {
126277
126367
  if (props.editor) {
126278
126368
  item.action ? await item.action(props.editor, currentContext.value) : null;
126279
126369
  if (item.component) {
126280
- menuRef.value;
126370
+ const menuElement = menuRef.value;
126281
126371
  const componentProps = getPropsByItemId(item.id, props);
126282
- props.openPopover(vue.markRaw(item.component), componentProps, {
126283
- left: menuPosition.value.left,
126284
- top: menuPosition.value.top
126285
- });
126372
+ let popoverPosition = { left: menuPosition.value.left, top: menuPosition.value.top };
126373
+ if (menuElement) {
126374
+ const menuRect = menuElement.getBoundingClientRect();
126375
+ const container = menuElement.closest(".super-editor");
126376
+ if (container) {
126377
+ const containerRect = container.getBoundingClientRect();
126378
+ popoverPosition = {
126379
+ left: `${menuRect.left - containerRect.left}px`,
126380
+ top: `${menuRect.top - containerRect.top}px`
126381
+ };
126382
+ }
126383
+ }
126384
+ props.openPopover(vue.markRaw(item.component), componentProps, popoverPosition);
126286
126385
  closeMenu({ restoreCursor: false });
126287
126386
  } else {
126288
126387
  const shouldRestoreCursor = item.id !== "paste";