@harbour-enterprises/superdoc 1.0.0-beta.21 → 1.0.0-beta.22

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 (28) hide show
  1. package/dist/chunks/{PdfViewer-CEwbF85g.es.js → PdfViewer-B42JCeYb.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CqAQvFv3.cjs → PdfViewer-CswYWp1h.cjs} +1 -1
  3. package/dist/chunks/{index-DSuc12CK-DH_DeF0B.es.js → index-895wSAjT-C4ksiI6n.es.js} +1 -1
  4. package/dist/chunks/{index-DSuc12CK-Dpg5Hd9W.cjs → index-895wSAjT-CWlZl8zz.cjs} +1 -1
  5. package/dist/chunks/{index-Dy-eAVHL.cjs → index-CK4eX_iu.cjs} +7 -5
  6. package/dist/chunks/{index-BFobqgP4.es.js → index-DBmh710D.es.js} +7 -5
  7. package/dist/chunks/{super-editor.es-C2UuUFg3.cjs → super-editor.es-BkRizaIE.cjs} +206 -77
  8. package/dist/chunks/{super-editor.es-B5YJmpPg.es.js → super-editor.es-V792hb-6.es.js} +206 -77
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-Cw0V00On.js → converter-DhkZt4Pv.js} +6 -6
  12. package/dist/super-editor/chunks/{docx-zipper-D7k6lS5l.js → docx-zipper-Bajmc-RM.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-CDWzRc4H.js → editor-oZjoYNA0.js} +208 -78
  14. package/dist/super-editor/chunks/{index-DSuc12CK.js → index-895wSAjT.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-CHJspeuY.js → toolbar-Bn5LTbq9.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +212 -81
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -36389,7 +36389,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36389
36389
  static getStoredSuperdocVersion(docx) {
36390
36390
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
36391
36391
  }
36392
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.21") {
36392
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.22") {
36393
36393
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
36394
36394
  }
36395
36395
  /**
@@ -47552,7 +47552,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
47552
47552
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
47553
47553
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
47554
47554
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
47555
- 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, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _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, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _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, 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, 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, _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;
47555
+ 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, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _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, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _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, 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, 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;
47556
47556
  var GOOD_LEAF_SIZE = 200;
47557
47557
  var RopeSequence = function RopeSequence2() {
47558
47558
  };
@@ -57454,6 +57454,59 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57454
57454
  return true;
57455
57455
  };
57456
57456
  }
57457
+ const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
57458
+ const handled = changeListLevel(-1, editor, tr);
57459
+ if (handled && dispatch) {
57460
+ dispatch(tr);
57461
+ }
57462
+ return handled;
57463
+ };
57464
+ const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
57465
+ const { tr, state: state2, editor, dispatch } = props;
57466
+ const { node: paragraph2, pos } = findParentNode(isList)(state2.selection) || {};
57467
+ if (!paragraph2) return false;
57468
+ if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph2)) return false;
57469
+ if (checkType === "startParagraph") {
57470
+ const { $from, empty: empty2 } = state2.selection;
57471
+ if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph2)) return false;
57472
+ }
57473
+ const ilvl = getResolvedParagraphProperties(paragraph2).numberingProperties.ilvl;
57474
+ if (ilvl > 0) {
57475
+ const outdented = decreaseListIndent()(props);
57476
+ if (outdented) {
57477
+ tr.scrollIntoView();
57478
+ }
57479
+ return outdented;
57480
+ } else {
57481
+ updateNumberingProperties(null, paragraph2, pos, editor, tr);
57482
+ }
57483
+ if (dispatch) dispatch(tr);
57484
+ return true;
57485
+ };
57486
+ function isVisuallyEmptyParagraph(node2) {
57487
+ if (!node2 || node2.type.name !== "paragraph") return false;
57488
+ let hasHardBreak = false;
57489
+ node2.descendants((n) => {
57490
+ if (n.type && n.type.name === "hardBreak") {
57491
+ hasHardBreak = true;
57492
+ return false;
57493
+ }
57494
+ return true;
57495
+ });
57496
+ if (hasHardBreak) return false;
57497
+ const text2 = (node2.textContent || "").replace(/\u200b/g, "").trim();
57498
+ if (text2.length > 0) return false;
57499
+ let hasInlineLeaf = false;
57500
+ node2.descendants((n) => {
57501
+ if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
57502
+ hasInlineLeaf = true;
57503
+ return false;
57504
+ }
57505
+ return true;
57506
+ });
57507
+ if (hasInlineLeaf) return false;
57508
+ return true;
57509
+ }
57457
57510
  const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
57458
57511
  let predicate;
57459
57512
  if (listType === "orderedList") {
@@ -57473,19 +57526,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57473
57526
  const { from: from2, to } = selection;
57474
57527
  let firstListNode = null;
57475
57528
  let hasNonListParagraphs = false;
57476
- let paragraphsInSelection = [];
57529
+ let allParagraphsInSelection = [];
57477
57530
  state2.doc.nodesBetween(from2, to, (node2, pos) => {
57478
57531
  if (node2.type.name === "paragraph") {
57479
- paragraphsInSelection.push({ node: node2, pos });
57480
- if (!firstListNode && predicate(node2)) {
57481
- firstListNode = node2;
57482
- } else if (!predicate(node2)) {
57483
- hasNonListParagraphs = true;
57484
- }
57532
+ allParagraphsInSelection.push({ node: node2, pos });
57485
57533
  return false;
57486
57534
  }
57487
57535
  return true;
57488
57536
  });
57537
+ let paragraphsInSelection = allParagraphsInSelection.length === 1 ? allParagraphsInSelection : allParagraphsInSelection.filter(({ node: node2 }) => !isVisuallyEmptyParagraph(node2));
57538
+ for (const { node: node2 } of paragraphsInSelection) {
57539
+ if (!firstListNode && predicate(node2)) {
57540
+ firstListNode = node2;
57541
+ } else if (!predicate(node2)) {
57542
+ hasNonListParagraphs = true;
57543
+ }
57544
+ }
57489
57545
  if (!firstListNode && from2 > 0) {
57490
57546
  const $from = state2.doc.resolve(from2);
57491
57547
  const parentIndex = $from.index(-1);
@@ -57529,11 +57585,30 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57529
57585
  }
57530
57586
  updateNumberingProperties(sharedNumberingProperties, node2, pos, editor, tr);
57531
57587
  }
57532
- const newTo = tr.mapping.map(to);
57533
- if (newTo >= 0 && newTo <= tr.doc.content.size) {
57534
- try {
57535
- tr.setSelection(state2.selection.constructor.near(tr.doc.resolve(newTo)));
57536
- } catch {
57588
+ if (paragraphsInSelection.length > 0) {
57589
+ const firstPara = paragraphsInSelection[0];
57590
+ const lastPara = paragraphsInSelection[paragraphsInSelection.length - 1];
57591
+ const mappedFirstPos = tr.mapping.map(firstPara.pos);
57592
+ const mappedLastPos = tr.mapping.map(lastPara.pos);
57593
+ const $firstPos = tr.doc.resolve(mappedFirstPos);
57594
+ const $lastPos = tr.doc.resolve(mappedLastPos);
57595
+ const firstNode = $firstPos.nodeAfter;
57596
+ const lastNode = $lastPos.nodeAfter;
57597
+ if (firstNode && lastNode) {
57598
+ let selFrom = mappedFirstPos + 1;
57599
+ let selTo = mappedLastPos + lastNode.nodeSize - 1;
57600
+ if (firstNode.firstChild && firstNode.firstChild.type.name === "run") {
57601
+ selFrom = mappedFirstPos + 2;
57602
+ }
57603
+ if (lastNode.lastChild && lastNode.lastChild.type.name === "run") {
57604
+ selTo = mappedLastPos + lastNode.nodeSize - 2;
57605
+ }
57606
+ if (selFrom >= 0 && selTo <= tr.doc.content.size && selFrom <= selTo) {
57607
+ try {
57608
+ tr.setSelection(TextSelection$1.create(tr.doc, selFrom, selTo));
57609
+ } catch {
57610
+ }
57611
+ }
57537
57612
  }
57538
57613
  }
57539
57614
  if (dispatch) dispatch(tr);
@@ -57546,59 +57621,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57546
57621
  }
57547
57622
  return handled;
57548
57623
  };
57549
- const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
57550
- const handled = changeListLevel(-1, editor, tr);
57551
- if (handled && dispatch) {
57552
- dispatch(tr);
57553
- }
57554
- return handled;
57555
- };
57556
- const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
57557
- const { tr, state: state2, editor, dispatch } = props;
57558
- const { node: paragraph2, pos } = findParentNode(isList)(state2.selection) || {};
57559
- if (!paragraph2) return false;
57560
- if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph2)) return false;
57561
- if (checkType === "startParagraph") {
57562
- const { $from, empty: empty2 } = state2.selection;
57563
- if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph2)) return false;
57564
- }
57565
- const ilvl = getResolvedParagraphProperties(paragraph2).numberingProperties.ilvl;
57566
- if (ilvl > 0) {
57567
- const outdented = decreaseListIndent()(props);
57568
- if (outdented) {
57569
- tr.scrollIntoView();
57570
- }
57571
- return outdented;
57572
- } else {
57573
- updateNumberingProperties(null, paragraph2, pos, editor, tr);
57574
- }
57575
- if (dispatch) dispatch(tr);
57576
- return true;
57577
- };
57578
- function isVisuallyEmptyParagraph(node2) {
57579
- if (!node2 || node2.type.name !== "paragraph") return false;
57580
- let hasHardBreak = false;
57581
- node2.descendants((n) => {
57582
- if (n.type && n.type.name === "hardBreak") {
57583
- hasHardBreak = true;
57584
- return false;
57585
- }
57586
- return true;
57587
- });
57588
- if (hasHardBreak) return false;
57589
- const text2 = (node2.textContent || "").replace(/\u200b/g, "").trim();
57590
- if (text2.length > 0) return false;
57591
- let hasInlineLeaf = false;
57592
- node2.descendants((n) => {
57593
- if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
57594
- hasInlineLeaf = true;
57595
- return false;
57596
- }
57597
- return true;
57598
- });
57599
- if (hasInlineLeaf) return false;
57600
- return true;
57601
- }
57602
57624
  const restoreSelection = () => ({ editor, state: state2, tr }) => {
57603
57625
  if (editor.options.lastSelection) {
57604
57626
  const selectionTr = tr.setSelection(
@@ -57681,6 +57703,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57681
57703
  insertTabCharacter,
57682
57704
  insertTabNode,
57683
57705
  isStyleTokenEnabled,
57706
+ isVisuallyEmptyParagraph,
57684
57707
  joinBackward,
57685
57708
  joinDown,
57686
57709
  joinForward,
@@ -57799,12 +57822,38 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57799
57822
  const Editable = Extension.create({
57800
57823
  name: "editable",
57801
57824
  addPmPlugins() {
57825
+ const editor = this.editor;
57802
57826
  const editablePlugin = new Plugin({
57803
57827
  key: new PluginKey("editable"),
57804
57828
  props: {
57805
- editable: () => {
57806
- return this.editor.options.editable;
57807
- }
57829
+ editable: () => editor.options.editable,
57830
+ handleDOMEvents: {
57831
+ beforeinput: (_view, event) => {
57832
+ if (!editor.options.editable) {
57833
+ event.preventDefault();
57834
+ return true;
57835
+ }
57836
+ return false;
57837
+ },
57838
+ mousedown: (_view, event) => {
57839
+ if (!editor.options.editable) {
57840
+ event.preventDefault();
57841
+ return true;
57842
+ }
57843
+ return false;
57844
+ },
57845
+ focus: (view, event) => {
57846
+ if (!editor.options.editable) {
57847
+ event.preventDefault();
57848
+ view.dom.blur();
57849
+ return true;
57850
+ }
57851
+ return false;
57852
+ }
57853
+ },
57854
+ handleClick: () => !editor.options.editable,
57855
+ handleDoubleClick: () => !editor.options.editable,
57856
+ handleTripleClick: () => !editor.options.editable
57808
57857
  }
57809
57858
  });
57810
57859
  return [editablePlugin];
@@ -61362,7 +61411,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61362
61411
  const shouldSkipNodeView = (editor) => {
61363
61412
  return isHeadless(editor);
61364
61413
  };
61365
- const summaryVersion = "1.0.0-beta.21";
61414
+ const summaryVersion = "1.0.0-beta.22";
61366
61415
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
61367
61416
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
61368
61417
  function mapAttributes(attrs) {
@@ -61767,10 +61816,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61767
61816
  this.view.updateState(this.state);
61768
61817
  }
61769
61818
  /**
61770
- * Set whether the editor is editable
61819
+ * Set whether the editor is editable.
61820
+ *
61821
+ * When setting to non-editable, this method:
61822
+ * - Forces ProseMirror to re-evaluate the editable prop from the Editable plugin
61823
+ * - Blurs the editor to remove the cursor
61824
+ *
61825
+ * @param editable - Whether the editor should accept user input (default: true)
61826
+ * @param emitUpdate - Whether to emit an update event after changing editability (default: true)
61771
61827
  */
61772
61828
  setEditable(editable = true, emitUpdate = true) {
61773
61829
  this.setOptions({ editable });
61830
+ if (this.view) {
61831
+ this.view.setProps({});
61832
+ if (!editable && this.view.dom) {
61833
+ this.view.dom.blur();
61834
+ }
61835
+ }
61774
61836
  if (emitUpdate) {
61775
61837
  this.emit("update", { editor: this, transaction: this.state.tr });
61776
61838
  }
@@ -62138,7 +62200,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62138
62200
  { default: remarkStringify2 },
62139
62201
  { default: remarkGfm2 }
62140
62202
  ] = await Promise.all([
62141
- Promise.resolve().then(() => indexDSuc12CK),
62203
+ Promise.resolve().then(() => index895wSAjT),
62142
62204
  Promise.resolve().then(() => indexDRCvimau),
62143
62205
  Promise.resolve().then(() => indexC_x_N6Uh),
62144
62206
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -62343,7 +62405,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62343
62405
  * Process collaboration migrations
62344
62406
  */
62345
62407
  processCollaborationMigrations() {
62346
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.21");
62408
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.22");
62347
62409
  if (!this.options.ydoc) return;
62348
62410
  const metaMap = this.options.ydoc.getMap("meta");
62349
62411
  let docVersion = metaMap.get("version");
@@ -80414,9 +80476,36 @@ ${l}
80414
80476
  }
80415
80477
  return base2;
80416
80478
  };
80479
+ const hasListMarkerProperties = (attrs) => {
80480
+ if (!attrs || typeof attrs !== "object") return false;
80481
+ const obj = attrs;
80482
+ if (!obj.numberingProperties || typeof obj.numberingProperties !== "object") return false;
80483
+ const numProps = obj.numberingProperties;
80484
+ if ("numId" in numProps) {
80485
+ const numId = numProps.numId;
80486
+ if (typeof numId !== "number" && typeof numId !== "string") return false;
80487
+ }
80488
+ if ("ilvl" in numProps) {
80489
+ const ilvl = numProps.ilvl;
80490
+ if (typeof ilvl !== "number") return false;
80491
+ }
80492
+ if ("wordLayout" in obj && obj.wordLayout !== void 0) {
80493
+ if (typeof obj.wordLayout !== "object" || obj.wordLayout === null) return false;
80494
+ const wordLayout = obj.wordLayout;
80495
+ if ("marker" in wordLayout && wordLayout.marker !== void 0) {
80496
+ if (typeof wordLayout.marker !== "object" || wordLayout.marker === null) return false;
80497
+ const marker = wordLayout.marker;
80498
+ if ("markerText" in marker && marker.markerText !== void 0) {
80499
+ if (typeof marker.markerText !== "string") return false;
80500
+ }
80501
+ }
80502
+ }
80503
+ return true;
80504
+ };
80417
80505
  const deriveBlockVersion = (block) => {
80418
80506
  if (block.kind === "paragraph") {
80419
- return block.runs.map((run2) => {
80507
+ const markerVersion = hasListMarkerProperties(block.attrs) ? `marker:${block.attrs.numberingProperties.numId ?? ""}:${block.attrs.numberingProperties.ilvl ?? 0}:${block.attrs.wordLayout?.marker?.markerText ?? ""}` : "";
80508
+ const runsVersion = block.runs.map((run2) => {
80420
80509
  if (run2.kind === "image") {
80421
80510
  const imgRun = run2;
80422
80511
  return [
@@ -80459,6 +80548,7 @@ ${l}
80459
80548
  textRun.token ?? ""
80460
80549
  ].join(",");
80461
80550
  }).join("|");
80551
+ return markerVersion ? `${markerVersion}|${runsVersion}` : runsVersion;
80462
80552
  }
80463
80553
  if (block.kind === "list") {
80464
80554
  return block.items.map((item) => `${item.id}:${item.marker.text}:${deriveBlockVersion(item.paragraph)}`).join("|");
@@ -84962,7 +85052,12 @@ ${l}
84962
85052
  setupInputBridge_fn = function() {
84963
85053
  __privateGet$1(this, _inputBridge)?.destroy();
84964
85054
  const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
84965
- __privateSet(this, _inputBridge, new PresentationInputBridge(win, __privateGet$1(this, _visibleHost), () => __privateMethod$1(this, _PresentationEditor_instances, getActiveDomTarget_fn).call(this)));
85055
+ __privateSet(this, _inputBridge, new PresentationInputBridge(
85056
+ win,
85057
+ __privateGet$1(this, _visibleHost),
85058
+ () => __privateMethod$1(this, _PresentationEditor_instances, getActiveDomTarget_fn).call(this),
85059
+ () => __privateGet$1(this, _documentMode) !== "viewing"
85060
+ ));
84966
85061
  __privateGet$1(this, _inputBridge).bind();
84967
85062
  };
84968
85063
  initHeaderFooterRegistry_fn = function() {
@@ -85350,6 +85445,10 @@ ${l}
85350
85445
  if (!__privateGet$1(this, _localSelectionLayer)) {
85351
85446
  return;
85352
85447
  }
85448
+ if (__privateGet$1(this, _documentMode) === "viewing") {
85449
+ __privateGet$1(this, _localSelectionLayer).innerHTML = "";
85450
+ return;
85451
+ }
85353
85452
  const layout = __privateGet$1(this, _layoutState).layout;
85354
85453
  const selection = this.getActiveEditor().state?.selection;
85355
85454
  __privateGet$1(this, _localSelectionLayer).innerHTML = "";
@@ -86655,11 +86754,27 @@ ${l}
86655
86754
  };
86656
86755
  let PresentationEditor = _PresentationEditor;
86657
86756
  class PresentationInputBridge {
86658
- constructor(windowRoot, layoutSurface, getTargetDom, onTargetChanged, options) {
86757
+ /**
86758
+ * Creates a new PresentationInputBridge that forwards user input events from the visible layout
86759
+ * surface to the hidden editor DOM. This enables input handling when the actual editor is not
86760
+ * directly visible to the user.
86761
+ *
86762
+ * @param windowRoot - The window object containing the layout surface and editor target
86763
+ * @param layoutSurface - The visible HTML element that receives user input events (e.g., keyboard, mouse)
86764
+ * @param getTargetDom - Callback that returns the hidden editor's DOM element where events should be forwarded
86765
+ * @param isEditable - Callback that returns whether the editor is in an editable mode (editing/suggesting).
86766
+ * When this returns false (e.g., in viewing mode), keyboard, text, and composition
86767
+ * events will not be forwarded to prevent document modification.
86768
+ * @param onTargetChanged - Optional callback invoked when the target editor DOM element changes
86769
+ * @param options - Optional configuration including:
86770
+ * - useWindowFallback: Whether to attach window-level event listeners as fallback
86771
+ */
86772
+ constructor(windowRoot, layoutSurface, getTargetDom, isEditable, onTargetChanged, options) {
86659
86773
  __privateAdd$1(this, _PresentationInputBridge_instances);
86660
86774
  __privateAdd$1(this, _windowRoot);
86661
86775
  __privateAdd$1(this, _layoutSurfaces);
86662
86776
  __privateAdd$1(this, _getTargetDom);
86777
+ __privateAdd$1(this, _isEditable);
86663
86778
  __privateAdd$1(this, _onTargetChanged);
86664
86779
  __privateAdd$1(this, _listeners);
86665
86780
  __privateAdd$1(this, _currentTarget, null);
@@ -86668,6 +86783,7 @@ ${l}
86668
86783
  __privateSet(this, _windowRoot, windowRoot);
86669
86784
  __privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
86670
86785
  __privateSet(this, _getTargetDom, getTargetDom);
86786
+ __privateSet(this, _isEditable, isEditable);
86671
86787
  __privateSet(this, _onTargetChanged, onTargetChanged);
86672
86788
  __privateSet(this, _listeners, []);
86673
86789
  __privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
@@ -86734,6 +86850,7 @@ ${l}
86734
86850
  _windowRoot = /* @__PURE__ */ new WeakMap();
86735
86851
  _layoutSurfaces = /* @__PURE__ */ new WeakMap();
86736
86852
  _getTargetDom = /* @__PURE__ */ new WeakMap();
86853
+ _isEditable = /* @__PURE__ */ new WeakMap();
86737
86854
  _onTargetChanged = /* @__PURE__ */ new WeakMap();
86738
86855
  _listeners = /* @__PURE__ */ new WeakMap();
86739
86856
  _currentTarget = /* @__PURE__ */ new WeakMap();
@@ -86764,6 +86881,9 @@ ${l}
86764
86881
  }
86765
86882
  };
86766
86883
  forwardKeyboardEvent_fn = function(event) {
86884
+ if (!__privateGet$1(this, _isEditable).call(this)) {
86885
+ return;
86886
+ }
86767
86887
  if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
86768
86888
  return;
86769
86889
  }
@@ -86791,6 +86911,9 @@ ${l}
86791
86911
  __privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
86792
86912
  };
86793
86913
  forwardTextEvent_fn = function(event) {
86914
+ if (!__privateGet$1(this, _isEditable).call(this)) {
86915
+ return;
86916
+ }
86794
86917
  if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
86795
86918
  return;
86796
86919
  }
@@ -86821,6 +86944,9 @@ ${l}
86821
86944
  });
86822
86945
  };
86823
86946
  forwardCompositionEvent_fn = function(event) {
86947
+ if (!__privateGet$1(this, _isEditable).call(this)) {
86948
+ return;
86949
+ }
86824
86950
  if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
86825
86951
  return;
86826
86952
  }
@@ -86840,6 +86966,9 @@ ${l}
86840
86966
  __privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
86841
86967
  };
86842
86968
  forwardContextMenu_fn = function(event) {
86969
+ if (!__privateGet$1(this, _isEditable).call(this)) {
86970
+ return;
86971
+ }
86843
86972
  if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
86844
86973
  return;
86845
86974
  }
@@ -139836,7 +139965,7 @@ ${style2}
139836
139965
  this.config.colors = shuffleArray(this.config.colors);
139837
139966
  this.userColorMap = /* @__PURE__ */ new Map();
139838
139967
  this.colorIndex = 0;
139839
- this.version = "1.0.0-beta.21";
139968
+ this.version = "1.0.0-beta.22";
139840
139969
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
139841
139970
  this.superdocId = config2.superdocId || v4();
139842
139971
  this.colors = this.config.colors;
@@ -140247,7 +140376,9 @@ ${style2}
140247
140376
  editing: () => this.#setModeEditing(),
140248
140377
  suggesting: () => this.#setModeSuggesting()
140249
140378
  };
140250
- if (types2[type2]) types2[type2]();
140379
+ if (types2[type2]) {
140380
+ types2[type2]();
140381
+ }
140251
140382
  }
140252
140383
  /**
140253
140384
  * Set the document mode on a document's editor (PresentationEditor or Editor).
@@ -140319,7 +140450,7 @@ ${style2}
140319
140450
  }
140320
140451
  #setModeViewing() {
140321
140452
  this.toolbar.activeEditor = null;
140322
- this.setTrackedChangesPreferences({ mode: "final", enabled: false });
140453
+ this.setTrackedChangesPreferences({ mode: "original", enabled: false });
140323
140454
  this.superdocStore.documents.forEach((doc2) => {
140324
140455
  doc2.removeComments();
140325
140456
  this.#applyDocumentMode(doc2, "viewing");
@@ -142279,7 +142410,7 @@ ${style2}
142279
142410
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
142280
142411
  );
142281
142412
  }
142282
- const indexDSuc12CK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
142413
+ const index895wSAjT = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
142283
142414
  __proto__: null,
142284
142415
  unified
142285
142416
  }, Symbol.toStringTag, { value: "Module" }));