@harbour-enterprises/superdoc 2.0.0-next.2 → 2.0.0-next.20
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.
- package/dist/chunks/{PdfViewer-CWO98Qls.cjs → PdfViewer-Y5Q3KpNr.cjs} +1 -1
- package/dist/chunks/{PdfViewer-C4xgIIbF.es.js → PdfViewer-ag_ZFG_a.es.js} +1 -1
- package/dist/chunks/{index-BY-3Vl72.cjs → index-CWNzyoyI.cjs} +4 -6
- package/dist/chunks/{index-s9GUR_Gc.es.js → index-Dymes5hN.es.js} +4 -6
- package/dist/chunks/{index-BqPa6D4q-8U4x8RP6.es.js → index-XnRj2biz-CWqMvtJZ.es.js} +1 -1
- package/dist/chunks/{index-BqPa6D4q-Dulj8zfc.cjs → index-XnRj2biz-DiLIwrZX.cjs} +1 -1
- package/dist/chunks/{super-editor.es-CT28vUbx.es.js → super-editor.es-BBUBeVVw.es.js} +950 -202
- package/dist/chunks/{super-editor.es-BM-ulSRj.cjs → super-editor.es-DwEkOdPH.cjs} +950 -202
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts +3 -3
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/types/index.d.ts +173 -0
- package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
- package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/style.css +14 -6
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CDlAWcRu.js → converter-CFpzAUl1.js} +49 -9
- package/dist/super-editor/chunks/{docx-zipper-B2VXuf8h.js → docx-zipper-B4U-khNy.js} +1 -1
- package/dist/super-editor/chunks/{editor-B4Q_tNET.js → editor-CUCVDSiG.js} +894 -196
- package/dist/super-editor/chunks/{index-BqPa6D4q.js → index-XnRj2biz.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-BD-lDCLr.js → toolbar-DXUz-ZeU.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +14 -6
- package/dist/super-editor/super-editor.es.js +19 -9
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +953 -207
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -38547,8 +38547,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38547
38547
|
);
|
|
38548
38548
|
const isInternal = parentComment?.isInternal || originalComment.isInternal;
|
|
38549
38549
|
if (commentsExportType === "external" && isInternal) return;
|
|
38550
|
-
const isResolved = !!originalComment.resolvedTime;
|
|
38551
|
-
if (isResolved) return;
|
|
38552
38550
|
if (node2.type !== "commentRangeStart" && node2.type !== "commentRangeEnd") {
|
|
38553
38551
|
return;
|
|
38554
38552
|
}
|
|
@@ -39217,11 +39215,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39217
39215
|
}
|
|
39218
39216
|
if (elements.length === 1) {
|
|
39219
39217
|
text2 = elements[0].text;
|
|
39220
|
-
const
|
|
39218
|
+
const docXmlSpace = params2.converter?.documentAttributes?.["xml:space"];
|
|
39219
|
+
const xmlSpace = encodedAttrs.xmlSpace ?? attributes?.["xml:space"] ?? elements[0]?.attributes?.["xml:space"] ?? docXmlSpace;
|
|
39221
39220
|
if (xmlSpace !== "preserve" && typeof text2 === "string") {
|
|
39222
39221
|
text2 = text2.replace(/^[ \t\n\r]+/, "").replace(/[ \t\n\r]+$/, "");
|
|
39223
39222
|
}
|
|
39224
39223
|
text2 = text2.replace(/\[\[sdspace\]\]/g, "");
|
|
39224
|
+
if (xmlSpace !== "preserve" && typeof text2 === "string" && !text2.trim()) {
|
|
39225
|
+
return null;
|
|
39226
|
+
}
|
|
39225
39227
|
} else if (!elements.length && encodedAttrs.xmlSpace === "preserve") {
|
|
39226
39228
|
text2 = " ";
|
|
39227
39229
|
} else return null;
|
|
@@ -42204,8 +42206,46 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
42204
42206
|
this.declaration = this.initialJSON?.declaration;
|
|
42205
42207
|
this.resolveDocumentGuid();
|
|
42206
42208
|
}
|
|
42209
|
+
/**
|
|
42210
|
+
* Parses XML content into JSON format while preserving whitespace-only text runs.
|
|
42211
|
+
*
|
|
42212
|
+
* This method wraps xml-js's xml2json parser with additional preprocessing to prevent
|
|
42213
|
+
* the parser from dropping whitespace-only content in <w:t> and <w:delText> elements.
|
|
42214
|
+
* This is critical for correctly handling documents that rely on document-level
|
|
42215
|
+
* xml:space="preserve" rather than per-element attributes, which is common in
|
|
42216
|
+
* PDF-to-DOCX converted documents.
|
|
42217
|
+
*
|
|
42218
|
+
* The whitespace preservation strategy:
|
|
42219
|
+
* 1. Before parsing, wraps whitespace-only content with [[sdspace]] placeholders
|
|
42220
|
+
* 2. xml-js parser preserves the placeholder-wrapped text
|
|
42221
|
+
* 3. During text node processing (t-translator.js), placeholders are removed
|
|
42222
|
+
*
|
|
42223
|
+
* @param {string} xml - The XML string to parse
|
|
42224
|
+
* @returns {Object} The parsed JSON representation of the XML document
|
|
42225
|
+
*
|
|
42226
|
+
* @example
|
|
42227
|
+
* // Handles whitespace-only text runs
|
|
42228
|
+
* const xml = '<w:t> </w:t>';
|
|
42229
|
+
* const result = parseXmlToJson(xml);
|
|
42230
|
+
* // Result preserves the space: { elements: [{ text: '[[sdspace]] [[sdspace]]' }] }
|
|
42231
|
+
*
|
|
42232
|
+
* @example
|
|
42233
|
+
* // Handles elements with attributes
|
|
42234
|
+
* const xml = '<w:t xml:space="preserve"> text </w:t>';
|
|
42235
|
+
* const result = parseXmlToJson(xml);
|
|
42236
|
+
* // Preserves content and attributes
|
|
42237
|
+
*
|
|
42238
|
+
* @example
|
|
42239
|
+
* // Handles both w:t and w:delText elements
|
|
42240
|
+
* const xml = '<w:delText> </w:delText>';
|
|
42241
|
+
* const result = parseXmlToJson(xml);
|
|
42242
|
+
* // Preserves whitespace in deleted text
|
|
42243
|
+
*/
|
|
42207
42244
|
parseXmlToJson(xml2) {
|
|
42208
|
-
const newXml = xml2.replace(
|
|
42245
|
+
const newXml = xml2.replace(
|
|
42246
|
+
/(<w:(?:t|delText)(?:\s[^>]*)?>)(\s+)(<\/w:(?:t|delText)>)/g,
|
|
42247
|
+
"$1[[sdspace]]$2[[sdspace]]$3"
|
|
42248
|
+
);
|
|
42209
42249
|
return JSON.parse(xmljs.xml2json(newXml, null, 2));
|
|
42210
42250
|
}
|
|
42211
42251
|
/**
|
|
@@ -42428,7 +42468,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
42428
42468
|
static getStoredSuperdocVersion(docx) {
|
|
42429
42469
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42430
42470
|
}
|
|
42431
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.
|
|
42471
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.20") {
|
|
42432
42472
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42433
42473
|
}
|
|
42434
42474
|
/**
|
|
@@ -53615,7 +53655,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53615
53655
|
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);
|
|
53616
53656
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
53617
53657
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
53618
|
-
var _a, _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, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _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, _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, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _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, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, wrapHiddenEditorFocus_fn, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_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, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _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, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_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;
|
|
53658
|
+
var _a, _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, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _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, _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, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _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, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, wrapHiddenEditorFocus_fn, syncDocumentModeClass_fn, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_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, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _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, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_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;
|
|
53619
53659
|
var GOOD_LEAF_SIZE = 200;
|
|
53620
53660
|
var RopeSequence = function RopeSequence2() {
|
|
53621
53661
|
};
|
|
@@ -65451,6 +65491,9 @@ ${err.toString()}`);
|
|
|
65451
65491
|
return null;
|
|
65452
65492
|
}
|
|
65453
65493
|
const actualMark = start2.node.marks.find((mark2) => mark2.type.name === markName);
|
|
65494
|
+
if (!actualMark) {
|
|
65495
|
+
return null;
|
|
65496
|
+
}
|
|
65454
65497
|
let startIndex = $pos.index();
|
|
65455
65498
|
let startPos = $pos.start() + start2.offset;
|
|
65456
65499
|
while (startIndex > 0 && actualMark.isInSet(parent.child(startIndex - 1).marks)) {
|
|
@@ -65740,6 +65783,70 @@ ${err.toString()}`);
|
|
|
65740
65783
|
});
|
|
65741
65784
|
return positions;
|
|
65742
65785
|
};
|
|
65786
|
+
const getCommentMarkSegmentsById = (commentId, doc2) => {
|
|
65787
|
+
const segments = [];
|
|
65788
|
+
doc2.descendants((node2, pos) => {
|
|
65789
|
+
if (!node2.isInline) return;
|
|
65790
|
+
const commentMark = node2.marks?.find(
|
|
65791
|
+
(mark2) => mark2.type.name === CommentMarkName$1 && mark2.attrs?.commentId === commentId
|
|
65792
|
+
);
|
|
65793
|
+
if (!commentMark) return;
|
|
65794
|
+
segments.push({
|
|
65795
|
+
from: pos,
|
|
65796
|
+
to: pos + node2.nodeSize,
|
|
65797
|
+
attrs: commentMark.attrs || {}
|
|
65798
|
+
});
|
|
65799
|
+
});
|
|
65800
|
+
return segments;
|
|
65801
|
+
};
|
|
65802
|
+
const getCommentMarkRangesById = (commentId, doc2) => {
|
|
65803
|
+
const segments = getCommentMarkSegmentsById(commentId, doc2);
|
|
65804
|
+
if (!segments.length) return { segments, ranges: [] };
|
|
65805
|
+
const ranges = [];
|
|
65806
|
+
let active = null;
|
|
65807
|
+
segments.forEach((seg) => {
|
|
65808
|
+
if (!active) {
|
|
65809
|
+
active = {
|
|
65810
|
+
from: seg.from,
|
|
65811
|
+
to: seg.to,
|
|
65812
|
+
internal: !!seg.attrs?.internal
|
|
65813
|
+
};
|
|
65814
|
+
return;
|
|
65815
|
+
}
|
|
65816
|
+
if (seg.from <= active.to) {
|
|
65817
|
+
active.to = Math.max(active.to, seg.to);
|
|
65818
|
+
return;
|
|
65819
|
+
}
|
|
65820
|
+
ranges.push(active);
|
|
65821
|
+
active = {
|
|
65822
|
+
from: seg.from,
|
|
65823
|
+
to: seg.to,
|
|
65824
|
+
internal: !!seg.attrs?.internal
|
|
65825
|
+
};
|
|
65826
|
+
});
|
|
65827
|
+
if (active) ranges.push(active);
|
|
65828
|
+
return { segments, ranges };
|
|
65829
|
+
};
|
|
65830
|
+
const resolveCommentById = ({ commentId, state: state2, tr, dispatch }) => {
|
|
65831
|
+
const { schema } = state2;
|
|
65832
|
+
const markType = schema.marks?.[CommentMarkName$1];
|
|
65833
|
+
if (!markType) return false;
|
|
65834
|
+
const { segments, ranges } = getCommentMarkRangesById(commentId, state2.doc);
|
|
65835
|
+
if (!segments.length) return false;
|
|
65836
|
+
segments.forEach(({ from: from2, to, attrs }) => {
|
|
65837
|
+
tr.removeMark(from2, to, markType.create(attrs));
|
|
65838
|
+
});
|
|
65839
|
+
const startType = schema.nodes?.commentRangeStart;
|
|
65840
|
+
const endType = schema.nodes?.commentRangeEnd;
|
|
65841
|
+
if (startType && endType) {
|
|
65842
|
+
ranges.slice().sort((a2, b2) => b2.from - a2.from).forEach(({ from: from2, to, internal }) => {
|
|
65843
|
+
tr.insert(to, endType.create({ "w:id": commentId }));
|
|
65844
|
+
tr.insert(from2, startType.create({ "w:id": commentId, internal }));
|
|
65845
|
+
});
|
|
65846
|
+
}
|
|
65847
|
+
dispatch(tr);
|
|
65848
|
+
return true;
|
|
65849
|
+
};
|
|
65743
65850
|
const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
65744
65851
|
const commentMap = /* @__PURE__ */ new Map();
|
|
65745
65852
|
comments.forEach((c2) => {
|
|
@@ -65846,6 +65953,7 @@ ${err.toString()}`);
|
|
|
65846
65953
|
const prepareCommentsForImport = (doc2, tr, schema, converter) => {
|
|
65847
65954
|
const toMark = [];
|
|
65848
65955
|
const toDelete = [];
|
|
65956
|
+
const toUpdate = [];
|
|
65849
65957
|
doc2.descendants((node2, pos) => {
|
|
65850
65958
|
const { type: type2 } = node2;
|
|
65851
65959
|
const commentNodes = ["commentRangeStart", "commentRangeEnd", "commentReference"];
|
|
@@ -65854,8 +65962,9 @@ ${err.toString()}`);
|
|
|
65854
65962
|
converter,
|
|
65855
65963
|
importedId: node2.attrs["w:id"]
|
|
65856
65964
|
});
|
|
65965
|
+
const isDone = !!matchingImportedComment?.isDone;
|
|
65857
65966
|
if (type2.name === "commentRangeStart") {
|
|
65858
|
-
if (!
|
|
65967
|
+
if (!isDone) {
|
|
65859
65968
|
toMark.push({
|
|
65860
65969
|
commentId: resolvedCommentId,
|
|
65861
65970
|
importedId,
|
|
@@ -65869,8 +65978,29 @@ ${err.toString()}`);
|
|
|
65869
65978
|
commentId: resolvedCommentId,
|
|
65870
65979
|
importedId
|
|
65871
65980
|
});
|
|
65872
|
-
|
|
65981
|
+
if (isDone) {
|
|
65982
|
+
toUpdate.push({
|
|
65983
|
+
pos,
|
|
65984
|
+
attrs: {
|
|
65985
|
+
...node2.attrs,
|
|
65986
|
+
"w:id": resolvedCommentId,
|
|
65987
|
+
internal
|
|
65988
|
+
}
|
|
65989
|
+
});
|
|
65990
|
+
} else {
|
|
65991
|
+
toDelete.push({ start: pos, end: pos + 1 });
|
|
65992
|
+
}
|
|
65873
65993
|
} else if (type2.name === "commentRangeEnd") {
|
|
65994
|
+
if (isDone) {
|
|
65995
|
+
toUpdate.push({
|
|
65996
|
+
pos,
|
|
65997
|
+
attrs: {
|
|
65998
|
+
...node2.attrs,
|
|
65999
|
+
"w:id": resolvedCommentId
|
|
66000
|
+
}
|
|
66001
|
+
});
|
|
66002
|
+
return;
|
|
66003
|
+
}
|
|
65874
66004
|
const itemToMark = toMark.find((p2) => p2.importedId === importedId);
|
|
65875
66005
|
if (!itemToMark) return;
|
|
65876
66006
|
const { start: start2 } = itemToMark;
|
|
@@ -65885,6 +66015,11 @@ ${err.toString()}`);
|
|
|
65885
66015
|
toDelete.push({ start: pos, end: pos + 1 });
|
|
65886
66016
|
}
|
|
65887
66017
|
});
|
|
66018
|
+
if (typeof tr.setNodeMarkup === "function") {
|
|
66019
|
+
toUpdate.sort((a2, b2) => b2.pos - a2.pos).forEach(({ pos, attrs }) => {
|
|
66020
|
+
tr.setNodeMarkup(pos, void 0, attrs);
|
|
66021
|
+
});
|
|
66022
|
+
}
|
|
65888
66023
|
toDelete.sort((a2, b2) => b2.start - a2.start).forEach(({ start: start2, end: end2 }) => {
|
|
65889
66024
|
tr.delete(start2, end2);
|
|
65890
66025
|
});
|
|
@@ -66078,7 +66213,7 @@ ${err.toString()}`);
|
|
|
66078
66213
|
},
|
|
66079
66214
|
resolveComment: ({ commentId }) => ({ tr, dispatch, state: state2 }) => {
|
|
66080
66215
|
tr.setMeta(CommentsPluginKey, { event: "update" });
|
|
66081
|
-
|
|
66216
|
+
return resolveCommentById({ commentId, state: state2, tr, dispatch });
|
|
66082
66217
|
},
|
|
66083
66218
|
setCursorById: (id) => ({ state: state2, editor }) => {
|
|
66084
66219
|
const { from: from2 } = findRangeById(state2.doc, id) || {};
|
|
@@ -66511,47 +66646,58 @@ ${err.toString()}`);
|
|
|
66511
66646
|
return from2 !== null && to !== null ? { from: from2, to } : null;
|
|
66512
66647
|
}
|
|
66513
66648
|
const replaceStep = ({ state: state2, tr, step, newTr, map: map2, user, date, originalStep, originalStepIndex }) => {
|
|
66514
|
-
const
|
|
66515
|
-
|
|
66516
|
-
const
|
|
66517
|
-
const
|
|
66518
|
-
|
|
66519
|
-
|
|
66520
|
-
|
|
66521
|
-
|
|
66522
|
-
|
|
66523
|
-
|
|
66524
|
-
|
|
66525
|
-
|
|
66526
|
-
|
|
66527
|
-
|
|
66528
|
-
|
|
66529
|
-
|
|
66530
|
-
|
|
66531
|
-
|
|
66532
|
-
|
|
66533
|
-
const insertedMark = markInsertion({
|
|
66534
|
-
tr: trTemp,
|
|
66535
|
-
from: newStep.from,
|
|
66536
|
-
to: mappedNewStepTo,
|
|
66537
|
-
user,
|
|
66538
|
-
date
|
|
66539
|
-
});
|
|
66540
|
-
const condensedStep = new ReplaceStep(newStep.from, newStep.to, trTemp.doc.slice(newStep.from, mappedNewStepTo));
|
|
66541
|
-
newTr.step(condensedStep);
|
|
66542
|
-
const mirrorIndex = map2.maps.length - 1;
|
|
66543
|
-
map2.appendMap(condensedStep.getMap(), mirrorIndex);
|
|
66544
|
-
if (newStep.from !== mappedNewStepTo) {
|
|
66545
|
-
meta2.insertedMark = insertedMark;
|
|
66546
|
-
meta2.step = condensedStep;
|
|
66649
|
+
const trTemp = state2.apply(newTr).tr;
|
|
66650
|
+
let positionTo = step.to;
|
|
66651
|
+
const probePos = Math.max(step.from, step.to - 1);
|
|
66652
|
+
const deletionSpan = findMarkPosition(trTemp.doc, probePos, TrackDeleteMarkName$1);
|
|
66653
|
+
if (deletionSpan && deletionSpan.to > positionTo) {
|
|
66654
|
+
positionTo = deletionSpan.to;
|
|
66655
|
+
}
|
|
66656
|
+
const tryInsert = (slice2) => {
|
|
66657
|
+
const insertionStep = new ReplaceStep(positionTo, positionTo, slice2, false);
|
|
66658
|
+
if (trTemp.maybeStep(insertionStep).failed) return null;
|
|
66659
|
+
return {
|
|
66660
|
+
insertedFrom: insertionStep.from,
|
|
66661
|
+
insertedTo: insertionStep.getMap().map(insertionStep.to, 1)
|
|
66662
|
+
};
|
|
66663
|
+
};
|
|
66664
|
+
const insertion = tryInsert(step.slice) || tryInsert(Slice.maxOpen(step.slice.content, true));
|
|
66665
|
+
if (!insertion) {
|
|
66666
|
+
if (!newTr.maybeStep(step).failed) {
|
|
66667
|
+
map2.appendMap(step.getMap());
|
|
66547
66668
|
}
|
|
66548
|
-
|
|
66549
|
-
|
|
66669
|
+
return;
|
|
66670
|
+
}
|
|
66671
|
+
const meta2 = {};
|
|
66672
|
+
const insertedMark = markInsertion({
|
|
66673
|
+
tr: trTemp,
|
|
66674
|
+
from: insertion.insertedFrom,
|
|
66675
|
+
to: insertion.insertedTo,
|
|
66676
|
+
user,
|
|
66677
|
+
date
|
|
66678
|
+
});
|
|
66679
|
+
const trackedInsertedSlice = trTemp.doc.slice(insertion.insertedFrom, insertion.insertedTo);
|
|
66680
|
+
const condensedStep = new ReplaceStep(positionTo, positionTo, trackedInsertedSlice, false);
|
|
66681
|
+
if (newTr.maybeStep(condensedStep).failed) {
|
|
66682
|
+
if (!newTr.maybeStep(step).failed) {
|
|
66683
|
+
map2.appendMap(step.getMap());
|
|
66550
66684
|
}
|
|
66685
|
+
return;
|
|
66686
|
+
}
|
|
66687
|
+
const invertStep = originalStep.invert(tr.docs[originalStepIndex]).map(map2);
|
|
66688
|
+
map2.appendMap(invertStep.getMap());
|
|
66689
|
+
const mirrorIndex = map2.maps.length - 1;
|
|
66690
|
+
map2.appendMap(condensedStep.getMap(), mirrorIndex);
|
|
66691
|
+
if (insertion.insertedFrom !== insertion.insertedTo) {
|
|
66692
|
+
meta2.insertedMark = insertedMark;
|
|
66693
|
+
meta2.step = condensedStep;
|
|
66694
|
+
}
|
|
66695
|
+
if (!newTr.selection.eq(trTemp.selection)) {
|
|
66696
|
+
newTr.setSelection(trTemp.selection);
|
|
66551
66697
|
}
|
|
66552
66698
|
if (step.from !== step.to) {
|
|
66553
66699
|
const {
|
|
66554
|
-
deletionMark
|
|
66700
|
+
deletionMark,
|
|
66555
66701
|
deletionMap,
|
|
66556
66702
|
nodes: deletionNodes
|
|
66557
66703
|
} = markDeletion({
|
|
@@ -66563,7 +66709,7 @@ ${err.toString()}`);
|
|
|
66563
66709
|
id: meta2.insertedMark?.attrs?.id
|
|
66564
66710
|
});
|
|
66565
66711
|
meta2.deletionNodes = deletionNodes;
|
|
66566
|
-
meta2.deletionMark =
|
|
66712
|
+
meta2.deletionMark = deletionMark;
|
|
66567
66713
|
map2.appendMapping(deletionMap);
|
|
66568
66714
|
}
|
|
66569
66715
|
newTr.setMeta(TrackChangesBasePluginKey, meta2);
|
|
@@ -68384,7 +68530,7 @@ ${err.toString()}`);
|
|
|
68384
68530
|
const shouldSkipNodeView = (editor) => {
|
|
68385
68531
|
return isHeadless(editor);
|
|
68386
68532
|
};
|
|
68387
|
-
const summaryVersion = "2.0.0-next.
|
|
68533
|
+
const summaryVersion = "2.0.0-next.20";
|
|
68388
68534
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
68389
68535
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
68390
68536
|
function mapAttributes(attrs) {
|
|
@@ -69173,7 +69319,7 @@ ${err.toString()}`);
|
|
|
69173
69319
|
{ default: remarkStringify2 },
|
|
69174
69320
|
{ default: remarkGfm2 }
|
|
69175
69321
|
] = await Promise.all([
|
|
69176
|
-
Promise.resolve().then(() =>
|
|
69322
|
+
Promise.resolve().then(() => indexXnRj2biz),
|
|
69177
69323
|
Promise.resolve().then(() => indexDRCvimau),
|
|
69178
69324
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
69179
69325
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -69378,7 +69524,7 @@ ${err.toString()}`);
|
|
|
69378
69524
|
* Process collaboration migrations
|
|
69379
69525
|
*/
|
|
69380
69526
|
processCollaborationMigrations() {
|
|
69381
|
-
console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.
|
|
69527
|
+
console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.20");
|
|
69382
69528
|
if (!this.options.ydoc) return;
|
|
69383
69529
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
69384
69530
|
let docVersion = metaMap.get("version");
|
|
@@ -74942,6 +75088,24 @@ ${l}
|
|
|
74942
75088
|
display: block;
|
|
74943
75089
|
}
|
|
74944
75090
|
|
|
75091
|
+
/* Viewing mode: remove structured content affordances */
|
|
75092
|
+
.presentation-editor--viewing .superdoc-structured-content-block,
|
|
75093
|
+
.presentation-editor--viewing .superdoc-structured-content-inline {
|
|
75094
|
+
background: none;
|
|
75095
|
+
border: none;
|
|
75096
|
+
padding: 0;
|
|
75097
|
+
}
|
|
75098
|
+
|
|
75099
|
+
.presentation-editor--viewing .superdoc-structured-content-inline:hover {
|
|
75100
|
+
background: none;
|
|
75101
|
+
border: none;
|
|
75102
|
+
}
|
|
75103
|
+
|
|
75104
|
+
.presentation-editor--viewing .superdoc-structured-content__label,
|
|
75105
|
+
.presentation-editor--viewing .superdoc-structured-content-inline__label {
|
|
75106
|
+
display: none !important;
|
|
75107
|
+
}
|
|
75108
|
+
|
|
74945
75109
|
/* Print mode: hide visual styling for SDT containers */
|
|
74946
75110
|
@media print {
|
|
74947
75111
|
.superdoc-document-section,
|
|
@@ -76630,7 +76794,7 @@ ${l}
|
|
|
76630
76794
|
return true;
|
|
76631
76795
|
}
|
|
76632
76796
|
const LIST_MARKER_GAP$2 = 8;
|
|
76633
|
-
const DEFAULT_TAB_INTERVAL_PX$
|
|
76797
|
+
const DEFAULT_TAB_INTERVAL_PX$2 = 48;
|
|
76634
76798
|
const DEFAULT_PAGE_HEIGHT_PX = 1056;
|
|
76635
76799
|
const DEFAULT_VIRTUALIZED_PAGE_GAP$1 = 72;
|
|
76636
76800
|
const COMMENT_EXTERNAL_COLOR = "#B1124B";
|
|
@@ -77557,6 +77721,7 @@ ${l}
|
|
|
77557
77721
|
const block = lookup2.block;
|
|
77558
77722
|
const measure = lookup2.measure;
|
|
77559
77723
|
const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : void 0;
|
|
77724
|
+
const alignment2 = block.attrs?.alignment;
|
|
77560
77725
|
const fragmentEl = this.doc.createElement("div");
|
|
77561
77726
|
fragmentEl.classList.add(CLASS_NAMES$1.fragment);
|
|
77562
77727
|
const isTocEntry = block.attrs?.isTocEntry;
|
|
@@ -77635,7 +77800,7 @@ ${l}
|
|
|
77635
77800
|
const textStart = paraIndentLeft + firstLine;
|
|
77636
77801
|
tabWidth = textStart - currentPos;
|
|
77637
77802
|
if (tabWidth <= 0) {
|
|
77638
|
-
tabWidth = DEFAULT_TAB_INTERVAL_PX$
|
|
77803
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$2 - currentPos % DEFAULT_TAB_INTERVAL_PX$2;
|
|
77639
77804
|
} else if (tabWidth < LIST_MARKER_GAP$2) {
|
|
77640
77805
|
tabWidth = LIST_MARKER_GAP$2;
|
|
77641
77806
|
}
|
|
@@ -77662,6 +77827,21 @@ ${l}
|
|
|
77662
77827
|
let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
77663
77828
|
if (index2 === 0 && listFirstLineMarkerTabWidth != null) {
|
|
77664
77829
|
availableWidthOverride = fragment.width - listFirstLineMarkerTabWidth - Math.max(0, paraIndentRight);
|
|
77830
|
+
if (alignment2 === "justify" || alignment2 === "both") {
|
|
77831
|
+
console.log(
|
|
77832
|
+
"[justify-debug][painter-firstline-available]",
|
|
77833
|
+
JSON.stringify({
|
|
77834
|
+
blockId: block.id,
|
|
77835
|
+
fragmentWidth: fragment.width,
|
|
77836
|
+
markerTabWidth: listFirstLineMarkerTabWidth,
|
|
77837
|
+
paraIndentRight,
|
|
77838
|
+
availableWidthOverride,
|
|
77839
|
+
lineMaxWidth: line.maxWidth ?? null,
|
|
77840
|
+
lineWidth: line.width,
|
|
77841
|
+
lineNaturalWidth: line.naturalWidth ?? null
|
|
77842
|
+
})
|
|
77843
|
+
);
|
|
77844
|
+
}
|
|
77665
77845
|
}
|
|
77666
77846
|
const isLastLineOfFragment = index2 === lines.length - 1;
|
|
77667
77847
|
const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
|
|
@@ -77787,7 +77967,7 @@ ${l}
|
|
|
77787
77967
|
const textStart = paraIndentLeft + firstLine;
|
|
77788
77968
|
tabWidth = textStart - currentPos;
|
|
77789
77969
|
if (tabWidth <= 0) {
|
|
77790
|
-
tabWidth = DEFAULT_TAB_INTERVAL_PX$
|
|
77970
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$2 - currentPos % DEFAULT_TAB_INTERVAL_PX$2;
|
|
77791
77971
|
} else if (tabWidth < LIST_MARKER_GAP$2) {
|
|
77792
77972
|
tabWidth = LIST_MARKER_GAP$2;
|
|
77793
77973
|
}
|
|
@@ -79321,6 +79501,23 @@ ${l}
|
|
|
79321
79501
|
if (spacingPerSpace !== 0) {
|
|
79322
79502
|
el.style.wordSpacing = `${spacingPerSpace}px`;
|
|
79323
79503
|
}
|
|
79504
|
+
if (justifyShouldApply && spacingPerSpace < 0) {
|
|
79505
|
+
console.log(
|
|
79506
|
+
"[justify-debug][painter-wordspacing-negative]",
|
|
79507
|
+
JSON.stringify({
|
|
79508
|
+
blockId: block.id,
|
|
79509
|
+
lineIndex: lineIndex ?? null,
|
|
79510
|
+
alignment: alignment2 ?? null,
|
|
79511
|
+
availableWidth,
|
|
79512
|
+
lineWidth,
|
|
79513
|
+
lineMaxWidth: line.maxWidth ?? null,
|
|
79514
|
+
lineNaturalWidth: line.naturalWidth ?? null,
|
|
79515
|
+
spaceCount,
|
|
79516
|
+
hasExplicitPositioning: Boolean(hasExplicitPositioning),
|
|
79517
|
+
skipJustify: Boolean(skipJustify)
|
|
79518
|
+
})
|
|
79519
|
+
);
|
|
79520
|
+
}
|
|
79324
79521
|
if (hasExplicitPositioning && line.segments) {
|
|
79325
79522
|
const paraIndent = block.attrs?.indent;
|
|
79326
79523
|
const indentLeft = paraIndent?.left ?? 0;
|
|
@@ -81514,6 +81711,28 @@ ${l}
|
|
|
81514
81711
|
const TAB_CHAR_LENGTH = 1;
|
|
81515
81712
|
const SPACE_CHARS = SPACE_CHARS$1;
|
|
81516
81713
|
const isTabRun$1 = (run2) => run2?.kind === "tab";
|
|
81714
|
+
const isWordChar$3 = (char) => {
|
|
81715
|
+
if (!char) return false;
|
|
81716
|
+
const code2 = char.charCodeAt(0);
|
|
81717
|
+
return code2 >= 48 && code2 <= 57 || code2 >= 65 && code2 <= 90 || code2 >= 97 && code2 <= 122 || char === "'";
|
|
81718
|
+
};
|
|
81719
|
+
const capitalizeText$2 = (text2) => {
|
|
81720
|
+
if (!text2) return text2;
|
|
81721
|
+
let result = "";
|
|
81722
|
+
for (let i2 = 0; i2 < text2.length; i2 += 1) {
|
|
81723
|
+
const prevChar = i2 > 0 ? text2[i2 - 1] : "";
|
|
81724
|
+
const ch = text2[i2];
|
|
81725
|
+
result += isWordChar$3(ch) && !isWordChar$3(prevChar) ? ch.toUpperCase() : ch;
|
|
81726
|
+
}
|
|
81727
|
+
return result;
|
|
81728
|
+
};
|
|
81729
|
+
const applyTextTransform$2 = (text2, transform) => {
|
|
81730
|
+
if (!text2 || !transform || transform === "none") return text2;
|
|
81731
|
+
if (transform === "uppercase") return text2.toUpperCase();
|
|
81732
|
+
if (transform === "lowercase") return text2.toLowerCase();
|
|
81733
|
+
if (transform === "capitalize") return capitalizeText$2(text2);
|
|
81734
|
+
return text2;
|
|
81735
|
+
};
|
|
81517
81736
|
function getMeasurementContext() {
|
|
81518
81737
|
if (measurementCtx) return measurementCtx;
|
|
81519
81738
|
if (typeof document === "undefined") {
|
|
@@ -81689,17 +81908,19 @@ ${l}
|
|
|
81689
81908
|
}
|
|
81690
81909
|
const text2 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
81691
81910
|
const runLength = text2.length;
|
|
81911
|
+
const transform = isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? void 0 : run2.textTransform;
|
|
81912
|
+
const displayText = applyTextTransform$2(text2, transform);
|
|
81692
81913
|
if (currentCharOffset + runLength >= charOffset) {
|
|
81693
81914
|
const offsetInRun = charOffset - currentCharOffset;
|
|
81694
81915
|
ctx2.font = getRunFontString(run2);
|
|
81695
|
-
const textUpToTarget =
|
|
81916
|
+
const textUpToTarget = displayText.slice(0, offsetInRun);
|
|
81696
81917
|
const measured2 = ctx2.measureText(textUpToTarget);
|
|
81697
81918
|
const spacingWidth = computeLetterSpacingWidth(run2, offsetInRun, runLength);
|
|
81698
|
-
const spacesInPortion = justify.extraPerSpace !== 0 ? countSpaces(
|
|
81919
|
+
const spacesInPortion = justify.extraPerSpace !== 0 ? countSpaces(text2.slice(0, offsetInRun)) : 0;
|
|
81699
81920
|
return alignmentOffset + currentX + measured2.width + spacingWidth + justify.extraPerSpace * (spaceTally + spacesInPortion);
|
|
81700
81921
|
}
|
|
81701
81922
|
ctx2.font = getRunFontString(run2);
|
|
81702
|
-
const measured = ctx2.measureText(
|
|
81923
|
+
const measured = ctx2.measureText(displayText);
|
|
81703
81924
|
const runLetterSpacing = computeLetterSpacingWidth(run2, runLength, runLength);
|
|
81704
81925
|
const spacesInRun = justify.extraPerSpace !== 0 ? countSpaces(text2) : 0;
|
|
81705
81926
|
currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
|
|
@@ -81738,8 +81959,10 @@ ${l}
|
|
|
81738
81959
|
return segmentBaseX + (offsetInSegment >= segmentChars ? segment.width ?? 0 : 0);
|
|
81739
81960
|
}
|
|
81740
81961
|
const text2 = run2.text ?? "";
|
|
81741
|
-
const
|
|
81742
|
-
const
|
|
81962
|
+
const transform = "textTransform" in run2 ? run2.textTransform : void 0;
|
|
81963
|
+
const displayText = applyTextTransform$2(text2, transform);
|
|
81964
|
+
const displaySegmentText = displayText.slice(segment.fromChar, segment.toChar);
|
|
81965
|
+
const textUpToTarget = displaySegmentText.slice(0, offsetInSegment);
|
|
81743
81966
|
ctx2.font = getRunFontString(run2);
|
|
81744
81967
|
const measured = ctx2.measureText(textUpToTarget);
|
|
81745
81968
|
const spacingWidth = computeLetterSpacingWidth(run2, offsetInSegment, segmentChars);
|
|
@@ -81835,12 +82058,14 @@ ${l}
|
|
|
81835
82058
|
}
|
|
81836
82059
|
const text2 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
81837
82060
|
const runLength = text2.length;
|
|
82061
|
+
const transform = isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? void 0 : run2.textTransform;
|
|
82062
|
+
const displayText = applyTextTransform$2(text2, transform);
|
|
81838
82063
|
if (runLength === 0) continue;
|
|
81839
82064
|
ctx2.font = getRunFontString(run2);
|
|
81840
82065
|
for (let i2 = 0; i2 <= runLength; i2++) {
|
|
81841
|
-
const textUpToChar =
|
|
82066
|
+
const textUpToChar = displayText.slice(0, i2);
|
|
81842
82067
|
const measured2 = ctx2.measureText(textUpToChar);
|
|
81843
|
-
const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(
|
|
82068
|
+
const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(text2.slice(0, i2)) : 0;
|
|
81844
82069
|
const charX = currentX + measured2.width + computeLetterSpacingWidth(run2, i2, runLength) + justify.extraPerSpace * (spaceTally + spacesInPortion);
|
|
81845
82070
|
if (charX >= safeX) {
|
|
81846
82071
|
if (i2 === 0) {
|
|
@@ -81850,7 +82075,7 @@ ${l}
|
|
|
81850
82075
|
pmPosition: pmPosition3
|
|
81851
82076
|
};
|
|
81852
82077
|
}
|
|
81853
|
-
const prevText =
|
|
82078
|
+
const prevText = displayText.slice(0, i2 - 1);
|
|
81854
82079
|
const prevMeasured = ctx2.measureText(prevText);
|
|
81855
82080
|
const prevX = currentX + prevMeasured.width + computeLetterSpacingWidth(run2, i2 - 1, runLength);
|
|
81856
82081
|
const distToPrev = Math.abs(safeX - prevX);
|
|
@@ -81863,7 +82088,7 @@ ${l}
|
|
|
81863
82088
|
};
|
|
81864
82089
|
}
|
|
81865
82090
|
}
|
|
81866
|
-
const measured = ctx2.measureText(
|
|
82091
|
+
const measured = ctx2.measureText(displayText);
|
|
81867
82092
|
const runLetterSpacing = computeLetterSpacingWidth(run2, runLength, runLength);
|
|
81868
82093
|
const spacesInRun = justify.extraPerSpace > 0 ? countSpaces(text2) : 0;
|
|
81869
82094
|
currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
|
|
@@ -82294,6 +82519,83 @@ ${l}
|
|
|
82294
82519
|
}
|
|
82295
82520
|
return index2;
|
|
82296
82521
|
}
|
|
82522
|
+
const LIST_MARKER_GAP$1 = 8;
|
|
82523
|
+
const MIN_MARKER_GUTTER = 24;
|
|
82524
|
+
const DEFAULT_LIST_INDENT_BASE_PX = 24;
|
|
82525
|
+
const DEFAULT_LIST_INDENT_STEP_PX = 24;
|
|
82526
|
+
const DEFAULT_LIST_HANGING_PX$1 = 18;
|
|
82527
|
+
const SPACE_SUFFIX_GAP_PX = 4;
|
|
82528
|
+
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
82529
|
+
function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, measureMarkerText) {
|
|
82530
|
+
const marker = wordLayout?.marker;
|
|
82531
|
+
if (!marker) {
|
|
82532
|
+
const textStartPx = wordLayout?.firstLineIndentMode === true && typeof wordLayout.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : void 0;
|
|
82533
|
+
return textStartPx;
|
|
82534
|
+
}
|
|
82535
|
+
const markerBoxWidth = typeof marker.markerBoxWidthPx === "number" && Number.isFinite(marker.markerBoxWidthPx) ? marker.markerBoxWidthPx : 0;
|
|
82536
|
+
let markerTextWidth = typeof marker.glyphWidthPx === "number" && Number.isFinite(marker.glyphWidthPx) ? marker.glyphWidthPx : void 0;
|
|
82537
|
+
if (markerTextWidth == null && marker.markerText) {
|
|
82538
|
+
markerTextWidth = measureMarkerText(marker.markerText, marker);
|
|
82539
|
+
}
|
|
82540
|
+
if (!Number.isFinite(markerTextWidth) || markerTextWidth !== void 0 && markerTextWidth < 0) {
|
|
82541
|
+
markerTextWidth = markerBoxWidth;
|
|
82542
|
+
}
|
|
82543
|
+
const finalMarkerTextWidth = Math.max(0, markerTextWidth ?? 0);
|
|
82544
|
+
let markerStartPos;
|
|
82545
|
+
if (wordLayout?.firstLineIndentMode === true && typeof marker.markerX === "number" && Number.isFinite(marker.markerX)) {
|
|
82546
|
+
markerStartPos = marker.markerX;
|
|
82547
|
+
} else {
|
|
82548
|
+
markerStartPos = indentLeft - hanging + firstLine;
|
|
82549
|
+
}
|
|
82550
|
+
if (!Number.isFinite(markerStartPos)) {
|
|
82551
|
+
markerStartPos = 0;
|
|
82552
|
+
}
|
|
82553
|
+
const currentPos = markerStartPos + finalMarkerTextWidth;
|
|
82554
|
+
const suffix2 = marker.suffix ?? "tab";
|
|
82555
|
+
if (suffix2 === "space") {
|
|
82556
|
+
return markerStartPos + finalMarkerTextWidth + SPACE_SUFFIX_GAP_PX;
|
|
82557
|
+
}
|
|
82558
|
+
if (suffix2 === "nothing") {
|
|
82559
|
+
return markerStartPos + finalMarkerTextWidth;
|
|
82560
|
+
}
|
|
82561
|
+
const markerJustification = marker.justification ?? "left";
|
|
82562
|
+
if (markerJustification !== "left") {
|
|
82563
|
+
const gutterWidth = typeof marker.gutterWidthPx === "number" && Number.isFinite(marker.gutterWidthPx) && marker.gutterWidthPx > 0 ? marker.gutterWidthPx : LIST_MARKER_GAP$1;
|
|
82564
|
+
return markerStartPos + finalMarkerTextWidth + Math.max(gutterWidth, LIST_MARKER_GAP$1);
|
|
82565
|
+
}
|
|
82566
|
+
if (wordLayout?.firstLineIndentMode === true) {
|
|
82567
|
+
let targetTabStop;
|
|
82568
|
+
if (Array.isArray(wordLayout.tabsPx)) {
|
|
82569
|
+
for (const tab of wordLayout.tabsPx) {
|
|
82570
|
+
if (typeof tab === "number" && tab > currentPos) {
|
|
82571
|
+
targetTabStop = tab;
|
|
82572
|
+
break;
|
|
82573
|
+
}
|
|
82574
|
+
}
|
|
82575
|
+
}
|
|
82576
|
+
const textStartTarget = typeof marker.textStartX === "number" && Number.isFinite(marker.textStartX) ? marker.textStartX : wordLayout.textStartPx;
|
|
82577
|
+
let tabWidth2;
|
|
82578
|
+
if (targetTabStop !== void 0) {
|
|
82579
|
+
tabWidth2 = targetTabStop - currentPos;
|
|
82580
|
+
} else if (textStartTarget !== void 0 && Number.isFinite(textStartTarget) && textStartTarget > currentPos) {
|
|
82581
|
+
tabWidth2 = textStartTarget - currentPos;
|
|
82582
|
+
} else {
|
|
82583
|
+
tabWidth2 = LIST_MARKER_GAP$1;
|
|
82584
|
+
}
|
|
82585
|
+
if (tabWidth2 < LIST_MARKER_GAP$1) {
|
|
82586
|
+
tabWidth2 = LIST_MARKER_GAP$1;
|
|
82587
|
+
}
|
|
82588
|
+
return markerStartPos + finalMarkerTextWidth + tabWidth2;
|
|
82589
|
+
}
|
|
82590
|
+
const textStart = indentLeft + firstLine;
|
|
82591
|
+
let tabWidth = textStart - currentPos;
|
|
82592
|
+
if (tabWidth <= 0) {
|
|
82593
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
|
|
82594
|
+
} else if (tabWidth < LIST_MARKER_GAP$1) {
|
|
82595
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
82596
|
+
}
|
|
82597
|
+
return markerStartPos + finalMarkerTextWidth + tabWidth;
|
|
82598
|
+
}
|
|
82297
82599
|
function getWordLayoutConfig(block) {
|
|
82298
82600
|
if (!block || block.kind !== "paragraph") {
|
|
82299
82601
|
return void 0;
|
|
@@ -82326,9 +82628,16 @@ ${l}
|
|
|
82326
82628
|
const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
|
|
82327
82629
|
let indentAdjust = paraIndentLeft;
|
|
82328
82630
|
if (isListItem2 && isFirstLine && isFirstLineIndentMode) {
|
|
82631
|
+
const resolvedTextStart = resolveListTextStartPx(
|
|
82632
|
+
wordLayout,
|
|
82633
|
+
paraIndentLeft,
|
|
82634
|
+
Math.max(firstLineIndent, 0),
|
|
82635
|
+
Math.max(hangingIndent, 0),
|
|
82636
|
+
() => markerWidth
|
|
82637
|
+
// Use provided markerWidth since we don't have canvas access here
|
|
82638
|
+
);
|
|
82329
82639
|
const textStartFallback = paraIndentLeft + Math.max(firstLineIndent, 0) + markerWidth;
|
|
82330
|
-
|
|
82331
|
-
indentAdjust = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : textStartFallback;
|
|
82640
|
+
indentAdjust = typeof resolvedTextStart === "number" && Number.isFinite(resolvedTextStart) ? resolvedTextStart : textStartFallback;
|
|
82332
82641
|
} else if (isFirstLine && !isListItem2) {
|
|
82333
82642
|
indentAdjust += firstLineOffset;
|
|
82334
82643
|
}
|
|
@@ -82484,7 +82793,10 @@ ${l}
|
|
|
82484
82793
|
}
|
|
82485
82794
|
function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
82486
82795
|
const zones = [];
|
|
82487
|
-
|
|
82796
|
+
let currentColumns = columns;
|
|
82797
|
+
let currentMargins = margins;
|
|
82798
|
+
let currentPageWidth = pageWidth;
|
|
82799
|
+
let marginLeft = Math.max(0, currentMargins?.left ?? 0);
|
|
82488
82800
|
return {
|
|
82489
82801
|
registerDrawing(drawingBlock, measure, anchorY, columnIndex, pageNumber) {
|
|
82490
82802
|
if (!drawingBlock.anchor?.isAnchored) {
|
|
@@ -82497,7 +82809,7 @@ ${l}
|
|
|
82497
82809
|
}
|
|
82498
82810
|
const objectWidth = measure.width ?? 0;
|
|
82499
82811
|
const objectHeight = measure.height ?? 0;
|
|
82500
|
-
const x2 = computeAnchorX(anchor, columnIndex,
|
|
82812
|
+
const x2 = computeAnchorX(anchor, columnIndex, currentColumns, objectWidth, currentMargins, currentPageWidth);
|
|
82501
82813
|
const y2 = anchorY + (anchor.offsetV ?? 0);
|
|
82502
82814
|
const zone = {
|
|
82503
82815
|
imageBlockId: drawingBlock.id,
|
|
@@ -82531,7 +82843,7 @@ ${l}
|
|
|
82531
82843
|
}
|
|
82532
82844
|
const tableWidth = measure.totalWidth ?? 0;
|
|
82533
82845
|
const tableHeight = measure.totalHeight ?? 0;
|
|
82534
|
-
const x2 = computeTableAnchorX(anchor, columnIndex,
|
|
82846
|
+
const x2 = computeTableAnchorX(anchor, columnIndex, currentColumns, tableWidth, currentMargins, currentPageWidth);
|
|
82535
82847
|
const y2 = anchorY + (anchor.offsetV ?? 0);
|
|
82536
82848
|
const zone = {
|
|
82537
82849
|
imageBlockId: tableBlock.id,
|
|
@@ -82579,7 +82891,7 @@ ${l}
|
|
|
82579
82891
|
}
|
|
82580
82892
|
const leftFloats = [];
|
|
82581
82893
|
const rightFloats = [];
|
|
82582
|
-
const columnOrigin = marginLeft + columnIndex * (
|
|
82894
|
+
const columnOrigin = marginLeft + columnIndex * (currentColumns.width + currentColumns.gap);
|
|
82583
82895
|
const columnCenter = columnOrigin + baseWidth / 2;
|
|
82584
82896
|
for (const zone of wrappingZones) {
|
|
82585
82897
|
if (zone.wrapMode === "left") {
|
|
@@ -82618,6 +82930,22 @@ ${l}
|
|
|
82618
82930
|
},
|
|
82619
82931
|
clear() {
|
|
82620
82932
|
zones.length = 0;
|
|
82933
|
+
},
|
|
82934
|
+
/**
|
|
82935
|
+
* Update layout context used for positioning and wrapping (columns, margins, page width).
|
|
82936
|
+
* This method should be called when the layout configuration changes (e.g., section breaks,
|
|
82937
|
+
* column changes, page size changes) to ensure floating objects are positioned and wrapped
|
|
82938
|
+
* correctly relative to the new layout boundaries.
|
|
82939
|
+
*
|
|
82940
|
+
* @param nextColumns - Column layout configuration (width, gap, count)
|
|
82941
|
+
* @param nextMargins - Optional page margins (left, right) in pixels
|
|
82942
|
+
* @param nextPageWidth - Optional total page width in pixels
|
|
82943
|
+
*/
|
|
82944
|
+
setLayoutContext(nextColumns, nextMargins, nextPageWidth) {
|
|
82945
|
+
currentColumns = nextColumns;
|
|
82946
|
+
currentMargins = nextMargins;
|
|
82947
|
+
currentPageWidth = nextPageWidth;
|
|
82948
|
+
marginLeft = Math.max(0, currentMargins?.left ?? 0);
|
|
82621
82949
|
}
|
|
82622
82950
|
};
|
|
82623
82951
|
}
|
|
@@ -82717,7 +83045,14 @@ ${l}
|
|
|
82717
83045
|
const props = {};
|
|
82718
83046
|
if (source.kind !== "sectionBreak") return props;
|
|
82719
83047
|
if (source.margins) {
|
|
82720
|
-
props.margins = {
|
|
83048
|
+
props.margins = {
|
|
83049
|
+
header: source.margins.header,
|
|
83050
|
+
footer: source.margins.footer,
|
|
83051
|
+
top: source.margins.top,
|
|
83052
|
+
right: source.margins.right,
|
|
83053
|
+
bottom: source.margins.bottom,
|
|
83054
|
+
left: source.margins.left
|
|
83055
|
+
};
|
|
82721
83056
|
}
|
|
82722
83057
|
if (source.pageSize) {
|
|
82723
83058
|
props.pageSize = { w: source.pageSize.w, h: source.pageSize.h };
|
|
@@ -82765,20 +83100,36 @@ ${l}
|
|
|
82765
83100
|
next2.activeOrientation = block.orientation;
|
|
82766
83101
|
next2.pendingOrientation = null;
|
|
82767
83102
|
}
|
|
83103
|
+
const headerDistance = typeof block.margins?.header === "number" ? Math.max(0, block.margins.header) : next2.activeHeaderDistance;
|
|
83104
|
+
const footerDistance = typeof block.margins?.footer === "number" ? Math.max(0, block.margins.footer) : next2.activeFooterDistance;
|
|
83105
|
+
const sectionTop = typeof block.margins?.top === "number" ? Math.max(0, block.margins.top) : baseMargins.top;
|
|
83106
|
+
const sectionBottom = typeof block.margins?.bottom === "number" ? Math.max(0, block.margins.bottom) : baseMargins.bottom;
|
|
82768
83107
|
if (block.margins?.header !== void 0) {
|
|
82769
|
-
const headerDistance = Math.max(0, block.margins.header);
|
|
82770
83108
|
next2.activeHeaderDistance = headerDistance;
|
|
82771
83109
|
next2.pendingHeaderDistance = headerDistance;
|
|
82772
|
-
next2.activeTopMargin = calcRequiredTopMargin(headerDistance, baseMargins.top);
|
|
82773
|
-
next2.pendingTopMargin = next2.activeTopMargin;
|
|
82774
83110
|
}
|
|
82775
83111
|
if (block.margins?.footer !== void 0) {
|
|
82776
|
-
const footerDistance = Math.max(0, block.margins.footer);
|
|
82777
83112
|
next2.activeFooterDistance = footerDistance;
|
|
82778
83113
|
next2.pendingFooterDistance = footerDistance;
|
|
82779
|
-
|
|
83114
|
+
}
|
|
83115
|
+
if (block.margins?.top !== void 0 || block.margins?.header !== void 0) {
|
|
83116
|
+
next2.activeTopMargin = calcRequiredTopMargin(headerDistance, sectionTop);
|
|
83117
|
+
next2.pendingTopMargin = next2.activeTopMargin;
|
|
83118
|
+
}
|
|
83119
|
+
if (block.margins?.bottom !== void 0 || block.margins?.footer !== void 0) {
|
|
83120
|
+
next2.activeBottomMargin = calcRequiredBottomMargin(footerDistance, sectionBottom);
|
|
82780
83121
|
next2.pendingBottomMargin = next2.activeBottomMargin;
|
|
82781
83122
|
}
|
|
83123
|
+
if (block.margins?.left !== void 0) {
|
|
83124
|
+
const leftMargin = Math.max(0, block.margins.left);
|
|
83125
|
+
next2.activeLeftMargin = leftMargin;
|
|
83126
|
+
next2.pendingLeftMargin = leftMargin;
|
|
83127
|
+
}
|
|
83128
|
+
if (block.margins?.right !== void 0) {
|
|
83129
|
+
const rightMargin = Math.max(0, block.margins.right);
|
|
83130
|
+
next2.activeRightMargin = rightMargin;
|
|
83131
|
+
next2.pendingRightMargin = rightMargin;
|
|
83132
|
+
}
|
|
82782
83133
|
if (block.columns) {
|
|
82783
83134
|
next2.activeColumns = { count: block.columns.count, gap: block.columns.gap };
|
|
82784
83135
|
next2.pendingColumns = null;
|
|
@@ -82787,26 +83138,42 @@ ${l}
|
|
|
82787
83138
|
}
|
|
82788
83139
|
const headerPx = block.margins?.header;
|
|
82789
83140
|
const footerPx = block.margins?.footer;
|
|
83141
|
+
const topPx = block.margins?.top;
|
|
83142
|
+
const bottomPx = block.margins?.bottom;
|
|
82790
83143
|
const nextTop = next2.pendingTopMargin ?? next2.activeTopMargin;
|
|
82791
83144
|
const nextBottom = next2.pendingBottomMargin ?? next2.activeBottomMargin;
|
|
83145
|
+
const nextLeft = next2.pendingLeftMargin ?? next2.activeLeftMargin;
|
|
83146
|
+
const nextRight = next2.pendingRightMargin ?? next2.activeRightMargin;
|
|
82792
83147
|
const nextHeader = next2.pendingHeaderDistance ?? next2.activeHeaderDistance;
|
|
82793
83148
|
const nextFooter = next2.pendingFooterDistance ?? next2.activeFooterDistance;
|
|
82794
|
-
if (typeof headerPx === "number") {
|
|
82795
|
-
const newHeaderDist = Math.max(0, headerPx);
|
|
83149
|
+
if (typeof headerPx === "number" || typeof topPx === "number") {
|
|
83150
|
+
const newHeaderDist = typeof headerPx === "number" ? Math.max(0, headerPx) : nextHeader;
|
|
83151
|
+
const sectionTop = typeof topPx === "number" ? Math.max(0, topPx) : baseMargins.top;
|
|
82796
83152
|
next2.pendingHeaderDistance = newHeaderDist;
|
|
82797
|
-
next2.pendingTopMargin = calcRequiredTopMargin(newHeaderDist,
|
|
83153
|
+
next2.pendingTopMargin = calcRequiredTopMargin(newHeaderDist, sectionTop);
|
|
82798
83154
|
} else {
|
|
82799
83155
|
next2.pendingTopMargin = nextTop;
|
|
82800
83156
|
next2.pendingHeaderDistance = nextHeader;
|
|
82801
83157
|
}
|
|
82802
|
-
if (typeof footerPx === "number") {
|
|
82803
|
-
const newFooterDist = Math.max(0, footerPx);
|
|
83158
|
+
if (typeof footerPx === "number" || typeof bottomPx === "number") {
|
|
83159
|
+
const newFooterDist = typeof footerPx === "number" ? Math.max(0, footerPx) : nextFooter;
|
|
83160
|
+
const sectionBottom = typeof bottomPx === "number" ? Math.max(0, bottomPx) : baseMargins.bottom;
|
|
82804
83161
|
next2.pendingFooterDistance = newFooterDist;
|
|
82805
|
-
next2.pendingBottomMargin = calcRequiredBottomMargin(newFooterDist,
|
|
83162
|
+
next2.pendingBottomMargin = calcRequiredBottomMargin(newFooterDist, sectionBottom);
|
|
82806
83163
|
} else {
|
|
82807
83164
|
next2.pendingBottomMargin = nextBottom;
|
|
82808
83165
|
next2.pendingFooterDistance = nextFooter;
|
|
82809
83166
|
}
|
|
83167
|
+
if (typeof block.margins?.left === "number") {
|
|
83168
|
+
next2.pendingLeftMargin = Math.max(0, block.margins.left);
|
|
83169
|
+
} else {
|
|
83170
|
+
next2.pendingLeftMargin = nextLeft;
|
|
83171
|
+
}
|
|
83172
|
+
if (typeof block.margins?.right === "number") {
|
|
83173
|
+
next2.pendingRightMargin = Math.max(0, block.margins.right);
|
|
83174
|
+
} else {
|
|
83175
|
+
next2.pendingRightMargin = nextRight;
|
|
83176
|
+
}
|
|
82810
83177
|
if (block.pageSize) {
|
|
82811
83178
|
next2.pendingPageSize = { w: block.pageSize.w, h: block.pageSize.h };
|
|
82812
83179
|
}
|
|
@@ -82866,6 +83233,12 @@ ${l}
|
|
|
82866
83233
|
if (next2.pendingBottomMargin != null) {
|
|
82867
83234
|
next2.activeBottomMargin = next2.pendingBottomMargin;
|
|
82868
83235
|
}
|
|
83236
|
+
if (next2.pendingLeftMargin != null) {
|
|
83237
|
+
next2.activeLeftMargin = next2.pendingLeftMargin;
|
|
83238
|
+
}
|
|
83239
|
+
if (next2.pendingRightMargin != null) {
|
|
83240
|
+
next2.activeRightMargin = next2.pendingRightMargin;
|
|
83241
|
+
}
|
|
82869
83242
|
if (next2.pendingHeaderDistance != null) {
|
|
82870
83243
|
next2.activeHeaderDistance = next2.pendingHeaderDistance;
|
|
82871
83244
|
}
|
|
@@ -82883,6 +83256,8 @@ ${l}
|
|
|
82883
83256
|
}
|
|
82884
83257
|
next2.pendingTopMargin = null;
|
|
82885
83258
|
next2.pendingBottomMargin = null;
|
|
83259
|
+
next2.pendingLeftMargin = null;
|
|
83260
|
+
next2.pendingRightMargin = null;
|
|
82886
83261
|
next2.pendingHeaderDistance = null;
|
|
82887
83262
|
next2.pendingFooterDistance = null;
|
|
82888
83263
|
next2.pendingPageSize = null;
|
|
@@ -83111,7 +83486,8 @@ ${l}
|
|
|
83111
83486
|
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
|
|
83112
83487
|
const firstLineIndent = calculateFirstLineIndent(block, measure);
|
|
83113
83488
|
const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
|
|
83114
|
-
|
|
83489
|
+
const newLines = normalizeLines(newMeasure);
|
|
83490
|
+
lines = newLines;
|
|
83115
83491
|
didRemeasureForColumnWidth = true;
|
|
83116
83492
|
}
|
|
83117
83493
|
let fromLine = 0;
|
|
@@ -83193,7 +83569,8 @@ ${l}
|
|
|
83193
83569
|
if (narrowestRemeasureWidth < remeasureWidth) {
|
|
83194
83570
|
const firstLineIndent = calculateFirstLineIndent(block, measure);
|
|
83195
83571
|
const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
|
|
83196
|
-
|
|
83572
|
+
const newLines = normalizeLines(newMeasure);
|
|
83573
|
+
lines = newLines;
|
|
83197
83574
|
didRemeasureForFloats = true;
|
|
83198
83575
|
}
|
|
83199
83576
|
}
|
|
@@ -83537,6 +83914,94 @@ ${l}
|
|
|
83537
83914
|
function getCellTotalLines(cell2) {
|
|
83538
83915
|
return getCellLines(cell2).length;
|
|
83539
83916
|
}
|
|
83917
|
+
function mergePmRange(target, range2) {
|
|
83918
|
+
if (typeof range2.pmStart === "number") {
|
|
83919
|
+
target.pmStart = target.pmStart == null ? range2.pmStart : Math.min(target.pmStart, range2.pmStart);
|
|
83920
|
+
}
|
|
83921
|
+
if (typeof range2.pmEnd === "number") {
|
|
83922
|
+
target.pmEnd = target.pmEnd == null ? range2.pmEnd : Math.max(target.pmEnd, range2.pmEnd);
|
|
83923
|
+
}
|
|
83924
|
+
}
|
|
83925
|
+
function computeCellPmRange(cell2, cellMeasure, fromLine, toLine) {
|
|
83926
|
+
const range2 = {};
|
|
83927
|
+
if (!cell2 || !cellMeasure) return range2;
|
|
83928
|
+
const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
|
|
83929
|
+
const blockMeasures = cellMeasure.blocks ?? (cellMeasure.paragraph ? [cellMeasure.paragraph] : []);
|
|
83930
|
+
const maxBlocks = Math.min(cellBlocks.length, blockMeasures.length);
|
|
83931
|
+
let cumulativeLineCount = 0;
|
|
83932
|
+
for (let i2 = 0; i2 < maxBlocks; i2++) {
|
|
83933
|
+
const block = cellBlocks[i2];
|
|
83934
|
+
const blockMeasure = blockMeasures[i2];
|
|
83935
|
+
if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
|
|
83936
|
+
const paraMeasure = blockMeasure;
|
|
83937
|
+
const lines = paraMeasure.lines;
|
|
83938
|
+
const blockLineCount = lines?.length ?? 0;
|
|
83939
|
+
const blockStartGlobal = cumulativeLineCount;
|
|
83940
|
+
const blockEndGlobal = cumulativeLineCount + blockLineCount;
|
|
83941
|
+
const localFrom = Math.max(fromLine, blockStartGlobal) - blockStartGlobal;
|
|
83942
|
+
const localTo = Math.min(toLine, blockEndGlobal) - blockStartGlobal;
|
|
83943
|
+
if (lines && lines.length > 0 && localFrom < localTo) {
|
|
83944
|
+
mergePmRange(range2, computeFragmentPmRange(block, lines, localFrom, localTo));
|
|
83945
|
+
} else {
|
|
83946
|
+
mergePmRange(range2, extractBlockPmRange(block));
|
|
83947
|
+
}
|
|
83948
|
+
cumulativeLineCount += blockLineCount;
|
|
83949
|
+
continue;
|
|
83950
|
+
}
|
|
83951
|
+
mergePmRange(range2, extractBlockPmRange(block));
|
|
83952
|
+
}
|
|
83953
|
+
return range2;
|
|
83954
|
+
}
|
|
83955
|
+
function computeTableFragmentPmRange(block, measure, fromRow, toRow, partialRow) {
|
|
83956
|
+
const range2 = {};
|
|
83957
|
+
for (let rowIndex = fromRow; rowIndex < toRow; rowIndex++) {
|
|
83958
|
+
const row2 = block.rows[rowIndex];
|
|
83959
|
+
const rowMeasure = measure.rows[rowIndex];
|
|
83960
|
+
if (!row2 || !rowMeasure) continue;
|
|
83961
|
+
const isPartial = partialRow?.rowIndex === rowIndex;
|
|
83962
|
+
const cellCount = Math.min(row2.cells.length, rowMeasure.cells.length);
|
|
83963
|
+
for (let cellIndex = 0; cellIndex < cellCount; cellIndex++) {
|
|
83964
|
+
const cell2 = row2.cells[cellIndex];
|
|
83965
|
+
const cellMeasure = rowMeasure.cells[cellIndex];
|
|
83966
|
+
if (!cell2 || !cellMeasure) continue;
|
|
83967
|
+
const totalLines = getCellTotalLines(cellMeasure);
|
|
83968
|
+
let fromLine = 0;
|
|
83969
|
+
let toLine = totalLines;
|
|
83970
|
+
if (isPartial) {
|
|
83971
|
+
const hasValidFromLineByCell = partialRow?.fromLineByCell && cellIndex < partialRow.fromLineByCell.length;
|
|
83972
|
+
const hasValidToLineByCell = partialRow?.toLineByCell && cellIndex < partialRow.toLineByCell.length;
|
|
83973
|
+
if (hasValidFromLineByCell) {
|
|
83974
|
+
const rawFrom = partialRow.fromLineByCell[cellIndex];
|
|
83975
|
+
if (typeof rawFrom === "number" && rawFrom >= 0) {
|
|
83976
|
+
fromLine = rawFrom;
|
|
83977
|
+
}
|
|
83978
|
+
}
|
|
83979
|
+
if (hasValidToLineByCell) {
|
|
83980
|
+
const rawTo = partialRow.toLineByCell[cellIndex];
|
|
83981
|
+
if (typeof rawTo === "number") {
|
|
83982
|
+
toLine = rawTo === -1 ? totalLines : rawTo;
|
|
83983
|
+
}
|
|
83984
|
+
}
|
|
83985
|
+
}
|
|
83986
|
+
fromLine = Math.max(0, Math.min(fromLine, totalLines));
|
|
83987
|
+
toLine = Math.max(0, Math.min(toLine, totalLines));
|
|
83988
|
+
if (toLine < fromLine) {
|
|
83989
|
+
toLine = fromLine;
|
|
83990
|
+
}
|
|
83991
|
+
mergePmRange(range2, computeCellPmRange(cell2, cellMeasure, fromLine, toLine));
|
|
83992
|
+
}
|
|
83993
|
+
}
|
|
83994
|
+
return range2;
|
|
83995
|
+
}
|
|
83996
|
+
function applyTableFragmentPmRange(fragment, block, measure) {
|
|
83997
|
+
const range2 = computeTableFragmentPmRange(block, measure, fragment.fromRow, fragment.toRow, fragment.partialRow);
|
|
83998
|
+
if (range2.pmStart != null) {
|
|
83999
|
+
fragment.pmStart = range2.pmStart;
|
|
84000
|
+
}
|
|
84001
|
+
if (range2.pmEnd != null) {
|
|
84002
|
+
fragment.pmEnd = range2.pmEnd;
|
|
84003
|
+
}
|
|
84004
|
+
}
|
|
83540
84005
|
function computePartialRow(rowIndex, blockRow, measure, availableHeight, fromLineByCell) {
|
|
83541
84006
|
const row2 = measure.rows[rowIndex];
|
|
83542
84007
|
if (!row2) {
|
|
@@ -83681,6 +84146,7 @@ ${l}
|
|
|
83681
84146
|
height,
|
|
83682
84147
|
metadata
|
|
83683
84148
|
};
|
|
84149
|
+
applyTableFragmentPmRange(fragment, context.block, context.measure);
|
|
83684
84150
|
state2.page.fragments.push(fragment);
|
|
83685
84151
|
state2.cursorY += height;
|
|
83686
84152
|
}
|
|
@@ -83759,6 +84225,7 @@ ${l}
|
|
|
83759
84225
|
height,
|
|
83760
84226
|
metadata
|
|
83761
84227
|
};
|
|
84228
|
+
applyTableFragmentPmRange(fragment, block, measure);
|
|
83762
84229
|
state2.page.fragments.push(fragment);
|
|
83763
84230
|
state2.cursorY += height;
|
|
83764
84231
|
return;
|
|
@@ -83822,6 +84289,7 @@ ${l}
|
|
|
83822
84289
|
partialRow: continuationPartialRow,
|
|
83823
84290
|
metadata: generateFragmentMetadata(measure)
|
|
83824
84291
|
};
|
|
84292
|
+
applyTableFragmentPmRange(fragment2, block, measure);
|
|
83825
84293
|
state2.page.fragments.push(fragment2);
|
|
83826
84294
|
state2.cursorY += fragmentHeight2;
|
|
83827
84295
|
}
|
|
@@ -83866,6 +84334,7 @@ ${l}
|
|
|
83866
84334
|
partialRow: forcedPartialRow,
|
|
83867
84335
|
metadata: generateFragmentMetadata(measure)
|
|
83868
84336
|
};
|
|
84337
|
+
applyTableFragmentPmRange(fragment2, block, measure);
|
|
83869
84338
|
state2.page.fragments.push(fragment2);
|
|
83870
84339
|
state2.cursorY += fragmentHeight2;
|
|
83871
84340
|
pendingPartialRow = forcedPartialRow;
|
|
@@ -83901,6 +84370,7 @@ ${l}
|
|
|
83901
84370
|
partialRow: partialRow || void 0,
|
|
83902
84371
|
metadata: generateFragmentMetadata(measure)
|
|
83903
84372
|
};
|
|
84373
|
+
applyTableFragmentPmRange(fragment, block, measure);
|
|
83904
84374
|
state2.page.fragments.push(fragment);
|
|
83905
84375
|
state2.cursorY += fragmentHeight;
|
|
83906
84376
|
if (partialRow && !partialRow.isLastPart) {
|
|
@@ -83918,7 +84388,7 @@ ${l}
|
|
|
83918
84388
|
columnBoundaries: generateColumnBoundaries(measure),
|
|
83919
84389
|
coordinateSystem: "fragment"
|
|
83920
84390
|
};
|
|
83921
|
-
|
|
84391
|
+
const fragment = {
|
|
83922
84392
|
kind: "table",
|
|
83923
84393
|
blockId: block.id,
|
|
83924
84394
|
fromRow: 0,
|
|
@@ -83929,6 +84399,8 @@ ${l}
|
|
|
83929
84399
|
height: measure.totalHeight ?? 0,
|
|
83930
84400
|
metadata
|
|
83931
84401
|
};
|
|
84402
|
+
applyTableFragmentPmRange(fragment, block, measure);
|
|
84403
|
+
return fragment;
|
|
83932
84404
|
}
|
|
83933
84405
|
function isPageRelativeAnchor(block) {
|
|
83934
84406
|
const vRelativeFrom = block.anchor?.vRelativeFrom;
|
|
@@ -84350,8 +84822,8 @@ ${l}
|
|
|
84350
84822
|
header: options.margins?.header ?? options.margins?.top ?? DEFAULT_MARGINS$2.top,
|
|
84351
84823
|
footer: options.margins?.footer ?? options.margins?.bottom ?? DEFAULT_MARGINS$2.bottom
|
|
84352
84824
|
};
|
|
84353
|
-
const
|
|
84354
|
-
if (
|
|
84825
|
+
const baseContentWidth = pageSize.w - (margins.left + margins.right);
|
|
84826
|
+
if (baseContentWidth <= 0) {
|
|
84355
84827
|
throw new Error("layoutDocument: pageSize and margins yield non-positive content area");
|
|
84356
84828
|
}
|
|
84357
84829
|
const validateContentHeight = (height) => {
|
|
@@ -84381,8 +84853,12 @@ ${l}
|
|
|
84381
84853
|
const effectiveBottomMargin = maxFooterContentHeight > 0 ? Math.max(margins.bottom, footerDistance + maxFooterContentHeight) : margins.bottom;
|
|
84382
84854
|
let activeTopMargin = effectiveTopMargin;
|
|
84383
84855
|
let activeBottomMargin = effectiveBottomMargin;
|
|
84856
|
+
let activeLeftMargin = margins.left;
|
|
84857
|
+
let activeRightMargin = margins.right;
|
|
84384
84858
|
let pendingTopMargin = null;
|
|
84385
84859
|
let pendingBottomMargin = null;
|
|
84860
|
+
let pendingLeftMargin = null;
|
|
84861
|
+
let pendingRightMargin = null;
|
|
84386
84862
|
let activeHeaderDistance = margins.header ?? margins.top;
|
|
84387
84863
|
let pendingHeaderDistance = null;
|
|
84388
84864
|
let activeFooterDistance = margins.footer ?? margins.bottom;
|
|
@@ -84395,10 +84871,11 @@ ${l}
|
|
|
84395
84871
|
let pendingOrientation = null;
|
|
84396
84872
|
let activeVAlign = null;
|
|
84397
84873
|
let pendingVAlign = null;
|
|
84874
|
+
const paginatorMargins = { left: activeLeftMargin, right: activeRightMargin };
|
|
84398
84875
|
const floatManager = createFloatingObjectManager(
|
|
84399
|
-
normalizeColumns(activeColumns,
|
|
84400
|
-
{ left:
|
|
84401
|
-
|
|
84876
|
+
normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)),
|
|
84877
|
+
{ left: activeLeftMargin, right: activeRightMargin },
|
|
84878
|
+
activePageSize.w
|
|
84402
84879
|
);
|
|
84403
84880
|
const nextSectionPropsAtBreak = computeNextSectionPropsAtBreak(blocks2);
|
|
84404
84881
|
const scheduleSectionBreakCompat = (block, state2, baseMargins) => {
|
|
@@ -84415,22 +84892,38 @@ ${l}
|
|
|
84415
84892
|
next2.activeOrientation = block.orientation;
|
|
84416
84893
|
next2.pendingOrientation = null;
|
|
84417
84894
|
}
|
|
84895
|
+
const headerDistance2 = typeof block.margins?.header === "number" ? Math.max(0, block.margins.header) : next2.activeHeaderDistance;
|
|
84896
|
+
const footerDistance2 = typeof block.margins?.footer === "number" ? Math.max(0, block.margins.footer) : next2.activeFooterDistance;
|
|
84897
|
+
const sectionTop = typeof block.margins?.top === "number" ? Math.max(0, block.margins.top) : baseMargins.top;
|
|
84898
|
+
const sectionBottom = typeof block.margins?.bottom === "number" ? Math.max(0, block.margins.bottom) : baseMargins.bottom;
|
|
84418
84899
|
if (block.margins?.header !== void 0) {
|
|
84419
|
-
|
|
84420
|
-
next2.
|
|
84421
|
-
next2.pendingHeaderDistance = headerDist;
|
|
84422
|
-
const requiredTop = maxHeaderContentHeight > 0 ? headerDist + maxHeaderContentHeight : headerDist;
|
|
84423
|
-
next2.activeTopMargin = Math.max(baseMargins.top, requiredTop);
|
|
84424
|
-
next2.pendingTopMargin = next2.activeTopMargin;
|
|
84900
|
+
next2.activeHeaderDistance = headerDistance2;
|
|
84901
|
+
next2.pendingHeaderDistance = headerDistance2;
|
|
84425
84902
|
}
|
|
84426
84903
|
if (block.margins?.footer !== void 0) {
|
|
84427
|
-
const footerDistance2 = Math.max(0, block.margins.footer);
|
|
84428
84904
|
next2.activeFooterDistance = footerDistance2;
|
|
84429
84905
|
next2.pendingFooterDistance = footerDistance2;
|
|
84906
|
+
}
|
|
84907
|
+
if (block.margins?.top !== void 0 || block.margins?.header !== void 0) {
|
|
84908
|
+
const requiredTop = maxHeaderContentHeight > 0 ? headerDistance2 + maxHeaderContentHeight : headerDistance2;
|
|
84909
|
+
next2.activeTopMargin = Math.max(sectionTop, requiredTop);
|
|
84910
|
+
next2.pendingTopMargin = next2.activeTopMargin;
|
|
84911
|
+
}
|
|
84912
|
+
if (block.margins?.bottom !== void 0 || block.margins?.footer !== void 0) {
|
|
84430
84913
|
const requiredBottom = maxFooterContentHeight > 0 ? footerDistance2 + maxFooterContentHeight : footerDistance2;
|
|
84431
|
-
next2.activeBottomMargin = Math.max(
|
|
84914
|
+
next2.activeBottomMargin = Math.max(sectionBottom, requiredBottom);
|
|
84432
84915
|
next2.pendingBottomMargin = next2.activeBottomMargin;
|
|
84433
84916
|
}
|
|
84917
|
+
if (block.margins?.left !== void 0) {
|
|
84918
|
+
const leftMargin = Math.max(0, block.margins.left);
|
|
84919
|
+
next2.activeLeftMargin = leftMargin;
|
|
84920
|
+
next2.pendingLeftMargin = leftMargin;
|
|
84921
|
+
}
|
|
84922
|
+
if (block.margins?.right !== void 0) {
|
|
84923
|
+
const rightMargin = Math.max(0, block.margins.right);
|
|
84924
|
+
next2.activeRightMargin = rightMargin;
|
|
84925
|
+
next2.pendingRightMargin = rightMargin;
|
|
84926
|
+
}
|
|
84434
84927
|
if (block.columns) {
|
|
84435
84928
|
next2.activeColumns = { count: block.columns.count, gap: block.columns.gap };
|
|
84436
84929
|
next2.pendingColumns = null;
|
|
@@ -84459,27 +84952,35 @@ ${l}
|
|
|
84459
84952
|
const headerPx = block.margins?.header;
|
|
84460
84953
|
const footerPx = block.margins?.footer;
|
|
84461
84954
|
const topPx = block.margins?.top;
|
|
84955
|
+
const bottomPx = block.margins?.bottom;
|
|
84956
|
+
const leftPx = block.margins?.left;
|
|
84957
|
+
const rightPx = block.margins?.right;
|
|
84462
84958
|
const nextTop = next2.pendingTopMargin ?? next2.activeTopMargin;
|
|
84463
84959
|
const nextBottom = next2.pendingBottomMargin ?? next2.activeBottomMargin;
|
|
84960
|
+
const nextLeft = next2.pendingLeftMargin ?? next2.activeLeftMargin;
|
|
84961
|
+
const nextRight = next2.pendingRightMargin ?? next2.activeRightMargin;
|
|
84464
84962
|
const nextHeader = next2.pendingHeaderDistance ?? next2.activeHeaderDistance;
|
|
84465
84963
|
const nextFooter = next2.pendingFooterDistance ?? next2.activeFooterDistance;
|
|
84466
84964
|
next2.pendingHeaderDistance = typeof headerPx === "number" ? Math.max(0, headerPx) : nextHeader;
|
|
84467
84965
|
next2.pendingFooterDistance = typeof footerPx === "number" ? Math.max(0, footerPx) : nextFooter;
|
|
84468
84966
|
if (typeof headerPx === "number" || typeof topPx === "number") {
|
|
84469
|
-
const sectionTop = topPx
|
|
84967
|
+
const sectionTop = typeof topPx === "number" ? Math.max(0, topPx) : baseMargins.top;
|
|
84470
84968
|
const sectionHeader = next2.pendingHeaderDistance;
|
|
84471
84969
|
const requiredTop = maxHeaderContentHeight > 0 ? sectionHeader + maxHeaderContentHeight : sectionHeader;
|
|
84472
84970
|
next2.pendingTopMargin = Math.max(sectionTop, requiredTop);
|
|
84473
84971
|
} else {
|
|
84474
84972
|
next2.pendingTopMargin = nextTop;
|
|
84475
84973
|
}
|
|
84476
|
-
if (typeof footerPx === "number") {
|
|
84974
|
+
if (typeof footerPx === "number" || typeof bottomPx === "number") {
|
|
84477
84975
|
const sectionFooter = next2.pendingFooterDistance;
|
|
84976
|
+
const sectionBottom = typeof bottomPx === "number" ? Math.max(0, bottomPx) : baseMargins.bottom;
|
|
84478
84977
|
const requiredBottom = maxFooterContentHeight > 0 ? sectionFooter + maxFooterContentHeight : sectionFooter;
|
|
84479
|
-
next2.pendingBottomMargin = Math.max(
|
|
84978
|
+
next2.pendingBottomMargin = Math.max(sectionBottom, requiredBottom);
|
|
84480
84979
|
} else {
|
|
84481
84980
|
next2.pendingBottomMargin = nextBottom;
|
|
84482
84981
|
}
|
|
84982
|
+
next2.pendingLeftMargin = typeof leftPx === "number" ? Math.max(0, leftPx) : nextLeft;
|
|
84983
|
+
next2.pendingRightMargin = typeof rightPx === "number" ? Math.max(0, rightPx) : nextRight;
|
|
84483
84984
|
if (block.pageSize) next2.pendingPageSize = { w: block.pageSize.w, h: block.pageSize.h };
|
|
84484
84985
|
if (block.orientation) next2.pendingOrientation = block.orientation;
|
|
84485
84986
|
const sectionType = block.type ?? "continuous";
|
|
@@ -84564,7 +85065,7 @@ ${l}
|
|
|
84564
85065
|
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
84565
85066
|
let pendingSectionIndex = null;
|
|
84566
85067
|
const paginator = createPaginator({
|
|
84567
|
-
margins:
|
|
85068
|
+
margins: paginatorMargins,
|
|
84568
85069
|
getActiveTopMargin: () => activeTopMargin,
|
|
84569
85070
|
getActiveBottomMargin: () => activeBottomMargin,
|
|
84570
85071
|
getActiveHeaderDistance: () => activeHeaderDistance,
|
|
@@ -84579,8 +85080,12 @@ ${l}
|
|
|
84579
85080
|
const applied = applyPendingToActive({
|
|
84580
85081
|
activeTopMargin,
|
|
84581
85082
|
activeBottomMargin,
|
|
85083
|
+
activeLeftMargin,
|
|
85084
|
+
activeRightMargin,
|
|
84582
85085
|
pendingTopMargin,
|
|
84583
85086
|
pendingBottomMargin,
|
|
85087
|
+
pendingLeftMargin,
|
|
85088
|
+
pendingRightMargin,
|
|
84584
85089
|
activeHeaderDistance,
|
|
84585
85090
|
activeFooterDistance,
|
|
84586
85091
|
pendingHeaderDistance,
|
|
@@ -84595,8 +85100,12 @@ ${l}
|
|
|
84595
85100
|
});
|
|
84596
85101
|
activeTopMargin = applied.activeTopMargin;
|
|
84597
85102
|
activeBottomMargin = applied.activeBottomMargin;
|
|
85103
|
+
activeLeftMargin = applied.activeLeftMargin;
|
|
85104
|
+
activeRightMargin = applied.activeRightMargin;
|
|
84598
85105
|
pendingTopMargin = applied.pendingTopMargin;
|
|
84599
85106
|
pendingBottomMargin = applied.pendingBottomMargin;
|
|
85107
|
+
pendingLeftMargin = applied.pendingLeftMargin;
|
|
85108
|
+
pendingRightMargin = applied.pendingRightMargin;
|
|
84600
85109
|
activeHeaderDistance = applied.activeHeaderDistance;
|
|
84601
85110
|
activeFooterDistance = applied.activeFooterDistance;
|
|
84602
85111
|
pendingHeaderDistance = applied.pendingHeaderDistance;
|
|
@@ -84608,6 +85117,14 @@ ${l}
|
|
|
84608
85117
|
activeOrientation = applied.activeOrientation;
|
|
84609
85118
|
pendingOrientation = applied.pendingOrientation;
|
|
84610
85119
|
cachedColumnsState.state = null;
|
|
85120
|
+
paginatorMargins.left = activeLeftMargin;
|
|
85121
|
+
paginatorMargins.right = activeRightMargin;
|
|
85122
|
+
const contentWidth = activePageSize.w - (activeLeftMargin + activeRightMargin);
|
|
85123
|
+
floatManager.setLayoutContext(
|
|
85124
|
+
normalizeColumns(activeColumns, contentWidth),
|
|
85125
|
+
{ left: activeLeftMargin, right: activeRightMargin },
|
|
85126
|
+
activePageSize.w
|
|
85127
|
+
);
|
|
84611
85128
|
if (pendingNumbering) {
|
|
84612
85129
|
if (pendingNumbering.format) activeNumberFormat = pendingNumbering.format;
|
|
84613
85130
|
if (typeof pendingNumbering.start === "number" && Number.isFinite(pendingNumbering.start)) {
|
|
@@ -84652,7 +85169,7 @@ ${l}
|
|
|
84652
85169
|
const getActiveColumnsForState = paginator.getActiveColumnsForState;
|
|
84653
85170
|
let cachedColumnsState = { state: null, constraintIndex: -2, contentWidth: -1, colsConfig: null, normalized: null };
|
|
84654
85171
|
const getCurrentColumns = () => {
|
|
84655
|
-
const currentContentWidth = activePageSize.w - (
|
|
85172
|
+
const currentContentWidth = activePageSize.w - (activeLeftMargin + activeRightMargin);
|
|
84656
85173
|
const state2 = states[states.length - 1] ?? null;
|
|
84657
85174
|
const colsConfig = state2 ? getActiveColumnsForState(state2) : activeColumns;
|
|
84658
85175
|
const constraintIndex = state2 ? state2.activeConstraintIndex : -1;
|
|
@@ -84685,6 +85202,12 @@ ${l}
|
|
|
84685
85202
|
layoutLog(` Current page: ${state2.page.number}, cursorY: ${state2.cursorY}`);
|
|
84686
85203
|
activeColumns = newColumns;
|
|
84687
85204
|
cachedColumnsState.state = null;
|
|
85205
|
+
const contentWidth = activePageSize.w - (activeLeftMargin + activeRightMargin);
|
|
85206
|
+
floatManager.setLayoutContext(
|
|
85207
|
+
normalizeColumns(activeColumns, contentWidth),
|
|
85208
|
+
{ left: activeLeftMargin, right: activeRightMargin },
|
|
85209
|
+
activePageSize.w
|
|
85210
|
+
);
|
|
84688
85211
|
};
|
|
84689
85212
|
const anchoredByParagraph = collectAnchoredDrawings(blocks2, measures);
|
|
84690
85213
|
const anchoredTablesByParagraph = collectAnchoredTables(blocks2, measures);
|
|
@@ -84716,10 +85239,10 @@ ${l}
|
|
|
84716
85239
|
if (alignV === "top") {
|
|
84717
85240
|
anchorY = offsetV;
|
|
84718
85241
|
} else if (alignV === "bottom") {
|
|
84719
|
-
const pageHeight = contentBottom + margins
|
|
85242
|
+
const pageHeight = contentBottom + (state2.page.margins?.bottom ?? activeBottomMargin);
|
|
84720
85243
|
anchorY = pageHeight - imageHeight + offsetV;
|
|
84721
85244
|
} else if (alignV === "center") {
|
|
84722
|
-
const pageHeight = contentBottom + margins
|
|
85245
|
+
const pageHeight = contentBottom + (state2.page.margins?.bottom ?? activeBottomMargin);
|
|
84723
85246
|
anchorY = (pageHeight - imageHeight) / 2 + offsetV;
|
|
84724
85247
|
} else {
|
|
84725
85248
|
anchorY = offsetV;
|
|
@@ -84730,11 +85253,11 @@ ${l}
|
|
|
84730
85253
|
const anchorX = entry.block.anchor ? computeAnchorX(
|
|
84731
85254
|
entry.block.anchor,
|
|
84732
85255
|
state2.columnIndex,
|
|
84733
|
-
normalizeColumns(activeColumns,
|
|
85256
|
+
normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)),
|
|
84734
85257
|
entry.measure.width,
|
|
84735
|
-
{ left:
|
|
85258
|
+
{ left: activeLeftMargin, right: activeRightMargin },
|
|
84736
85259
|
activePageSize.w
|
|
84737
|
-
) :
|
|
85260
|
+
) : activeLeftMargin;
|
|
84738
85261
|
floatManager.registerDrawing(entry.block, entry.measure, anchorY, state2.columnIndex, state2.page.number);
|
|
84739
85262
|
preRegisteredPositions.set(entry.block.id, { anchorX, anchorY, pageNumber: state2.page.number });
|
|
84740
85263
|
}
|
|
@@ -84772,8 +85295,12 @@ ${l}
|
|
|
84772
85295
|
const sectionState = {
|
|
84773
85296
|
activeTopMargin,
|
|
84774
85297
|
activeBottomMargin,
|
|
85298
|
+
activeLeftMargin,
|
|
85299
|
+
activeRightMargin,
|
|
84775
85300
|
pendingTopMargin,
|
|
84776
85301
|
pendingBottomMargin,
|
|
85302
|
+
pendingLeftMargin,
|
|
85303
|
+
pendingRightMargin,
|
|
84777
85304
|
activeHeaderDistance,
|
|
84778
85305
|
activeFooterDistance,
|
|
84779
85306
|
pendingHeaderDistance,
|
|
@@ -84807,8 +85334,12 @@ ${l}
|
|
|
84807
85334
|
layoutLog(`[Layout] ========== END SECTION BREAK ==========`);
|
|
84808
85335
|
activeTopMargin = updatedState.activeTopMargin;
|
|
84809
85336
|
activeBottomMargin = updatedState.activeBottomMargin;
|
|
85337
|
+
activeLeftMargin = updatedState.activeLeftMargin;
|
|
85338
|
+
activeRightMargin = updatedState.activeRightMargin;
|
|
84810
85339
|
pendingTopMargin = updatedState.pendingTopMargin;
|
|
84811
85340
|
pendingBottomMargin = updatedState.pendingBottomMargin;
|
|
85341
|
+
pendingLeftMargin = updatedState.pendingLeftMargin;
|
|
85342
|
+
pendingRightMargin = updatedState.pendingRightMargin;
|
|
84812
85343
|
activeHeaderDistance = updatedState.activeHeaderDistance;
|
|
84813
85344
|
activeFooterDistance = updatedState.activeFooterDistance;
|
|
84814
85345
|
pendingHeaderDistance = updatedState.pendingHeaderDistance;
|
|
@@ -84946,8 +85477,8 @@ ${l}
|
|
|
84946
85477
|
pageMargins: {
|
|
84947
85478
|
top: activeTopMargin,
|
|
84948
85479
|
bottom: activeBottomMargin,
|
|
84949
|
-
left:
|
|
84950
|
-
right:
|
|
85480
|
+
left: activeLeftMargin,
|
|
85481
|
+
right: activeRightMargin
|
|
84951
85482
|
},
|
|
84952
85483
|
columns: getCurrentColumns(),
|
|
84953
85484
|
placedAnchoredIds
|
|
@@ -84969,9 +85500,9 @@ ${l}
|
|
|
84969
85500
|
const cols = getCurrentColumns();
|
|
84970
85501
|
let maxWidth;
|
|
84971
85502
|
if (relativeFrom === "page") {
|
|
84972
|
-
maxWidth = cols.count === 1 ? activePageSize.w -
|
|
85503
|
+
maxWidth = cols.count === 1 ? activePageSize.w - (activeLeftMargin + activeRightMargin) : activePageSize.w;
|
|
84973
85504
|
} else if (relativeFrom === "margin") {
|
|
84974
|
-
maxWidth = activePageSize.w -
|
|
85505
|
+
maxWidth = activePageSize.w - (activeLeftMargin + activeRightMargin);
|
|
84975
85506
|
} else {
|
|
84976
85507
|
maxWidth = cols.width;
|
|
84977
85508
|
}
|
|
@@ -85131,6 +85662,9 @@ ${l}
|
|
|
85131
85662
|
if (!Number.isFinite(height) || height <= 0) {
|
|
85132
85663
|
throw new Error("layoutHeaderFooter: height must be positive");
|
|
85133
85664
|
}
|
|
85665
|
+
const maxBehindDocOverflow = Math.max(192, height * 4);
|
|
85666
|
+
const minBehindDocY = -maxBehindDocOverflow;
|
|
85667
|
+
const maxBehindDocY = height + maxBehindDocOverflow;
|
|
85134
85668
|
const marginLeft = constraints.margins?.left ?? 0;
|
|
85135
85669
|
const transformedBlocks = marginLeft > 0 ? blocks2.map((block) => {
|
|
85136
85670
|
const hasPageRelativeAnchor = (block.kind === "image" || block.kind === "drawing") && block.anchor?.hRelativeFrom === "page" && block.anchor.offsetH != null;
|
|
@@ -85161,6 +85695,18 @@ ${l}
|
|
|
85161
85695
|
if (idx == null) continue;
|
|
85162
85696
|
const block = blocks2[idx];
|
|
85163
85697
|
const measure = measures[idx];
|
|
85698
|
+
const isAnchoredFragment = (fragment.kind === "image" || fragment.kind === "drawing") && fragment.isAnchored === true;
|
|
85699
|
+
if (isAnchoredFragment) {
|
|
85700
|
+
if (block.kind !== "image" && block.kind !== "drawing") {
|
|
85701
|
+
throw new Error(
|
|
85702
|
+
`Type mismatch: fragment kind is ${fragment.kind} but block kind is ${block.kind} for block ${block.id}`
|
|
85703
|
+
);
|
|
85704
|
+
}
|
|
85705
|
+
const anchoredBlock = block;
|
|
85706
|
+
if (anchoredBlock.anchor?.behindDoc && (fragment.y < minBehindDocY || fragment.y > maxBehindDocY)) {
|
|
85707
|
+
continue;
|
|
85708
|
+
}
|
|
85709
|
+
}
|
|
85164
85710
|
if (fragment.y < minY) minY = fragment.y;
|
|
85165
85711
|
let bottom2 = fragment.y;
|
|
85166
85712
|
if (fragment.kind === "para" && measure?.kind === "paragraph") {
|
|
@@ -86158,11 +86704,11 @@ ${l}
|
|
|
86158
86704
|
if (text2.length === 0) return null;
|
|
86159
86705
|
const clampedPos = Math.max(0, Math.min(localPos, text2.length));
|
|
86160
86706
|
let wordStart = clampedPos;
|
|
86161
|
-
while (wordStart > 0 && isWordChar(text2[wordStart - 1])) {
|
|
86707
|
+
while (wordStart > 0 && isWordChar$2(text2[wordStart - 1])) {
|
|
86162
86708
|
wordStart--;
|
|
86163
86709
|
}
|
|
86164
86710
|
let wordEnd = clampedPos;
|
|
86165
|
-
while (wordEnd < text2.length && isWordChar(text2[wordEnd])) {
|
|
86711
|
+
while (wordEnd < text2.length && isWordChar$2(text2[wordEnd])) {
|
|
86166
86712
|
wordEnd++;
|
|
86167
86713
|
}
|
|
86168
86714
|
if (wordStart === wordEnd) {
|
|
@@ -86225,7 +86771,7 @@ ${l}
|
|
|
86225
86771
|
}
|
|
86226
86772
|
return null;
|
|
86227
86773
|
}
|
|
86228
|
-
function isWordChar(char) {
|
|
86774
|
+
function isWordChar$2(char) {
|
|
86229
86775
|
return /[\p{L}\p{N}_]/u.test(char);
|
|
86230
86776
|
}
|
|
86231
86777
|
function isWhitespace$1(char) {
|
|
@@ -86260,6 +86806,29 @@ ${l}
|
|
|
86260
86806
|
function runText(run2) {
|
|
86261
86807
|
return "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
86262
86808
|
}
|
|
86809
|
+
const isWordChar$1 = (char) => {
|
|
86810
|
+
if (!char) return false;
|
|
86811
|
+
const code2 = char.charCodeAt(0);
|
|
86812
|
+
return code2 >= 48 && code2 <= 57 || code2 >= 65 && code2 <= 90 || code2 >= 97 && code2 <= 122 || char === "'";
|
|
86813
|
+
};
|
|
86814
|
+
const capitalizeText$1 = (text2, fullText, startOffset) => {
|
|
86815
|
+
if (!text2) return text2;
|
|
86816
|
+
const hasFullText = typeof startOffset === "number" && fullText != null;
|
|
86817
|
+
let result = "";
|
|
86818
|
+
for (let i2 = 0; i2 < text2.length; i2 += 1) {
|
|
86819
|
+
const prevChar = hasFullText ? startOffset + i2 > 0 ? fullText[startOffset + i2 - 1] : "" : i2 > 0 ? text2[i2 - 1] : "";
|
|
86820
|
+
const ch = text2[i2];
|
|
86821
|
+
result += isWordChar$1(ch) && !isWordChar$1(prevChar) ? ch.toUpperCase() : ch;
|
|
86822
|
+
}
|
|
86823
|
+
return result;
|
|
86824
|
+
};
|
|
86825
|
+
const applyTextTransform$1 = (text2, transform, fullText, startOffset) => {
|
|
86826
|
+
if (!text2 || !transform || transform === "none") return text2;
|
|
86827
|
+
if (transform === "uppercase") return text2.toUpperCase();
|
|
86828
|
+
if (transform === "lowercase") return text2.toLowerCase();
|
|
86829
|
+
if (transform === "capitalize") return capitalizeText$1(text2, fullText, startOffset);
|
|
86830
|
+
return text2;
|
|
86831
|
+
};
|
|
86263
86832
|
const DEFAULT_TAB_INTERVAL_TWIPS$1 = 720;
|
|
86264
86833
|
const TWIPS_PER_INCH$4 = 1440;
|
|
86265
86834
|
const PX_PER_INCH$3 = 96;
|
|
@@ -86268,6 +86837,13 @@ ${l}
|
|
|
86268
86837
|
const WIDTH_FUDGE_PX = 0.5;
|
|
86269
86838
|
const twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$1;
|
|
86270
86839
|
const pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1);
|
|
86840
|
+
const markerFontString = (run2) => {
|
|
86841
|
+
const size2 = run2?.fontSize ?? 16;
|
|
86842
|
+
const family = run2?.fontFamily ?? "Arial";
|
|
86843
|
+
const italic = run2?.italic ? "italic " : "";
|
|
86844
|
+
const bold = run2?.bold ? "bold " : "";
|
|
86845
|
+
return `${italic}${bold}${size2}px ${family}`.trim();
|
|
86846
|
+
};
|
|
86271
86847
|
const buildTabStopsPx$1 = (indent2, tabs, tabIntervalTwips) => {
|
|
86272
86848
|
const paragraphIndentTwips = {
|
|
86273
86849
|
left: pxToTwips$1(Math.max(0, indent2?.left ?? 0)),
|
|
@@ -86298,7 +86874,9 @@ ${l}
|
|
|
86298
86874
|
};
|
|
86299
86875
|
function measureRunSliceWidth(run2, fromChar, toChar) {
|
|
86300
86876
|
const context = getCtx();
|
|
86301
|
-
const
|
|
86877
|
+
const fullText = runText(run2);
|
|
86878
|
+
const transform = isTextRun$2(run2) ? run2.textTransform : void 0;
|
|
86879
|
+
const text2 = applyTextTransform$1(fullText.slice(fromChar, toChar), transform, fullText, fromChar);
|
|
86302
86880
|
if (!context) {
|
|
86303
86881
|
const textRun = isTextRun$2(run2) ? run2 : null;
|
|
86304
86882
|
const size2 = textRun?.fontSize ?? 16;
|
|
@@ -86344,8 +86922,21 @@ ${l}
|
|
|
86344
86922
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
86345
86923
|
const markerTextStartX = wordLayout?.marker?.textStartX;
|
|
86346
86924
|
const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : void 0;
|
|
86347
|
-
const
|
|
86348
|
-
|
|
86925
|
+
const resolvedTextStartPx = resolveListTextStartPx(
|
|
86926
|
+
wordLayout,
|
|
86927
|
+
indentLeft,
|
|
86928
|
+
indentFirstLine,
|
|
86929
|
+
indentHanging,
|
|
86930
|
+
(markerText, marker) => {
|
|
86931
|
+
const context = getCtx();
|
|
86932
|
+
if (!context) return 0;
|
|
86933
|
+
context.font = markerFontString(marker.run);
|
|
86934
|
+
return context.measureText(markerText).width;
|
|
86935
|
+
}
|
|
86936
|
+
);
|
|
86937
|
+
const effectiveTextStartPx = resolvedTextStartPx ?? textStartPx;
|
|
86938
|
+
const treatAsHanging = !wordLayout?.marker && effectiveTextStartPx && indentLeft === 0 && indentHanging === 0;
|
|
86939
|
+
const firstLineWidth = typeof effectiveTextStartPx === "number" && effectiveTextStartPx > indentLeft && !treatAsHanging ? Math.max(1, maxWidth - effectiveTextStartPx - indentRight) : Math.max(1, contentWidth - rawFirstLineOffset);
|
|
86349
86940
|
const tabStops = buildTabStopsPx$1(indent2, attrs?.tabs, attrs?.tabIntervalTwips);
|
|
86350
86941
|
let currentRun = 0;
|
|
86351
86942
|
let currentChar = 0;
|
|
@@ -86885,7 +87476,7 @@ ${l}
|
|
|
86885
87476
|
if (dirty.deletedBlockIds.length > 0) {
|
|
86886
87477
|
measureCache.invalidate(dirty.deletedBlockIds);
|
|
86887
87478
|
}
|
|
86888
|
-
const { measurementWidth, measurementHeight } = resolveMeasurementConstraints(options);
|
|
87479
|
+
const { measurementWidth, measurementHeight } = resolveMeasurementConstraints(options, nextBlocks);
|
|
86889
87480
|
if (measurementWidth <= 0 || measurementHeight <= 0) {
|
|
86890
87481
|
throw new Error("incrementalLayout: invalid measurement constraints resolved from options");
|
|
86891
87482
|
}
|
|
@@ -87154,7 +87745,7 @@ ${l}
|
|
|
87154
87745
|
const DEFAULT_PAGE_SIZE$1 = { w: 612, h: 792 };
|
|
87155
87746
|
const DEFAULT_MARGINS$1 = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
87156
87747
|
const normalizeMargin = (value, fallback) => Number.isFinite(value) ? value : fallback;
|
|
87157
|
-
function resolveMeasurementConstraints(options) {
|
|
87748
|
+
function resolveMeasurementConstraints(options, blocks2) {
|
|
87158
87749
|
const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
|
|
87159
87750
|
const margins = {
|
|
87160
87751
|
top: normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top),
|
|
@@ -87162,23 +87753,41 @@ ${l}
|
|
|
87162
87753
|
bottom: normalizeMargin(options.margins?.bottom, DEFAULT_MARGINS$1.bottom),
|
|
87163
87754
|
left: normalizeMargin(options.margins?.left, DEFAULT_MARGINS$1.left)
|
|
87164
87755
|
};
|
|
87165
|
-
const
|
|
87166
|
-
const
|
|
87167
|
-
const
|
|
87168
|
-
|
|
87756
|
+
const baseContentWidth = pageSize.w - (margins.left + margins.right);
|
|
87757
|
+
const baseContentHeight = pageSize.h - (margins.top + margins.bottom);
|
|
87758
|
+
const computeColumnWidth = (contentWidth, columns) => {
|
|
87759
|
+
if (!columns || columns.count <= 1) return contentWidth;
|
|
87169
87760
|
const gap = Math.max(0, columns.gap ?? 0);
|
|
87170
87761
|
const totalGap = gap * (columns.count - 1);
|
|
87171
|
-
|
|
87172
|
-
|
|
87173
|
-
|
|
87174
|
-
|
|
87175
|
-
|
|
87762
|
+
return (contentWidth - totalGap) / columns.count;
|
|
87763
|
+
};
|
|
87764
|
+
let measurementWidth = computeColumnWidth(baseContentWidth, options.columns);
|
|
87765
|
+
let measurementHeight = baseContentHeight;
|
|
87766
|
+
if (blocks2 && blocks2.length > 0) {
|
|
87767
|
+
for (const block of blocks2) {
|
|
87768
|
+
if (block.kind !== "sectionBreak") continue;
|
|
87769
|
+
const sectionPageSize = block.pageSize ?? pageSize;
|
|
87770
|
+
const sectionMargins = {
|
|
87771
|
+
top: normalizeMargin(block.margins?.top, margins.top),
|
|
87772
|
+
right: normalizeMargin(block.margins?.right, margins.right),
|
|
87773
|
+
bottom: normalizeMargin(block.margins?.bottom, margins.bottom),
|
|
87774
|
+
left: normalizeMargin(block.margins?.left, margins.left)
|
|
87176
87775
|
};
|
|
87776
|
+
const contentWidth = sectionPageSize.w - (sectionMargins.left + sectionMargins.right);
|
|
87777
|
+
const contentHeight = sectionPageSize.h - (sectionMargins.top + sectionMargins.bottom);
|
|
87778
|
+
if (contentWidth <= 0 || contentHeight <= 0) continue;
|
|
87779
|
+
const columnWidth = computeColumnWidth(contentWidth, block.columns ?? options.columns);
|
|
87780
|
+
if (columnWidth > measurementWidth) {
|
|
87781
|
+
measurementWidth = columnWidth;
|
|
87782
|
+
}
|
|
87783
|
+
if (contentHeight > measurementHeight) {
|
|
87784
|
+
measurementHeight = contentHeight;
|
|
87785
|
+
}
|
|
87177
87786
|
}
|
|
87178
87787
|
}
|
|
87179
87788
|
return {
|
|
87180
|
-
measurementWidth
|
|
87181
|
-
measurementHeight
|
|
87789
|
+
measurementWidth,
|
|
87790
|
+
measurementHeight
|
|
87182
87791
|
};
|
|
87183
87792
|
}
|
|
87184
87793
|
const serializeHeaderFooterResults = (kind, batch2) => {
|
|
@@ -89568,14 +90177,15 @@ ${l}
|
|
|
89568
90177
|
if (!schema) return [];
|
|
89569
90178
|
const types2 = [];
|
|
89570
90179
|
try {
|
|
89571
|
-
schema.nodes
|
|
90180
|
+
for (const name in schema.nodes) {
|
|
89572
90181
|
if (name === "text") {
|
|
89573
|
-
|
|
90182
|
+
continue;
|
|
89574
90183
|
}
|
|
89575
|
-
|
|
90184
|
+
const nodeType = schema.nodes[name];
|
|
90185
|
+
if (nodeType && (nodeType.isAtom || nodeType.isLeaf)) {
|
|
89576
90186
|
types2.push(name);
|
|
89577
90187
|
}
|
|
89578
|
-
}
|
|
90188
|
+
}
|
|
89579
90189
|
} catch {
|
|
89580
90190
|
return [];
|
|
89581
90191
|
}
|
|
@@ -90978,6 +91588,7 @@ ${l}
|
|
|
90978
91588
|
function hasIntrinsicBoundarySignals(_2) {
|
|
90979
91589
|
return false;
|
|
90980
91590
|
}
|
|
91591
|
+
const DEFAULT_HEADER_FOOTER_MARGIN_PX = 0;
|
|
90981
91592
|
function shouldIgnoreSectionBreak(paragraph2, index2, total, hasBodySectPr) {
|
|
90982
91593
|
const paragraphAttrs = paragraph2.attrs ?? {};
|
|
90983
91594
|
const paragraphProperties = paragraphAttrs?.paragraphProperties;
|
|
@@ -91018,14 +91629,15 @@ ${l}
|
|
|
91018
91629
|
const sectionData = extractSectionData(item.node);
|
|
91019
91630
|
if (!sectionData) return;
|
|
91020
91631
|
const sectPr = getSectPrFromNode(item.node);
|
|
91632
|
+
const hasAnyMargin = sectionData.headerPx != null || sectionData.footerPx != null || sectionData.topPx != null || sectionData.rightPx != null || sectionData.bottomPx != null || sectionData.leftPx != null;
|
|
91021
91633
|
const range2 = {
|
|
91022
91634
|
sectionIndex: idx,
|
|
91023
91635
|
startParagraphIndex: currentStart,
|
|
91024
91636
|
endParagraphIndex: item.index,
|
|
91025
91637
|
sectPr,
|
|
91026
|
-
margins:
|
|
91027
|
-
header: sectionData.headerPx ??
|
|
91028
|
-
footer: sectionData.footerPx ??
|
|
91638
|
+
margins: hasAnyMargin ? {
|
|
91639
|
+
header: sectionData.headerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
|
|
91640
|
+
footer: sectionData.footerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
|
|
91029
91641
|
top: sectionData.topPx,
|
|
91030
91642
|
right: sectionData.rightPx,
|
|
91031
91643
|
bottom: sectionData.bottomPx,
|
|
@@ -91067,14 +91679,15 @@ ${l}
|
|
|
91067
91679
|
};
|
|
91068
91680
|
const bodySectionData = extractSectionData(tempNode);
|
|
91069
91681
|
if (!bodySectionData) return null;
|
|
91682
|
+
const hasAnyMargin = bodySectionData.headerPx != null || bodySectionData.footerPx != null || bodySectionData.topPx != null || bodySectionData.rightPx != null || bodySectionData.bottomPx != null || bodySectionData.leftPx != null;
|
|
91070
91683
|
return {
|
|
91071
91684
|
sectionIndex,
|
|
91072
91685
|
startParagraphIndex: currentStart,
|
|
91073
91686
|
endParagraphIndex: totalParagraphs - 1,
|
|
91074
91687
|
sectPr: bodySectPr,
|
|
91075
|
-
margins:
|
|
91076
|
-
header: bodySectionData.headerPx ??
|
|
91077
|
-
footer: bodySectionData.footerPx ??
|
|
91688
|
+
margins: hasAnyMargin ? {
|
|
91689
|
+
header: bodySectionData.headerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
|
|
91690
|
+
footer: bodySectionData.footerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
|
|
91078
91691
|
top: bodySectionData.topPx,
|
|
91079
91692
|
right: bodySectionData.rightPx,
|
|
91080
91693
|
bottom: bodySectionData.bottomPx,
|
|
@@ -92058,11 +92671,27 @@ ${l}
|
|
|
92058
92671
|
}, void 0);
|
|
92059
92672
|
};
|
|
92060
92673
|
const normalizeUnderlineStyle = (value) => {
|
|
92061
|
-
if (value ===
|
|
92062
|
-
return
|
|
92674
|
+
if (value === void 0 || value === null) {
|
|
92675
|
+
return "single";
|
|
92063
92676
|
}
|
|
92064
|
-
if (
|
|
92065
|
-
return value;
|
|
92677
|
+
if (typeof value === "boolean") {
|
|
92678
|
+
return value ? "single" : void 0;
|
|
92679
|
+
}
|
|
92680
|
+
if (typeof value === "number") {
|
|
92681
|
+
return value === 0 ? void 0 : "single";
|
|
92682
|
+
}
|
|
92683
|
+
if (typeof value === "string") {
|
|
92684
|
+
const normalized = value.trim().toLowerCase();
|
|
92685
|
+
if (!normalized) {
|
|
92686
|
+
return "single";
|
|
92687
|
+
}
|
|
92688
|
+
if (normalized === "none" || normalized === "0" || normalized === "false" || normalized === "off") {
|
|
92689
|
+
return void 0;
|
|
92690
|
+
}
|
|
92691
|
+
if (normalized === "double" || normalized === "dotted" || normalized === "dashed" || normalized === "wavy") {
|
|
92692
|
+
return normalized;
|
|
92693
|
+
}
|
|
92694
|
+
return "single";
|
|
92066
92695
|
}
|
|
92067
92696
|
return "single";
|
|
92068
92697
|
};
|
|
@@ -92214,13 +92843,16 @@ ${l}
|
|
|
92214
92843
|
break;
|
|
92215
92844
|
}
|
|
92216
92845
|
case "underline": {
|
|
92217
|
-
const
|
|
92846
|
+
const underlineValue = mark2.attrs?.underlineType ?? mark2.attrs?.value ?? mark2.attrs?.underline ?? mark2.attrs?.style;
|
|
92847
|
+
const style2 = normalizeUnderlineStyle(underlineValue);
|
|
92218
92848
|
if (style2) {
|
|
92219
92849
|
const underlineColor = resolveColorFromAttributes(mark2.attrs ?? {}, themeColors);
|
|
92220
92850
|
run2.underline = {
|
|
92221
92851
|
style: style2,
|
|
92222
92852
|
color: underlineColor ?? run2.underline?.color
|
|
92223
92853
|
};
|
|
92854
|
+
} else if (underlineValue !== void 0 && underlineValue !== null) {
|
|
92855
|
+
delete run2.underline;
|
|
92224
92856
|
}
|
|
92225
92857
|
break;
|
|
92226
92858
|
}
|
|
@@ -93156,8 +93788,8 @@ ${l}
|
|
|
93156
93788
|
}
|
|
93157
93789
|
return void 0;
|
|
93158
93790
|
}
|
|
93159
|
-
const DEFAULT_LIST_HANGING_PX
|
|
93160
|
-
const LIST_MARKER_GAP
|
|
93791
|
+
const DEFAULT_LIST_HANGING_PX = 18;
|
|
93792
|
+
const LIST_MARKER_GAP = 8;
|
|
93161
93793
|
const DEFAULT_BULLET_GLYPH = "•";
|
|
93162
93794
|
const DEFAULT_DECIMAL_PATTERN = "%1.";
|
|
93163
93795
|
const ASCII_UPPERCASE_A = 65;
|
|
@@ -93568,7 +94200,7 @@ ${l}
|
|
|
93568
94200
|
let markerBoxWidthPx;
|
|
93569
94201
|
let markerX;
|
|
93570
94202
|
if (hasFirstLineIndent) {
|
|
93571
|
-
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP
|
|
94203
|
+
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP : DEFAULT_LIST_HANGING_PX;
|
|
93572
94204
|
markerX = indentLeftPx + (firstLinePx ?? 0);
|
|
93573
94205
|
layout.textStartPx = markerX + markerBoxWidthPx;
|
|
93574
94206
|
layout.hangingPx = 0;
|
|
@@ -93668,12 +94300,12 @@ ${l}
|
|
|
93668
94300
|
let markerBox = Math.max(hangingPxRaw || 0, 0);
|
|
93669
94301
|
if (markerBox <= 0) {
|
|
93670
94302
|
if (glyphWidthPx != null && glyphWidthPx > 0) {
|
|
93671
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP
|
|
94303
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP;
|
|
93672
94304
|
} else {
|
|
93673
|
-
markerBox = DEFAULT_LIST_HANGING_PX
|
|
94305
|
+
markerBox = DEFAULT_LIST_HANGING_PX;
|
|
93674
94306
|
}
|
|
93675
|
-
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP
|
|
93676
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP
|
|
94307
|
+
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP > markerBox) {
|
|
94308
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP;
|
|
93677
94309
|
}
|
|
93678
94310
|
return markerBox;
|
|
93679
94311
|
};
|
|
@@ -93693,7 +94325,7 @@ ${l}
|
|
|
93693
94325
|
textStartX: textStartPx,
|
|
93694
94326
|
baselineOffsetPx: markerRun.baselineShift ?? 0,
|
|
93695
94327
|
// Gutter is the small gap between marker and text, not the full marker box width
|
|
93696
|
-
gutterWidthPx: LIST_MARKER_GAP
|
|
94328
|
+
gutterWidthPx: LIST_MARKER_GAP,
|
|
93697
94329
|
justification: numbering.lvlJc ?? "left",
|
|
93698
94330
|
suffix: normalizeSuffix$1(numbering.suffix) ?? "tab",
|
|
93699
94331
|
run: markerRun,
|
|
@@ -93783,7 +94415,10 @@ ${l}
|
|
|
93783
94415
|
tabStops: cloneIfObject(resolvedExtended.tabStops),
|
|
93784
94416
|
keepLines: resolvedExtended.keepLines,
|
|
93785
94417
|
keepNext: resolvedExtended.keepNext,
|
|
93786
|
-
numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties)
|
|
94418
|
+
numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties),
|
|
94419
|
+
// Extract contextualSpacing from style resolution - this is a sibling to spacing in OOXML,
|
|
94420
|
+
// not nested within it. When true, suppresses spacing between paragraphs of the same style.
|
|
94421
|
+
contextualSpacing: resolvedExtended.contextualSpacing
|
|
93787
94422
|
};
|
|
93788
94423
|
return hydrated;
|
|
93789
94424
|
};
|
|
@@ -94385,6 +95020,31 @@ ${l}
|
|
|
94385
95020
|
return null;
|
|
94386
95021
|
}
|
|
94387
95022
|
};
|
|
95023
|
+
const normalizeWordLayoutForIndent = (wordLayout, paragraphIndent) => {
|
|
95024
|
+
const resolvedIndent = wordLayout.resolvedIndent ?? paragraphIndent ?? {};
|
|
95025
|
+
const indentLeft = isFiniteNumber(resolvedIndent.left) ? resolvedIndent.left : 0;
|
|
95026
|
+
const firstLine = isFiniteNumber(resolvedIndent.firstLine) ? resolvedIndent.firstLine : 0;
|
|
95027
|
+
const hanging = isFiniteNumber(resolvedIndent.hanging) ? resolvedIndent.hanging : 0;
|
|
95028
|
+
const shouldFirstLineIndentMode = firstLine > 0 && !hanging;
|
|
95029
|
+
if (wordLayout.firstLineIndentMode === true && !shouldFirstLineIndentMode) {
|
|
95030
|
+
wordLayout.firstLineIndentMode = false;
|
|
95031
|
+
}
|
|
95032
|
+
if (wordLayout.firstLineIndentMode === true) {
|
|
95033
|
+
if (isFiniteNumber(wordLayout.textStartPx)) {
|
|
95034
|
+
if (wordLayout.marker && (!isFiniteNumber(wordLayout.marker.textStartX) || wordLayout.marker.textStartX !== wordLayout.textStartPx)) {
|
|
95035
|
+
wordLayout.marker.textStartX = wordLayout.textStartPx;
|
|
95036
|
+
}
|
|
95037
|
+
} else if (wordLayout.marker && isFiniteNumber(wordLayout.marker.textStartX)) {
|
|
95038
|
+
wordLayout.textStartPx = wordLayout.marker.textStartX;
|
|
95039
|
+
}
|
|
95040
|
+
} else {
|
|
95041
|
+
wordLayout.textStartPx = indentLeft;
|
|
95042
|
+
if (wordLayout.marker) {
|
|
95043
|
+
wordLayout.marker.textStartX = indentLeft;
|
|
95044
|
+
}
|
|
95045
|
+
}
|
|
95046
|
+
return wordLayout;
|
|
95047
|
+
};
|
|
94388
95048
|
const computeParagraphAttrs = (para, styleContext, listCounterContext, converterContext, hydrationOverride) => {
|
|
94389
95049
|
const attrs = para.attrs ?? {};
|
|
94390
95050
|
const paragraphProps = typeof attrs.paragraphProperties === "object" && attrs.paragraphProperties !== null ? attrs.paragraphProperties : {};
|
|
@@ -94493,7 +95153,7 @@ ${l}
|
|
|
94493
95153
|
paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
|
|
94494
95154
|
}
|
|
94495
95155
|
}
|
|
94496
|
-
const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
|
|
95156
|
+
const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing") ?? hydrated?.contextualSpacing;
|
|
94497
95157
|
if (contextualSpacingValue != null) {
|
|
94498
95158
|
paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
|
|
94499
95159
|
}
|
|
@@ -94707,8 +95367,11 @@ ${l}
|
|
|
94707
95367
|
let wordLayout = computeWordLayoutForParagraph(paragraphAttrs, enrichedNumberingProps, styleContext);
|
|
94708
95368
|
if (!wordLayout && enrichedNumberingProps.resolvedLevelIndent) {
|
|
94709
95369
|
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
94710
|
-
const
|
|
94711
|
-
|
|
95370
|
+
const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
|
|
95371
|
+
const mergedIndent = { ...baseIndent, ...paragraphAttrs.indent ?? {} };
|
|
95372
|
+
const firstLinePx = isFiniteNumber(mergedIndent.firstLine) ? mergedIndent.firstLine : 0;
|
|
95373
|
+
const hangingPx = isFiniteNumber(mergedIndent.hanging) ? mergedIndent.hanging : 0;
|
|
95374
|
+
if (firstLinePx > 0 && !hangingPx) {
|
|
94712
95375
|
wordLayout = {
|
|
94713
95376
|
// Treat as first-line-indent mode: text starts after the marker+firstLine offset.
|
|
94714
95377
|
firstLineIndentMode: true,
|
|
@@ -94716,10 +95379,13 @@ ${l}
|
|
|
94716
95379
|
};
|
|
94717
95380
|
}
|
|
94718
95381
|
}
|
|
94719
|
-
if (wordLayout &&
|
|
95382
|
+
if (wordLayout && !Number.isFinite(wordLayout.textStartPx) && enrichedNumberingProps.resolvedLevelIndent) {
|
|
94720
95383
|
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
94721
|
-
const
|
|
94722
|
-
|
|
95384
|
+
const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
|
|
95385
|
+
const mergedIndent = { ...baseIndent, ...paragraphAttrs.indent ?? {} };
|
|
95386
|
+
const firstLinePx = isFiniteNumber(mergedIndent.firstLine) ? mergedIndent.firstLine : 0;
|
|
95387
|
+
const hangingPx = isFiniteNumber(mergedIndent.hanging) ? mergedIndent.hanging : 0;
|
|
95388
|
+
if (firstLinePx > 0 && !hangingPx) {
|
|
94723
95389
|
wordLayout = {
|
|
94724
95390
|
...wordLayout,
|
|
94725
95391
|
firstLineIndentMode: wordLayout.firstLineIndentMode ?? true,
|
|
@@ -94739,6 +95405,7 @@ ${l}
|
|
|
94739
95405
|
wordLayout.marker.suffix = listRendering.suffix;
|
|
94740
95406
|
}
|
|
94741
95407
|
}
|
|
95408
|
+
wordLayout = normalizeWordLayoutForIndent(wordLayout, paragraphAttrs.indent);
|
|
94742
95409
|
paragraphAttrs.wordLayout = wordLayout;
|
|
94743
95410
|
}
|
|
94744
95411
|
if (enrichedNumberingProps.resolvedLevelIndent) {
|
|
@@ -98855,11 +99522,6 @@ ${l}
|
|
|
98855
99522
|
cleanups
|
|
98856
99523
|
};
|
|
98857
99524
|
}
|
|
98858
|
-
const LIST_MARKER_GAP = 8;
|
|
98859
|
-
const MIN_MARKER_GUTTER = 24;
|
|
98860
|
-
const DEFAULT_LIST_INDENT_BASE_PX = 24;
|
|
98861
|
-
const DEFAULT_LIST_INDENT_STEP_PX = 24;
|
|
98862
|
-
const DEFAULT_LIST_HANGING_PX = 18;
|
|
98863
99525
|
function calculateRotatedBounds(input2) {
|
|
98864
99526
|
const width = Math.max(0, input2.width);
|
|
98865
99527
|
const height = Math.max(0, input2.height);
|
|
@@ -99029,7 +99691,7 @@ ${l}
|
|
|
99029
99691
|
return Math.max(advanceWidth, paintedWidth);
|
|
99030
99692
|
}
|
|
99031
99693
|
const MIN_SINGLE_LINE_PX = 12 * 96 / 72;
|
|
99032
|
-
const
|
|
99694
|
+
const WORD_SINGLE_LINE_SPACING_MULTIPLIER = 1.15;
|
|
99033
99695
|
function calculateTypographyMetrics(fontSize2, spacing, fontInfo) {
|
|
99034
99696
|
let ascent;
|
|
99035
99697
|
let descent;
|
|
@@ -99042,7 +99704,7 @@ ${l}
|
|
|
99042
99704
|
ascent = roundValue(fontSize2 * 0.8);
|
|
99043
99705
|
descent = roundValue(fontSize2 * 0.2);
|
|
99044
99706
|
}
|
|
99045
|
-
const baseLineHeight = Math.max(ascent + descent
|
|
99707
|
+
const baseLineHeight = Math.max(fontSize2 * WORD_SINGLE_LINE_SPACING_MULTIPLIER, ascent + descent, MIN_SINGLE_LINE_PX);
|
|
99046
99708
|
const lineHeight2 = roundValue(resolveLineHeight(spacing, baseLineHeight));
|
|
99047
99709
|
return {
|
|
99048
99710
|
ascent,
|
|
@@ -99123,8 +99785,25 @@ ${l}
|
|
|
99123
99785
|
const rawTextStartPx = wordLayout?.textStartPx;
|
|
99124
99786
|
const markerTextStartX = wordLayout?.marker?.textStartX;
|
|
99125
99787
|
const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof rawTextStartPx === "number" && Number.isFinite(rawTextStartPx) ? rawTextStartPx : void 0;
|
|
99126
|
-
|
|
99127
|
-
|
|
99788
|
+
const resolvedTextStartPx = resolveListTextStartPx(
|
|
99789
|
+
wordLayout,
|
|
99790
|
+
indentLeft,
|
|
99791
|
+
firstLine,
|
|
99792
|
+
hanging,
|
|
99793
|
+
(markerText, marker) => {
|
|
99794
|
+
const markerRun = {
|
|
99795
|
+
fontFamily: toCssFontFamily(marker.run?.fontFamily) ?? marker.run?.fontFamily ?? "Arial",
|
|
99796
|
+
fontSize: marker.run?.fontSize ?? 16,
|
|
99797
|
+
bold: marker.run?.bold ?? false,
|
|
99798
|
+
italic: marker.run?.italic ?? false
|
|
99799
|
+
};
|
|
99800
|
+
const { font: markerFont } = buildFontString(markerRun);
|
|
99801
|
+
return measureText(markerText, markerFont, ctx2);
|
|
99802
|
+
}
|
|
99803
|
+
);
|
|
99804
|
+
const effectiveTextStartPx = resolvedTextStartPx ?? textStartPx;
|
|
99805
|
+
if (typeof effectiveTextStartPx === "number" && effectiveTextStartPx > indentLeft) {
|
|
99806
|
+
initialAvailableWidth = Math.max(1, maxWidth - effectiveTextStartPx - indentRight);
|
|
99128
99807
|
} else {
|
|
99129
99808
|
initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
|
|
99130
99809
|
}
|
|
@@ -99211,7 +99890,7 @@ ${l}
|
|
|
99211
99890
|
pendingTabAlignment = null;
|
|
99212
99891
|
return startX;
|
|
99213
99892
|
};
|
|
99214
|
-
const alignSegmentAtTab = (segmentText, font, runContext) => {
|
|
99893
|
+
const alignSegmentAtTab = (segmentText, font, runContext, segmentStartChar) => {
|
|
99215
99894
|
if (!pendingTabAlignment || !currentLine) return void 0;
|
|
99216
99895
|
const { val } = pendingTabAlignment;
|
|
99217
99896
|
let segmentWidth = 0;
|
|
@@ -99220,11 +99899,11 @@ ${l}
|
|
|
99220
99899
|
const idx = segmentText.indexOf(decimalSeparator);
|
|
99221
99900
|
if (idx >= 0) {
|
|
99222
99901
|
const beforeText = segmentText.slice(0, idx);
|
|
99223
|
-
beforeDecimalWidth = beforeText.length > 0 ? measureRunWidth(beforeText, font, ctx2, runContext) : 0;
|
|
99902
|
+
beforeDecimalWidth = beforeText.length > 0 ? measureRunWidth(beforeText, font, ctx2, runContext, segmentStartChar) : 0;
|
|
99224
99903
|
}
|
|
99225
|
-
segmentWidth = segmentText.length > 0 ? measureRunWidth(segmentText, font, ctx2, runContext) : 0;
|
|
99904
|
+
segmentWidth = segmentText.length > 0 ? measureRunWidth(segmentText, font, ctx2, runContext, segmentStartChar) : 0;
|
|
99226
99905
|
} else if (val === "end" || val === "center") {
|
|
99227
|
-
segmentWidth = segmentText.length > 0 ? measureRunWidth(segmentText, font, ctx2, runContext) : 0;
|
|
99906
|
+
segmentWidth = segmentText.length > 0 ? measureRunWidth(segmentText, font, ctx2, runContext, segmentStartChar) : 0;
|
|
99228
99907
|
}
|
|
99229
99908
|
return alignPendingTabForWidth(segmentWidth, beforeDecimalWidth);
|
|
99230
99909
|
};
|
|
@@ -99276,8 +99955,8 @@ ${l}
|
|
|
99276
99955
|
const { font } = buildFontString(
|
|
99277
99956
|
lastRun
|
|
99278
99957
|
);
|
|
99279
|
-
const fullWidth = measureRunWidth(sliceText, font, ctx2, lastRun);
|
|
99280
|
-
const keptWidth = keptText.length > 0 ? measureRunWidth(keptText, font, ctx2, lastRun) : 0;
|
|
99958
|
+
const fullWidth = measureRunWidth(sliceText, font, ctx2, lastRun, sliceStart);
|
|
99959
|
+
const keptWidth = keptText.length > 0 ? measureRunWidth(keptText, font, ctx2, lastRun, sliceStart) : 0;
|
|
99281
99960
|
const delta = Math.max(0, fullWidth - keptWidth);
|
|
99282
99961
|
lineToTrim.width = roundValue(Math.max(0, lineToTrim.width - delta));
|
|
99283
99962
|
lineToTrim.spaceCount = Math.max(0, lineToTrim.spaceCount - trimCount);
|
|
@@ -99488,7 +100167,8 @@ ${l}
|
|
|
99488
100167
|
continue;
|
|
99489
100168
|
}
|
|
99490
100169
|
if (isFieldAnnotationRun(run2)) {
|
|
99491
|
-
const
|
|
100170
|
+
const rawDisplayText = run2.displayLabel || "";
|
|
100171
|
+
const displayText = applyTextTransform(rawDisplayText, run2);
|
|
99492
100172
|
const annotationFontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
99493
100173
|
const annotationFontFamily = run2.fontFamily || "Arial, sans-serif";
|
|
99494
100174
|
const fontWeight = run2.bold ? "bold" : "normal";
|
|
@@ -99591,7 +100271,7 @@ ${l}
|
|
|
99591
100271
|
const spacesLength = segment.length;
|
|
99592
100272
|
const spacesStartChar = charPosInRun;
|
|
99593
100273
|
const spacesEndChar = charPosInRun + spacesLength;
|
|
99594
|
-
const spacesWidth = measureRunWidth(segment, font, ctx2, run2);
|
|
100274
|
+
const spacesWidth = measureRunWidth(segment, font, ctx2, run2, spacesStartChar);
|
|
99595
100275
|
if (!currentLine) {
|
|
99596
100276
|
currentLine = {
|
|
99597
100277
|
fromRun: runIndex,
|
|
@@ -99655,7 +100335,7 @@ ${l}
|
|
|
99655
100335
|
}
|
|
99656
100336
|
let segmentStartX;
|
|
99657
100337
|
if (currentLine && pendingTabAlignment) {
|
|
99658
|
-
segmentStartX = alignSegmentAtTab(segment, font, run2);
|
|
100338
|
+
segmentStartX = alignSegmentAtTab(segment, font, run2, charPosInRun);
|
|
99659
100339
|
if (segmentStartX == null) {
|
|
99660
100340
|
segmentStartX = currentLine.width;
|
|
99661
100341
|
}
|
|
@@ -99665,7 +100345,7 @@ ${l}
|
|
|
99665
100345
|
if (word2 === "") {
|
|
99666
100346
|
const spaceStartChar = charPosInRun;
|
|
99667
100347
|
const spaceEndChar = charPosInRun + 1;
|
|
99668
|
-
const singleSpaceWidth = measureRunWidth(" ", font, ctx2, run2);
|
|
100348
|
+
const singleSpaceWidth = measureRunWidth(" ", font, ctx2, run2, spaceStartChar);
|
|
99669
100349
|
if (!currentLine) {
|
|
99670
100350
|
currentLine = {
|
|
99671
100351
|
fromRun: runIndex,
|
|
@@ -99716,12 +100396,12 @@ ${l}
|
|
|
99716
100396
|
charPosInRun = spaceEndChar;
|
|
99717
100397
|
continue;
|
|
99718
100398
|
}
|
|
99719
|
-
const wordOnlyWidth = measureRunWidth(word2, font, ctx2, run2);
|
|
99720
|
-
const shouldIncludeDelimiterSpace = wordIndex < lastNonEmptyWordIndex;
|
|
99721
|
-
const spaceWidth = shouldIncludeDelimiterSpace ? measureRunWidth(" ", font, ctx2, run2) : 0;
|
|
99722
|
-
const wordCommitWidth = wordOnlyWidth + spaceWidth;
|
|
99723
100399
|
const wordStartChar = charPosInRun;
|
|
100400
|
+
const wordOnlyWidth = measureRunWidth(word2, font, ctx2, run2, wordStartChar);
|
|
100401
|
+
const shouldIncludeDelimiterSpace = wordIndex < lastNonEmptyWordIndex;
|
|
99724
100402
|
const wordEndNoSpace = charPosInRun + word2.length;
|
|
100403
|
+
const spaceWidth = shouldIncludeDelimiterSpace ? measureRunWidth(" ", font, ctx2, run2, wordEndNoSpace) : 0;
|
|
100404
|
+
const wordCommitWidth = wordOnlyWidth + spaceWidth;
|
|
99725
100405
|
const wordEndWithSpace = wordEndNoSpace + (shouldIncludeDelimiterSpace ? 1 : 0);
|
|
99726
100406
|
const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
99727
100407
|
if (wordOnlyWidth > effectiveMaxWidth && word2.length > 1) {
|
|
@@ -99740,7 +100420,7 @@ ${l}
|
|
|
99740
100420
|
const hasTabOnlyLine = currentLine && currentLine.segments && currentLine.segments.length === 0 && currentLine.width > 0;
|
|
99741
100421
|
const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
|
|
99742
100422
|
const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
|
|
99743
|
-
const chunks = breakWordIntoChunks(word2, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run2);
|
|
100423
|
+
const chunks = breakWordIntoChunks(word2, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run2, wordStartChar);
|
|
99744
100424
|
let chunkCharOffset = wordStartChar;
|
|
99745
100425
|
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
99746
100426
|
const chunk = chunks[chunkIndex];
|
|
@@ -99842,6 +100522,10 @@ ${l}
|
|
|
99842
100522
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
99843
100523
|
charPosInRun = wordEndWithSpace;
|
|
99844
100524
|
currentLine.spaceCount += 1;
|
|
100525
|
+
if (currentLine.segments?.[0]) {
|
|
100526
|
+
currentLine.segments[0].toChar = wordEndWithSpace;
|
|
100527
|
+
currentLine.segments[0].width += spaceWidth;
|
|
100528
|
+
}
|
|
99845
100529
|
} else {
|
|
99846
100530
|
charPosInRun = wordEndWithSpace;
|
|
99847
100531
|
}
|
|
@@ -99864,7 +100548,7 @@ ${l}
|
|
|
99864
100548
|
if (candidateSpaces > 0) {
|
|
99865
100549
|
const overflow = totalWidthWithWord - availableWidth;
|
|
99866
100550
|
if (overflow > 0) {
|
|
99867
|
-
const baseSpaceWidth = spaceWidth || measureRunWidth(" ", font, ctx2, run2) || Math.max(1, boundarySpacing);
|
|
100551
|
+
const baseSpaceWidth = spaceWidth || measureRunWidth(" ", font, ctx2, run2, wordEndNoSpace) || Math.max(1, boundarySpacing);
|
|
99868
100552
|
const perSpaceCompression = overflow / candidateSpaces;
|
|
99869
100553
|
const maxPerSpaceCompression = baseSpaceWidth * 0.25;
|
|
99870
100554
|
if (perSpaceCompression <= maxPerSpaceCompression) {
|
|
@@ -99904,6 +100588,10 @@ ${l}
|
|
|
99904
100588
|
currentLine.width = roundValue(currentLine.width + spaceWidth + (run2.letterSpacing ?? 0));
|
|
99905
100589
|
charPosInRun = wordEndWithSpace;
|
|
99906
100590
|
currentLine.spaceCount += 1;
|
|
100591
|
+
if (currentLine.segments?.[0]) {
|
|
100592
|
+
currentLine.segments[0].toChar = wordEndWithSpace;
|
|
100593
|
+
currentLine.segments[0].width += spaceWidth;
|
|
100594
|
+
}
|
|
99907
100595
|
} else {
|
|
99908
100596
|
charPosInRun = wordEndWithSpace;
|
|
99909
100597
|
}
|
|
@@ -100039,8 +100727,8 @@ ${l}
|
|
|
100039
100727
|
const { font: markerFont } = buildFontString(markerRun);
|
|
100040
100728
|
const markerText = wordLayout.marker.markerText ?? "";
|
|
100041
100729
|
const glyphWidth = markerText ? measureText(markerText, markerFont, ctx2) : 0;
|
|
100042
|
-
const gutter = typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx >= 0 ? wordLayout.marker.gutterWidthPx : LIST_MARKER_GAP;
|
|
100043
|
-
const markerBoxWidth = Math.max(wordLayout.marker.markerBoxWidthPx ?? 0, glyphWidth + LIST_MARKER_GAP);
|
|
100730
|
+
const gutter = typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx >= 0 ? wordLayout.marker.gutterWidthPx : LIST_MARKER_GAP$1;
|
|
100731
|
+
const markerBoxWidth = Math.max(wordLayout.marker.markerBoxWidthPx ?? 0, glyphWidth + LIST_MARKER_GAP$1);
|
|
100044
100732
|
markerInfo = {
|
|
100045
100733
|
markerWidth: markerBoxWidth,
|
|
100046
100734
|
markerTextWidth: glyphWidth,
|
|
@@ -100384,7 +101072,7 @@ ${l}
|
|
|
100384
101072
|
markerTextWidth = markerText ? measureText(markerText, markerFont, ctx2) : 0;
|
|
100385
101073
|
indentLeft = resolveIndentLeft(item);
|
|
100386
101074
|
const indentHanging = resolveIndentHanging(item);
|
|
100387
|
-
markerWidth = Math.max(MIN_MARKER_GUTTER, markerTextWidth + LIST_MARKER_GAP, indentHanging);
|
|
101075
|
+
markerWidth = Math.max(MIN_MARKER_GUTTER, markerTextWidth + LIST_MARKER_GAP$1, indentHanging);
|
|
100388
101076
|
}
|
|
100389
101077
|
const paragraphWidth = Math.max(1, constraints.maxWidth - indentLeft - markerWidth);
|
|
100390
101078
|
const paragraphMeasure = await measureParagraphBlock(item.paragraph, paragraphWidth);
|
|
@@ -100410,16 +101098,46 @@ ${l}
|
|
|
100410
101098
|
fontSize: 16
|
|
100411
101099
|
};
|
|
100412
101100
|
};
|
|
100413
|
-
const
|
|
101101
|
+
const isWordChar = (char) => {
|
|
101102
|
+
if (!char) return false;
|
|
101103
|
+
const code2 = char.charCodeAt(0);
|
|
101104
|
+
return code2 >= 48 && code2 <= 57 || code2 >= 65 && code2 <= 90 || code2 >= 97 && code2 <= 122 || char === "'";
|
|
101105
|
+
};
|
|
101106
|
+
const capitalizeText = (text2, fullText, startOffset) => {
|
|
101107
|
+
if (!text2) return text2;
|
|
101108
|
+
const hasFullText = typeof startOffset === "number" && fullText != null;
|
|
101109
|
+
let result = "";
|
|
101110
|
+
for (let i2 = 0; i2 < text2.length; i2 += 1) {
|
|
101111
|
+
const prevChar = hasFullText ? startOffset + i2 > 0 ? fullText[startOffset + i2 - 1] : "" : i2 > 0 ? text2[i2 - 1] : "";
|
|
101112
|
+
const ch = text2[i2];
|
|
101113
|
+
result += isWordChar(ch) && !isWordChar(prevChar) ? ch.toUpperCase() : ch;
|
|
101114
|
+
}
|
|
101115
|
+
return result;
|
|
101116
|
+
};
|
|
101117
|
+
const applyTextTransform = (text2, run2, startOffset) => {
|
|
101118
|
+
const transform = "textTransform" in run2 ? run2.textTransform : void 0;
|
|
101119
|
+
if (!text2 || !transform || transform === "none") return text2;
|
|
101120
|
+
if (transform === "uppercase") return text2.toUpperCase();
|
|
101121
|
+
if (transform === "lowercase") return text2.toLowerCase();
|
|
101122
|
+
if (transform === "capitalize") {
|
|
101123
|
+
const fullText = "text" in run2 && typeof run2.text === "string" ? run2.text : text2;
|
|
101124
|
+
return capitalizeText(text2, fullText, startOffset);
|
|
101125
|
+
}
|
|
101126
|
+
return text2;
|
|
101127
|
+
};
|
|
101128
|
+
const measureRunWidth = (text2, font, ctx2, run2, startOffset) => {
|
|
100414
101129
|
const letterSpacing = run2.kind === "text" || run2.kind === void 0 ? run2.letterSpacing || 0 : 0;
|
|
100415
|
-
const
|
|
101130
|
+
const displayText = applyTextTransform(text2, run2, startOffset);
|
|
101131
|
+
const width = getMeasuredTextWidth(displayText, font, letterSpacing, ctx2);
|
|
100416
101132
|
return roundValue(width);
|
|
100417
101133
|
};
|
|
100418
|
-
const breakWordIntoChunks = (word2, maxWidth, font, ctx2, run2) => {
|
|
101134
|
+
const breakWordIntoChunks = (word2, maxWidth, font, ctx2, run2, startOffset) => {
|
|
100419
101135
|
const chunks = [];
|
|
101136
|
+
const baseOffset = typeof startOffset === "number" ? startOffset : 0;
|
|
100420
101137
|
if (maxWidth <= 0) {
|
|
100421
|
-
for (
|
|
100422
|
-
const
|
|
101138
|
+
for (let i2 = 0; i2 < word2.length; i2++) {
|
|
101139
|
+
const char = word2[i2];
|
|
101140
|
+
const charWidth = measureRunWidth(char, font, ctx2, run2, baseOffset + i2);
|
|
100423
101141
|
chunks.push({ text: char, width: charWidth });
|
|
100424
101142
|
}
|
|
100425
101143
|
return chunks;
|
|
@@ -100429,11 +101147,11 @@ ${l}
|
|
|
100429
101147
|
for (let i2 = 0; i2 < word2.length; i2++) {
|
|
100430
101148
|
const char = word2[i2];
|
|
100431
101149
|
const testChunk = currentChunk + char;
|
|
100432
|
-
const testWidth = measureRunWidth(testChunk, font, ctx2, run2);
|
|
101150
|
+
const testWidth = measureRunWidth(testChunk, font, ctx2, run2, baseOffset);
|
|
100433
101151
|
if (testWidth > maxWidth && currentChunk.length > 0) {
|
|
100434
101152
|
chunks.push({ text: currentChunk, width: currentWidth });
|
|
100435
101153
|
currentChunk = char;
|
|
100436
|
-
currentWidth = measureRunWidth(char, font, ctx2, run2);
|
|
101154
|
+
currentWidth = measureRunWidth(char, font, ctx2, run2, baseOffset + i2);
|
|
100437
101155
|
} else {
|
|
100438
101156
|
currentChunk = testChunk;
|
|
100439
101157
|
currentWidth = testWidth;
|
|
@@ -100487,12 +101205,13 @@ ${l}
|
|
|
100487
101205
|
italic: run2.italic
|
|
100488
101206
|
});
|
|
100489
101207
|
ctx2.font = font;
|
|
100490
|
-
const
|
|
101208
|
+
const displayText = applyTextTransform(run2.text, run2);
|
|
101209
|
+
const metrics = ctx2.measureText(displayText);
|
|
100491
101210
|
const advanceWidth = metrics.width;
|
|
100492
101211
|
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
100493
101212
|
const textWidth = Math.max(advanceWidth, paintedWidth);
|
|
100494
101213
|
const width = roundValue(textWidth + DROP_CAP_PADDING_PX);
|
|
100495
|
-
const baseLineHeight = resolveLineHeight(spacing, run2.fontSize *
|
|
101214
|
+
const baseLineHeight = resolveLineHeight(spacing, run2.fontSize * WORD_SINGLE_LINE_SPACING_MULTIPLIER);
|
|
100496
101215
|
const height = roundValue(baseLineHeight * lines);
|
|
100497
101216
|
return {
|
|
100498
101217
|
width,
|
|
@@ -100513,7 +101232,7 @@ ${l}
|
|
|
100513
101232
|
if (indentHanging > 0) {
|
|
100514
101233
|
return indentHanging;
|
|
100515
101234
|
}
|
|
100516
|
-
return DEFAULT_LIST_HANGING_PX;
|
|
101235
|
+
return DEFAULT_LIST_HANGING_PX$1;
|
|
100517
101236
|
};
|
|
100518
101237
|
const buildTabStopsPx = (indent2, tabs, tabIntervalTwips) => {
|
|
100519
101238
|
const paragraphIndentTwips = {
|
|
@@ -100719,6 +101438,9 @@ ${l}
|
|
|
100719
101438
|
if (event.button !== 0) {
|
|
100720
101439
|
return;
|
|
100721
101440
|
}
|
|
101441
|
+
if (event.ctrlKey && navigator.platform.includes("Mac")) {
|
|
101442
|
+
return;
|
|
101443
|
+
}
|
|
100722
101444
|
__privateSet(this, _pendingMarginClick, null);
|
|
100723
101445
|
const target = event.target;
|
|
100724
101446
|
if (target?.closest?.(".superdoc-ruler-handle") != null) {
|
|
@@ -101215,6 +101937,10 @@ ${l}
|
|
|
101215
101937
|
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
101216
101938
|
return;
|
|
101217
101939
|
}
|
|
101940
|
+
if (__privateGet$1(this, _documentMode) === "viewing") {
|
|
101941
|
+
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
101942
|
+
return;
|
|
101943
|
+
}
|
|
101218
101944
|
const region = __privateMethod$1(this, _PresentationEditor_instances, hitTestHeaderFooterRegion_fn).call(this, normalized.x, normalized.y);
|
|
101219
101945
|
if (!region) {
|
|
101220
101946
|
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
@@ -101443,6 +102169,7 @@ ${l}
|
|
|
101443
102169
|
__privateSet(this, _visibleHost, options.element);
|
|
101444
102170
|
__privateGet$1(this, _visibleHost).innerHTML = "";
|
|
101445
102171
|
__privateGet$1(this, _visibleHost).classList.add("presentation-editor");
|
|
102172
|
+
__privateMethod$1(this, _PresentationEditor_instances, syncDocumentModeClass_fn).call(this);
|
|
101446
102173
|
if (!__privateGet$1(this, _visibleHost).hasAttribute("tabindex")) {
|
|
101447
102174
|
__privateGet$1(this, _visibleHost).tabIndex = 0;
|
|
101448
102175
|
}
|
|
@@ -101938,6 +102665,7 @@ ${l}
|
|
|
101938
102665
|
}
|
|
101939
102666
|
__privateSet(this, _documentMode, mode);
|
|
101940
102667
|
__privateGet$1(this, _editor3).setDocumentMode(mode);
|
|
102668
|
+
__privateMethod$1(this, _PresentationEditor_instances, syncDocumentModeClass_fn).call(this);
|
|
101941
102669
|
__privateMethod$1(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
|
|
101942
102670
|
const trackedChangesChanged = __privateMethod$1(this, _PresentationEditor_instances, syncTrackedChangesPreferences_fn).call(this);
|
|
101943
102671
|
if (trackedChangesChanged) {
|
|
@@ -102848,6 +103576,10 @@ ${l}
|
|
|
102848
103576
|
}
|
|
102849
103577
|
};
|
|
102850
103578
|
};
|
|
103579
|
+
syncDocumentModeClass_fn = function() {
|
|
103580
|
+
if (!__privateGet$1(this, _visibleHost)) return;
|
|
103581
|
+
__privateGet$1(this, _visibleHost).classList.toggle("presentation-editor--viewing", __privateGet$1(this, _documentMode) === "viewing");
|
|
103582
|
+
};
|
|
102851
103583
|
collectCommentPositions_fn = function() {
|
|
102852
103584
|
return collectCommentPositions(__privateGet$1(this, _editor3)?.state?.doc ?? null, {
|
|
102853
103585
|
commentMarkName: CommentMarkName,
|
|
@@ -103481,7 +104213,7 @@ ${l}
|
|
|
103481
104213
|
const atomNodeTypes = getAtomNodeTypes(__privateGet$1(this, _editor3)?.schema ?? null);
|
|
103482
104214
|
const positionMap2 = __privateGet$1(this, _editor3)?.state?.doc && docJson ? buildPositionMapFromPmDoc(__privateGet$1(this, _editor3).state.doc, docJson) : null;
|
|
103483
104215
|
const result = toFlowBlocks(docJson, {
|
|
103484
|
-
mediaFiles: __privateGet$1(this,
|
|
104216
|
+
mediaFiles: __privateGet$1(this, _editor3)?.storage?.image?.media,
|
|
103485
104217
|
emitSectionBreaks: true,
|
|
103486
104218
|
sectionMetadata,
|
|
103487
104219
|
trackedChangesMode: __privateGet$1(this, _trackedChangesMode),
|
|
@@ -104548,6 +105280,10 @@ ${l}
|
|
|
104548
105280
|
});
|
|
104549
105281
|
};
|
|
104550
105282
|
renderHoverRegion_fn = function(region) {
|
|
105283
|
+
if (__privateGet$1(this, _documentMode) === "viewing") {
|
|
105284
|
+
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
105285
|
+
return;
|
|
105286
|
+
}
|
|
104551
105287
|
if (!__privateGet$1(this, _hoverOverlay) || !__privateGet$1(this, _hoverTooltip)) return;
|
|
104552
105288
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, region.pageIndex, region.localX, region.localY);
|
|
104553
105289
|
if (!coords) {
|
|
@@ -106128,6 +106864,8 @@ ${l}
|
|
|
106128
106864
|
const cbRect = containingBlock.getBoundingClientRect();
|
|
106129
106865
|
left2 -= cbRect.left;
|
|
106130
106866
|
top2 -= cbRect.top;
|
|
106867
|
+
left2 += containingBlock.scrollLeft || 0;
|
|
106868
|
+
top2 += containingBlock.scrollTop || 0;
|
|
106131
106869
|
} catch (error) {
|
|
106132
106870
|
console.warn("SlashMenu: Failed to adjust for containing block", error);
|
|
106133
106871
|
}
|
|
@@ -122035,7 +122773,7 @@ ${l}
|
|
|
122035
122773
|
document.addEventListener("mousedown", globalMousedownHandler);
|
|
122036
122774
|
scrollHandler = () => {
|
|
122037
122775
|
if (currentWrapper && resizeContainer) {
|
|
122038
|
-
updateHandlePositions(currentWrapper
|
|
122776
|
+
updateHandlePositions(currentWrapper);
|
|
122039
122777
|
}
|
|
122040
122778
|
};
|
|
122041
122779
|
window.addEventListener("scroll", scrollHandler, true);
|
|
@@ -122097,7 +122835,7 @@ ${l}
|
|
|
122097
122835
|
}
|
|
122098
122836
|
applyStyleIsolationClass(resizeContainer);
|
|
122099
122837
|
document.body.appendChild(resizeContainer);
|
|
122100
|
-
updateHandlePositions(wrapper
|
|
122838
|
+
updateHandlePositions(wrapper);
|
|
122101
122839
|
}
|
|
122102
122840
|
function hideResizeHandles() {
|
|
122103
122841
|
if (resizeContainer?.parentNode) {
|
|
@@ -137466,7 +138204,7 @@ ${style2}
|
|
|
137466
138204
|
if (open) {
|
|
137467
138205
|
nextTick(() => {
|
|
137468
138206
|
if (searchInput.value) {
|
|
137469
|
-
searchInput.value.focus();
|
|
138207
|
+
searchInput.value.focus({ preventScroll: true });
|
|
137470
138208
|
}
|
|
137471
138209
|
});
|
|
137472
138210
|
}
|
|
@@ -137571,7 +138309,11 @@ ${style2}
|
|
|
137571
138309
|
};
|
|
137572
138310
|
const handleGlobalOutsideClick = (event) => {
|
|
137573
138311
|
if (isOpen.value && menuRef.value && !menuRef.value.contains(event.target)) {
|
|
137574
|
-
|
|
138312
|
+
const isCtrlClickOnMac = event.ctrlKey && isMacOS();
|
|
138313
|
+
const isLeftClick = event.button === 0 && !isCtrlClickOnMac;
|
|
138314
|
+
if (isLeftClick) {
|
|
138315
|
+
moveCursorToMouseEvent(event, props.editor);
|
|
138316
|
+
}
|
|
137575
138317
|
closeMenu({ restoreCursor: false });
|
|
137576
138318
|
}
|
|
137577
138319
|
};
|
|
@@ -139666,6 +140408,12 @@ ${style2}
|
|
|
139666
140408
|
if (props.options?.suppressSkeletonLoader || !props.options?.collaborationProvider) editorReady.value = true;
|
|
139667
140409
|
});
|
|
139668
140410
|
const handleMarginClick = (event) => {
|
|
140411
|
+
if (event.button !== 0) {
|
|
140412
|
+
return;
|
|
140413
|
+
}
|
|
140414
|
+
if (event.ctrlKey && isMacOS()) {
|
|
140415
|
+
return;
|
|
140416
|
+
}
|
|
139669
140417
|
if (event.target.classList.contains("ProseMirror")) return;
|
|
139670
140418
|
onMarginClickCursorChange(event, activeEditor.value);
|
|
139671
140419
|
};
|
|
@@ -139804,7 +140552,7 @@ ${style2}
|
|
|
139804
140552
|
};
|
|
139805
140553
|
}
|
|
139806
140554
|
});
|
|
139807
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-
|
|
140555
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-c9a3c876"]]);
|
|
139808
140556
|
const _hoisted_1$h = ["innerHTML"];
|
|
139809
140557
|
const _sfc_main$i = {
|
|
139810
140558
|
__name: "SuperInput",
|
|
@@ -143012,12 +143760,10 @@ ${reason}`);
|
|
|
143012
143760
|
return processedComments;
|
|
143013
143761
|
};
|
|
143014
143762
|
const convertHtmlToSchema = (commentHTML) => {
|
|
143015
|
-
const div2 = document.createElement("div");
|
|
143016
|
-
div2.innerHTML = commentHTML;
|
|
143017
143763
|
const editor = new Editor({
|
|
143018
143764
|
mode: "text",
|
|
143019
143765
|
isHeadless: true,
|
|
143020
|
-
content:
|
|
143766
|
+
content: commentHTML,
|
|
143021
143767
|
extensions: getRichTextExtensions()
|
|
143022
143768
|
});
|
|
143023
143769
|
return editor.getJSON().content[0];
|
|
@@ -157258,7 +158004,7 @@ ${style2}
|
|
|
157258
158004
|
this.config.colors = shuffleArray(this.config.colors);
|
|
157259
158005
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
157260
158006
|
this.colorIndex = 0;
|
|
157261
|
-
this.version = "2.0.0-next.
|
|
158007
|
+
this.version = "2.0.0-next.20";
|
|
157262
158008
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
157263
158009
|
this.superdocId = config2.superdocId || v4();
|
|
157264
158010
|
this.colors = this.config.colors;
|
|
@@ -159731,7 +160477,7 @@ ${style2}
|
|
|
159731
160477
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
159732
160478
|
);
|
|
159733
160479
|
}
|
|
159734
|
-
const
|
|
160480
|
+
const indexXnRj2biz = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
159735
160481
|
__proto__: null,
|
|
159736
160482
|
unified
|
|
159737
160483
|
}, Symbol.toStringTag, { value: "Module" }));
|