@harbour-enterprises/superdoc 1.0.0-beta.95 → 1.0.0-beta.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/chunks/{PdfViewer--l9mxuw6.cjs → PdfViewer-BGTfnD4T.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DC5ZtOHL.es.js → PdfViewer-Cdp1WJ9e.es.js} +1 -1
  3. package/dist/chunks/{index-D_AIVJix.es.js → index-BV9YtiyI.es.js} +3 -3
  4. package/dist/chunks/{index-DA6_gKCn.cjs → index-C-IS20yQ.cjs} +3 -3
  5. package/dist/chunks/{index-DJD7xO_i-DlZGZmeW.es.js → index-lfdM_gm7-_EQjLyqH.es.js} +1 -1
  6. package/dist/chunks/{index-DJD7xO_i-CVT8OSh8.cjs → index-lfdM_gm7-qtx-V4oF.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-DLfNMkAR.cjs → super-editor.es-D2zn943K.cjs} +58 -23
  8. package/dist/chunks/{super-editor.es-L0F8-awY.es.js → super-editor.es-De2XS3A1.es.js} +58 -23
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CAiO-oW4.js → converter-B29ATZFC.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DRP7HhmI.js → docx-zipper-BPktKUBx.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-D5oQ83xJ.js → editor-BRHMYtPA.js} +59 -24
  13. package/dist/super-editor/chunks/{index-DJD7xO_i.js → index-lfdM_gm7.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-ax2sbcF_.js → toolbar-CB2cJCLh.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +68 -33
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -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, _cellAnchor, _cellDragMode, _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, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_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, applyDomCorrectionToRects_fn, renderCellSelectionOverlay_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, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_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 SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-CAiO-oW4.js";
16
- import { D as DocxZipper } from "./docx-zipper-DRP7HhmI.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 SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-B29ATZFC.js";
16
+ import { D as DocxZipper } from "./docx-zipper-BPktKUBx.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() {
@@ -13952,7 +13952,7 @@ const isHeadless = (editor) => {
13952
13952
  const shouldSkipNodeView = (editor) => {
13953
13953
  return isHeadless(editor);
13954
13954
  };
13955
- const summaryVersion = "1.0.0-beta.95";
13955
+ const summaryVersion = "1.0.0-beta.96";
13956
13956
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
13957
13957
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
13958
13958
  function mapAttributes(attrs) {
@@ -14744,7 +14744,7 @@ const _Editor = class _Editor extends EventEmitter {
14744
14744
  { default: remarkStringify },
14745
14745
  { default: remarkGfm }
14746
14746
  ] = await Promise.all([
14747
- import("./index-DJD7xO_i.js"),
14747
+ import("./index-lfdM_gm7.js"),
14748
14748
  import("./index-DRCvimau.js"),
14749
14749
  import("./index-C_x_N6Uh.js"),
14750
14750
  import("./index-D_sWOSiG.js"),
@@ -14949,7 +14949,7 @@ const _Editor = class _Editor extends EventEmitter {
14949
14949
  * Process collaboration migrations
14950
14950
  */
14951
14951
  processCollaborationMigrations() {
14952
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.95");
14952
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.96");
14953
14953
  if (!this.options.ydoc) return;
14954
14954
  const metaMap = this.options.ydoc.getMap("meta");
14955
14955
  let docVersion = metaMap.get("version");
@@ -21097,6 +21097,13 @@ const isTruthy = (value) => {
21097
21097
  }
21098
21098
  return false;
21099
21099
  };
21100
+ const safeGetProperty = (obj, key2) => {
21101
+ if (!obj || typeof obj !== "object") {
21102
+ return void 0;
21103
+ }
21104
+ const record = obj;
21105
+ return record[key2];
21106
+ };
21100
21107
  const isExplicitFalse = (value) => {
21101
21108
  if (value === false || value === 0) return true;
21102
21109
  if (typeof value === "string") {
@@ -21589,8 +21596,9 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
21589
21596
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
21590
21597
  }
21591
21598
  }
21592
- if (normalizedSpacing?.contextualSpacing != null) {
21593
- paragraphAttrs.contextualSpacing = normalizedSpacing.contextualSpacing;
21599
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
21600
+ if (contextualSpacingValue != null) {
21601
+ paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
21594
21602
  }
21595
21603
  const hasExplicitIndent = Boolean(normalizedIndent);
21596
21604
  const hasNumberingIndent = Boolean(computed2.numbering?.indent?.left || computed2.numbering?.indent?.hanging);
@@ -21642,7 +21650,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
21642
21650
  paragraphAttrs.tabs = normalizedTabs;
21643
21651
  }
21644
21652
  }
21645
- const asString = (value) => {
21653
+ const asString2 = (value) => {
21646
21654
  return typeof value === "string" ? value : void 0;
21647
21655
  };
21648
21656
  const normalizeFramePr = (value) => {
@@ -21665,7 +21673,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
21665
21673
  };
21666
21674
  const framePr = normalizeFramePr(attrs.framePr) ?? normalizeFramePr(attrs.paragraphProperties?.framePr) ?? extractFramePrFromElements(attrs.paragraphProperties);
21667
21675
  if (framePr) {
21668
- const rawXAlign = asString(framePr["w:xAlign"] ?? framePr.xAlign);
21676
+ const rawXAlign = asString2(framePr["w:xAlign"] ?? framePr.xAlign);
21669
21677
  const xAlign = typeof rawXAlign === "string" ? rawXAlign.toLowerCase() : void 0;
21670
21678
  if (xAlign === "left" || xAlign === "right" || xAlign === "center") {
21671
21679
  paragraphAttrs.floatAlignment = xAlign;
@@ -21675,7 +21683,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
21675
21683
  paragraphAttrs.dropCap = dropCap;
21676
21684
  const dropCapMode = typeof dropCap === "string" ? dropCap.toLowerCase() : "drop";
21677
21685
  const linesValue = pickNumber(framePr["w:lines"] ?? framePr.lines);
21678
- const wrapValue = asString(framePr["w:wrap"] ?? framePr.wrap);
21686
+ const wrapValue = asString2(framePr["w:wrap"] ?? framePr.wrap);
21679
21687
  const dropCapRunInfo = extractDropCapRunFromParagraph(para);
21680
21688
  if (dropCapRunInfo) {
21681
21689
  const descriptor = {
@@ -21693,18 +21701,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
21693
21701
  }
21694
21702
  }
21695
21703
  const frame = {};
21696
- const wrap = asString(framePr["w:wrap"] ?? framePr.wrap);
21704
+ const wrap = asString2(framePr["w:wrap"] ?? framePr.wrap);
21697
21705
  if (wrap) frame.wrap = wrap;
21698
21706
  if (xAlign) {
21699
21707
  frame.xAlign = xAlign;
21700
21708
  }
21701
- const rawYAlign = asString(framePr["w:yAlign"] ?? framePr.yAlign);
21709
+ const rawYAlign = asString2(framePr["w:yAlign"] ?? framePr.yAlign);
21702
21710
  if (rawYAlign) {
21703
21711
  frame.yAlign = rawYAlign;
21704
21712
  }
21705
- const hAnchor = asString(framePr["w:hAnchor"] ?? framePr.hAnchor);
21713
+ const hAnchor = asString2(framePr["w:hAnchor"] ?? framePr.hAnchor);
21706
21714
  if (hAnchor) frame.hAnchor = hAnchor;
21707
- const vAnchor = asString(framePr["w:vAnchor"] ?? framePr.vAnchor);
21715
+ const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
21708
21716
  if (vAnchor) frame.vAnchor = vAnchor;
21709
21717
  const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
21710
21718
  if (xTwips != null) frame.x = twipsToPx$1(xTwips);
@@ -33448,6 +33456,32 @@ const extractBlockPmRange = (block) => {
33448
33456
  pmEnd: end2 ?? (start2 != null ? start2 + 1 : void 0)
33449
33457
  };
33450
33458
  };
33459
+ const getParagraphAttrs = (block) => {
33460
+ if (!block.attrs || typeof block.attrs !== "object") {
33461
+ return void 0;
33462
+ }
33463
+ return block.attrs;
33464
+ };
33465
+ const asString = (value) => {
33466
+ return typeof value === "string" ? value : void 0;
33467
+ };
33468
+ const asBoolean = (value) => {
33469
+ if (value === true || value === 1) return true;
33470
+ if (typeof value === "string") {
33471
+ const normalized = value.toLowerCase();
33472
+ return normalized === "true" || normalized === "1" || normalized === "on";
33473
+ }
33474
+ return false;
33475
+ };
33476
+ const asSafeNumber = (value) => {
33477
+ if (typeof value !== "number") {
33478
+ return 0;
33479
+ }
33480
+ if (!Number.isFinite(value) || value < 0) {
33481
+ return 0;
33482
+ }
33483
+ return value;
33484
+ };
33451
33485
  function calculateFirstLineIndent(block, measure) {
33452
33486
  const wordLayout = block.attrs?.wordLayout;
33453
33487
  if (!wordLayout?.firstLineIndentMode) {
@@ -33465,7 +33499,8 @@ function calculateFirstLineIndent(block, measure) {
33465
33499
  function layoutParagraphBlock(ctx2, anchors) {
33466
33500
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
33467
33501
  const remeasureParagraph2 = ctx2.remeasureParagraph;
33468
- const frame = block.attrs?.frame;
33502
+ const blockAttrs = getParagraphAttrs(block);
33503
+ const frame = blockAttrs?.frame;
33469
33504
  if (anchors?.anchoredDrawings?.length) {
33470
33505
  for (const entry of anchors.anchoredDrawings) {
33471
33506
  if (anchors.placedAnchoredIds.has(entry.block.id)) continue;
@@ -33590,9 +33625,10 @@ function layoutParagraphBlock(ctx2, anchors) {
33590
33625
  didRemeasureForColumnWidth = true;
33591
33626
  }
33592
33627
  let fromLine = 0;
33593
- const spacing = block.attrs?.spacing ?? {};
33594
- const styleId = block.attrs?.styleId;
33595
- const contextualSpacing = Boolean(block.attrs?.contextualSpacing);
33628
+ const attrs = getParagraphAttrs(block);
33629
+ const spacing = attrs?.spacing ?? {};
33630
+ const styleId = asString(attrs?.styleId);
33631
+ const contextualSpacing = asBoolean(attrs?.contextualSpacing);
33596
33632
  let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
33597
33633
  const spacingAfter = Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
33598
33634
  let appliedSpacingBefore = spacingBefore === 0;
@@ -33673,14 +33709,13 @@ function layoutParagraphBlock(ctx2, anchors) {
33673
33709
  while (fromLine < lines.length) {
33674
33710
  let state = ensurePage();
33675
33711
  if (state.trailingSpacing == null) state.trailingSpacing = 0;
33676
- if (contextualSpacing) {
33677
- const prevStyle = state.lastParagraphStyleId;
33678
- if (styleId && prevStyle && prevStyle === styleId) {
33679
- spacingBefore = 0;
33680
- }
33681
- }
33682
33712
  if (contextualSpacing && state.lastParagraphStyleId && styleId && state.lastParagraphStyleId === styleId) {
33683
33713
  spacingBefore = 0;
33714
+ const prevTrailing = asSafeNumber(state.trailingSpacing);
33715
+ if (prevTrailing > 0) {
33716
+ state.cursorY -= prevTrailing;
33717
+ state.trailingSpacing = 0;
33718
+ }
33684
33719
  }
33685
33720
  if (!appliedSpacingBefore && spacingBefore > 0) {
33686
33721
  while (!appliedSpacingBefore) {
@@ -1,4 +1,4 @@
1
- import { aK as getDefaultExportFromCjs } from "./converter-CAiO-oW4.js";
1
+ import { aK as getDefaultExportFromCjs } from "./converter-B29ATZFC.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-CAiO-oW4.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-D5oQ83xJ.js";
2
+ import { p as process$1 } from "./converter-B29ATZFC.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BRHMYtPA.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-CAiO-oW4.js";
1
+ import { ac } from "./chunks/converter-B29ATZFC.js";
2
2
  export {
3
3
  ac as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-CAiO-oW4.js";
2
- import { D } from "./chunks/docx-zipper-DRP7HhmI.js";
1
+ import "./chunks/converter-B29ATZFC.js";
2
+ import { D } from "./chunks/docx-zipper-BPktKUBx.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-D5oQ83xJ.js";
2
- import "./chunks/converter-CAiO-oW4.js";
3
- import "./chunks/docx-zipper-DRP7HhmI.js";
1
+ import { E } from "./chunks/editor-BRHMYtPA.js";
2
+ import "./chunks/converter-B29ATZFC.js";
3
+ import "./chunks/docx-zipper-BPktKUBx.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-DRP7HhmI.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BPktKUBx.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _MARK_TOGGLE_NAMES, _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn, syncStickyMarksFromState_fn, restoreStickyMarksIfNeeded_fn, ensureStoredMarksForMarkToggle_fn;
12
- import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, at as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, an as parseSizeUnit, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-CAiO-oW4.js";
13
- import { ac, i, a9, aQ } from "./chunks/converter-CAiO-oW4.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as generateRulerDefinition, n as clampHandlePosition, o as calculateMarginFromHandle, p as measureCache, q as isHeadless, E as Editor, t as getStarterExtensions, P as PresentationEditor, v as Placeholder, w as getRichTextExtensions, D as DecorationSet, x as Decoration, M as Mark, z as Extension, A as Attribute, N as Node } from "./chunks/editor-D5oQ83xJ.js";
15
- import { F, I, G, T, B, H, C } from "./chunks/editor-D5oQ83xJ.js";
12
+ import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, at as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, an as parseSizeUnit, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-B29ATZFC.js";
13
+ import { ac, i, a9, aQ } from "./chunks/converter-B29ATZFC.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as generateRulerDefinition, n as clampHandlePosition, o as calculateMarginFromHandle, p as measureCache, q as isHeadless, E as Editor, t as getStarterExtensions, P as PresentationEditor, v as Placeholder, w as getRichTextExtensions, D as DecorationSet, x as Decoration, M as Mark, z as Extension, A as Attribute, N as Node } from "./chunks/editor-BRHMYtPA.js";
15
+ import { F, I, G, T, B, H, C } from "./chunks/editor-BRHMYtPA.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, defineComponent, reactive, onUnmounted, renderSlot, useCssVars, shallowRef, createBlock, Teleport, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-ax2sbcF_.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-CB2cJCLh.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-DRP7HhmI.js";
19
+ import { D } from "./chunks/docx-zipper-BPktKUBx.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-ax2sbcF_.js";
3
- import "./chunks/editor-D5oQ83xJ.js";
2
+ import { T } from "./chunks/toolbar-CB2cJCLh.js";
3
+ import "./chunks/editor-BRHMYtPA.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-DLfNMkAR.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-D2zn943K.cjs");
4
4
  require("./chunks/vue-jWLMl8Ts.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-L0F8-awY.es.js";
1
+ import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-De2XS3A1.es.js";
2
2
  import "./chunks/vue-Dysv_7z5.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-DLfNMkAR.cjs");
4
- const superdoc = require("./chunks/index-DA6_gKCn.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-D2zn943K.cjs");
4
+ const superdoc = require("./chunks/index-C-IS20yQ.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
7
7
  exports.Editor = superEditor_es.Editor;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-L0F8-awY.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-D_AIVJix.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-De2XS3A1.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-BV9YtiyI.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -42422,7 +42422,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42422
42422
  static getStoredSuperdocVersion(docx) {
42423
42423
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42424
42424
  }
42425
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.95") {
42425
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.96") {
42426
42426
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42427
42427
  }
42428
42428
  /**
@@ -67497,7 +67497,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67497
67497
  const shouldSkipNodeView = (editor) => {
67498
67498
  return isHeadless(editor);
67499
67499
  };
67500
- const summaryVersion = "1.0.0-beta.95";
67500
+ const summaryVersion = "1.0.0-beta.96";
67501
67501
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67502
67502
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67503
67503
  function mapAttributes(attrs) {
@@ -68286,7 +68286,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68286
68286
  { default: remarkStringify2 },
68287
68287
  { default: remarkGfm2 }
68288
68288
  ] = await Promise.all([
68289
- Promise.resolve().then(() => indexDJD7xO_i),
68289
+ Promise.resolve().then(() => indexLfdM_gm7),
68290
68290
  Promise.resolve().then(() => indexDRCvimau),
68291
68291
  Promise.resolve().then(() => indexC_x_N6Uh),
68292
68292
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68491,7 +68491,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68491
68491
  * Process collaboration migrations
68492
68492
  */
68493
68493
  processCollaborationMigrations() {
68494
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.95");
68494
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.96");
68495
68495
  if (!this.options.ydoc) return;
68496
68496
  const metaMap = this.options.ydoc.getMap("meta");
68497
68497
  let docVersion = metaMap.get("version");
@@ -74551,6 +74551,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74551
74551
  }
74552
74552
  return false;
74553
74553
  };
74554
+ const safeGetProperty = (obj, key2) => {
74555
+ if (!obj || typeof obj !== "object") {
74556
+ return void 0;
74557
+ }
74558
+ const record = obj;
74559
+ return record[key2];
74560
+ };
74554
74561
  const isExplicitFalse = (value) => {
74555
74562
  if (value === false || value === 0) return true;
74556
74563
  if (typeof value === "string") {
@@ -75043,8 +75050,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75043
75050
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
75044
75051
  }
75045
75052
  }
75046
- if (normalizedSpacing?.contextualSpacing != null) {
75047
- paragraphAttrs.contextualSpacing = normalizedSpacing.contextualSpacing;
75053
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
75054
+ if (contextualSpacingValue != null) {
75055
+ paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
75048
75056
  }
75049
75057
  const hasExplicitIndent = Boolean(normalizedIndent);
75050
75058
  const hasNumberingIndent = Boolean(computed2.numbering?.indent?.left || computed2.numbering?.indent?.hanging);
@@ -75096,7 +75104,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75096
75104
  paragraphAttrs.tabs = normalizedTabs;
75097
75105
  }
75098
75106
  }
75099
- const asString = (value) => {
75107
+ const asString2 = (value) => {
75100
75108
  return typeof value === "string" ? value : void 0;
75101
75109
  };
75102
75110
  const normalizeFramePr = (value) => {
@@ -75119,7 +75127,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75119
75127
  };
75120
75128
  const framePr = normalizeFramePr(attrs.framePr) ?? normalizeFramePr(attrs.paragraphProperties?.framePr) ?? extractFramePrFromElements(attrs.paragraphProperties);
75121
75129
  if (framePr) {
75122
- const rawXAlign = asString(framePr["w:xAlign"] ?? framePr.xAlign);
75130
+ const rawXAlign = asString2(framePr["w:xAlign"] ?? framePr.xAlign);
75123
75131
  const xAlign = typeof rawXAlign === "string" ? rawXAlign.toLowerCase() : void 0;
75124
75132
  if (xAlign === "left" || xAlign === "right" || xAlign === "center") {
75125
75133
  paragraphAttrs.floatAlignment = xAlign;
@@ -75129,7 +75137,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75129
75137
  paragraphAttrs.dropCap = dropCap;
75130
75138
  const dropCapMode = typeof dropCap === "string" ? dropCap.toLowerCase() : "drop";
75131
75139
  const linesValue = pickNumber(framePr["w:lines"] ?? framePr.lines);
75132
- const wrapValue = asString(framePr["w:wrap"] ?? framePr.wrap);
75140
+ const wrapValue = asString2(framePr["w:wrap"] ?? framePr.wrap);
75133
75141
  const dropCapRunInfo = extractDropCapRunFromParagraph(para);
75134
75142
  if (dropCapRunInfo) {
75135
75143
  const descriptor = {
@@ -75147,18 +75155,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75147
75155
  }
75148
75156
  }
75149
75157
  const frame = {};
75150
- const wrap2 = asString(framePr["w:wrap"] ?? framePr.wrap);
75158
+ const wrap2 = asString2(framePr["w:wrap"] ?? framePr.wrap);
75151
75159
  if (wrap2) frame.wrap = wrap2;
75152
75160
  if (xAlign) {
75153
75161
  frame.xAlign = xAlign;
75154
75162
  }
75155
- const rawYAlign = asString(framePr["w:yAlign"] ?? framePr.yAlign);
75163
+ const rawYAlign = asString2(framePr["w:yAlign"] ?? framePr.yAlign);
75156
75164
  if (rawYAlign) {
75157
75165
  frame.yAlign = rawYAlign;
75158
75166
  }
75159
- const hAnchor = asString(framePr["w:hAnchor"] ?? framePr.hAnchor);
75167
+ const hAnchor = asString2(framePr["w:hAnchor"] ?? framePr.hAnchor);
75160
75168
  if (hAnchor) frame.hAnchor = hAnchor;
75161
- const vAnchor = asString(framePr["w:vAnchor"] ?? framePr.vAnchor);
75169
+ const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
75162
75170
  if (vAnchor) frame.vAnchor = vAnchor;
75163
75171
  const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
75164
75172
  if (xTwips != null) frame.x = twipsToPx$1(xTwips);
@@ -86902,6 +86910,32 @@ ${l}
86902
86910
  pmEnd: end2 ?? (start2 != null ? start2 + 1 : void 0)
86903
86911
  };
86904
86912
  };
86913
+ const getParagraphAttrs = (block) => {
86914
+ if (!block.attrs || typeof block.attrs !== "object") {
86915
+ return void 0;
86916
+ }
86917
+ return block.attrs;
86918
+ };
86919
+ const asString = (value) => {
86920
+ return typeof value === "string" ? value : void 0;
86921
+ };
86922
+ const asBoolean = (value) => {
86923
+ if (value === true || value === 1) return true;
86924
+ if (typeof value === "string") {
86925
+ const normalized = value.toLowerCase();
86926
+ return normalized === "true" || normalized === "1" || normalized === "on";
86927
+ }
86928
+ return false;
86929
+ };
86930
+ const asSafeNumber = (value) => {
86931
+ if (typeof value !== "number") {
86932
+ return 0;
86933
+ }
86934
+ if (!Number.isFinite(value) || value < 0) {
86935
+ return 0;
86936
+ }
86937
+ return value;
86938
+ };
86905
86939
  function calculateFirstLineIndent(block, measure) {
86906
86940
  const wordLayout = block.attrs?.wordLayout;
86907
86941
  if (!wordLayout?.firstLineIndentMode) {
@@ -86919,7 +86953,8 @@ ${l}
86919
86953
  function layoutParagraphBlock(ctx2, anchors) {
86920
86954
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
86921
86955
  const remeasureParagraph2 = ctx2.remeasureParagraph;
86922
- const frame = block.attrs?.frame;
86956
+ const blockAttrs = getParagraphAttrs(block);
86957
+ const frame = blockAttrs?.frame;
86923
86958
  if (anchors?.anchoredDrawings?.length) {
86924
86959
  for (const entry of anchors.anchoredDrawings) {
86925
86960
  if (anchors.placedAnchoredIds.has(entry.block.id)) continue;
@@ -87044,9 +87079,10 @@ ${l}
87044
87079
  didRemeasureForColumnWidth = true;
87045
87080
  }
87046
87081
  let fromLine = 0;
87047
- const spacing = block.attrs?.spacing ?? {};
87048
- const styleId = block.attrs?.styleId;
87049
- const contextualSpacing = Boolean(block.attrs?.contextualSpacing);
87082
+ const attrs = getParagraphAttrs(block);
87083
+ const spacing = attrs?.spacing ?? {};
87084
+ const styleId = asString(attrs?.styleId);
87085
+ const contextualSpacing = asBoolean(attrs?.contextualSpacing);
87050
87086
  let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
87051
87087
  const spacingAfter = Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
87052
87088
  let appliedSpacingBefore = spacingBefore === 0;
@@ -87127,14 +87163,13 @@ ${l}
87127
87163
  while (fromLine < lines.length) {
87128
87164
  let state2 = ensurePage();
87129
87165
  if (state2.trailingSpacing == null) state2.trailingSpacing = 0;
87130
- if (contextualSpacing) {
87131
- const prevStyle = state2.lastParagraphStyleId;
87132
- if (styleId && prevStyle && prevStyle === styleId) {
87133
- spacingBefore = 0;
87134
- }
87135
- }
87136
87166
  if (contextualSpacing && state2.lastParagraphStyleId && styleId && state2.lastParagraphStyleId === styleId) {
87137
87167
  spacingBefore = 0;
87168
+ const prevTrailing = asSafeNumber(state2.trailingSpacing);
87169
+ if (prevTrailing > 0) {
87170
+ state2.cursorY -= prevTrailing;
87171
+ state2.trailingSpacing = 0;
87172
+ }
87138
87173
  }
87139
87174
  if (!appliedSpacingBefore && spacingBefore > 0) {
87140
87175
  while (!appliedSpacingBefore) {
@@ -151950,7 +151985,7 @@ ${style2}
151950
151985
  this.config.colors = shuffleArray(this.config.colors);
151951
151986
  this.userColorMap = /* @__PURE__ */ new Map();
151952
151987
  this.colorIndex = 0;
151953
- this.version = "1.0.0-beta.95";
151988
+ this.version = "1.0.0-beta.96";
151954
151989
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
151955
151990
  this.superdocId = config2.superdocId || v4();
151956
151991
  this.colors = this.config.colors;
@@ -154422,7 +154457,7 @@ ${style2}
154422
154457
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
154423
154458
  );
154424
154459
  }
154425
- const indexDJD7xO_i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154460
+ const indexLfdM_gm7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154426
154461
  __proto__: null,
154427
154462
  unified
154428
154463
  }, Symbol.toStringTag, { value: "Module" }));
@@ -164640,8 +164675,8 @@ ${style2}
164640
164675
  const type2 = typeof value;
164641
164676
  if (type2 !== "object" || !value)
164642
164677
  return [PRIMITIVE, type2];
164643
- const asString = toString.call(value).slice(8, -1);
164644
- switch (asString) {
164678
+ const asString2 = toString.call(value).slice(8, -1);
164679
+ switch (asString2) {
164645
164680
  case "Array":
164646
164681
  return [ARRAY, EMPTY];
164647
164682
  case "Object":
@@ -164655,13 +164690,13 @@ ${style2}
164655
164690
  case "Set":
164656
164691
  return [SET, EMPTY];
164657
164692
  case "DataView":
164658
- return [ARRAY, asString];
164693
+ return [ARRAY, asString2];
164659
164694
  }
164660
- if (asString.includes("Array"))
164661
- return [ARRAY, asString];
164662
- if (asString.includes("Error"))
164663
- return [ERROR, asString];
164664
- return [OBJECT, asString];
164695
+ if (asString2.includes("Array"))
164696
+ return [ARRAY, asString2];
164697
+ if (asString2.includes("Error"))
164698
+ return [ERROR, asString2];
164699
+ return [OBJECT, asString2];
164665
164700
  };
164666
164701
  const shouldSkip = ([TYPE, type2]) => TYPE === PRIMITIVE && (type2 === "function" || type2 === "symbol");
164667
164702
  const serializer = (strict, json, $2, _2) => {