@harbour-enterprises/superdoc 1.0.0-beta.61 → 1.0.0-beta.63

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 (30) hide show
  1. package/dist/chunks/{PdfViewer-CuTlpPQO.cjs → PdfViewer-Dc7zft9M.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BHLsVrSe.es.js → PdfViewer-Enk2l025.es.js} +1 -1
  3. package/dist/chunks/{index-u8dj63PM-Bfomc8Z6.es.js → index-BO5Ne6G9-BxC5lPet.es.js} +1 -1
  4. package/dist/chunks/{index-u8dj63PM-VgHx1nNP.cjs → index-BO5Ne6G9-njLy4w3i.cjs} +1 -1
  5. package/dist/chunks/{index-E5x6cBKw.cjs → index-DZPXVd1d.cjs} +3 -3
  6. package/dist/chunks/{index-DeFp1DEO.es.js → index-KZsFukCq.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-nY9_xN6Z.cjs → super-editor.es-Crw7wu2n.cjs} +206 -68
  8. package/dist/chunks/{super-editor.es-CI3WoKIG.es.js → super-editor.es-DhGXcD3R.es.js} +206 -68
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/style.css +29 -29
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-DaSkPzA9.js → converter-C4bE8Uad.js} +164 -46
  13. package/dist/super-editor/chunks/{docx-zipper-Cx1zgQ8B.js → docx-zipper-BIkbwyZO.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-45pxcsTR.js → editor-ByMtGRzi.js} +33 -20
  15. package/dist/super-editor/chunks/{index-u8dj63PM.js → index-BO5Ne6G9.js} +1 -1
  16. package/dist/super-editor/chunks/{toolbar-C4OC-AnI.js → toolbar-DFgaXUsx.js} +2 -2
  17. package/dist/super-editor/converter.es.js +1 -1
  18. package/dist/super-editor/docx-zipper.es.js +2 -2
  19. package/dist/super-editor/editor.es.js +3 -3
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/style.css +29 -29
  22. package/dist/super-editor/super-editor.es.js +17 -10
  23. package/dist/super-editor/toolbar.es.js +2 -2
  24. package/dist/super-editor.cjs +1 -1
  25. package/dist/super-editor.es.js +1 -1
  26. package/dist/superdoc.cjs +2 -2
  27. package/dist/superdoc.es.js +2 -2
  28. package/dist/superdoc.umd.js +208 -70
  29. package/dist/superdoc.umd.js.map +1 -1
  30. package/package.json +1 -1
@@ -42431,11 +42431,71 @@ const _SuperConverter = class _SuperConverter {
42431
42431
  return JSON.parse(xmljs.xml2json(newXml, null, 2));
42432
42432
  }
42433
42433
  /**
42434
- * Generic method to get a stored custom property from docx
42434
+ * Checks if an element name matches the expected local name, with or without namespace prefix.
42435
+ * This helper supports custom namespace prefixes in DOCX files (e.g., 'op:Properties', 'custom:property').
42436
+ *
42437
+ * @private
42438
+ * @static
42439
+ * @param {string|undefined|null} elementName - The element name to check (may include namespace prefix)
42440
+ * @param {string} expectedLocalName - The expected local name without prefix
42441
+ * @returns {boolean} True if the element name matches (with or without prefix)
42442
+ *
42443
+ * @example
42444
+ * // Exact match without prefix
42445
+ * _matchesElementName('Properties', 'Properties') // => true
42446
+ *
42447
+ * @example
42448
+ * // Match with namespace prefix
42449
+ * _matchesElementName('op:Properties', 'Properties') // => true
42450
+ * _matchesElementName('custom:property', 'property') // => true
42451
+ *
42452
+ * @example
42453
+ * // No match
42454
+ * _matchesElementName('SomeOtherElement', 'Properties') // => false
42455
+ * _matchesElementName(':Properties', 'Properties') // => false (empty prefix)
42456
+ */
42457
+ static _matchesElementName(elementName, expectedLocalName) {
42458
+ if (!elementName || typeof elementName !== "string") return false;
42459
+ if (!expectedLocalName) return false;
42460
+ if (elementName === expectedLocalName) return true;
42461
+ if (elementName.endsWith(`:${expectedLocalName}`)) {
42462
+ const prefix = elementName.slice(0, -(expectedLocalName.length + 1));
42463
+ return prefix.length > 0;
42464
+ }
42465
+ return false;
42466
+ }
42467
+ /**
42468
+ * Generic method to get a stored custom property from docx.
42469
+ * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
42470
+ *
42435
42471
  * @static
42436
42472
  * @param {Array} docx - Array of docx file objects
42437
42473
  * @param {string} propertyName - Name of the property to retrieve
42438
42474
  * @returns {string|null} The property value or null if not found
42475
+ *
42476
+ * Returns null in the following cases:
42477
+ * - docx array is empty or doesn't contain 'docProps/custom.xml'
42478
+ * - custom.xml cannot be parsed
42479
+ * - Properties element is not found (with or without namespace prefix)
42480
+ * - Property with the specified name is not found
42481
+ * - Property has malformed structure (missing nested elements or text)
42482
+ * - Any error occurs during parsing or retrieval
42483
+ *
42484
+ * @example
42485
+ * // Standard property without namespace prefix
42486
+ * const version = SuperConverter.getStoredCustomProperty(docx, 'SuperdocVersion');
42487
+ * // => '1.2.3'
42488
+ *
42489
+ * @example
42490
+ * // Property with namespace prefix (e.g., from Office 365)
42491
+ * const guid = SuperConverter.getStoredCustomProperty(docx, 'DocumentGuid');
42492
+ * // Works with both 'Properties' and 'op:Properties' elements
42493
+ * // => 'abc-123-def-456'
42494
+ *
42495
+ * @example
42496
+ * // Non-existent property
42497
+ * const missing = SuperConverter.getStoredCustomProperty(docx, 'NonExistent');
42498
+ * // => null
42439
42499
  */
42440
42500
  static getStoredCustomProperty(docx, propertyName) {
42441
42501
  try {
@@ -42444,10 +42504,16 @@ const _SuperConverter = class _SuperConverter {
42444
42504
  const converter = new _SuperConverter();
42445
42505
  const content = customXml.content;
42446
42506
  const contentJson = converter.parseXmlToJson(content);
42447
- const properties = contentJson.elements?.find((el) => el.name === "Properties");
42507
+ const properties = contentJson?.elements?.find((el) => _SuperConverter._matchesElementName(el.name, "Properties"));
42448
42508
  if (!properties?.elements) return null;
42449
- const property = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
42509
+ const property = properties.elements.find(
42510
+ (el) => _SuperConverter._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42511
+ );
42450
42512
  if (!property) return null;
42513
+ if (!property.elements?.[0]?.elements?.[0]?.text) {
42514
+ console.warn(`Malformed property structure for "${propertyName}"`);
42515
+ return null;
42516
+ }
42451
42517
  return property.elements[0].elements[0].text;
42452
42518
  } catch (e) {
42453
42519
  console.warn(`Error getting custom property ${propertyName}:`, e);
@@ -42455,60 +42521,112 @@ const _SuperConverter = class _SuperConverter {
42455
42521
  }
42456
42522
  }
42457
42523
  /**
42458
- * Generic method to set a stored custom property in docx
42524
+ * Generic method to set a stored custom property in docx.
42525
+ * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
42526
+ *
42459
42527
  * @static
42460
- * @param {Object} docx - The docx object to store the property in
42528
+ * @param {Object} docx - The docx object to store the property in (converted XML structure)
42461
42529
  * @param {string} propertyName - Name of the property
42462
42530
  * @param {string|Function} value - Value or function that returns the value
42463
42531
  * @param {boolean} preserveExisting - If true, won't overwrite existing values
42464
- * @returns {string} The stored value
42532
+ * @returns {string|null} The stored value, or null if Properties element is not found
42533
+ *
42534
+ * @throws {Error} If an error occurs during property setting (logged as warning)
42535
+ *
42536
+ * @example
42537
+ * // Set a new property
42538
+ * const value = SuperConverter.setStoredCustomProperty(docx, 'MyProperty', 'MyValue');
42539
+ * // => 'MyValue'
42540
+ *
42541
+ * @example
42542
+ * // Set a property with a function
42543
+ * const guid = SuperConverter.setStoredCustomProperty(docx, 'DocumentGuid', () => uuidv4());
42544
+ * // => 'abc-123-def-456'
42545
+ *
42546
+ * @example
42547
+ * // Preserve existing value
42548
+ * SuperConverter.setStoredCustomProperty(docx, 'MyProperty', 'NewValue', true);
42549
+ * // => 'MyValue' (original value preserved)
42550
+ *
42551
+ * @example
42552
+ * // Works with namespace prefixes
42553
+ * // If docx has 'op:Properties' and 'op:property' elements, this will handle them correctly
42554
+ * const version = SuperConverter.setStoredCustomProperty(docx, 'Version', '2.0.0');
42555
+ * // => '2.0.0'
42465
42556
  */
42466
42557
  static setStoredCustomProperty(docx, propertyName, value, preserveExisting = false) {
42467
- const customLocation = "docProps/custom.xml";
42468
- if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
42469
- const customXml = docx[customLocation];
42470
- const properties = customXml.elements?.find((el) => el.name === "Properties");
42471
- if (!properties) return null;
42472
- if (!properties.elements) properties.elements = [];
42473
- let property = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
42474
- if (property && preserveExisting) {
42475
- return property.elements[0].elements[0].text;
42476
- }
42477
- const finalValue = typeof value === "function" ? value() : value;
42478
- if (!property) {
42479
- const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
42480
- const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42481
- property = {
42482
- type: "element",
42483
- name: "property",
42484
- attributes: {
42485
- name: propertyName,
42486
- fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
42487
- pid
42488
- },
42489
- elements: [
42490
- {
42491
- type: "element",
42492
- name: "vt:lpwstr",
42493
- elements: [
42494
- {
42495
- type: "text",
42496
- text: finalValue
42497
- }
42498
- ]
42499
- }
42500
- ]
42501
- };
42502
- properties.elements.push(property);
42503
- } else {
42504
- property.elements[0].elements[0].text = finalValue;
42558
+ try {
42559
+ const customLocation = "docProps/custom.xml";
42560
+ if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
42561
+ const customXml = docx[customLocation];
42562
+ const properties = customXml.elements?.find((el) => _SuperConverter._matchesElementName(el.name, "Properties"));
42563
+ if (!properties) return null;
42564
+ if (!properties.elements) properties.elements = [];
42565
+ let property = properties.elements.find(
42566
+ (el) => _SuperConverter._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42567
+ );
42568
+ if (property && preserveExisting) {
42569
+ if (!property.elements?.[0]?.elements?.[0]?.text) {
42570
+ console.warn(`Malformed existing property structure for "${propertyName}"`);
42571
+ return null;
42572
+ }
42573
+ return property.elements[0].elements[0].text;
42574
+ }
42575
+ const finalValue = typeof value === "function" ? value() : value;
42576
+ if (!property) {
42577
+ const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
42578
+ const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42579
+ property = {
42580
+ type: "element",
42581
+ name: "property",
42582
+ attributes: {
42583
+ name: propertyName,
42584
+ fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
42585
+ pid
42586
+ },
42587
+ elements: [
42588
+ {
42589
+ type: "element",
42590
+ name: "vt:lpwstr",
42591
+ elements: [
42592
+ {
42593
+ type: "text",
42594
+ text: finalValue
42595
+ }
42596
+ ]
42597
+ }
42598
+ ]
42599
+ };
42600
+ properties.elements.push(property);
42601
+ } else {
42602
+ if (!property.elements?.[0]?.elements?.[0]) {
42603
+ console.warn(`Malformed property structure for "${propertyName}", recreating structure`);
42604
+ property.elements = [
42605
+ {
42606
+ type: "element",
42607
+ name: "vt:lpwstr",
42608
+ elements: [
42609
+ {
42610
+ type: "text",
42611
+ text: finalValue
42612
+ }
42613
+ ]
42614
+ }
42615
+ ];
42616
+ } else {
42617
+ property.elements[0].elements[0].text = finalValue;
42618
+ }
42619
+ }
42620
+ return finalValue;
42621
+ } catch (e) {
42622
+ console.warn(`Error setting custom property ${propertyName}:`, e);
42623
+ return null;
42505
42624
  }
42506
- return finalValue;
42507
42625
  }
42508
42626
  static getStoredSuperdocVersion(docx) {
42509
42627
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42510
42628
  }
42511
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.61") {
42629
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.63") {
42512
42630
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42513
42631
  }
42514
42632
  /**
@@ -1,4 +1,4 @@
1
- import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-DaSkPzA9.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-C4bE8Uad.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, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_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, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
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 htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as resolveRunProperties, at as encodeCSSFromPPr, au as twipsToPixels$2, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-DaSkPzA9.js";
16
- import { D as DocxZipper } from "./docx-zipper-Cx1zgQ8B.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 htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as resolveRunProperties, at as encodeCSSFromPPr, au as twipsToPixels$2, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-C4bE8Uad.js";
16
+ import { D as DocxZipper } from "./docx-zipper-BIkbwyZO.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() {
@@ -13923,7 +13923,7 @@ const isHeadless = (editor) => {
13923
13923
  const shouldSkipNodeView = (editor) => {
13924
13924
  return isHeadless(editor);
13925
13925
  };
13926
- const summaryVersion = "1.0.0-beta.61";
13926
+ const summaryVersion = "1.0.0-beta.63";
13927
13927
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
13928
13928
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
13929
13929
  function mapAttributes(attrs) {
@@ -14715,7 +14715,7 @@ const _Editor = class _Editor extends EventEmitter {
14715
14715
  { default: remarkStringify },
14716
14716
  { default: remarkGfm }
14717
14717
  ] = await Promise.all([
14718
- import("./index-u8dj63PM.js"),
14718
+ import("./index-BO5Ne6G9.js"),
14719
14719
  import("./index-DRCvimau.js"),
14720
14720
  import("./index-C_x_N6Uh.js"),
14721
14721
  import("./index-D_sWOSiG.js"),
@@ -14920,7 +14920,7 @@ const _Editor = class _Editor extends EventEmitter {
14920
14920
  * Process collaboration migrations
14921
14921
  */
14922
14922
  processCollaborationMigrations() {
14923
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.61");
14923
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.63");
14924
14924
  if (!this.options.ydoc) return;
14925
14925
  const metaMap = this.options.ydoc.getMap("meta");
14926
14926
  let docVersion = metaMap.get("version");
@@ -18981,12 +18981,6 @@ const Engines = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
18981
18981
  resolveSpacingIndent: resolveSpacingIndent$1,
18982
18982
  scaleWrapPolygon
18983
18983
  }, Symbol.toStringTag, { value: "Module" }));
18984
- const extractHeaderFooterSpace = (margins) => {
18985
- return {
18986
- headerSpace: margins?.header ?? 0,
18987
- footerSpace: margins?.footer ?? 0
18988
- };
18989
- };
18990
18984
  const hasParagraphStyleContext = (context) => {
18991
18985
  return Boolean(context?.docx);
18992
18986
  };
@@ -21901,8 +21895,7 @@ const normalizeRowHeight = (rowProps) => {
21901
21895
  if (rawValue == null) return void 0;
21902
21896
  const rawRule = heightObj.rule ?? heightObj.hRule;
21903
21897
  const rule = rawRule === "exact" || rawRule === "atLeast" || rawRule === "auto" ? rawRule : "atLeast";
21904
- const isLikelyTwips = rawValue >= 300 || Math.abs(rawValue % 15) < 1e-6;
21905
- const valuePx = isLikelyTwips ? twipsToPx$1(rawValue) : rawValue;
21898
+ const valuePx = twipsToPx$1(rawValue);
21906
21899
  return {
21907
21900
  value: valuePx,
21908
21901
  rule
@@ -27238,6 +27231,7 @@ const _DomPainter = class _DomPainter {
27238
27231
  container.style.height = `${data.height}px`;
27239
27232
  container.style.top = `${Math.max(0, offset2)}px`;
27240
27233
  container.style.zIndex = "1";
27234
+ container.style.overflow = "visible";
27241
27235
  let footerYOffset = 0;
27242
27236
  if (kind === "footer" && data.fragments.length > 0) {
27243
27237
  const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max2, f2) => {
@@ -36250,7 +36244,14 @@ async function measureParagraphBlock(block, maxWidth) {
36250
36244
  leftJustifiedMarkerSpace = markerBoxWidth + gutterWidth;
36251
36245
  }
36252
36246
  }
36253
- const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
36247
+ let initialAvailableWidth;
36248
+ const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
36249
+ const textStartPx = wordLayout?.textStartPx;
36250
+ if (isFirstLineIndentMode && typeof textStartPx === "number" && textStartPx > 0) {
36251
+ initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
36252
+ } else {
36253
+ initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
36254
+ }
36254
36255
  const tabStops = buildTabStopsPx(
36255
36256
  indent,
36256
36257
  block.attrs?.tabs,
@@ -38273,7 +38274,9 @@ class HeaderFooterLayoutAdapter {
38273
38274
  const batch = {};
38274
38275
  let hasBlocks = false;
38275
38276
  descriptors.forEach((descriptor) => {
38276
- if (!descriptor.variant) return;
38277
+ if (!descriptor.variant) {
38278
+ return;
38279
+ }
38277
38280
  const blocks = __privateMethod(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
38278
38281
  if (blocks && blocks.length > 0) {
38279
38282
  batch[descriptor.variant] = blocks;
@@ -41993,14 +41996,20 @@ computeHeaderFooterConstraints_fn = function() {
41993
41996
  const margins = __privateGet(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
41994
41997
  const marginLeft = margins.left ?? DEFAULT_MARGINS.left;
41995
41998
  const marginRight = margins.right ?? DEFAULT_MARGINS.right;
41996
- const width = pageSize.w - (marginLeft + marginRight);
41997
- if (!Number.isFinite(width) || width <= 0) {
41999
+ const bodyContentWidth = pageSize.w - (marginLeft + marginRight);
42000
+ if (!Number.isFinite(bodyContentWidth) || bodyContentWidth <= 0) {
41998
42001
  return null;
41999
42002
  }
42000
- const { headerSpace, footerSpace } = extractHeaderFooterSpace(margins);
42001
- const height = Math.max(headerSpace, footerSpace, 1);
42003
+ const measurementWidth = bodyContentWidth;
42004
+ const marginTop = margins.top ?? DEFAULT_MARGINS.top;
42005
+ const marginBottom = margins.bottom ?? DEFAULT_MARGINS.bottom;
42006
+ const headerMargin = margins.header ?? 0;
42007
+ const footerMargin = margins.footer ?? 0;
42008
+ const headerContentSpace = Math.max(marginTop - headerMargin, 0);
42009
+ const footerContentSpace = Math.max(marginBottom - footerMargin, 0);
42010
+ const height = Math.max(headerContentSpace, footerContentSpace, 1);
42002
42011
  return {
42003
- width,
42012
+ width: measurementWidth,
42004
42013
  height,
42005
42014
  // Pass actual page dimensions for page-relative anchor positioning in headers/footers
42006
42015
  pageWidth: pageSize.w,
@@ -46576,7 +46585,11 @@ const splitRunsAfterMarkPlugin = new Plugin({
46576
46585
  const runType = newState.schema.nodes["run"];
46577
46586
  if (!runType) return null;
46578
46587
  const runPositions = /* @__PURE__ */ new Set();
46588
+ const docSize = newState.doc.content.size;
46579
46589
  markRanges.forEach(({ from: from2, to }) => {
46590
+ if (from2 < 0 || to < 0 || from2 > docSize || to > docSize || from2 > to) {
46591
+ return;
46592
+ }
46580
46593
  newState.doc.nodesBetween(from2, to, (node, pos) => {
46581
46594
  if (node.type === runType) runPositions.add(pos);
46582
46595
  });
@@ -1,4 +1,4 @@
1
- import { aK as getDefaultExportFromCjs } from "./converter-DaSkPzA9.js";
1
+ import { aK as getDefaultExportFromCjs } from "./converter-C4bE8Uad.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, onMounted, onBeforeUnmount, createVNode, readonly, watch, 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-DaSkPzA9.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-45pxcsTR.js";
2
+ import { p as process$1 } from "./converter-C4bE8Uad.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-ByMtGRzi.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 { ac } from "./chunks/converter-DaSkPzA9.js";
1
+ import { ac } from "./chunks/converter-C4bE8Uad.js";
2
2
  export {
3
3
  ac as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DaSkPzA9.js";
2
- import { D } from "./chunks/docx-zipper-Cx1zgQ8B.js";
1
+ import "./chunks/converter-C4bE8Uad.js";
2
+ import { D } from "./chunks/docx-zipper-BIkbwyZO.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-45pxcsTR.js";
2
- import "./chunks/converter-DaSkPzA9.js";
3
- import "./chunks/docx-zipper-Cx1zgQ8B.js";
1
+ import { E } from "./chunks/editor-ByMtGRzi.js";
2
+ import "./chunks/converter-C4bE8Uad.js";
3
+ import "./chunks/docx-zipper-BIkbwyZO.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-Cx1zgQ8B.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BIkbwyZO.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -1347,12 +1347,12 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
1347
1347
  fill: currentColor;
1348
1348
  }
1349
1349
 
1350
- .link-input-wrapper[data-v-ba50627b] {
1350
+ .link-input-wrapper[data-v-de37bd1c] {
1351
1351
  display: flex;
1352
1352
  flex-direction: column;
1353
1353
  gap: 8px;
1354
1354
  }
1355
- .link-input-ctn[data-v-ba50627b] {
1355
+ .link-input-ctn[data-v-de37bd1c] {
1356
1356
  width: 320px;
1357
1357
  display: flex;
1358
1358
  flex-direction: column;
@@ -1361,19 +1361,19 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
1361
1361
  background-color: #fff;
1362
1362
  box-sizing: border-box;
1363
1363
  }
1364
- .link-input-ctn[data-v-ba50627b] svg {
1364
+ .link-input-ctn[data-v-de37bd1c] svg {
1365
1365
  width: 100%;
1366
1366
  height: 100%;
1367
1367
  display: block;
1368
1368
  fill: currentColor;
1369
1369
  }
1370
- .link-input-ctn .input-row[data-v-ba50627b] {
1370
+ .link-input-ctn .input-row[data-v-de37bd1c] {
1371
1371
  align-content: baseline;
1372
1372
  display: flex;
1373
1373
  align-items: center;
1374
1374
  font-size: 16px;
1375
1375
  }
1376
- .link-input-ctn .input-row input[data-v-ba50627b] {
1376
+ .link-input-ctn .input-row input[data-v-de37bd1c] {
1377
1377
  font-size: 13px;
1378
1378
  flex-grow: 1;
1379
1379
  padding: 10px;
@@ -1384,30 +1384,30 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
1384
1384
  border: 1px solid #ddd;
1385
1385
  box-sizing: border-box;
1386
1386
  }
1387
- .link-input-ctn .input-row input[data-v-ba50627b]:active,
1388
- .link-input-ctn .input-row input[data-v-ba50627b]:focus {
1387
+ .link-input-ctn .input-row input[data-v-de37bd1c]:active,
1388
+ .link-input-ctn .input-row input[data-v-de37bd1c]:focus {
1389
1389
  outline: none;
1390
1390
  border: 1px solid #1355ff;
1391
1391
  }
1392
- .link-input-ctn .input-icon[data-v-ba50627b] {
1392
+ .link-input-ctn .input-icon[data-v-de37bd1c] {
1393
1393
  position: absolute;
1394
1394
  left: 25px;
1395
1395
  width: auto;
1396
1396
  color: #999;
1397
1397
  pointer-events: none;
1398
1398
  }
1399
- .link-input-ctn .input-icon[data-v-ba50627b]:not(.text-input-icon) {
1399
+ .link-input-ctn .input-icon[data-v-de37bd1c]:not(.text-input-icon) {
1400
1400
  transform: rotate(45deg);
1401
1401
  height: 12px;
1402
1402
  }
1403
- .link-input-ctn.high-contrast .input-icon[data-v-ba50627b] {
1403
+ .link-input-ctn.high-contrast .input-icon[data-v-de37bd1c] {
1404
1404
  color: #000;
1405
1405
  }
1406
- .link-input-ctn.high-contrast .input-row input[data-v-ba50627b] {
1406
+ .link-input-ctn.high-contrast .input-row input[data-v-de37bd1c] {
1407
1407
  color: #000;
1408
1408
  border-color: #000;
1409
1409
  }
1410
- .open-link-icon[data-v-ba50627b] {
1410
+ .open-link-icon[data-v-de37bd1c] {
1411
1411
  margin-left: 10px;
1412
1412
  width: 30px;
1413
1413
  height: 30px;
@@ -1420,56 +1420,56 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
1420
1420
  transition: all 0.2s ease;
1421
1421
  cursor: pointer;
1422
1422
  }
1423
- .open-link-icon[data-v-ba50627b]:hover {
1423
+ .open-link-icon[data-v-de37bd1c]:hover {
1424
1424
  color: #1355ff;
1425
1425
  background-color: white;
1426
1426
  border: 1px solid #dbdbdb;
1427
1427
  }
1428
- .open-link-icon[data-v-ba50627b] svg {
1428
+ .open-link-icon[data-v-de37bd1c] svg {
1429
1429
  width: 15px;
1430
1430
  height: 15px;
1431
1431
  }
1432
- .disabled[data-v-ba50627b] {
1432
+ .disabled[data-v-de37bd1c] {
1433
1433
  opacity: 0.6;
1434
1434
  cursor: not-allowed;
1435
1435
  pointer-events: none;
1436
1436
  }
1437
- .link-buttons[data-v-ba50627b] {
1437
+ .link-buttons[data-v-de37bd1c] {
1438
1438
  display: flex;
1439
1439
  justify-content: flex-end;
1440
1440
  margin-top: 10px;
1441
1441
  }
1442
- .remove-btn__icon[data-v-ba50627b] {
1442
+ .remove-btn__icon[data-v-de37bd1c] {
1443
1443
  display: inline-flex;
1444
1444
  width: 13px;
1445
1445
  height: 13px;
1446
1446
  flex-shrink: 0;
1447
1447
  margin-right: 4px;
1448
1448
  }
1449
- .link-buttons button[data-v-ba50627b] {
1449
+ .link-buttons button[data-v-de37bd1c] {
1450
1450
  margin-left: 5px;
1451
1451
  }
1452
- .disable-btn[data-v-ba50627b] {
1452
+ .disable-btn[data-v-de37bd1c] {
1453
1453
  opacity: 0.6;
1454
1454
  cursor: not-allowed;
1455
1455
  pointer-events: none;
1456
1456
  }
1457
- .go-to-anchor a[data-v-ba50627b] {
1457
+ .go-to-anchor a[data-v-de37bd1c] {
1458
1458
  font-size: 14px;
1459
1459
  text-decoration: underline;
1460
1460
  }
1461
- .clickable[data-v-ba50627b] {
1461
+ .clickable[data-v-de37bd1c] {
1462
1462
  cursor: pointer;
1463
1463
  }
1464
- .link-title[data-v-ba50627b] {
1464
+ .link-title[data-v-de37bd1c] {
1465
1465
  font-size: 14px;
1466
1466
  font-weight: 600;
1467
1467
  margin-bottom: 10px;
1468
1468
  }
1469
- .hasBottomMargin[data-v-ba50627b] {
1469
+ .hasBottomMargin[data-v-de37bd1c] {
1470
1470
  margin-bottom: 1em;
1471
1471
  }
1472
- .remove-btn[data-v-ba50627b] {
1472
+ .remove-btn[data-v-de37bd1c] {
1473
1473
  display: inline-flex;
1474
1474
  justify-content: center;
1475
1475
  align-items: center;
@@ -1485,10 +1485,10 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
1485
1485
  border: 1px solid #ebebeb;
1486
1486
  box-sizing: border-box;
1487
1487
  }
1488
- .remove-btn[data-v-ba50627b]:hover {
1488
+ .remove-btn[data-v-de37bd1c]:hover {
1489
1489
  background-color: #dbdbdb;
1490
1490
  }
1491
- .submit-btn[data-v-ba50627b] {
1491
+ .submit-btn[data-v-de37bd1c] {
1492
1492
  display: inline-flex;
1493
1493
  justify-content: center;
1494
1494
  align-items: center;
@@ -1508,14 +1508,14 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
1508
1508
  /* &.high-contrast {
1509
1509
  background-color: black;
1510
1510
  } */
1511
- .submit-btn[data-v-ba50627b]:hover {
1511
+ .submit-btn[data-v-de37bd1c]:hover {
1512
1512
  background-color: #0d47c1;
1513
1513
  }
1514
- .error[data-v-ba50627b] {
1514
+ .error[data-v-de37bd1c] {
1515
1515
  border-color: red !important;
1516
1516
  background-color: #ff00001a;
1517
1517
  }
1518
- .submit[data-v-ba50627b] {
1518
+ .submit[data-v-de37bd1c] {
1519
1519
  cursor: pointer;
1520
1520
  }
1521
1521