@harbour-enterprises/superdoc 0.29.0-next.9 → 0.30.0-next.1

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 (57) hide show
  1. package/dist/chunks/{PdfViewer-BV-ij_Jn.es.js → PdfViewer-DNnHwEf_.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-DpviVXfb.cjs → PdfViewer-Mru9qU0u.cjs} +1 -1
  3. package/dist/chunks/{index-sJFE-5Sw-Chv1r9bA.cjs → index-C3nnrhrj-D6qn1DZi.cjs} +1 -1
  4. package/dist/chunks/{index-sJFE-5Sw-r5deiWbP.es.js → index-C3nnrhrj-D8emuLzt.es.js} +1 -1
  5. package/dist/chunks/{index-UVpS_47e.es.js → index-DcqOqWRC.es.js} +3 -3
  6. package/dist/chunks/{index-B5hIswvq.cjs → index-s9auAjqk.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-C9OTu_pS.es.js → super-editor.es-D1glcoJr.es.js} +1251 -778
  8. package/dist/chunks/{super-editor.es-Cw1FmXd7.cjs → super-editor.es-DPd8_luo.cjs} +1251 -778
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
  11. package/dist/style.css +57 -15
  12. package/dist/super-editor/ai-writer.es.js +2 -2
  13. package/dist/super-editor/chunks/{converter-D6qfGG_6.js → converter-Z2aFlUnt.js} +540 -374
  14. package/dist/super-editor/chunks/{docx-zipper-BqmHhBsY.js → docx-zipper-DIZfYOpO.js} +1 -1
  15. package/dist/super-editor/chunks/{editor-5q11lIMq.js → editor-DCiWw1F7.js} +359 -58
  16. package/dist/super-editor/chunks/{index-sJFE-5Sw.js → index-C3nnrhrj.js} +1 -1
  17. package/dist/super-editor/chunks/{toolbar-BV-1nlen.js → toolbar-B5-PSkGu.js} +2 -2
  18. package/dist/super-editor/converter.es.js +1 -1
  19. package/dist/super-editor/docx-zipper.es.js +2 -2
  20. package/dist/super-editor/editor.es.js +3 -3
  21. package/dist/super-editor/file-zipper.es.js +1 -1
  22. package/dist/super-editor/style.css +57 -15
  23. package/dist/super-editor/super-editor/src/components/pagination-helpers.d.ts.map +1 -1
  24. package/dist/super-editor/super-editor/src/components/toolbar/defaultItems.d.ts.map +1 -1
  25. package/dist/super-editor/super-editor/src/components/toolbar/super-toolbar.d.ts.map +1 -1
  26. package/dist/super-editor/super-editor/src/core/Editor.d.ts.map +1 -1
  27. package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts.map +1 -1
  28. package/dist/super-editor/super-editor/src/core/super-converter/relationship-helpers.d.ts.map +1 -1
  29. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts.map +1 -1
  30. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts +6 -0
  31. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts.map +1 -1
  32. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts.map +1 -1
  33. package/dist/super-editor/super-editor/src/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  34. package/dist/super-editor/super-editor/src/extensions/index.d.ts +2 -1
  35. package/dist/super-editor/super-editor/src/extensions/index.d.ts.map +1 -1
  36. package/dist/super-editor/super-editor/src/extensions/page-number/page-number.d.ts.map +1 -1
  37. package/dist/super-editor/super-editor/src/extensions/pagination/pagination-helpers.d.ts.map +1 -1
  38. package/dist/super-editor/super-editor/src/extensions/pagination/pagination.d.ts.map +1 -1
  39. package/dist/super-editor/super-editor/src/extensions/search/prosemirror-search-patched.d.ts.map +1 -1
  40. package/dist/super-editor/super-editor/src/extensions/shape-group/ShapeGroupView.d.ts +22 -0
  41. package/dist/super-editor/super-editor/src/extensions/shape-group/ShapeGroupView.d.ts.map +1 -0
  42. package/dist/super-editor/super-editor/src/extensions/shape-group/index.d.ts +3 -0
  43. package/dist/super-editor/super-editor/src/extensions/shape-group/index.d.ts.map +1 -0
  44. package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts +3 -0
  45. package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts.map +1 -0
  46. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
  47. package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts +1 -0
  48. package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts.map +1 -1
  49. package/dist/super-editor/super-editor.es.js +25 -18
  50. package/dist/super-editor/toolbar.es.js +2 -2
  51. package/dist/super-editor.cjs +1 -1
  52. package/dist/super-editor.es.js +1 -1
  53. package/dist/superdoc.cjs +2 -2
  54. package/dist/superdoc.es.js +2 -2
  55. package/dist/superdoc.umd.js +1015 -542
  56. package/dist/superdoc.umd.js.map +1 -1
  57. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-D6qfGG_6.js";
1
+ import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-Z2aFlUnt.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,8 +12,8 @@ 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, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_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, applyIndentStyling_fn, _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 docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-D6qfGG_6.js";
16
- import { D as DocxZipper } from "./docx-zipper-BqmHhBsY.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 docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-Z2aFlUnt.js";
16
+ import { D as DocxZipper } from "./docx-zipper-DIZfYOpO.js";
17
17
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
@@ -11701,9 +11701,15 @@ const applyStyleIsolationClass = (target) => {
11701
11701
  if (!target || !target.classList) return;
11702
11702
  target.classList.add(STYLE_ISOLATION_CLASS);
11703
11703
  };
11704
+ const isHeadless = (editor) => {
11705
+ return editor?.options?.isHeadless ?? false;
11706
+ };
11707
+ const shouldSkipNodeView = (editor) => {
11708
+ return isHeadless(editor);
11709
+ };
11704
11710
  const PaginationPluginKey = new PluginKey("paginationPlugin");
11705
11711
  const initPaginationData = async (editor) => {
11706
- if (!editor.converter) return;
11712
+ if (isHeadless(editor) || !editor.converter) return;
11707
11713
  const sectionData = { headers: {}, footers: {} };
11708
11714
  const headerIds = editor.converter.headerIds.ids;
11709
11715
  const footerIds = editor.converter.footerIds.ids;
@@ -11839,6 +11845,7 @@ const broadcastEditorEvents = (editor, sectionEditor) => {
11839
11845
  });
11840
11846
  };
11841
11847
  const toggleHeaderFooterEditMode = ({ editor, focusedSectionEditor, isEditMode, documentMode }) => {
11848
+ if (isHeadless(editor)) return;
11842
11849
  editor.converter.headerEditors.forEach((item) => {
11843
11850
  item.editor.setEditable(isEditMode, false);
11844
11851
  item.editor.view.dom.setAttribute("aria-readonly", !isEditMode);
@@ -14955,10 +14962,12 @@ const _Editor = class _Editor extends EventEmitter {
14955
14962
  };
14956
14963
  if ("orientation" in screen && "addEventListener" in screen.orientation) {
14957
14964
  screen.orientation.addEventListener("change", handleResize);
14958
- } else {
14965
+ } else if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
14959
14966
  window.matchMedia("(orientation: portrait)").addEventListener("change", handleResize);
14960
14967
  }
14961
- window.addEventListener("resize", () => handleResize);
14968
+ if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
14969
+ window.addEventListener("resize", () => handleResize);
14970
+ }
14962
14971
  }
14963
14972
  /**
14964
14973
  * Get document identifier for telemetry (async - may generate hash)
@@ -15072,7 +15081,7 @@ const _Editor = class _Editor extends EventEmitter {
15072
15081
  { default: remarkStringify },
15073
15082
  { default: remarkGfm }
15074
15083
  ] = await Promise.all([
15075
- import("./index-sJFE-5Sw.js"),
15084
+ import("./index-C3nnrhrj.js"),
15076
15085
  import("./index-DRCvimau.js"),
15077
15086
  import("./index-C_x_N6Uh.js"),
15078
15087
  import("./index-D_sWOSiG.js"),
@@ -15124,7 +15133,7 @@ const _Editor = class _Editor extends EventEmitter {
15124
15133
  this.initDefaultStyles();
15125
15134
  hasMadeUpdate = true;
15126
15135
  }
15127
- if (hasMadeUpdate) {
15136
+ if (hasMadeUpdate && !isHeadless(this)) {
15128
15137
  const newTr = this.view.state.tr;
15129
15138
  newTr.setMeta("forceUpdatePagination", true);
15130
15139
  this.view.dispatch(newTr);
@@ -15290,7 +15299,7 @@ const _Editor = class _Editor extends EventEmitter {
15290
15299
  * @returns {Object | void} Migration results
15291
15300
  */
15292
15301
  processCollaborationMigrations() {
15293
- console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.9");
15302
+ console.debug("[checkVersionMigrations] Current editor version", "0.30.0-next.1");
15294
15303
  if (!this.options.ydoc) return;
15295
15304
  const metaMap = this.options.ydoc.getMap("meta");
15296
15305
  let docVersion = metaMap.get("version");
@@ -15802,16 +15811,18 @@ createView_fn = function(element) {
15802
15811
  handleClick: __privateMethod(this, _Editor_instances, handleNodeSelection_fn).bind(this),
15803
15812
  handleDoubleClick: async (view, pos, event) => {
15804
15813
  if (this.options.documentMode !== "editing") return;
15805
- const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
15806
- const isFooter = hasSomeParentWithClass(event.target, "pagination-section-footer");
15807
- if (isHeader || isFooter) {
15808
- const eventClone = new event.constructor(event.type);
15809
- event.target.dispatchEvent(eventClone);
15810
- if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
15811
- return;
15814
+ if (!isHeadless(this)) {
15815
+ const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
15816
+ const isFooter = hasSomeParentWithClass(event.target, "pagination-section-footer");
15817
+ if (isHeader || isFooter) {
15818
+ const eventClone = new event.constructor(event.type);
15819
+ event.target.dispatchEvent(eventClone);
15820
+ if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
15821
+ return;
15822
+ }
15812
15823
  }
15813
15824
  event.stopPropagation();
15814
- if (!this.options.editable) {
15825
+ if (!this.options.editable && !isHeadless(this)) {
15815
15826
  this.setEditable(true, false);
15816
15827
  toggleHeaderFooterEditMode({
15817
15828
  editor: this,
@@ -20490,9 +20501,6 @@ function orderedListSync(editor) {
20490
20501
  }
20491
20502
  });
20492
20503
  }
20493
- const shouldSkipNodeView = (editor) => {
20494
- return editor.options.isHeadless;
20495
- };
20496
20504
  const ListItem = Node$1.create({
20497
20505
  name: "listItem",
20498
20506
  content: "paragraph* block*",
@@ -26464,7 +26472,7 @@ const FieldAnnotation = Node$1.create({
26464
26472
  }
26465
26473
  if (dispatch) {
26466
26474
  commands2.updateFieldAnnotationsAttributes([annotation], attrs);
26467
- if (this.editor.options.pagination) {
26475
+ if (this.editor.options.pagination && !isHeadless(this.editor)) {
26468
26476
  setTimeout(() => {
26469
26477
  const newTr = this.editor.view.state.tr;
26470
26478
  newTr.setMeta("forceUpdatePagination", true);
@@ -28401,7 +28409,9 @@ const PageNumber = Node$1.create({
28401
28409
  const pageNumberNode = schema.nodeFromJSON(pageNumberNodeJSON);
28402
28410
  if (dispatch) {
28403
28411
  tr.replaceSelectionWith(pageNumberNode, false);
28404
- tr.setMeta("forceUpdatePagination", true);
28412
+ if (!isHeadless(editor)) {
28413
+ tr.setMeta("forceUpdatePagination", true);
28414
+ }
28405
28415
  }
28406
28416
  return true;
28407
28417
  }
@@ -31470,6 +31480,255 @@ const VectorShape = Node$1.create({
31470
31480
  };
31471
31481
  }
31472
31482
  });
31483
+ class ShapeGroupView {
31484
+ constructor(props) {
31485
+ __publicField(this, "node");
31486
+ __publicField(this, "view");
31487
+ __publicField(this, "getPos");
31488
+ __publicField(this, "decorations");
31489
+ __publicField(this, "innerDecorations");
31490
+ __publicField(this, "editor");
31491
+ __publicField(this, "extension");
31492
+ __publicField(this, "htmlAttributes");
31493
+ __publicField(this, "root");
31494
+ this.node = props.node;
31495
+ this.view = props.editor.view;
31496
+ this.getPos = props.getPos;
31497
+ this.decorations = props.decorations;
31498
+ this.innerDecorations = props.innerDecorations;
31499
+ this.editor = props.editor;
31500
+ this.extension = props.extension;
31501
+ this.htmlAttributes = props.htmlAttributes;
31502
+ this.mount();
31503
+ }
31504
+ mount() {
31505
+ this.buildView();
31506
+ }
31507
+ get dom() {
31508
+ return this.root;
31509
+ }
31510
+ get contentDOM() {
31511
+ return null;
31512
+ }
31513
+ createElement() {
31514
+ const attrs = this.node.attrs;
31515
+ const { groupTransform, shapes, size } = attrs;
31516
+ const container = document.createElement("div");
31517
+ container.classList.add("sd-shape-group");
31518
+ container.setAttribute("data-shape-group", "");
31519
+ const width = size?.width || groupTransform?.width || 300;
31520
+ const height = size?.height || groupTransform?.height || 200;
31521
+ container.style.width = `${width}px`;
31522
+ container.style.height = `${height}px`;
31523
+ container.style.position = "relative";
31524
+ container.style.display = "inline-block";
31525
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
31526
+ svg.setAttribute("version", "1.1");
31527
+ svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
31528
+ svg.setAttribute("width", width.toString());
31529
+ svg.setAttribute("height", height.toString());
31530
+ svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
31531
+ svg.style.display = "block";
31532
+ if (shapes && Array.isArray(shapes)) {
31533
+ shapes.forEach((shape) => {
31534
+ if (shape.shapeType === "vectorShape") {
31535
+ const shapeElement = this.createShapeElement(shape, groupTransform);
31536
+ if (shapeElement) {
31537
+ svg.appendChild(shapeElement);
31538
+ }
31539
+ }
31540
+ });
31541
+ }
31542
+ container.appendChild(svg);
31543
+ return { element: container };
31544
+ }
31545
+ createShapeElement(shape) {
31546
+ const attrs = shape.attrs;
31547
+ if (!attrs) return null;
31548
+ const x = attrs.x || 0;
31549
+ const y = attrs.y || 0;
31550
+ const width = attrs.width || 100;
31551
+ const height = attrs.height || 100;
31552
+ const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
31553
+ const transforms = [];
31554
+ transforms.push(`translate(${x}, ${y})`);
31555
+ if (attrs.rotation !== 0) {
31556
+ transforms.push(`rotate(${attrs.rotation} ${width / 2} ${height / 2})`);
31557
+ }
31558
+ if (attrs.flipH) {
31559
+ transforms.push(`scale(-1, 1) translate(${-width}, 0)`);
31560
+ }
31561
+ if (attrs.flipV) {
31562
+ transforms.push(`scale(1, -1) translate(0, ${-height})`);
31563
+ }
31564
+ if (transforms.length > 0) {
31565
+ g.setAttribute("transform", transforms.join(" "));
31566
+ }
31567
+ const shapeKind = attrs.kind || "rect";
31568
+ const fillColor = attrs.fillColor || "#5b9bd5";
31569
+ const strokeColor = attrs.strokeColor || "#000000";
31570
+ const strokeWidth = attrs.strokeWidth || 1;
31571
+ try {
31572
+ const svgContent = k({
31573
+ preset: shapeKind,
31574
+ styleOverrides: {
31575
+ fill: fillColor || "none",
31576
+ stroke: strokeColor || "none",
31577
+ strokeWidth: strokeWidth || 0
31578
+ },
31579
+ width,
31580
+ height
31581
+ });
31582
+ if (svgContent) {
31583
+ const tempDiv = document.createElement("div");
31584
+ tempDiv.innerHTML = svgContent;
31585
+ const svgElement = tempDiv.querySelector("svg");
31586
+ if (svgElement) {
31587
+ Array.from(svgElement.children).forEach((child) => {
31588
+ const clonedChild = child.cloneNode(true);
31589
+ if (clonedChild.tagName === "ellipse") {
31590
+ clonedChild.setAttribute("cx", (width / 2).toString());
31591
+ clonedChild.setAttribute("cy", (height / 2).toString());
31592
+ clonedChild.setAttribute("rx", (width / 2).toString());
31593
+ clonedChild.setAttribute("ry", (height / 2).toString());
31594
+ } else if (clonedChild.tagName === "circle") {
31595
+ if (width !== height) {
31596
+ const ellipse = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
31597
+ ellipse.setAttribute("cx", (width / 2).toString());
31598
+ ellipse.setAttribute("cy", (height / 2).toString());
31599
+ ellipse.setAttribute("rx", (width / 2).toString());
31600
+ ellipse.setAttribute("ry", (height / 2).toString());
31601
+ Array.from(clonedChild.attributes).forEach((attr) => {
31602
+ if (!["cx", "cy", "r"].includes(attr.name)) {
31603
+ ellipse.setAttribute(attr.name, attr.value);
31604
+ }
31605
+ });
31606
+ g.appendChild(ellipse);
31607
+ return;
31608
+ } else {
31609
+ clonedChild.setAttribute("cx", (width / 2).toString());
31610
+ clonedChild.setAttribute("cy", (height / 2).toString());
31611
+ clonedChild.setAttribute("r", (width / 2).toString());
31612
+ }
31613
+ } else if (clonedChild.tagName === "rect") {
31614
+ clonedChild.setAttribute("width", width.toString());
31615
+ clonedChild.setAttribute("height", height.toString());
31616
+ } else if (clonedChild.tagName === "path" && svgElement.hasAttribute("viewBox")) {
31617
+ const viewBox = svgElement.getAttribute("viewBox").split(" ").map(Number);
31618
+ if (viewBox.length === 4) {
31619
+ const [, , vbWidth, vbHeight] = viewBox;
31620
+ const scaleX = width / vbWidth;
31621
+ const scaleY = height / vbHeight;
31622
+ if (scaleX !== 1 || scaleY !== 1) {
31623
+ const pathTransform = `scale(${scaleX}, ${scaleY})`;
31624
+ const existingTransform = clonedChild.getAttribute("transform");
31625
+ clonedChild.setAttribute(
31626
+ "transform",
31627
+ existingTransform ? `${existingTransform} ${pathTransform}` : pathTransform
31628
+ );
31629
+ }
31630
+ }
31631
+ } else if (clonedChild.hasAttribute("width")) {
31632
+ clonedChild.setAttribute("width", width.toString());
31633
+ }
31634
+ if (clonedChild.hasAttribute("height") && clonedChild.tagName !== "ellipse") {
31635
+ clonedChild.setAttribute("height", height.toString());
31636
+ }
31637
+ g.appendChild(clonedChild);
31638
+ });
31639
+ }
31640
+ }
31641
+ } catch (error) {
31642
+ console.warn("Failed to generate shape SVG:", error);
31643
+ const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
31644
+ rect.setAttribute("width", width.toString());
31645
+ rect.setAttribute("height", height.toString());
31646
+ rect.setAttribute("fill", fillColor);
31647
+ rect.setAttribute("stroke", strokeColor);
31648
+ rect.setAttribute("stroke-width", strokeWidth.toString());
31649
+ g.appendChild(rect);
31650
+ }
31651
+ return g;
31652
+ }
31653
+ buildView() {
31654
+ const { element } = this.createElement();
31655
+ this.root = element;
31656
+ }
31657
+ update() {
31658
+ return false;
31659
+ }
31660
+ }
31661
+ const ShapeGroup = Node$1.create({
31662
+ name: "shapeGroup",
31663
+ group: "inline",
31664
+ inline: true,
31665
+ atom: true,
31666
+ addOptions() {
31667
+ return {
31668
+ htmlAttributes: {
31669
+ contenteditable: false
31670
+ }
31671
+ };
31672
+ },
31673
+ addAttributes() {
31674
+ return {
31675
+ groupTransform: {
31676
+ default: {},
31677
+ renderDOM: () => ({})
31678
+ },
31679
+ shapes: {
31680
+ default: [],
31681
+ renderDOM: () => ({})
31682
+ },
31683
+ size: {
31684
+ default: null,
31685
+ renderDOM: (attrs) => {
31686
+ if (!attrs.size) return {};
31687
+ const sizeData = {};
31688
+ if (attrs.size.width) sizeData["data-width"] = attrs.size.width;
31689
+ if (attrs.size.height) sizeData["data-height"] = attrs.size.height;
31690
+ return sizeData;
31691
+ }
31692
+ },
31693
+ padding: {
31694
+ default: null,
31695
+ renderDOM: (attrs) => {
31696
+ if (!attrs.padding) return {};
31697
+ const paddingData = {};
31698
+ if (attrs.padding.top != null) paddingData["data-padding-top"] = attrs.padding.top;
31699
+ if (attrs.padding.right != null) paddingData["data-padding-right"] = attrs.padding.right;
31700
+ if (attrs.padding.bottom != null) paddingData["data-padding-bottom"] = attrs.padding.bottom;
31701
+ if (attrs.padding.left != null) paddingData["data-padding-left"] = attrs.padding.left;
31702
+ return paddingData;
31703
+ }
31704
+ },
31705
+ marginOffset: {
31706
+ default: null,
31707
+ renderDOM: (attrs) => {
31708
+ if (!attrs.marginOffset) return {};
31709
+ const offsetData = {};
31710
+ if (attrs.marginOffset.horizontal != null) offsetData["data-offset-x"] = attrs.marginOffset.horizontal;
31711
+ if (attrs.marginOffset.top != null) offsetData["data-offset-y"] = attrs.marginOffset.top;
31712
+ return offsetData;
31713
+ }
31714
+ },
31715
+ drawingContent: {
31716
+ rendered: false
31717
+ }
31718
+ };
31719
+ },
31720
+ parseDOM() {
31721
+ return false;
31722
+ },
31723
+ renderDOM({ htmlAttributes }) {
31724
+ return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-shape-group": "" })];
31725
+ },
31726
+ addNodeView() {
31727
+ return (props) => {
31728
+ return new ShapeGroupView({ ...props });
31729
+ };
31730
+ }
31731
+ });
31473
31732
  const TextStyle = Mark.create({
31474
31733
  name: "textStyle",
31475
31734
  addOptions() {
@@ -36819,6 +37078,10 @@ const Pagination = Extension.create({
36819
37078
  };
36820
37079
  },
36821
37080
  addCommands() {
37081
+ const editor = this.editor;
37082
+ if (isHeadless(editor)) {
37083
+ return {};
37084
+ }
36822
37085
  return {
36823
37086
  insertPageBreak: () => ({ commands: commands2 }) => {
36824
37087
  return commands2.insertContent({
@@ -36829,20 +37092,26 @@ const Pagination = Extension.create({
36829
37092
  * Toggle pagination on/off
36830
37093
  * @returns {void}
36831
37094
  */
36832
- togglePagination: () => ({ tr, state, dispatch, editor }) => {
37095
+ togglePagination: () => ({ tr, state, dispatch, editor: editor2 }) => {
36833
37096
  const isEnabled = PaginationPluginKey.getState(state)?.isEnabled;
36834
37097
  tr.setMeta(PaginationPluginKey, { isEnabled: !isEnabled });
36835
37098
  if (dispatch) {
36836
37099
  dispatch(tr);
36837
- editor.initDefaultStyles(editor.element, !isEnabled);
37100
+ editor2.initDefaultStyles(editor2.element, !isEnabled);
36838
37101
  return true;
36839
37102
  }
36840
37103
  }
36841
37104
  };
36842
37105
  },
36843
37106
  addShortcuts() {
37107
+ const editor = this.editor;
37108
+ if (isHeadless(editor)) {
37109
+ return {};
37110
+ }
36844
37111
  return {
36845
- "Mod-Enter": () => this.editor.commands.insertPageBreak()
37112
+ "Mod-Enter": () => {
37113
+ return editor.commands.insertPageBreak();
37114
+ }
36846
37115
  };
36847
37116
  },
36848
37117
  /**
@@ -36850,6 +37119,9 @@ const Pagination = Extension.create({
36850
37119
  */
36851
37120
  addPmPlugins() {
36852
37121
  const editor = this.editor;
37122
+ if (isHeadless(editor)) {
37123
+ return [];
37124
+ }
36853
37125
  let isUpdating = false;
36854
37126
  let shouldUpdate = false;
36855
37127
  let hasInitialized = false;
@@ -36865,7 +37137,7 @@ const Pagination = Extension.create({
36865
37137
  isReadyToInit: false,
36866
37138
  decorations: DecorationSet.empty,
36867
37139
  isDebugging,
36868
- isEnabled: editor.options.pagination
37140
+ isEnabled: editor.options.pagination && !isHeadless(editor)
36869
37141
  };
36870
37142
  },
36871
37143
  apply(tr, oldState, prevEditorState, newEditorState) {
@@ -36943,6 +37215,7 @@ const Pagination = Extension.create({
36943
37215
  let previousDecorations = DecorationSet.empty;
36944
37216
  return {
36945
37217
  update: (view) => {
37218
+ if (isHeadless(editor)) return;
36946
37219
  if (!PaginationPluginKey.getState(view.state)?.isEnabled) return;
36947
37220
  if (!shouldUpdate || isUpdating) return;
36948
37221
  const performPaginationUpdate = () => {
@@ -36966,6 +37239,7 @@ const Pagination = Extension.create({
36966
37239
  },
36967
37240
  props: {
36968
37241
  decorations(state) {
37242
+ if (isHeadless(editor)) return DecorationSet.empty;
36969
37243
  const pluginState = PaginationPluginKey.getState(state);
36970
37244
  return pluginState.isEnabled ? pluginState.decorations : DecorationSet.empty;
36971
37245
  }
@@ -37334,7 +37608,7 @@ const getHeaderFooterEditorKey = ({ pageNumber, isHeader, isFooter, isFirstHeade
37334
37608
  return void 0;
37335
37609
  };
37336
37610
  const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
37337
- if (editor.options.documentMode !== "editing") return;
37611
+ if (isHeadless(editor) || editor.options.documentMode !== "editing") return;
37338
37612
  editor.setEditable(false, false);
37339
37613
  toggleHeaderFooterEditMode({
37340
37614
  editor,
@@ -37406,6 +37680,7 @@ function getActualBreakCoords(view, pos, calculatedThreshold) {
37406
37680
  return actualBreak;
37407
37681
  }
37408
37682
  const onImageLoad = (editor) => {
37683
+ if (isHeadless(editor)) return;
37409
37684
  if (typeof requestAnimationFrame !== "function") return;
37410
37685
  requestAnimationFrame(() => {
37411
37686
  const newTr = editor.view.state.tr;
@@ -37710,6 +37985,7 @@ function validRegExp(source) {
37710
37985
  }
37711
37986
  }
37712
37987
  const TextContentCache = /* @__PURE__ */ new WeakMap();
37988
+ const transparentInlineNodes = /* @__PURE__ */ new Set(["run", "bookmarkStart"]);
37713
37989
  function textContent(node) {
37714
37990
  let cached = TextContentCache.get(node);
37715
37991
  if (cached) return cached;
@@ -37718,7 +37994,7 @@ function textContent(node) {
37718
37994
  let child = node.child(i);
37719
37995
  if (child.isText) content += child.text;
37720
37996
  else if (child.isLeaf) content += "";
37721
- else if (child.type && child.type.name === "run") content += textContent(child);
37997
+ else if (child.type && transparentInlineNodes.has(child.type.name)) content += textContent(child);
37722
37998
  else content += " " + textContent(child) + " ";
37723
37999
  }
37724
38000
  TextContentCache.set(node, content);
@@ -37726,26 +38002,49 @@ function textContent(node) {
37726
38002
  }
37727
38003
  function mapIndexToDocPos(node, start2, index2) {
37728
38004
  if (index2 <= 0) return start2;
37729
- const fullText = textContent(node);
37730
- if (index2 >= fullText.length) return start2 + node.content.size;
37731
- let target = start2;
37732
- let remaining = index2;
37733
- let found = false;
37734
- node.descendants((child, pos) => {
37735
- if (found) return false;
37736
- if (!child.isText) return true;
37737
- const len = child.text.length;
37738
- if (remaining <= len) {
37739
- target = start2 + pos + remaining;
37740
- found = true;
37741
- return false;
38005
+ const fullTextLength = textContent(node).length;
38006
+ if (index2 >= fullTextLength) return start2 + node.content.size;
38007
+ return mapIndexWithinNode(node, start2, index2);
38008
+ }
38009
+ function mapIndexWithinNode(node, start2, index2) {
38010
+ if (index2 <= 0) return start2;
38011
+ let offset2 = start2;
38012
+ for (let i = 0; i < node.childCount; i++) {
38013
+ const child = node.child(i);
38014
+ const childStart = offset2;
38015
+ if (child.isText) {
38016
+ const len = child.text.length;
38017
+ if (index2 <= len) return childStart + index2;
38018
+ index2 -= len;
38019
+ offset2 += child.nodeSize;
38020
+ continue;
37742
38021
  }
37743
- remaining -= len;
37744
- return true;
37745
- });
37746
- return found ? target : start2 + node.content.size;
38022
+ if (child.isLeaf) {
38023
+ if (index2 <= 1) return childStart + Math.min(index2, 1);
38024
+ index2 -= 1;
38025
+ offset2 += child.nodeSize;
38026
+ continue;
38027
+ }
38028
+ const isTransparentInline = child.inlineContent && child.type && transparentInlineNodes.has(child.type.name);
38029
+ const innerTextLength = textContent(child).length;
38030
+ if (isTransparentInline) {
38031
+ if (index2 <= innerTextLength) return mapIndexWithinNode(child, childStart + 1, index2);
38032
+ index2 -= innerTextLength;
38033
+ offset2 += child.nodeSize;
38034
+ continue;
38035
+ }
38036
+ const contribution = innerTextLength + 2;
38037
+ const relativeIndex = index2 - 1;
38038
+ if (relativeIndex < 0) return childStart;
38039
+ if (relativeIndex <= innerTextLength) {
38040
+ return mapIndexWithinNode(child, childStart + 1, relativeIndex);
38041
+ }
38042
+ if (relativeIndex === innerTextLength + 1) return childStart + child.nodeSize;
38043
+ index2 -= contribution;
38044
+ offset2 += child.nodeSize;
38045
+ }
38046
+ return start2 + node.content.size;
37747
38047
  }
37748
- const transparentInlineNodes = /* @__PURE__ */ new Set(["run"]);
37749
38048
  function scanTextblocks(node, from2, to, f2, nodeStart = 0) {
37750
38049
  const isTransparentInline = node.inlineContent && node.type && transparentInlineNodes.has(node.type.name);
37751
38050
  if (node.inlineContent && !isTransparentInline) {
@@ -38221,9 +38520,9 @@ const NodeResizer = Extension.create({
38221
38520
  return {};
38222
38521
  },
38223
38522
  addPmPlugins() {
38224
- const isHeadless = this.editor.options.isHeadless;
38523
+ const isHeadless2 = this.editor.options.isHeadless;
38225
38524
  const hasDocument = typeof document !== "undefined";
38226
- if (isHeadless || !hasDocument) return [];
38525
+ if (isHeadless2 || !hasDocument) return [];
38227
38526
  return [nodeResizer(["image"], this.editor)];
38228
38527
  }
38229
38528
  });
@@ -38343,7 +38642,8 @@ const getStarterExtensions = () => {
38343
38642
  NodeResizer,
38344
38643
  CustomSelection,
38345
38644
  TextTransform,
38346
- VectorShape
38645
+ VectorShape,
38646
+ ShapeGroup
38347
38647
  ];
38348
38648
  };
38349
38649
  export {
@@ -38369,17 +38669,18 @@ export {
38369
38669
  undoDepth as j,
38370
38670
  redoDepth as k,
38371
38671
  collectTrackedChangesForContext as l,
38372
- getStarterExtensions as m,
38373
- getRichTextExtensions as n,
38374
- Decoration as o,
38375
- Extension as p,
38376
- index$1 as q,
38672
+ isHeadless as m,
38673
+ getStarterExtensions as n,
38674
+ getRichTextExtensions as o,
38675
+ Decoration as p,
38676
+ Extension as q,
38377
38677
  replaceSelectionWithImagePlaceholder as r,
38378
38678
  shouldBypassContextMenu as s,
38379
- index as t,
38679
+ index$1 as t,
38380
38680
  useHighContrastMode as u,
38381
- AnnotatorHelpers as v,
38382
- SectionHelpers as w,
38383
- getAllowedImageDimensions as x,
38384
- yUndoPluginKey as y
38681
+ index as v,
38682
+ AnnotatorHelpers as w,
38683
+ SectionHelpers as x,
38684
+ yUndoPluginKey as y,
38685
+ getAllowedImageDimensions as z
38385
38686
  };
@@ -1,4 +1,4 @@
1
- import { aA as getDefaultExportFromCjs } from "./converter-D6qfGG_6.js";
1
+ import { aA as getDefaultExportFromCjs } from "./converter-Z2aFlUnt.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -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-D6qfGG_6.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-5q11lIMq.js";
2
+ import { p as process$1 } from "./converter-Z2aFlUnt.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DCiWw1F7.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-D6qfGG_6.js";
1
+ import { a5 } from "./chunks/converter-Z2aFlUnt.js";
2
2
  export {
3
3
  a5 as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-D6qfGG_6.js";
2
- import { D } from "./chunks/docx-zipper-BqmHhBsY.js";
1
+ import "./chunks/converter-Z2aFlUnt.js";
2
+ import { D } from "./chunks/docx-zipper-DIZfYOpO.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-5q11lIMq.js";
2
- import "./chunks/converter-D6qfGG_6.js";
3
- import "./chunks/docx-zipper-BqmHhBsY.js";
1
+ import { E } from "./chunks/editor-DCiWw1F7.js";
2
+ import "./chunks/converter-Z2aFlUnt.js";
3
+ import "./chunks/docx-zipper-DIZfYOpO.js";
4
4
  export {
5
5
  E as Editor
6
6
  };