@harbour-enterprises/superdoc 0.24.0-next.1 → 0.24.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/chunks/{PdfViewer-DbOqZXrQ.es.js → PdfViewer-DEWI6Uts.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-JCz8O4m9.cjs → PdfViewer-skWUtg2N.cjs} +1 -1
  3. package/dist/chunks/{index-BppAJo0E.cjs → index-2QL0aZ2S.cjs} +2 -2
  4. package/dist/chunks/{index-BRpb9ulj.es.js → index-C_AMhrHP.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-B6zt2zq-.cjs → super-editor.es-CfK_qBM9.cjs} +1496 -897
  6. package/dist/chunks/{super-editor.es-BkjovEJQ.es.js → super-editor.es-iMAoOYOw.es.js} +1496 -897
  7. package/dist/core/types/index.d.ts.map +1 -1
  8. package/dist/style.css +5 -4
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CTR0TlK4.js → converter-BueCftlx.js} +1179 -858
  11. package/dist/super-editor/chunks/{docx-zipper-DUHu_gKU.js → docx-zipper-C9jmfWYZ.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-uVrxFmWV.js → editor-BsuNqVvp.js} +332 -53
  13. package/dist/super-editor/chunks/{toolbar-CotoiG3_.js → toolbar-DxhfgAoa.js} +2 -2
  14. package/dist/super-editor/converter.es.js +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/file-zipper.es.js +1 -1
  18. package/dist/super-editor/style.css +5 -4
  19. package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts +5 -0
  20. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +22 -0
  21. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +1 -0
  22. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/trackChangesImporter.d.ts +5 -0
  23. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +1 -0
  24. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/helpers.d.ts +1 -0
  25. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/del/del-translator.d.ts +7 -0
  26. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/del/index.d.ts +1 -0
  27. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ins/index.d.ts +1 -0
  28. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ins/ins-translator.d.ts +7 -0
  29. package/dist/super-editor/super-editor/src/extensions/image/image.d.ts +1 -1
  30. package/dist/super-editor/super-editor/src/extensions/image/imageHelpers/index.d.ts +1 -0
  31. package/dist/super-editor/super-editor/src/extensions/image/imageHelpers/legacyAttributes.d.ts +17 -0
  32. package/dist/super-editor/super-editor.es.js +7 -7
  33. package/dist/super-editor/toolbar.es.js +2 -2
  34. package/dist/super-editor.cjs +1 -1
  35. package/dist/super-editor.es.js +1 -1
  36. package/dist/superdoc.cjs +2 -2
  37. package/dist/superdoc.es.js +2 -2
  38. package/dist/superdoc.umd.js +1496 -897
  39. package/dist/superdoc.umd.js.map +1 -1
  40. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-CTR0TlK4.js";
1
+ import { p as process$1, ax as commonjsGlobal, B as Buffer, ay as getDefaultExportFromCjs, az as getContentTypesFromXml, aA as xmljs } from "./converter-BueCftlx.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as SelectionRange, as as Transform, at as isInTable$1, au as generateDocxRandomId, av as insertNewRelationship } from "./converter-CTR0TlK4.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as SelectionRange, as as Transform, at as isInTable$1, au as generateDocxRandomId, av as insertNewRelationship, aw as inchesToPixels } from "./converter-BueCftlx.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-DUHu_gKU.js";
17
+ import { D as DocxZipper } from "./docx-zipper-C9jmfWYZ.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -26415,6 +26415,58 @@ const registerImages = async (foundImages, editor, view) => {
26415
26415
  }
26416
26416
  });
26417
26417
  };
26418
+ const normalizeWrap = (attrs = {}) => {
26419
+ const wrap = attrs.wrap;
26420
+ if (wrap?.type && wrap.type !== "Inline") {
26421
+ return {
26422
+ type: wrap.type,
26423
+ attrs: wrap.attrs ?? {}
26424
+ };
26425
+ }
26426
+ if (wrap?.type === "Inline" && Object.keys(wrap.attrs ?? {}).length) {
26427
+ return {
26428
+ type: "Inline",
26429
+ attrs: wrap.attrs
26430
+ };
26431
+ }
26432
+ if (!wrap && attrs.wrapText) {
26433
+ return {
26434
+ type: "Square",
26435
+ attrs: {
26436
+ wrapText: attrs.wrapText
26437
+ }
26438
+ };
26439
+ }
26440
+ if (!wrap && attrs.wrapTopAndBottom) {
26441
+ return {
26442
+ type: "TopAndBottom",
26443
+ attrs: {}
26444
+ };
26445
+ }
26446
+ if (wrap?.type === "Inline") {
26447
+ return {
26448
+ type: "Inline",
26449
+ attrs: wrap.attrs ?? {}
26450
+ };
26451
+ }
26452
+ return {
26453
+ type: "Inline",
26454
+ attrs: {}
26455
+ };
26456
+ };
26457
+ const normalizeMarginOffset = (marginOffset = {}) => {
26458
+ const { left: left2, horizontal, ...rest } = marginOffset;
26459
+ return {
26460
+ ...rest,
26461
+ horizontal: horizontal ?? left2
26462
+ };
26463
+ };
26464
+ const getNormalizedImageAttrs = (attrs = {}) => {
26465
+ return {
26466
+ wrap: normalizeWrap(attrs),
26467
+ marginOffset: normalizeMarginOffset(attrs.marginOffset ?? {})
26468
+ };
26469
+ };
26418
26470
  const ImagePositionPluginKey = new PluginKey("ImagePosition");
26419
26471
  const ImagePositionPlugin = ({ editor }) => {
26420
26472
  const { view } = editor;
@@ -26462,7 +26514,8 @@ const getImagePositionDecorations = (state, view) => {
26462
26514
  let style = "";
26463
26515
  let className = "";
26464
26516
  const { vRelativeFrom, alignH } = node.attrs.anchorData;
26465
- const { size, padding, marginOffset } = node.attrs;
26517
+ const { size, padding } = node.attrs;
26518
+ const { marginOffset } = getNormalizedImageAttrs(node.attrs);
26466
26519
  const pageBreak = findPreviousDomNodeWithClass(view, pos, "pagination-break-wrapper");
26467
26520
  if (pageBreak) {
26468
26521
  switch (alignH) {
@@ -26579,7 +26632,24 @@ const Image = Node$1.create({
26579
26632
  rendered: false
26580
26633
  },
26581
26634
  originalAttributes: { rendered: false },
26582
- wrapTopAndBottom: { rendered: false },
26635
+ /**
26636
+ * @category Attribute
26637
+ * @param {Object} wrap - Wrapping options
26638
+ * @param {string} wrap.type - Wrap type: "None", "Square", "Through", "Tight", "TopAndBottom", "Inline"
26639
+ * @param {Object} [wrap.attrs] - Wrap attributes (only allowed attributes for the given type will be accepted)
26640
+ * @param {string} [wrap.attrs.wrapText] - Text wrapping mode for Square type: "bothSides", "largest", "left", "right"
26641
+ * @param {number} [wrap.attrs.distTop] - Top distance in pixels
26642
+ * @param {number} [wrap.attrs.distBottom] - Bottom distance in pixels
26643
+ * @param {number} [wrap.attrs.distLeft] - Left distance in pixels
26644
+ * @param {number} [wrap.attrs.distRight] - Right distance in pixels
26645
+ * @param {Array} [wrap.attrs.polygon] - Polygon points for Through/Tight types: [[x1,y1], [x2,y2], ...]
26646
+ * @param {boolean} [wrap.attrs.behindDoc] - Whether image should be behind document text (for wrapNone)
26647
+ */
26648
+ wrap: {
26649
+ default: { type: "Inline" },
26650
+ rendered: false
26651
+ // Handled in main renderDOM
26652
+ },
26583
26653
  anchorData: {
26584
26654
  default: null,
26585
26655
  rendered: false
@@ -26625,7 +26695,6 @@ const Image = Node$1.create({
26625
26695
  * @private
26626
26696
  */
26627
26697
  simplePos: { rendered: false },
26628
- wrapText: { rendered: false },
26629
26698
  extension: { rendered: false },
26630
26699
  size: {
26631
26700
  default: {},
@@ -26641,55 +26710,13 @@ const Image = Node$1.create({
26641
26710
  },
26642
26711
  padding: {
26643
26712
  default: {},
26644
- renderDOM: ({ size = {}, padding, marginOffset, transformData = {} }) => {
26645
- let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
26646
- const { rotation } = transformData;
26647
- const { height, width } = size;
26648
- if (rotation && height && width) {
26649
- const { horizontal, vertical } = getRotationMargins(width, height, rotation);
26650
- left2 += horizontal;
26651
- right2 += horizontal;
26652
- top2 += vertical;
26653
- bottom2 += vertical;
26654
- }
26655
- let style = "";
26656
- if (left2 && marginOffset?.left == null) style += `margin-left: ${left2}px;`;
26657
- if (top2 && marginOffset?.top == null) style += `margin-top: ${top2}px;`;
26658
- if (bottom2) style += `margin-bottom: ${bottom2}px;`;
26659
- if (right2) style += `margin-right: ${right2}px;`;
26660
- return { style };
26661
- }
26713
+ rendered: false
26714
+ // Handled in main renderDOM
26662
26715
  },
26663
26716
  marginOffset: {
26664
26717
  default: {},
26665
- renderDOM: ({ marginOffset, anchorData, transformData, size }) => {
26666
- const hasAnchorData = Boolean(anchorData);
26667
- const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
26668
- if (!hasAnchorData && !hasMarginOffsets) return {};
26669
- const relativeFromPageV = anchorData?.vRelativeFrom === "page";
26670
- const maxMarginV = 500;
26671
- const baseLeft = marginOffset?.left ?? 0;
26672
- const baseTop = marginOffset?.top ?? 0;
26673
- let rotationLeft = 0;
26674
- let rotationTop = 0;
26675
- const { rotation } = transformData ?? {};
26676
- const { height, width } = size ?? {};
26677
- if (rotation && height && width) {
26678
- const { horizontal, vertical } = getRotationMargins(width, height, rotation);
26679
- rotationLeft = horizontal;
26680
- rotationTop = vertical;
26681
- }
26682
- const left2 = baseLeft + rotationLeft;
26683
- const top2 = baseTop + rotationTop;
26684
- let style = "";
26685
- if (left2) style += `margin-left: ${left2}px;`;
26686
- if (top2) {
26687
- if (relativeFromPageV && top2 >= maxMarginV) style += `margin-top: ${maxMarginV}px;`;
26688
- else style += `margin-top: ${top2}px;`;
26689
- }
26690
- if (!style) return {};
26691
- return { style };
26692
- }
26718
+ rendered: false
26719
+ // Handled in main renderDOM
26693
26720
  },
26694
26721
  style: {
26695
26722
  default: null,
@@ -26708,8 +26735,181 @@ const Image = Node$1.create({
26708
26735
  }
26709
26736
  ];
26710
26737
  },
26711
- renderDOM({ htmlAttributes }) {
26712
- return ["img", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
26738
+ renderDOM({ node, htmlAttributes }) {
26739
+ const { wrap, marginOffset } = getNormalizedImageAttrs(node.attrs);
26740
+ const { anchorData, padding, transformData = {}, size = { width: 0, height: 0 } } = node.attrs;
26741
+ const margin = {
26742
+ left: 0,
26743
+ right: 0,
26744
+ top: 0,
26745
+ bottom: 0
26746
+ };
26747
+ let centered = false;
26748
+ let floatRight = false;
26749
+ let baseHorizontal = marginOffset?.horizontal || 0;
26750
+ let style = "";
26751
+ if (padding) {
26752
+ if (padding.left) margin.left += padding.left;
26753
+ if (padding.right) margin.right += padding.right;
26754
+ if (padding.top) margin.top += padding.top;
26755
+ if (padding.bottom) margin.bottom += padding.bottom;
26756
+ }
26757
+ const { rotation } = transformData;
26758
+ const { height, width } = size;
26759
+ if (rotation && height && width) {
26760
+ const { horizontal, vertical } = getRotationMargins(width, height, rotation);
26761
+ margin.left += horizontal;
26762
+ margin.right += horizontal;
26763
+ margin.top += vertical;
26764
+ margin.bottom += vertical;
26765
+ }
26766
+ if (wrap && wrap.type) {
26767
+ const { type, attrs = {} } = wrap;
26768
+ switch (type) {
26769
+ case "None":
26770
+ style += "position: absolute;";
26771
+ if (attrs.behindDoc) {
26772
+ style += "z-index: -1;";
26773
+ } else {
26774
+ style += "z-index: 1;";
26775
+ }
26776
+ break;
26777
+ case "Square":
26778
+ style += "shape-outside: border-box; clear: both;";
26779
+ if (attrs.wrapText === "right") {
26780
+ style += "float: left;";
26781
+ } else if (attrs.wrapText === "left") {
26782
+ style += "float: right;";
26783
+ floatRight = true;
26784
+ } else if (["largest", "bothSides"].includes(attrs.wrapText)) {
26785
+ const pageStyles2 = this.editor?.converter?.pageStyles;
26786
+ if (pageStyles2?.pageSize && pageStyles2?.pageMargins && size.width) {
26787
+ const pageWidth = inchesToPixels(pageStyles2.pageSize.width);
26788
+ const leftMargin = inchesToPixels(pageStyles2.pageMargins.left);
26789
+ const rightMargin = inchesToPixels(pageStyles2.pageMargins.right);
26790
+ const contentWidth = pageWidth - leftMargin - rightMargin;
26791
+ const imageWidth = size.width + (attrs.distLeft || 0) + (attrs.distRight || 0);
26792
+ const leftSpace = marginOffset.horizontal;
26793
+ const rightSpace = contentWidth - leftSpace - imageWidth;
26794
+ if (rightSpace < 0) {
26795
+ style += "float: left;";
26796
+ } else if (rightSpace > leftSpace) {
26797
+ style += "float: left;";
26798
+ } else {
26799
+ style += "float: right;";
26800
+ floatRight = true;
26801
+ baseHorizontal = rightSpace;
26802
+ }
26803
+ } else {
26804
+ style += "float: left;";
26805
+ }
26806
+ }
26807
+ if (attrs.distTop) margin.top += attrs.distTop;
26808
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
26809
+ if (attrs.distLeft) margin.left += attrs.distLeft;
26810
+ if (attrs.distRight) margin.right += attrs.distRight;
26811
+ break;
26812
+ case "Through":
26813
+ case "Tight":
26814
+ style += "clear: both;";
26815
+ const pageStyles = this.editor?.converter?.pageStyles;
26816
+ if (pageStyles?.pageSize && pageStyles?.pageMargins && size.width) {
26817
+ const pageWidth = inchesToPixels(pageStyles.pageSize.width);
26818
+ const leftMargin = inchesToPixels(pageStyles.pageMargins.left);
26819
+ const rightMargin = inchesToPixels(pageStyles.pageMargins.right);
26820
+ const contentWidth = pageWidth - leftMargin - rightMargin;
26821
+ const imageWidth = size.width + (attrs.distLeft || 0) + (attrs.distRight || 0);
26822
+ const leftSpace = marginOffset.horizontal;
26823
+ const rightSpace = contentWidth - leftSpace - imageWidth;
26824
+ if (rightSpace < 0) {
26825
+ style += "float: left;";
26826
+ } else if (rightSpace > leftSpace) {
26827
+ style += "float: left;";
26828
+ } else {
26829
+ style += "float: right;";
26830
+ floatRight = true;
26831
+ baseHorizontal = rightSpace;
26832
+ }
26833
+ } else {
26834
+ style += "float: left;";
26835
+ }
26836
+ if (attrs.distTop) margin.top += attrs.distTop;
26837
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
26838
+ if (attrs.distLeft) margin.left += attrs.distLeft;
26839
+ if (attrs.distRight) margin.right += attrs.distRight;
26840
+ if (attrs.polygon) {
26841
+ let horizontalOffset = floatRight ? attrs.polygon[0][0] || 0 : marginOffset.horizontal + 15;
26842
+ let maxX = 0;
26843
+ let minX = 0;
26844
+ let minY = 0;
26845
+ let maxY = 0;
26846
+ attrs.polygon.forEach(([x, y]) => {
26847
+ if (floatRight && x < horizontalOffset) horizontalOffset = x;
26848
+ if (x > maxX) maxX = x;
26849
+ if (x < minX) minX = x;
26850
+ if (y > maxY) maxY = y;
26851
+ if (y < minY) minY = y;
26852
+ });
26853
+ const originalWidth = maxX - minX;
26854
+ const originalHeight = maxY - minY;
26855
+ const scaleWidth = Math.min(1, size.width / originalWidth);
26856
+ const scaleHeight = Math.min(1, size.height / originalHeight);
26857
+ const verticalOffset = Math.max(0, marginOffset.top);
26858
+ const points = attrs.polygon.map(([x, y]) => `${horizontalOffset + x * scaleWidth}px ${verticalOffset + y * scaleHeight}px`).join(", ");
26859
+ style += `shape-outside: polygon(${points});`;
26860
+ }
26861
+ break;
26862
+ case "TopAndBottom":
26863
+ style += "display: block; clear: both;";
26864
+ if (attrs.distTop) margin.top += attrs.distTop;
26865
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
26866
+ centered = true;
26867
+ break;
26868
+ }
26869
+ }
26870
+ const hasAnchorData = Boolean(anchorData);
26871
+ const hasMarginOffsets = marginOffset?.horizontal != null || marginOffset?.top != null;
26872
+ if (hasAnchorData || hasMarginOffsets) {
26873
+ const relativeFromPageV = anchorData?.vRelativeFrom === "page";
26874
+ const maxMarginV = 500;
26875
+ const baseTop = Math.max(0, marginOffset?.top ?? 0);
26876
+ let rotationHorizontal = 0;
26877
+ let rotationTop = 0;
26878
+ const { rotation: rotation2 } = transformData ?? {};
26879
+ const { height: height2, width: width2 } = size ?? {};
26880
+ if (rotation2 && height2 && width2) {
26881
+ const { horizontal: horizontal2, vertical } = getRotationMargins(width2, height2, rotation2);
26882
+ rotationHorizontal = horizontal2;
26883
+ rotationTop = vertical;
26884
+ }
26885
+ const horizontal = baseHorizontal + rotationHorizontal;
26886
+ const top2 = baseTop + rotationTop;
26887
+ if (horizontal) {
26888
+ if (floatRight) {
26889
+ margin.right += horizontal;
26890
+ } else {
26891
+ margin.left += horizontal;
26892
+ }
26893
+ }
26894
+ if (top2) {
26895
+ if (relativeFromPageV && top2 >= maxMarginV) margin.top += maxMarginV;
26896
+ else margin.top += top2;
26897
+ }
26898
+ }
26899
+ if (centered) {
26900
+ style += "margin-left: auto; margin-right: auto;";
26901
+ } else {
26902
+ if (margin.left) style += `margin-left: ${margin.left}px;`;
26903
+ if (margin.right) style += `margin-right: ${margin.right}px;`;
26904
+ }
26905
+ if (margin.top) style += `margin-top: ${margin.top}px;`;
26906
+ if (margin.bottom) style += `margin-bottom: ${margin.bottom}px;`;
26907
+ const finalAttributes = { ...htmlAttributes };
26908
+ if (style) {
26909
+ const existingStyle = finalAttributes.style || "";
26910
+ finalAttributes.style = existingStyle + (existingStyle ? " " : "") + style;
26911
+ }
26912
+ return ["img", Attribute.mergeAttributes(this.options.htmlAttributes, finalAttributes)];
26713
26913
  },
26714
26914
  addCommands() {
26715
26915
  return {
@@ -26731,6 +26931,85 @@ const Image = Node$1.create({
26731
26931
  type: this.name,
26732
26932
  attrs: options
26733
26933
  });
26934
+ },
26935
+ /**
26936
+ * Set the wrapping mode and attributes for the selected image
26937
+ * @category Command
26938
+ * @param {Object} options - Wrapping options
26939
+ * @param {string} options.type - Wrap type: "None", "Square", "Through", "Tight", "TopAndBottom", "Inline"
26940
+ * @param {Object} [options.attrs] - Wrap attributes (only allowed attributes for the given type will be accepted)
26941
+ * @param {string} [options.attrs.wrapText] - Text wrapping mode for Square type: "bothSides", "largest", "left", "right"
26942
+ * @param {number} [options.attrs.distTop] - Top distance in pixels
26943
+ * @param {number} [options.attrs.distBottom] - Bottom distance in pixels
26944
+ * @param {number} [options.attrs.distLeft] - Left distance in pixels
26945
+ * @param {number} [options.attrs.distRight] - Right distance in pixels
26946
+ * @param {Array} [options.attrs.polygon] - Polygon points for Through/Tight types: [[x1,y1], [x2,y2], ...]
26947
+ * @param {boolean} [options.attrs.behindDoc] - Whether image should be behind document text (for wrapNone)
26948
+ * @example
26949
+ * // No wrapping, behind document
26950
+ * editor.commands.setWrapping({ type: 'None', attrs: {behindDoc: true} })
26951
+ *
26952
+ * // Square wrapping on both sides with distances
26953
+ * editor.commands.setWrapping({
26954
+ * type: 'Square',
26955
+ * attrs: {
26956
+ * wrapText: 'bothSides',
26957
+ * distTop: 10,
26958
+ * distBottom: 10,
26959
+ * distLeft: 10,
26960
+ * distRight: 10
26961
+ * }
26962
+ * })
26963
+ *
26964
+ * // Tight wrapping with polygon
26965
+ * editor.commands.setWrapping({
26966
+ * type: 'Tight',
26967
+ * attrs: {
26968
+ * polygon: [[0, 0], [100, 0], [100, 100], [0, 100]]
26969
+ * }
26970
+ * })
26971
+ *
26972
+ * // Top and bottom wrapping
26973
+ * editor.commands.setWrapping({
26974
+ * type: 'TopAndBottom',
26975
+ * attrs: {
26976
+ * distTop: 15,
26977
+ * distBottom: 15
26978
+ * }
26979
+ * })
26980
+ */
26981
+ setWrapping: (options) => ({ chain, state }) => {
26982
+ const { selection } = state;
26983
+ const { $from } = selection;
26984
+ const node = $from.nodeAfter;
26985
+ if (!node || node.type.name !== this.name) {
26986
+ return false;
26987
+ }
26988
+ const { type, attrs = {} } = options;
26989
+ const allowedAttrs = {};
26990
+ const allowedAttributes = {
26991
+ None: ["behindDoc"],
26992
+ Square: ["wrapText", "distTop", "distBottom", "distLeft", "distRight"],
26993
+ Through: ["distTop", "distBottom", "distLeft", "distRight", "polygon"],
26994
+ Tight: ["distTop", "distBottom", "distLeft", "distRight", "polygon"],
26995
+ TopAndBottom: ["distTop", "distBottom"],
26996
+ Inline: []
26997
+ };
26998
+ const allowedForType = allowedAttributes[type] || [];
26999
+ Object.keys(attrs).forEach((key2) => {
27000
+ if (allowedForType.includes(key2)) {
27001
+ allowedAttrs[key2] = attrs[key2];
27002
+ }
27003
+ });
27004
+ const updatedAttrs = {
27005
+ ...node.attrs,
27006
+ wrap: {
27007
+ type,
27008
+ attrs: allowedAttrs
27009
+ },
27010
+ isAnchor: type !== "Inline"
27011
+ };
27012
+ return chain().updateAttributes(this.name, updatedAttrs).run();
26734
27013
  }
26735
27014
  };
26736
27015
  },
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-CTR0TlK4.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-uVrxFmWV.js";
2
+ import { p as process$1 } from "./converter-BueCftlx.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BsuNqVvp.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-CTR0TlK4.js";
1
+ import { a5 } from "./chunks/converter-BueCftlx.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-CTR0TlK4.js";
2
- import { D } from "./chunks/docx-zipper-DUHu_gKU.js";
1
+ import "./chunks/converter-BueCftlx.js";
2
+ import { D } from "./chunks/docx-zipper-C9jmfWYZ.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-uVrxFmWV.js";
2
- import "./chunks/converter-CTR0TlK4.js";
3
- import "./chunks/docx-zipper-DUHu_gKU.js";
1
+ import { E } from "./chunks/editor-BsuNqVvp.js";
2
+ import "./chunks/converter-BueCftlx.js";
3
+ import "./chunks/docx-zipper-C9jmfWYZ.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-DUHu_gKU.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-C9jmfWYZ.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -439,6 +439,7 @@ a {
439
439
  -webkit-font-variant-ligatures: none;
440
440
  font-variant-ligatures: none;
441
441
  font-feature-settings: 'liga' 0; /* the above doesn't seem to work in Edge */
442
+ z-index: 0; /* Needed to place images behind text with lower z-index */
442
443
  }
443
444
  .ProseMirror pre {
444
445
  white-space: pre-wrap;
@@ -551,8 +552,8 @@ img.ProseMirror-separator {
551
552
  border-bottom: 1px solid #000;
552
553
  margin-bottom: 1.5px;
553
554
  }
554
- /*
555
- Tables
555
+ /*
556
+ Tables
556
557
  https://github.com/ProseMirror/prosemirror-tables/blob/master/style/tables.css
557
558
  https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
558
559
  */
@@ -568,8 +569,8 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
568
569
  scrollbar-width: thin;
569
570
  overflow: hidden;
570
571
 
571
- /*
572
- The border width does not need to be multiplied by two,
572
+ /*
573
+ The border width does not need to be multiplied by two,
573
574
  for tables it works differently. */
574
575
  width: calc(100% + (var(--table-border-width) + var(--offset)));
575
576
  }
@@ -3,6 +3,7 @@
3
3
  * @property {Object} node JSON node to translate (from PM schema)
4
4
  * @property {Object} [bodyNode] The stored body node to restore, if available
5
5
  * @property {Object[]} [relationships] The relationships to add to the document
6
+ * @property {Object} [extraParams] The extra params from NodeTranslator
6
7
  */
7
8
  /**
8
9
  * @typedef {Object} SchemaNode
@@ -124,6 +125,10 @@ export type ExportParams = {
124
125
  * The relationships to add to the document
125
126
  */
126
127
  relationships?: any[];
128
+ /**
129
+ * The extra params from NodeTranslator
130
+ */
131
+ extraParams?: any;
127
132
  };
128
133
  export type SchemaNode = {
129
134
  /**
@@ -2,6 +2,8 @@ export function inchesToTwips(inches: any): number;
2
2
  export function twipsToInches(twips: any): number;
3
3
  export function twipsToPixels(twips: any): number;
4
4
  export function pixelsToTwips(pixels: any): number;
5
+ export function pixelsToInches(pixels: any): number;
6
+ export function inchesToPixels(inches: any): number;
5
7
  export function twipsToLines(twips: any): number;
6
8
  export function linesToTwips(lines: any): number;
7
9
  export function halfPointToPixels(halfPoints: any): number;
@@ -13,6 +15,24 @@ export function eigthPointsToPixels(eigthPoints: any): number;
13
15
  export function pixelsToEightPoints(pixels: any): number;
14
16
  export function rotToDegrees(rot: any): number;
15
17
  export function degreesToRot(degrees: any): number;
18
+ /**
19
+ * Converts an array of pixel coordinates to a DOCX polygon node.
20
+ * Automatically adds a closing wp:lineTo element that connects back to the starting point,
21
+ * ensuring the polygon is properly closed in the DOCX format.
22
+ *
23
+ * @param {Array<[number, number]>} points - Array of [x, y] pixel coordinate pairs
24
+ * @returns {Object|null} DOCX polygon node with wp:start and wp:lineTo elements, or null if invalid input
25
+ */
26
+ export function objToPolygon(points: Array<[number, number]>): any | null;
27
+ /**
28
+ * Converts a DOCX polygon node to an array of pixel coordinates.
29
+ * Automatically removes duplicate closing points that are the same as the starting point,
30
+ * since polygons are assumed to be closed shapes.
31
+ *
32
+ * @param {Object} polygonNode - The polygon node from DOCX XML with wp:start and wp:lineTo elements
33
+ * @returns {Array<[number, number]>|null} Array of [x, y] pixel coordinate pairs, or null if invalid input
34
+ */
35
+ export function polygonToObj(polygonNode: any): Array<[number, number]> | null;
16
36
  export function getArrayBufferFromUrl(input: any, isHeadless: any): Promise<ArrayBuffer>;
17
37
  export function getContentTypesFromXml(contentTypesXml: any): string[];
18
38
  export function getHexColorFromDocxSystem(docxColor: any): string;
@@ -35,3 +55,5 @@ export function hasSomeParentWithClass(element: any, classname: any): any;
35
55
  * @returns {number} - The export value in twips
36
56
  */
37
57
  export function getTextIndentExportValue(indent: string | number): number;
58
+ export function polygonUnitsToPixels(pu: any): number;
59
+ export function pixelsToPolygonUnits(pixels: any): number;
@@ -46,6 +46,7 @@ export type XmlNode = import(any);
46
46
  export type PmNodeJson = {
47
47
  type: string;
48
48
  content: any;
49
+ marks: any;
49
50
  attrs: {};
50
51
  };
51
52
  export type PmMarkJson = {
@@ -6,3 +6,8 @@ export const handleTrackChangeNode: any;
6
6
  * @type {import("docxImporter").NodeHandlerEntry}
7
7
  */
8
8
  export const trackChangeNodeHandlerEntity: any;
9
+ export namespace __testables__ {
10
+ export { unwrapTrackChangeNode };
11
+ }
12
+ declare function unwrapTrackChangeNode(node: any): any;
13
+ export {};
@@ -49,6 +49,7 @@ export type PmNodeJson = {
49
49
  type: string;
50
50
  content: any;
51
51
  attrs: {};
52
+ marks: any;
52
53
  sdNodeOrKeyName: string;
53
54
  };
54
55
  export type PmMarkJson = {
@@ -0,0 +1 @@
1
+ export function createTrackStyleMark(marks: any[]): any | undefined;
@@ -0,0 +1,7 @@
1
+ /** @type {import('@translator').NodeTranslatorConfig} */
2
+ export const config: import("@translator").NodeTranslatorConfig;
3
+ /**
4
+ * The NodeTranslator instance for the w:b element.
5
+ * @type {import('@translator').NodeTranslator}
6
+ */
7
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./del-translator.js";
@@ -0,0 +1 @@
1
+ export * from "./ins-translator.js";
@@ -0,0 +1,7 @@
1
+ /** @type {import('@translator').NodeTranslatorConfig} */
2
+ export const config: import("@translator").NodeTranslatorConfig;
3
+ /**
4
+ * The NodeTranslator instance for the w:b element.
5
+ * @type {import('@translator').NodeTranslator}
6
+ */
7
+ export const translator: import("@translator").NodeTranslator;
@@ -21,7 +21,7 @@
21
21
  * @property {number} [padding.bottom] - Bottom padding in pixels
22
22
  * @property {number} [padding.right] - Right padding in pixels
23
23
  * @property {Object} [marginOffset] - Margin offset for anchored images
24
- * @property {number} [marginOffset.left] - Left margin offset
24
+ * @property {number} [marginOffset.horizontal] - Left/right margin offset
25
25
  * @property {number} [marginOffset.top] - Top margin offset
26
26
  * @property {string} [style] - Custom inline CSS styles
27
27
  * @property {string} [id] @internal Image element ID
@@ -6,3 +6,4 @@ export * from "./processUploadedImage.js";
6
6
  export * from "./imagePositionPlugin.js";
7
7
  export * from "./fileNameUtils.js";
8
8
  export * from "./rotation.js";
9
+ export * from "./legacyAttributes.js";