@harbour-enterprises/superdoc 2.0.0-next.1 → 2.0.0-next.11
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-BDQHgDVD.es.js → PdfViewer-CKia_BiV.es.js} +1 -1
- package/dist/chunks/{PdfViewer-Cun5Zr8u.cjs → PdfViewer-CqLaaynu.cjs} +1 -1
- package/dist/chunks/{index-if-EH8uU.cjs → index-B6y8QUV4.cjs} +3 -3
- package/dist/chunks/{index-Dq6vXk74-Vm-euNb7.cjs → index-Bym7r582-C-HNFdqE.cjs} +1 -1
- package/dist/chunks/{index-Dq6vXk74-CQD7nLbH.es.js → index-Bym7r582-C74MxNIS.es.js} +1 -1
- package/dist/chunks/{index-CGAmeAEK.es.js → index-CI_4oB5b.es.js} +3 -3
- package/dist/chunks/{super-editor.es-CwNpXZzP.cjs → super-editor.es-cwkDFZH7.cjs} +781 -158
- package/dist/chunks/{super-editor.es-DyaHVXrq.es.js → super-editor.es-d52fdTl1.es.js} +781 -158
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +6 -6
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BtoNJWI9.js → converter-BdRh3O4f.js} +45 -3
- package/dist/super-editor/chunks/{docx-zipper-CLkDdGOr.js → docx-zipper-Bn6DCl5u.js} +1 -1
- package/dist/super-editor/chunks/{editor-COH8793Z.js → editor-015kcgto.js} +734 -170
- package/dist/super-editor/chunks/{index-Dq6vXk74.js → index-Bym7r582.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Ca-BPuJ2.js → toolbar-CoU_nhyU.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 +6 -6
- package/dist/super-editor/super-editor.es.js +41 -17
- 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 +783 -160
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
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, hideDimmingOverlay_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;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$2, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$2, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-BdRh3O4f.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-Bn6DCl5u.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -14815,7 +14815,7 @@ const isHeadless = (editor) => {
|
|
|
14815
14815
|
const shouldSkipNodeView = (editor) => {
|
|
14816
14816
|
return isHeadless(editor);
|
|
14817
14817
|
};
|
|
14818
|
-
const summaryVersion = "2.0.0-next.
|
|
14818
|
+
const summaryVersion = "2.0.0-next.11";
|
|
14819
14819
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
14820
14820
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
14821
14821
|
function mapAttributes(attrs) {
|
|
@@ -15607,7 +15607,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
15607
15607
|
{ default: remarkStringify },
|
|
15608
15608
|
{ default: remarkGfm }
|
|
15609
15609
|
] = await Promise.all([
|
|
15610
|
-
import("./index-
|
|
15610
|
+
import("./index-Bym7r582.js"),
|
|
15611
15611
|
import("./index-DRCvimau.js"),
|
|
15612
15612
|
import("./index-C_x_N6Uh.js"),
|
|
15613
15613
|
import("./index-D_sWOSiG.js"),
|
|
@@ -15812,7 +15812,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
15812
15812
|
* Process collaboration migrations
|
|
15813
15813
|
*/
|
|
15814
15814
|
processCollaborationMigrations() {
|
|
15815
|
-
console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.
|
|
15815
|
+
console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.11");
|
|
15816
15816
|
if (!this.options.ydoc) return;
|
|
15817
15817
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
15818
15818
|
let docVersion = metaMap.get("version");
|
|
@@ -23152,7 +23152,7 @@ function isMinimalWordLayout(value) {
|
|
|
23152
23152
|
return true;
|
|
23153
23153
|
}
|
|
23154
23154
|
const LIST_MARKER_GAP$2 = 8;
|
|
23155
|
-
const DEFAULT_TAB_INTERVAL_PX$
|
|
23155
|
+
const DEFAULT_TAB_INTERVAL_PX$2 = 48;
|
|
23156
23156
|
const DEFAULT_PAGE_HEIGHT_PX = 1056;
|
|
23157
23157
|
const DEFAULT_VIRTUALIZED_PAGE_GAP$1 = 72;
|
|
23158
23158
|
const COMMENT_EXTERNAL_COLOR = "#B1124B";
|
|
@@ -24079,6 +24079,7 @@ const _DomPainter = class _DomPainter {
|
|
|
24079
24079
|
const block = lookup.block;
|
|
24080
24080
|
const measure = lookup.measure;
|
|
24081
24081
|
const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : void 0;
|
|
24082
|
+
const alignment = block.attrs?.alignment;
|
|
24082
24083
|
const fragmentEl = this.doc.createElement("div");
|
|
24083
24084
|
fragmentEl.classList.add(CLASS_NAMES$1.fragment);
|
|
24084
24085
|
const isTocEntry = block.attrs?.isTocEntry;
|
|
@@ -24157,7 +24158,7 @@ const _DomPainter = class _DomPainter {
|
|
|
24157
24158
|
const textStart = paraIndentLeft + firstLine;
|
|
24158
24159
|
tabWidth = textStart - currentPos;
|
|
24159
24160
|
if (tabWidth <= 0) {
|
|
24160
|
-
tabWidth = DEFAULT_TAB_INTERVAL_PX$
|
|
24161
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$2 - currentPos % DEFAULT_TAB_INTERVAL_PX$2;
|
|
24161
24162
|
} else if (tabWidth < LIST_MARKER_GAP$2) {
|
|
24162
24163
|
tabWidth = LIST_MARKER_GAP$2;
|
|
24163
24164
|
}
|
|
@@ -24184,6 +24185,21 @@ const _DomPainter = class _DomPainter {
|
|
|
24184
24185
|
let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
24185
24186
|
if (index2 === 0 && listFirstLineMarkerTabWidth != null) {
|
|
24186
24187
|
availableWidthOverride = fragment.width - listFirstLineMarkerTabWidth - Math.max(0, paraIndentRight);
|
|
24188
|
+
if (alignment === "justify" || alignment === "both") {
|
|
24189
|
+
console.log(
|
|
24190
|
+
"[justify-debug][painter-firstline-available]",
|
|
24191
|
+
JSON.stringify({
|
|
24192
|
+
blockId: block.id,
|
|
24193
|
+
fragmentWidth: fragment.width,
|
|
24194
|
+
markerTabWidth: listFirstLineMarkerTabWidth,
|
|
24195
|
+
paraIndentRight,
|
|
24196
|
+
availableWidthOverride,
|
|
24197
|
+
lineMaxWidth: line.maxWidth ?? null,
|
|
24198
|
+
lineWidth: line.width,
|
|
24199
|
+
lineNaturalWidth: line.naturalWidth ?? null
|
|
24200
|
+
})
|
|
24201
|
+
);
|
|
24202
|
+
}
|
|
24187
24203
|
}
|
|
24188
24204
|
const isLastLineOfFragment = index2 === lines.length - 1;
|
|
24189
24205
|
const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
|
|
@@ -24309,7 +24325,7 @@ const _DomPainter = class _DomPainter {
|
|
|
24309
24325
|
const textStart = paraIndentLeft + firstLine;
|
|
24310
24326
|
tabWidth = textStart - currentPos;
|
|
24311
24327
|
if (tabWidth <= 0) {
|
|
24312
|
-
tabWidth = DEFAULT_TAB_INTERVAL_PX$
|
|
24328
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$2 - currentPos % DEFAULT_TAB_INTERVAL_PX$2;
|
|
24313
24329
|
} else if (tabWidth < LIST_MARKER_GAP$2) {
|
|
24314
24330
|
tabWidth = LIST_MARKER_GAP$2;
|
|
24315
24331
|
}
|
|
@@ -25843,6 +25859,23 @@ const _DomPainter = class _DomPainter {
|
|
|
25843
25859
|
if (spacingPerSpace !== 0) {
|
|
25844
25860
|
el.style.wordSpacing = `${spacingPerSpace}px`;
|
|
25845
25861
|
}
|
|
25862
|
+
if (justifyShouldApply && spacingPerSpace < 0) {
|
|
25863
|
+
console.log(
|
|
25864
|
+
"[justify-debug][painter-wordspacing-negative]",
|
|
25865
|
+
JSON.stringify({
|
|
25866
|
+
blockId: block.id,
|
|
25867
|
+
lineIndex: lineIndex ?? null,
|
|
25868
|
+
alignment: alignment ?? null,
|
|
25869
|
+
availableWidth,
|
|
25870
|
+
lineWidth,
|
|
25871
|
+
lineMaxWidth: line.maxWidth ?? null,
|
|
25872
|
+
lineNaturalWidth: line.naturalWidth ?? null,
|
|
25873
|
+
spaceCount,
|
|
25874
|
+
hasExplicitPositioning: Boolean(hasExplicitPositioning),
|
|
25875
|
+
skipJustify: Boolean(skipJustify)
|
|
25876
|
+
})
|
|
25877
|
+
);
|
|
25878
|
+
}
|
|
25846
25879
|
if (hasExplicitPositioning && line.segments) {
|
|
25847
25880
|
const paraIndent = block.attrs?.indent;
|
|
25848
25881
|
const indentLeft = paraIndent?.left ?? 0;
|
|
@@ -28036,6 +28069,28 @@ let measurementCtx = null;
|
|
|
28036
28069
|
const TAB_CHAR_LENGTH = 1;
|
|
28037
28070
|
const SPACE_CHARS = SPACE_CHARS$1;
|
|
28038
28071
|
const isTabRun$1 = (run) => run?.kind === "tab";
|
|
28072
|
+
const isWordChar$3 = (char) => {
|
|
28073
|
+
if (!char) return false;
|
|
28074
|
+
const code = char.charCodeAt(0);
|
|
28075
|
+
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || char === "'";
|
|
28076
|
+
};
|
|
28077
|
+
const capitalizeText$2 = (text) => {
|
|
28078
|
+
if (!text) return text;
|
|
28079
|
+
let result = "";
|
|
28080
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
28081
|
+
const prevChar = i > 0 ? text[i - 1] : "";
|
|
28082
|
+
const ch = text[i];
|
|
28083
|
+
result += isWordChar$3(ch) && !isWordChar$3(prevChar) ? ch.toUpperCase() : ch;
|
|
28084
|
+
}
|
|
28085
|
+
return result;
|
|
28086
|
+
};
|
|
28087
|
+
const applyTextTransform$2 = (text, transform) => {
|
|
28088
|
+
if (!text || !transform || transform === "none") return text;
|
|
28089
|
+
if (transform === "uppercase") return text.toUpperCase();
|
|
28090
|
+
if (transform === "lowercase") return text.toLowerCase();
|
|
28091
|
+
if (transform === "capitalize") return capitalizeText$2(text);
|
|
28092
|
+
return text;
|
|
28093
|
+
};
|
|
28039
28094
|
function getMeasurementContext() {
|
|
28040
28095
|
if (measurementCtx) return measurementCtx;
|
|
28041
28096
|
if (typeof document === "undefined") {
|
|
@@ -28211,17 +28266,19 @@ function measureCharacterX(block, line, charOffset, availableWidthOverride, alig
|
|
|
28211
28266
|
}
|
|
28212
28267
|
const text = "src" in run || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation" ? "" : run.text ?? "";
|
|
28213
28268
|
const runLength = text.length;
|
|
28269
|
+
const transform = isTabRun$1(run) || "src" in run || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation" ? void 0 : run.textTransform;
|
|
28270
|
+
const displayText = applyTextTransform$2(text, transform);
|
|
28214
28271
|
if (currentCharOffset + runLength >= charOffset) {
|
|
28215
28272
|
const offsetInRun = charOffset - currentCharOffset;
|
|
28216
28273
|
ctx2.font = getRunFontString(run);
|
|
28217
|
-
const textUpToTarget =
|
|
28274
|
+
const textUpToTarget = displayText.slice(0, offsetInRun);
|
|
28218
28275
|
const measured2 = ctx2.measureText(textUpToTarget);
|
|
28219
28276
|
const spacingWidth = computeLetterSpacingWidth(run, offsetInRun, runLength);
|
|
28220
|
-
const spacesInPortion = justify.extraPerSpace !== 0 ? countSpaces(
|
|
28277
|
+
const spacesInPortion = justify.extraPerSpace !== 0 ? countSpaces(text.slice(0, offsetInRun)) : 0;
|
|
28221
28278
|
return alignmentOffset + currentX + measured2.width + spacingWidth + justify.extraPerSpace * (spaceTally + spacesInPortion);
|
|
28222
28279
|
}
|
|
28223
28280
|
ctx2.font = getRunFontString(run);
|
|
28224
|
-
const measured = ctx2.measureText(
|
|
28281
|
+
const measured = ctx2.measureText(displayText);
|
|
28225
28282
|
const runLetterSpacing = computeLetterSpacingWidth(run, runLength, runLength);
|
|
28226
28283
|
const spacesInRun = justify.extraPerSpace !== 0 ? countSpaces(text) : 0;
|
|
28227
28284
|
currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
|
|
@@ -28260,8 +28317,10 @@ function measureCharacterXSegmentBased(block, line, charOffset, ctx2) {
|
|
|
28260
28317
|
return segmentBaseX + (offsetInSegment >= segmentChars ? segment.width ?? 0 : 0);
|
|
28261
28318
|
}
|
|
28262
28319
|
const text = run.text ?? "";
|
|
28263
|
-
const
|
|
28264
|
-
const
|
|
28320
|
+
const transform = "textTransform" in run ? run.textTransform : void 0;
|
|
28321
|
+
const displayText = applyTextTransform$2(text, transform);
|
|
28322
|
+
const displaySegmentText = displayText.slice(segment.fromChar, segment.toChar);
|
|
28323
|
+
const textUpToTarget = displaySegmentText.slice(0, offsetInSegment);
|
|
28265
28324
|
ctx2.font = getRunFontString(run);
|
|
28266
28325
|
const measured = ctx2.measureText(textUpToTarget);
|
|
28267
28326
|
const spacingWidth = computeLetterSpacingWidth(run, offsetInSegment, segmentChars);
|
|
@@ -28357,12 +28416,14 @@ function findCharacterAtX(block, line, x, pmStart, availableWidthOverride, align
|
|
|
28357
28416
|
}
|
|
28358
28417
|
const text = "src" in run || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation" ? "" : run.text ?? "";
|
|
28359
28418
|
const runLength = text.length;
|
|
28419
|
+
const transform = isTabRun$1(run) || "src" in run || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation" ? void 0 : run.textTransform;
|
|
28420
|
+
const displayText = applyTextTransform$2(text, transform);
|
|
28360
28421
|
if (runLength === 0) continue;
|
|
28361
28422
|
ctx2.font = getRunFontString(run);
|
|
28362
28423
|
for (let i = 0; i <= runLength; i++) {
|
|
28363
|
-
const textUpToChar =
|
|
28424
|
+
const textUpToChar = displayText.slice(0, i);
|
|
28364
28425
|
const measured2 = ctx2.measureText(textUpToChar);
|
|
28365
|
-
const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(
|
|
28426
|
+
const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(text.slice(0, i)) : 0;
|
|
28366
28427
|
const charX = currentX + measured2.width + computeLetterSpacingWidth(run, i, runLength) + justify.extraPerSpace * (spaceTally + spacesInPortion);
|
|
28367
28428
|
if (charX >= safeX) {
|
|
28368
28429
|
if (i === 0) {
|
|
@@ -28372,7 +28433,7 @@ function findCharacterAtX(block, line, x, pmStart, availableWidthOverride, align
|
|
|
28372
28433
|
pmPosition: pmPosition3
|
|
28373
28434
|
};
|
|
28374
28435
|
}
|
|
28375
|
-
const prevText =
|
|
28436
|
+
const prevText = displayText.slice(0, i - 1);
|
|
28376
28437
|
const prevMeasured = ctx2.measureText(prevText);
|
|
28377
28438
|
const prevX = currentX + prevMeasured.width + computeLetterSpacingWidth(run, i - 1, runLength);
|
|
28378
28439
|
const distToPrev = Math.abs(safeX - prevX);
|
|
@@ -28385,7 +28446,7 @@ function findCharacterAtX(block, line, x, pmStart, availableWidthOverride, align
|
|
|
28385
28446
|
};
|
|
28386
28447
|
}
|
|
28387
28448
|
}
|
|
28388
|
-
const measured = ctx2.measureText(
|
|
28449
|
+
const measured = ctx2.measureText(displayText);
|
|
28389
28450
|
const runLetterSpacing = computeLetterSpacingWidth(run, runLength, runLength);
|
|
28390
28451
|
const spacesInRun = justify.extraPerSpace > 0 ? countSpaces(text) : 0;
|
|
28391
28452
|
currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
|
|
@@ -28816,6 +28877,83 @@ function findCharIndexAtX(textNode, container, targetX) {
|
|
|
28816
28877
|
}
|
|
28817
28878
|
return index2;
|
|
28818
28879
|
}
|
|
28880
|
+
const LIST_MARKER_GAP$1 = 8;
|
|
28881
|
+
const MIN_MARKER_GUTTER = 24;
|
|
28882
|
+
const DEFAULT_LIST_INDENT_BASE_PX = 24;
|
|
28883
|
+
const DEFAULT_LIST_INDENT_STEP_PX = 24;
|
|
28884
|
+
const DEFAULT_LIST_HANGING_PX$1 = 18;
|
|
28885
|
+
const SPACE_SUFFIX_GAP_PX = 4;
|
|
28886
|
+
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
28887
|
+
function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, measureMarkerText) {
|
|
28888
|
+
const marker = wordLayout?.marker;
|
|
28889
|
+
if (!marker) {
|
|
28890
|
+
const textStartPx = wordLayout?.firstLineIndentMode === true && typeof wordLayout.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : void 0;
|
|
28891
|
+
return textStartPx;
|
|
28892
|
+
}
|
|
28893
|
+
const markerBoxWidth = typeof marker.markerBoxWidthPx === "number" && Number.isFinite(marker.markerBoxWidthPx) ? marker.markerBoxWidthPx : 0;
|
|
28894
|
+
let markerTextWidth = typeof marker.glyphWidthPx === "number" && Number.isFinite(marker.glyphWidthPx) ? marker.glyphWidthPx : void 0;
|
|
28895
|
+
if (markerTextWidth == null && marker.markerText) {
|
|
28896
|
+
markerTextWidth = measureMarkerText(marker.markerText, marker);
|
|
28897
|
+
}
|
|
28898
|
+
if (!Number.isFinite(markerTextWidth) || markerTextWidth !== void 0 && markerTextWidth < 0) {
|
|
28899
|
+
markerTextWidth = markerBoxWidth;
|
|
28900
|
+
}
|
|
28901
|
+
const finalMarkerTextWidth = Math.max(0, markerTextWidth ?? 0);
|
|
28902
|
+
let markerStartPos;
|
|
28903
|
+
if (wordLayout?.firstLineIndentMode === true && typeof marker.markerX === "number" && Number.isFinite(marker.markerX)) {
|
|
28904
|
+
markerStartPos = marker.markerX;
|
|
28905
|
+
} else {
|
|
28906
|
+
markerStartPos = indentLeft - hanging + firstLine;
|
|
28907
|
+
}
|
|
28908
|
+
if (!Number.isFinite(markerStartPos)) {
|
|
28909
|
+
markerStartPos = 0;
|
|
28910
|
+
}
|
|
28911
|
+
const currentPos = markerStartPos + finalMarkerTextWidth;
|
|
28912
|
+
const suffix = marker.suffix ?? "tab";
|
|
28913
|
+
if (suffix === "space") {
|
|
28914
|
+
return markerStartPos + finalMarkerTextWidth + SPACE_SUFFIX_GAP_PX;
|
|
28915
|
+
}
|
|
28916
|
+
if (suffix === "nothing") {
|
|
28917
|
+
return markerStartPos + finalMarkerTextWidth;
|
|
28918
|
+
}
|
|
28919
|
+
const markerJustification = marker.justification ?? "left";
|
|
28920
|
+
if (markerJustification !== "left") {
|
|
28921
|
+
const gutterWidth = typeof marker.gutterWidthPx === "number" && Number.isFinite(marker.gutterWidthPx) && marker.gutterWidthPx > 0 ? marker.gutterWidthPx : LIST_MARKER_GAP$1;
|
|
28922
|
+
return markerStartPos + finalMarkerTextWidth + Math.max(gutterWidth, LIST_MARKER_GAP$1);
|
|
28923
|
+
}
|
|
28924
|
+
if (wordLayout?.firstLineIndentMode === true) {
|
|
28925
|
+
let targetTabStop;
|
|
28926
|
+
if (Array.isArray(wordLayout.tabsPx)) {
|
|
28927
|
+
for (const tab of wordLayout.tabsPx) {
|
|
28928
|
+
if (typeof tab === "number" && tab > currentPos) {
|
|
28929
|
+
targetTabStop = tab;
|
|
28930
|
+
break;
|
|
28931
|
+
}
|
|
28932
|
+
}
|
|
28933
|
+
}
|
|
28934
|
+
const textStartTarget = typeof marker.textStartX === "number" && Number.isFinite(marker.textStartX) ? marker.textStartX : wordLayout.textStartPx;
|
|
28935
|
+
let tabWidth2;
|
|
28936
|
+
if (targetTabStop !== void 0) {
|
|
28937
|
+
tabWidth2 = targetTabStop - currentPos;
|
|
28938
|
+
} else if (textStartTarget !== void 0 && Number.isFinite(textStartTarget) && textStartTarget > currentPos) {
|
|
28939
|
+
tabWidth2 = textStartTarget - currentPos;
|
|
28940
|
+
} else {
|
|
28941
|
+
tabWidth2 = LIST_MARKER_GAP$1;
|
|
28942
|
+
}
|
|
28943
|
+
if (tabWidth2 < LIST_MARKER_GAP$1) {
|
|
28944
|
+
tabWidth2 = LIST_MARKER_GAP$1;
|
|
28945
|
+
}
|
|
28946
|
+
return markerStartPos + finalMarkerTextWidth + tabWidth2;
|
|
28947
|
+
}
|
|
28948
|
+
const textStart = indentLeft + firstLine;
|
|
28949
|
+
let tabWidth = textStart - currentPos;
|
|
28950
|
+
if (tabWidth <= 0) {
|
|
28951
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
|
|
28952
|
+
} else if (tabWidth < LIST_MARKER_GAP$1) {
|
|
28953
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
28954
|
+
}
|
|
28955
|
+
return markerStartPos + finalMarkerTextWidth + tabWidth;
|
|
28956
|
+
}
|
|
28819
28957
|
function getWordLayoutConfig(block) {
|
|
28820
28958
|
if (!block || block.kind !== "paragraph") {
|
|
28821
28959
|
return void 0;
|
|
@@ -28848,9 +28986,16 @@ function calculateTextStartIndent(params2) {
|
|
|
28848
28986
|
const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
|
|
28849
28987
|
let indentAdjust = paraIndentLeft;
|
|
28850
28988
|
if (isListItem2 && isFirstLine && isFirstLineIndentMode) {
|
|
28989
|
+
const resolvedTextStart = resolveListTextStartPx(
|
|
28990
|
+
wordLayout,
|
|
28991
|
+
paraIndentLeft,
|
|
28992
|
+
Math.max(firstLineIndent, 0),
|
|
28993
|
+
Math.max(hangingIndent, 0),
|
|
28994
|
+
() => markerWidth
|
|
28995
|
+
// Use provided markerWidth since we don't have canvas access here
|
|
28996
|
+
);
|
|
28851
28997
|
const textStartFallback = paraIndentLeft + Math.max(firstLineIndent, 0) + markerWidth;
|
|
28852
|
-
|
|
28853
|
-
indentAdjust = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : textStartFallback;
|
|
28998
|
+
indentAdjust = typeof resolvedTextStart === "number" && Number.isFinite(resolvedTextStart) ? resolvedTextStart : textStartFallback;
|
|
28854
28999
|
} else if (isFirstLine && !isListItem2) {
|
|
28855
29000
|
indentAdjust += firstLineOffset;
|
|
28856
29001
|
}
|
|
@@ -29006,7 +29151,10 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
|
|
|
29006
29151
|
}
|
|
29007
29152
|
function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
29008
29153
|
const zones = [];
|
|
29009
|
-
|
|
29154
|
+
let currentColumns = columns;
|
|
29155
|
+
let currentMargins = margins;
|
|
29156
|
+
let currentPageWidth = pageWidth;
|
|
29157
|
+
let marginLeft = Math.max(0, currentMargins?.left ?? 0);
|
|
29010
29158
|
return {
|
|
29011
29159
|
registerDrawing(drawingBlock, measure, anchorY, columnIndex, pageNumber) {
|
|
29012
29160
|
if (!drawingBlock.anchor?.isAnchored) {
|
|
@@ -29019,7 +29167,7 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
29019
29167
|
}
|
|
29020
29168
|
const objectWidth = measure.width ?? 0;
|
|
29021
29169
|
const objectHeight = measure.height ?? 0;
|
|
29022
|
-
const x = computeAnchorX(anchor, columnIndex,
|
|
29170
|
+
const x = computeAnchorX(anchor, columnIndex, currentColumns, objectWidth, currentMargins, currentPageWidth);
|
|
29023
29171
|
const y = anchorY + (anchor.offsetV ?? 0);
|
|
29024
29172
|
const zone = {
|
|
29025
29173
|
imageBlockId: drawingBlock.id,
|
|
@@ -29053,7 +29201,7 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
29053
29201
|
}
|
|
29054
29202
|
const tableWidth = measure.totalWidth ?? 0;
|
|
29055
29203
|
const tableHeight = measure.totalHeight ?? 0;
|
|
29056
|
-
const x = computeTableAnchorX(anchor, columnIndex,
|
|
29204
|
+
const x = computeTableAnchorX(anchor, columnIndex, currentColumns, tableWidth, currentMargins, currentPageWidth);
|
|
29057
29205
|
const y = anchorY + (anchor.offsetV ?? 0);
|
|
29058
29206
|
const zone = {
|
|
29059
29207
|
imageBlockId: tableBlock.id,
|
|
@@ -29101,7 +29249,7 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
29101
29249
|
}
|
|
29102
29250
|
const leftFloats = [];
|
|
29103
29251
|
const rightFloats = [];
|
|
29104
|
-
const columnOrigin = marginLeft + columnIndex * (
|
|
29252
|
+
const columnOrigin = marginLeft + columnIndex * (currentColumns.width + currentColumns.gap);
|
|
29105
29253
|
const columnCenter = columnOrigin + baseWidth / 2;
|
|
29106
29254
|
for (const zone of wrappingZones) {
|
|
29107
29255
|
if (zone.wrapMode === "left") {
|
|
@@ -29140,6 +29288,22 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
29140
29288
|
},
|
|
29141
29289
|
clear() {
|
|
29142
29290
|
zones.length = 0;
|
|
29291
|
+
},
|
|
29292
|
+
/**
|
|
29293
|
+
* Update layout context used for positioning and wrapping (columns, margins, page width).
|
|
29294
|
+
* This method should be called when the layout configuration changes (e.g., section breaks,
|
|
29295
|
+
* column changes, page size changes) to ensure floating objects are positioned and wrapped
|
|
29296
|
+
* correctly relative to the new layout boundaries.
|
|
29297
|
+
*
|
|
29298
|
+
* @param nextColumns - Column layout configuration (width, gap, count)
|
|
29299
|
+
* @param nextMargins - Optional page margins (left, right) in pixels
|
|
29300
|
+
* @param nextPageWidth - Optional total page width in pixels
|
|
29301
|
+
*/
|
|
29302
|
+
setLayoutContext(nextColumns, nextMargins, nextPageWidth) {
|
|
29303
|
+
currentColumns = nextColumns;
|
|
29304
|
+
currentMargins = nextMargins;
|
|
29305
|
+
currentPageWidth = nextPageWidth;
|
|
29306
|
+
marginLeft = Math.max(0, currentMargins?.left ?? 0);
|
|
29143
29307
|
}
|
|
29144
29308
|
};
|
|
29145
29309
|
}
|
|
@@ -29239,7 +29403,14 @@ function computeNextSectionPropsAtBreak(blocks) {
|
|
|
29239
29403
|
const props = {};
|
|
29240
29404
|
if (source.kind !== "sectionBreak") return props;
|
|
29241
29405
|
if (source.margins) {
|
|
29242
|
-
props.margins = {
|
|
29406
|
+
props.margins = {
|
|
29407
|
+
header: source.margins.header,
|
|
29408
|
+
footer: source.margins.footer,
|
|
29409
|
+
top: source.margins.top,
|
|
29410
|
+
right: source.margins.right,
|
|
29411
|
+
bottom: source.margins.bottom,
|
|
29412
|
+
left: source.margins.left
|
|
29413
|
+
};
|
|
29243
29414
|
}
|
|
29244
29415
|
if (source.pageSize) {
|
|
29245
29416
|
props.pageSize = { w: source.pageSize.w, h: source.pageSize.h };
|
|
@@ -29287,20 +29458,36 @@ function scheduleSectionBreak(block, state, baseMargins, maxHeaderContentHeight
|
|
|
29287
29458
|
next.activeOrientation = block.orientation;
|
|
29288
29459
|
next.pendingOrientation = null;
|
|
29289
29460
|
}
|
|
29461
|
+
const headerDistance = typeof block.margins?.header === "number" ? Math.max(0, block.margins.header) : next.activeHeaderDistance;
|
|
29462
|
+
const footerDistance = typeof block.margins?.footer === "number" ? Math.max(0, block.margins.footer) : next.activeFooterDistance;
|
|
29463
|
+
const sectionTop = typeof block.margins?.top === "number" ? Math.max(0, block.margins.top) : baseMargins.top;
|
|
29464
|
+
const sectionBottom = typeof block.margins?.bottom === "number" ? Math.max(0, block.margins.bottom) : baseMargins.bottom;
|
|
29290
29465
|
if (block.margins?.header !== void 0) {
|
|
29291
|
-
const headerDistance = Math.max(0, block.margins.header);
|
|
29292
29466
|
next.activeHeaderDistance = headerDistance;
|
|
29293
29467
|
next.pendingHeaderDistance = headerDistance;
|
|
29294
|
-
next.activeTopMargin = calcRequiredTopMargin(headerDistance, baseMargins.top);
|
|
29295
|
-
next.pendingTopMargin = next.activeTopMargin;
|
|
29296
29468
|
}
|
|
29297
29469
|
if (block.margins?.footer !== void 0) {
|
|
29298
|
-
const footerDistance = Math.max(0, block.margins.footer);
|
|
29299
29470
|
next.activeFooterDistance = footerDistance;
|
|
29300
29471
|
next.pendingFooterDistance = footerDistance;
|
|
29301
|
-
|
|
29472
|
+
}
|
|
29473
|
+
if (block.margins?.top !== void 0 || block.margins?.header !== void 0) {
|
|
29474
|
+
next.activeTopMargin = calcRequiredTopMargin(headerDistance, sectionTop);
|
|
29475
|
+
next.pendingTopMargin = next.activeTopMargin;
|
|
29476
|
+
}
|
|
29477
|
+
if (block.margins?.bottom !== void 0 || block.margins?.footer !== void 0) {
|
|
29478
|
+
next.activeBottomMargin = calcRequiredBottomMargin(footerDistance, sectionBottom);
|
|
29302
29479
|
next.pendingBottomMargin = next.activeBottomMargin;
|
|
29303
29480
|
}
|
|
29481
|
+
if (block.margins?.left !== void 0) {
|
|
29482
|
+
const leftMargin = Math.max(0, block.margins.left);
|
|
29483
|
+
next.activeLeftMargin = leftMargin;
|
|
29484
|
+
next.pendingLeftMargin = leftMargin;
|
|
29485
|
+
}
|
|
29486
|
+
if (block.margins?.right !== void 0) {
|
|
29487
|
+
const rightMargin = Math.max(0, block.margins.right);
|
|
29488
|
+
next.activeRightMargin = rightMargin;
|
|
29489
|
+
next.pendingRightMargin = rightMargin;
|
|
29490
|
+
}
|
|
29304
29491
|
if (block.columns) {
|
|
29305
29492
|
next.activeColumns = { count: block.columns.count, gap: block.columns.gap };
|
|
29306
29493
|
next.pendingColumns = null;
|
|
@@ -29309,26 +29496,42 @@ function scheduleSectionBreak(block, state, baseMargins, maxHeaderContentHeight
|
|
|
29309
29496
|
}
|
|
29310
29497
|
const headerPx = block.margins?.header;
|
|
29311
29498
|
const footerPx = block.margins?.footer;
|
|
29499
|
+
const topPx = block.margins?.top;
|
|
29500
|
+
const bottomPx = block.margins?.bottom;
|
|
29312
29501
|
const nextTop = next.pendingTopMargin ?? next.activeTopMargin;
|
|
29313
29502
|
const nextBottom = next.pendingBottomMargin ?? next.activeBottomMargin;
|
|
29503
|
+
const nextLeft = next.pendingLeftMargin ?? next.activeLeftMargin;
|
|
29504
|
+
const nextRight = next.pendingRightMargin ?? next.activeRightMargin;
|
|
29314
29505
|
const nextHeader = next.pendingHeaderDistance ?? next.activeHeaderDistance;
|
|
29315
29506
|
const nextFooter = next.pendingFooterDistance ?? next.activeFooterDistance;
|
|
29316
|
-
if (typeof headerPx === "number") {
|
|
29317
|
-
const newHeaderDist = Math.max(0, headerPx);
|
|
29507
|
+
if (typeof headerPx === "number" || typeof topPx === "number") {
|
|
29508
|
+
const newHeaderDist = typeof headerPx === "number" ? Math.max(0, headerPx) : nextHeader;
|
|
29509
|
+
const sectionTop = typeof topPx === "number" ? Math.max(0, topPx) : baseMargins.top;
|
|
29318
29510
|
next.pendingHeaderDistance = newHeaderDist;
|
|
29319
|
-
next.pendingTopMargin = calcRequiredTopMargin(newHeaderDist,
|
|
29511
|
+
next.pendingTopMargin = calcRequiredTopMargin(newHeaderDist, sectionTop);
|
|
29320
29512
|
} else {
|
|
29321
29513
|
next.pendingTopMargin = nextTop;
|
|
29322
29514
|
next.pendingHeaderDistance = nextHeader;
|
|
29323
29515
|
}
|
|
29324
|
-
if (typeof footerPx === "number") {
|
|
29325
|
-
const newFooterDist = Math.max(0, footerPx);
|
|
29516
|
+
if (typeof footerPx === "number" || typeof bottomPx === "number") {
|
|
29517
|
+
const newFooterDist = typeof footerPx === "number" ? Math.max(0, footerPx) : nextFooter;
|
|
29518
|
+
const sectionBottom = typeof bottomPx === "number" ? Math.max(0, bottomPx) : baseMargins.bottom;
|
|
29326
29519
|
next.pendingFooterDistance = newFooterDist;
|
|
29327
|
-
next.pendingBottomMargin = calcRequiredBottomMargin(newFooterDist,
|
|
29520
|
+
next.pendingBottomMargin = calcRequiredBottomMargin(newFooterDist, sectionBottom);
|
|
29328
29521
|
} else {
|
|
29329
29522
|
next.pendingBottomMargin = nextBottom;
|
|
29330
29523
|
next.pendingFooterDistance = nextFooter;
|
|
29331
29524
|
}
|
|
29525
|
+
if (typeof block.margins?.left === "number") {
|
|
29526
|
+
next.pendingLeftMargin = Math.max(0, block.margins.left);
|
|
29527
|
+
} else {
|
|
29528
|
+
next.pendingLeftMargin = nextLeft;
|
|
29529
|
+
}
|
|
29530
|
+
if (typeof block.margins?.right === "number") {
|
|
29531
|
+
next.pendingRightMargin = Math.max(0, block.margins.right);
|
|
29532
|
+
} else {
|
|
29533
|
+
next.pendingRightMargin = nextRight;
|
|
29534
|
+
}
|
|
29332
29535
|
if (block.pageSize) {
|
|
29333
29536
|
next.pendingPageSize = { w: block.pageSize.w, h: block.pageSize.h };
|
|
29334
29537
|
}
|
|
@@ -29388,6 +29591,12 @@ function applyPendingToActive(state) {
|
|
|
29388
29591
|
if (next.pendingBottomMargin != null) {
|
|
29389
29592
|
next.activeBottomMargin = next.pendingBottomMargin;
|
|
29390
29593
|
}
|
|
29594
|
+
if (next.pendingLeftMargin != null) {
|
|
29595
|
+
next.activeLeftMargin = next.pendingLeftMargin;
|
|
29596
|
+
}
|
|
29597
|
+
if (next.pendingRightMargin != null) {
|
|
29598
|
+
next.activeRightMargin = next.pendingRightMargin;
|
|
29599
|
+
}
|
|
29391
29600
|
if (next.pendingHeaderDistance != null) {
|
|
29392
29601
|
next.activeHeaderDistance = next.pendingHeaderDistance;
|
|
29393
29602
|
}
|
|
@@ -29405,6 +29614,8 @@ function applyPendingToActive(state) {
|
|
|
29405
29614
|
}
|
|
29406
29615
|
next.pendingTopMargin = null;
|
|
29407
29616
|
next.pendingBottomMargin = null;
|
|
29617
|
+
next.pendingLeftMargin = null;
|
|
29618
|
+
next.pendingRightMargin = null;
|
|
29408
29619
|
next.pendingHeaderDistance = null;
|
|
29409
29620
|
next.pendingFooterDistance = null;
|
|
29410
29621
|
next.pendingPageSize = null;
|
|
@@ -29633,7 +29844,8 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
29633
29844
|
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
|
|
29634
29845
|
const firstLineIndent = calculateFirstLineIndent(block, measure);
|
|
29635
29846
|
const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
|
|
29636
|
-
|
|
29847
|
+
const newLines = normalizeLines(newMeasure);
|
|
29848
|
+
lines = newLines;
|
|
29637
29849
|
didRemeasureForColumnWidth = true;
|
|
29638
29850
|
}
|
|
29639
29851
|
let fromLine = 0;
|
|
@@ -29715,7 +29927,8 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
29715
29927
|
if (narrowestRemeasureWidth < remeasureWidth) {
|
|
29716
29928
|
const firstLineIndent = calculateFirstLineIndent(block, measure);
|
|
29717
29929
|
const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
|
|
29718
|
-
|
|
29930
|
+
const newLines = normalizeLines(newMeasure);
|
|
29931
|
+
lines = newLines;
|
|
29719
29932
|
didRemeasureForFloats = true;
|
|
29720
29933
|
}
|
|
29721
29934
|
}
|
|
@@ -30059,6 +30272,94 @@ function getCellPadding(cellIdx, blockRow) {
|
|
|
30059
30272
|
function getCellTotalLines(cell) {
|
|
30060
30273
|
return getCellLines(cell).length;
|
|
30061
30274
|
}
|
|
30275
|
+
function mergePmRange(target, range) {
|
|
30276
|
+
if (typeof range.pmStart === "number") {
|
|
30277
|
+
target.pmStart = target.pmStart == null ? range.pmStart : Math.min(target.pmStart, range.pmStart);
|
|
30278
|
+
}
|
|
30279
|
+
if (typeof range.pmEnd === "number") {
|
|
30280
|
+
target.pmEnd = target.pmEnd == null ? range.pmEnd : Math.max(target.pmEnd, range.pmEnd);
|
|
30281
|
+
}
|
|
30282
|
+
}
|
|
30283
|
+
function computeCellPmRange(cell, cellMeasure, fromLine, toLine) {
|
|
30284
|
+
const range = {};
|
|
30285
|
+
if (!cell || !cellMeasure) return range;
|
|
30286
|
+
const cellBlocks = cell.blocks ?? (cell.paragraph ? [cell.paragraph] : []);
|
|
30287
|
+
const blockMeasures = cellMeasure.blocks ?? (cellMeasure.paragraph ? [cellMeasure.paragraph] : []);
|
|
30288
|
+
const maxBlocks = Math.min(cellBlocks.length, blockMeasures.length);
|
|
30289
|
+
let cumulativeLineCount = 0;
|
|
30290
|
+
for (let i = 0; i < maxBlocks; i++) {
|
|
30291
|
+
const block = cellBlocks[i];
|
|
30292
|
+
const blockMeasure = blockMeasures[i];
|
|
30293
|
+
if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
|
|
30294
|
+
const paraMeasure = blockMeasure;
|
|
30295
|
+
const lines = paraMeasure.lines;
|
|
30296
|
+
const blockLineCount = lines?.length ?? 0;
|
|
30297
|
+
const blockStartGlobal = cumulativeLineCount;
|
|
30298
|
+
const blockEndGlobal = cumulativeLineCount + blockLineCount;
|
|
30299
|
+
const localFrom = Math.max(fromLine, blockStartGlobal) - blockStartGlobal;
|
|
30300
|
+
const localTo = Math.min(toLine, blockEndGlobal) - blockStartGlobal;
|
|
30301
|
+
if (lines && lines.length > 0 && localFrom < localTo) {
|
|
30302
|
+
mergePmRange(range, computeFragmentPmRange(block, lines, localFrom, localTo));
|
|
30303
|
+
} else {
|
|
30304
|
+
mergePmRange(range, extractBlockPmRange(block));
|
|
30305
|
+
}
|
|
30306
|
+
cumulativeLineCount += blockLineCount;
|
|
30307
|
+
continue;
|
|
30308
|
+
}
|
|
30309
|
+
mergePmRange(range, extractBlockPmRange(block));
|
|
30310
|
+
}
|
|
30311
|
+
return range;
|
|
30312
|
+
}
|
|
30313
|
+
function computeTableFragmentPmRange(block, measure, fromRow, toRow, partialRow) {
|
|
30314
|
+
const range = {};
|
|
30315
|
+
for (let rowIndex = fromRow; rowIndex < toRow; rowIndex++) {
|
|
30316
|
+
const row = block.rows[rowIndex];
|
|
30317
|
+
const rowMeasure = measure.rows[rowIndex];
|
|
30318
|
+
if (!row || !rowMeasure) continue;
|
|
30319
|
+
const isPartial = partialRow?.rowIndex === rowIndex;
|
|
30320
|
+
const cellCount = Math.min(row.cells.length, rowMeasure.cells.length);
|
|
30321
|
+
for (let cellIndex = 0; cellIndex < cellCount; cellIndex++) {
|
|
30322
|
+
const cell = row.cells[cellIndex];
|
|
30323
|
+
const cellMeasure = rowMeasure.cells[cellIndex];
|
|
30324
|
+
if (!cell || !cellMeasure) continue;
|
|
30325
|
+
const totalLines = getCellTotalLines(cellMeasure);
|
|
30326
|
+
let fromLine = 0;
|
|
30327
|
+
let toLine = totalLines;
|
|
30328
|
+
if (isPartial) {
|
|
30329
|
+
const hasValidFromLineByCell = partialRow?.fromLineByCell && cellIndex < partialRow.fromLineByCell.length;
|
|
30330
|
+
const hasValidToLineByCell = partialRow?.toLineByCell && cellIndex < partialRow.toLineByCell.length;
|
|
30331
|
+
if (hasValidFromLineByCell) {
|
|
30332
|
+
const rawFrom = partialRow.fromLineByCell[cellIndex];
|
|
30333
|
+
if (typeof rawFrom === "number" && rawFrom >= 0) {
|
|
30334
|
+
fromLine = rawFrom;
|
|
30335
|
+
}
|
|
30336
|
+
}
|
|
30337
|
+
if (hasValidToLineByCell) {
|
|
30338
|
+
const rawTo = partialRow.toLineByCell[cellIndex];
|
|
30339
|
+
if (typeof rawTo === "number") {
|
|
30340
|
+
toLine = rawTo === -1 ? totalLines : rawTo;
|
|
30341
|
+
}
|
|
30342
|
+
}
|
|
30343
|
+
}
|
|
30344
|
+
fromLine = Math.max(0, Math.min(fromLine, totalLines));
|
|
30345
|
+
toLine = Math.max(0, Math.min(toLine, totalLines));
|
|
30346
|
+
if (toLine < fromLine) {
|
|
30347
|
+
toLine = fromLine;
|
|
30348
|
+
}
|
|
30349
|
+
mergePmRange(range, computeCellPmRange(cell, cellMeasure, fromLine, toLine));
|
|
30350
|
+
}
|
|
30351
|
+
}
|
|
30352
|
+
return range;
|
|
30353
|
+
}
|
|
30354
|
+
function applyTableFragmentPmRange(fragment, block, measure) {
|
|
30355
|
+
const range = computeTableFragmentPmRange(block, measure, fragment.fromRow, fragment.toRow, fragment.partialRow);
|
|
30356
|
+
if (range.pmStart != null) {
|
|
30357
|
+
fragment.pmStart = range.pmStart;
|
|
30358
|
+
}
|
|
30359
|
+
if (range.pmEnd != null) {
|
|
30360
|
+
fragment.pmEnd = range.pmEnd;
|
|
30361
|
+
}
|
|
30362
|
+
}
|
|
30062
30363
|
function computePartialRow(rowIndex, blockRow, measure, availableHeight, fromLineByCell) {
|
|
30063
30364
|
const row = measure.rows[rowIndex];
|
|
30064
30365
|
if (!row) {
|
|
@@ -30203,6 +30504,7 @@ function layoutMonolithicTable(context) {
|
|
|
30203
30504
|
height,
|
|
30204
30505
|
metadata
|
|
30205
30506
|
};
|
|
30507
|
+
applyTableFragmentPmRange(fragment, context.block, context.measure);
|
|
30206
30508
|
state.page.fragments.push(fragment);
|
|
30207
30509
|
state.cursorY += height;
|
|
30208
30510
|
}
|
|
@@ -30281,6 +30583,7 @@ function layoutTableBlock({
|
|
|
30281
30583
|
height,
|
|
30282
30584
|
metadata
|
|
30283
30585
|
};
|
|
30586
|
+
applyTableFragmentPmRange(fragment, block, measure);
|
|
30284
30587
|
state.page.fragments.push(fragment);
|
|
30285
30588
|
state.cursorY += height;
|
|
30286
30589
|
return;
|
|
@@ -30344,6 +30647,7 @@ function layoutTableBlock({
|
|
|
30344
30647
|
partialRow: continuationPartialRow,
|
|
30345
30648
|
metadata: generateFragmentMetadata(measure)
|
|
30346
30649
|
};
|
|
30650
|
+
applyTableFragmentPmRange(fragment2, block, measure);
|
|
30347
30651
|
state.page.fragments.push(fragment2);
|
|
30348
30652
|
state.cursorY += fragmentHeight2;
|
|
30349
30653
|
}
|
|
@@ -30388,6 +30692,7 @@ function layoutTableBlock({
|
|
|
30388
30692
|
partialRow: forcedPartialRow,
|
|
30389
30693
|
metadata: generateFragmentMetadata(measure)
|
|
30390
30694
|
};
|
|
30695
|
+
applyTableFragmentPmRange(fragment2, block, measure);
|
|
30391
30696
|
state.page.fragments.push(fragment2);
|
|
30392
30697
|
state.cursorY += fragmentHeight2;
|
|
30393
30698
|
pendingPartialRow = forcedPartialRow;
|
|
@@ -30423,6 +30728,7 @@ function layoutTableBlock({
|
|
|
30423
30728
|
partialRow: partialRow || void 0,
|
|
30424
30729
|
metadata: generateFragmentMetadata(measure)
|
|
30425
30730
|
};
|
|
30731
|
+
applyTableFragmentPmRange(fragment, block, measure);
|
|
30426
30732
|
state.page.fragments.push(fragment);
|
|
30427
30733
|
state.cursorY += fragmentHeight;
|
|
30428
30734
|
if (partialRow && !partialRow.isLastPart) {
|
|
@@ -30440,7 +30746,7 @@ function createAnchoredTableFragment(block, measure, x, y) {
|
|
|
30440
30746
|
columnBoundaries: generateColumnBoundaries(measure),
|
|
30441
30747
|
coordinateSystem: "fragment"
|
|
30442
30748
|
};
|
|
30443
|
-
|
|
30749
|
+
const fragment = {
|
|
30444
30750
|
kind: "table",
|
|
30445
30751
|
blockId: block.id,
|
|
30446
30752
|
fromRow: 0,
|
|
@@ -30451,6 +30757,8 @@ function createAnchoredTableFragment(block, measure, x, y) {
|
|
|
30451
30757
|
height: measure.totalHeight ?? 0,
|
|
30452
30758
|
metadata
|
|
30453
30759
|
};
|
|
30760
|
+
applyTableFragmentPmRange(fragment, block, measure);
|
|
30761
|
+
return fragment;
|
|
30454
30762
|
}
|
|
30455
30763
|
function isPageRelativeAnchor(block) {
|
|
30456
30764
|
const vRelativeFrom = block.anchor?.vRelativeFrom;
|
|
@@ -30872,8 +31180,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
30872
31180
|
header: options.margins?.header ?? options.margins?.top ?? DEFAULT_MARGINS$2.top,
|
|
30873
31181
|
footer: options.margins?.footer ?? options.margins?.bottom ?? DEFAULT_MARGINS$2.bottom
|
|
30874
31182
|
};
|
|
30875
|
-
const
|
|
30876
|
-
if (
|
|
31183
|
+
const baseContentWidth = pageSize.w - (margins.left + margins.right);
|
|
31184
|
+
if (baseContentWidth <= 0) {
|
|
30877
31185
|
throw new Error("layoutDocument: pageSize and margins yield non-positive content area");
|
|
30878
31186
|
}
|
|
30879
31187
|
const validateContentHeight = (height) => {
|
|
@@ -30903,8 +31211,12 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
30903
31211
|
const effectiveBottomMargin = maxFooterContentHeight > 0 ? Math.max(margins.bottom, footerDistance + maxFooterContentHeight) : margins.bottom;
|
|
30904
31212
|
let activeTopMargin = effectiveTopMargin;
|
|
30905
31213
|
let activeBottomMargin = effectiveBottomMargin;
|
|
31214
|
+
let activeLeftMargin = margins.left;
|
|
31215
|
+
let activeRightMargin = margins.right;
|
|
30906
31216
|
let pendingTopMargin = null;
|
|
30907
31217
|
let pendingBottomMargin = null;
|
|
31218
|
+
let pendingLeftMargin = null;
|
|
31219
|
+
let pendingRightMargin = null;
|
|
30908
31220
|
let activeHeaderDistance = margins.header ?? margins.top;
|
|
30909
31221
|
let pendingHeaderDistance = null;
|
|
30910
31222
|
let activeFooterDistance = margins.footer ?? margins.bottom;
|
|
@@ -30917,10 +31229,11 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
30917
31229
|
let pendingOrientation = null;
|
|
30918
31230
|
let activeVAlign = null;
|
|
30919
31231
|
let pendingVAlign = null;
|
|
31232
|
+
const paginatorMargins = { left: activeLeftMargin, right: activeRightMargin };
|
|
30920
31233
|
const floatManager = createFloatingObjectManager(
|
|
30921
|
-
normalizeColumns(activeColumns,
|
|
30922
|
-
{ left:
|
|
30923
|
-
|
|
31234
|
+
normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)),
|
|
31235
|
+
{ left: activeLeftMargin, right: activeRightMargin },
|
|
31236
|
+
activePageSize.w
|
|
30924
31237
|
);
|
|
30925
31238
|
const nextSectionPropsAtBreak = computeNextSectionPropsAtBreak(blocks);
|
|
30926
31239
|
const scheduleSectionBreakCompat = (block, state, baseMargins) => {
|
|
@@ -30937,22 +31250,38 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
30937
31250
|
next.activeOrientation = block.orientation;
|
|
30938
31251
|
next.pendingOrientation = null;
|
|
30939
31252
|
}
|
|
31253
|
+
const headerDistance2 = typeof block.margins?.header === "number" ? Math.max(0, block.margins.header) : next.activeHeaderDistance;
|
|
31254
|
+
const footerDistance2 = typeof block.margins?.footer === "number" ? Math.max(0, block.margins.footer) : next.activeFooterDistance;
|
|
31255
|
+
const sectionTop = typeof block.margins?.top === "number" ? Math.max(0, block.margins.top) : baseMargins.top;
|
|
31256
|
+
const sectionBottom = typeof block.margins?.bottom === "number" ? Math.max(0, block.margins.bottom) : baseMargins.bottom;
|
|
30940
31257
|
if (block.margins?.header !== void 0) {
|
|
30941
|
-
|
|
30942
|
-
next.
|
|
30943
|
-
next.pendingHeaderDistance = headerDist;
|
|
30944
|
-
const requiredTop = maxHeaderContentHeight > 0 ? headerDist + maxHeaderContentHeight : headerDist;
|
|
30945
|
-
next.activeTopMargin = Math.max(baseMargins.top, requiredTop);
|
|
30946
|
-
next.pendingTopMargin = next.activeTopMargin;
|
|
31258
|
+
next.activeHeaderDistance = headerDistance2;
|
|
31259
|
+
next.pendingHeaderDistance = headerDistance2;
|
|
30947
31260
|
}
|
|
30948
31261
|
if (block.margins?.footer !== void 0) {
|
|
30949
|
-
const footerDistance2 = Math.max(0, block.margins.footer);
|
|
30950
31262
|
next.activeFooterDistance = footerDistance2;
|
|
30951
31263
|
next.pendingFooterDistance = footerDistance2;
|
|
31264
|
+
}
|
|
31265
|
+
if (block.margins?.top !== void 0 || block.margins?.header !== void 0) {
|
|
31266
|
+
const requiredTop = maxHeaderContentHeight > 0 ? headerDistance2 + maxHeaderContentHeight : headerDistance2;
|
|
31267
|
+
next.activeTopMargin = Math.max(sectionTop, requiredTop);
|
|
31268
|
+
next.pendingTopMargin = next.activeTopMargin;
|
|
31269
|
+
}
|
|
31270
|
+
if (block.margins?.bottom !== void 0 || block.margins?.footer !== void 0) {
|
|
30952
31271
|
const requiredBottom = maxFooterContentHeight > 0 ? footerDistance2 + maxFooterContentHeight : footerDistance2;
|
|
30953
|
-
next.activeBottomMargin = Math.max(
|
|
31272
|
+
next.activeBottomMargin = Math.max(sectionBottom, requiredBottom);
|
|
30954
31273
|
next.pendingBottomMargin = next.activeBottomMargin;
|
|
30955
31274
|
}
|
|
31275
|
+
if (block.margins?.left !== void 0) {
|
|
31276
|
+
const leftMargin = Math.max(0, block.margins.left);
|
|
31277
|
+
next.activeLeftMargin = leftMargin;
|
|
31278
|
+
next.pendingLeftMargin = leftMargin;
|
|
31279
|
+
}
|
|
31280
|
+
if (block.margins?.right !== void 0) {
|
|
31281
|
+
const rightMargin = Math.max(0, block.margins.right);
|
|
31282
|
+
next.activeRightMargin = rightMargin;
|
|
31283
|
+
next.pendingRightMargin = rightMargin;
|
|
31284
|
+
}
|
|
30956
31285
|
if (block.columns) {
|
|
30957
31286
|
next.activeColumns = { count: block.columns.count, gap: block.columns.gap };
|
|
30958
31287
|
next.pendingColumns = null;
|
|
@@ -30981,27 +31310,35 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
30981
31310
|
const headerPx = block.margins?.header;
|
|
30982
31311
|
const footerPx = block.margins?.footer;
|
|
30983
31312
|
const topPx = block.margins?.top;
|
|
31313
|
+
const bottomPx = block.margins?.bottom;
|
|
31314
|
+
const leftPx = block.margins?.left;
|
|
31315
|
+
const rightPx = block.margins?.right;
|
|
30984
31316
|
const nextTop = next.pendingTopMargin ?? next.activeTopMargin;
|
|
30985
31317
|
const nextBottom = next.pendingBottomMargin ?? next.activeBottomMargin;
|
|
31318
|
+
const nextLeft = next.pendingLeftMargin ?? next.activeLeftMargin;
|
|
31319
|
+
const nextRight = next.pendingRightMargin ?? next.activeRightMargin;
|
|
30986
31320
|
const nextHeader = next.pendingHeaderDistance ?? next.activeHeaderDistance;
|
|
30987
31321
|
const nextFooter = next.pendingFooterDistance ?? next.activeFooterDistance;
|
|
30988
31322
|
next.pendingHeaderDistance = typeof headerPx === "number" ? Math.max(0, headerPx) : nextHeader;
|
|
30989
31323
|
next.pendingFooterDistance = typeof footerPx === "number" ? Math.max(0, footerPx) : nextFooter;
|
|
30990
31324
|
if (typeof headerPx === "number" || typeof topPx === "number") {
|
|
30991
|
-
const sectionTop = topPx
|
|
31325
|
+
const sectionTop = typeof topPx === "number" ? Math.max(0, topPx) : baseMargins.top;
|
|
30992
31326
|
const sectionHeader = next.pendingHeaderDistance;
|
|
30993
31327
|
const requiredTop = maxHeaderContentHeight > 0 ? sectionHeader + maxHeaderContentHeight : sectionHeader;
|
|
30994
31328
|
next.pendingTopMargin = Math.max(sectionTop, requiredTop);
|
|
30995
31329
|
} else {
|
|
30996
31330
|
next.pendingTopMargin = nextTop;
|
|
30997
31331
|
}
|
|
30998
|
-
if (typeof footerPx === "number") {
|
|
31332
|
+
if (typeof footerPx === "number" || typeof bottomPx === "number") {
|
|
30999
31333
|
const sectionFooter = next.pendingFooterDistance;
|
|
31334
|
+
const sectionBottom = typeof bottomPx === "number" ? Math.max(0, bottomPx) : baseMargins.bottom;
|
|
31000
31335
|
const requiredBottom = maxFooterContentHeight > 0 ? sectionFooter + maxFooterContentHeight : sectionFooter;
|
|
31001
|
-
next.pendingBottomMargin = Math.max(
|
|
31336
|
+
next.pendingBottomMargin = Math.max(sectionBottom, requiredBottom);
|
|
31002
31337
|
} else {
|
|
31003
31338
|
next.pendingBottomMargin = nextBottom;
|
|
31004
31339
|
}
|
|
31340
|
+
next.pendingLeftMargin = typeof leftPx === "number" ? Math.max(0, leftPx) : nextLeft;
|
|
31341
|
+
next.pendingRightMargin = typeof rightPx === "number" ? Math.max(0, rightPx) : nextRight;
|
|
31005
31342
|
if (block.pageSize) next.pendingPageSize = { w: block.pageSize.w, h: block.pageSize.h };
|
|
31006
31343
|
if (block.orientation) next.pendingOrientation = block.orientation;
|
|
31007
31344
|
const sectionType = block.type ?? "continuous";
|
|
@@ -31086,7 +31423,7 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31086
31423
|
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
31087
31424
|
let pendingSectionIndex = null;
|
|
31088
31425
|
const paginator = createPaginator({
|
|
31089
|
-
margins:
|
|
31426
|
+
margins: paginatorMargins,
|
|
31090
31427
|
getActiveTopMargin: () => activeTopMargin,
|
|
31091
31428
|
getActiveBottomMargin: () => activeBottomMargin,
|
|
31092
31429
|
getActiveHeaderDistance: () => activeHeaderDistance,
|
|
@@ -31101,8 +31438,12 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31101
31438
|
const applied = applyPendingToActive({
|
|
31102
31439
|
activeTopMargin,
|
|
31103
31440
|
activeBottomMargin,
|
|
31441
|
+
activeLeftMargin,
|
|
31442
|
+
activeRightMargin,
|
|
31104
31443
|
pendingTopMargin,
|
|
31105
31444
|
pendingBottomMargin,
|
|
31445
|
+
pendingLeftMargin,
|
|
31446
|
+
pendingRightMargin,
|
|
31106
31447
|
activeHeaderDistance,
|
|
31107
31448
|
activeFooterDistance,
|
|
31108
31449
|
pendingHeaderDistance,
|
|
@@ -31117,8 +31458,12 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31117
31458
|
});
|
|
31118
31459
|
activeTopMargin = applied.activeTopMargin;
|
|
31119
31460
|
activeBottomMargin = applied.activeBottomMargin;
|
|
31461
|
+
activeLeftMargin = applied.activeLeftMargin;
|
|
31462
|
+
activeRightMargin = applied.activeRightMargin;
|
|
31120
31463
|
pendingTopMargin = applied.pendingTopMargin;
|
|
31121
31464
|
pendingBottomMargin = applied.pendingBottomMargin;
|
|
31465
|
+
pendingLeftMargin = applied.pendingLeftMargin;
|
|
31466
|
+
pendingRightMargin = applied.pendingRightMargin;
|
|
31122
31467
|
activeHeaderDistance = applied.activeHeaderDistance;
|
|
31123
31468
|
activeFooterDistance = applied.activeFooterDistance;
|
|
31124
31469
|
pendingHeaderDistance = applied.pendingHeaderDistance;
|
|
@@ -31130,6 +31475,14 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31130
31475
|
activeOrientation = applied.activeOrientation;
|
|
31131
31476
|
pendingOrientation = applied.pendingOrientation;
|
|
31132
31477
|
cachedColumnsState.state = null;
|
|
31478
|
+
paginatorMargins.left = activeLeftMargin;
|
|
31479
|
+
paginatorMargins.right = activeRightMargin;
|
|
31480
|
+
const contentWidth = activePageSize.w - (activeLeftMargin + activeRightMargin);
|
|
31481
|
+
floatManager.setLayoutContext(
|
|
31482
|
+
normalizeColumns(activeColumns, contentWidth),
|
|
31483
|
+
{ left: activeLeftMargin, right: activeRightMargin },
|
|
31484
|
+
activePageSize.w
|
|
31485
|
+
);
|
|
31133
31486
|
if (pendingNumbering) {
|
|
31134
31487
|
if (pendingNumbering.format) activeNumberFormat = pendingNumbering.format;
|
|
31135
31488
|
if (typeof pendingNumbering.start === "number" && Number.isFinite(pendingNumbering.start)) {
|
|
@@ -31174,7 +31527,7 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31174
31527
|
const getActiveColumnsForState = paginator.getActiveColumnsForState;
|
|
31175
31528
|
let cachedColumnsState = { state: null, constraintIndex: -2, contentWidth: -1, colsConfig: null, normalized: null };
|
|
31176
31529
|
const getCurrentColumns = () => {
|
|
31177
|
-
const currentContentWidth = activePageSize.w - (
|
|
31530
|
+
const currentContentWidth = activePageSize.w - (activeLeftMargin + activeRightMargin);
|
|
31178
31531
|
const state = states[states.length - 1] ?? null;
|
|
31179
31532
|
const colsConfig = state ? getActiveColumnsForState(state) : activeColumns;
|
|
31180
31533
|
const constraintIndex = state ? state.activeConstraintIndex : -1;
|
|
@@ -31207,6 +31560,12 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31207
31560
|
layoutLog(` Current page: ${state.page.number}, cursorY: ${state.cursorY}`);
|
|
31208
31561
|
activeColumns = newColumns;
|
|
31209
31562
|
cachedColumnsState.state = null;
|
|
31563
|
+
const contentWidth = activePageSize.w - (activeLeftMargin + activeRightMargin);
|
|
31564
|
+
floatManager.setLayoutContext(
|
|
31565
|
+
normalizeColumns(activeColumns, contentWidth),
|
|
31566
|
+
{ left: activeLeftMargin, right: activeRightMargin },
|
|
31567
|
+
activePageSize.w
|
|
31568
|
+
);
|
|
31210
31569
|
};
|
|
31211
31570
|
const anchoredByParagraph = collectAnchoredDrawings(blocks, measures);
|
|
31212
31571
|
const anchoredTablesByParagraph = collectAnchoredTables(blocks, measures);
|
|
@@ -31238,10 +31597,10 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31238
31597
|
if (alignV === "top") {
|
|
31239
31598
|
anchorY = offsetV;
|
|
31240
31599
|
} else if (alignV === "bottom") {
|
|
31241
|
-
const pageHeight = contentBottom + margins
|
|
31600
|
+
const pageHeight = contentBottom + (state.page.margins?.bottom ?? activeBottomMargin);
|
|
31242
31601
|
anchorY = pageHeight - imageHeight + offsetV;
|
|
31243
31602
|
} else if (alignV === "center") {
|
|
31244
|
-
const pageHeight = contentBottom + margins
|
|
31603
|
+
const pageHeight = contentBottom + (state.page.margins?.bottom ?? activeBottomMargin);
|
|
31245
31604
|
anchorY = (pageHeight - imageHeight) / 2 + offsetV;
|
|
31246
31605
|
} else {
|
|
31247
31606
|
anchorY = offsetV;
|
|
@@ -31252,11 +31611,11 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31252
31611
|
const anchorX = entry.block.anchor ? computeAnchorX(
|
|
31253
31612
|
entry.block.anchor,
|
|
31254
31613
|
state.columnIndex,
|
|
31255
|
-
normalizeColumns(activeColumns,
|
|
31614
|
+
normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)),
|
|
31256
31615
|
entry.measure.width,
|
|
31257
|
-
{ left:
|
|
31616
|
+
{ left: activeLeftMargin, right: activeRightMargin },
|
|
31258
31617
|
activePageSize.w
|
|
31259
|
-
) :
|
|
31618
|
+
) : activeLeftMargin;
|
|
31260
31619
|
floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
|
|
31261
31620
|
preRegisteredPositions.set(entry.block.id, { anchorX, anchorY, pageNumber: state.page.number });
|
|
31262
31621
|
}
|
|
@@ -31294,8 +31653,12 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31294
31653
|
const sectionState = {
|
|
31295
31654
|
activeTopMargin,
|
|
31296
31655
|
activeBottomMargin,
|
|
31656
|
+
activeLeftMargin,
|
|
31657
|
+
activeRightMargin,
|
|
31297
31658
|
pendingTopMargin,
|
|
31298
31659
|
pendingBottomMargin,
|
|
31660
|
+
pendingLeftMargin,
|
|
31661
|
+
pendingRightMargin,
|
|
31299
31662
|
activeHeaderDistance,
|
|
31300
31663
|
activeFooterDistance,
|
|
31301
31664
|
pendingHeaderDistance,
|
|
@@ -31329,8 +31692,12 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31329
31692
|
layoutLog(`[Layout] ========== END SECTION BREAK ==========`);
|
|
31330
31693
|
activeTopMargin = updatedState.activeTopMargin;
|
|
31331
31694
|
activeBottomMargin = updatedState.activeBottomMargin;
|
|
31695
|
+
activeLeftMargin = updatedState.activeLeftMargin;
|
|
31696
|
+
activeRightMargin = updatedState.activeRightMargin;
|
|
31332
31697
|
pendingTopMargin = updatedState.pendingTopMargin;
|
|
31333
31698
|
pendingBottomMargin = updatedState.pendingBottomMargin;
|
|
31699
|
+
pendingLeftMargin = updatedState.pendingLeftMargin;
|
|
31700
|
+
pendingRightMargin = updatedState.pendingRightMargin;
|
|
31334
31701
|
activeHeaderDistance = updatedState.activeHeaderDistance;
|
|
31335
31702
|
activeFooterDistance = updatedState.activeFooterDistance;
|
|
31336
31703
|
pendingHeaderDistance = updatedState.pendingHeaderDistance;
|
|
@@ -31468,8 +31835,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31468
31835
|
pageMargins: {
|
|
31469
31836
|
top: activeTopMargin,
|
|
31470
31837
|
bottom: activeBottomMargin,
|
|
31471
|
-
left:
|
|
31472
|
-
right:
|
|
31838
|
+
left: activeLeftMargin,
|
|
31839
|
+
right: activeRightMargin
|
|
31473
31840
|
},
|
|
31474
31841
|
columns: getCurrentColumns(),
|
|
31475
31842
|
placedAnchoredIds
|
|
@@ -31491,9 +31858,9 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
31491
31858
|
const cols = getCurrentColumns();
|
|
31492
31859
|
let maxWidth;
|
|
31493
31860
|
if (relativeFrom === "page") {
|
|
31494
|
-
maxWidth = cols.count === 1 ? activePageSize.w -
|
|
31861
|
+
maxWidth = cols.count === 1 ? activePageSize.w - (activeLeftMargin + activeRightMargin) : activePageSize.w;
|
|
31495
31862
|
} else if (relativeFrom === "margin") {
|
|
31496
|
-
maxWidth = activePageSize.w -
|
|
31863
|
+
maxWidth = activePageSize.w - (activeLeftMargin + activeRightMargin);
|
|
31497
31864
|
} else {
|
|
31498
31865
|
maxWidth = cols.width;
|
|
31499
31866
|
}
|
|
@@ -31653,6 +32020,9 @@ function layoutHeaderFooter(blocks, measures, constraints) {
|
|
|
31653
32020
|
if (!Number.isFinite(height) || height <= 0) {
|
|
31654
32021
|
throw new Error("layoutHeaderFooter: height must be positive");
|
|
31655
32022
|
}
|
|
32023
|
+
const maxBehindDocOverflow = Math.max(192, height * 4);
|
|
32024
|
+
const minBehindDocY = -maxBehindDocOverflow;
|
|
32025
|
+
const maxBehindDocY = height + maxBehindDocOverflow;
|
|
31656
32026
|
const marginLeft = constraints.margins?.left ?? 0;
|
|
31657
32027
|
const transformedBlocks = marginLeft > 0 ? blocks.map((block) => {
|
|
31658
32028
|
const hasPageRelativeAnchor = (block.kind === "image" || block.kind === "drawing") && block.anchor?.hRelativeFrom === "page" && block.anchor.offsetH != null;
|
|
@@ -31683,6 +32053,18 @@ function layoutHeaderFooter(blocks, measures, constraints) {
|
|
|
31683
32053
|
if (idx == null) continue;
|
|
31684
32054
|
const block = blocks[idx];
|
|
31685
32055
|
const measure = measures[idx];
|
|
32056
|
+
const isAnchoredFragment = (fragment.kind === "image" || fragment.kind === "drawing") && fragment.isAnchored === true;
|
|
32057
|
+
if (isAnchoredFragment) {
|
|
32058
|
+
if (block.kind !== "image" && block.kind !== "drawing") {
|
|
32059
|
+
throw new Error(
|
|
32060
|
+
`Type mismatch: fragment kind is ${fragment.kind} but block kind is ${block.kind} for block ${block.id}`
|
|
32061
|
+
);
|
|
32062
|
+
}
|
|
32063
|
+
const anchoredBlock = block;
|
|
32064
|
+
if (anchoredBlock.anchor?.behindDoc && (fragment.y < minBehindDocY || fragment.y > maxBehindDocY)) {
|
|
32065
|
+
continue;
|
|
32066
|
+
}
|
|
32067
|
+
}
|
|
31686
32068
|
if (fragment.y < minY) minY = fragment.y;
|
|
31687
32069
|
let bottom2 = fragment.y;
|
|
31688
32070
|
if (fragment.kind === "para" && measure?.kind === "paragraph") {
|
|
@@ -32680,11 +33062,11 @@ function findWordBoundaries(blocks, pos) {
|
|
|
32680
33062
|
if (text.length === 0) return null;
|
|
32681
33063
|
const clampedPos = Math.max(0, Math.min(localPos, text.length));
|
|
32682
33064
|
let wordStart = clampedPos;
|
|
32683
|
-
while (wordStart > 0 && isWordChar(text[wordStart - 1])) {
|
|
33065
|
+
while (wordStart > 0 && isWordChar$2(text[wordStart - 1])) {
|
|
32684
33066
|
wordStart--;
|
|
32685
33067
|
}
|
|
32686
33068
|
let wordEnd = clampedPos;
|
|
32687
|
-
while (wordEnd < text.length && isWordChar(text[wordEnd])) {
|
|
33069
|
+
while (wordEnd < text.length && isWordChar$2(text[wordEnd])) {
|
|
32688
33070
|
wordEnd++;
|
|
32689
33071
|
}
|
|
32690
33072
|
if (wordStart === wordEnd) {
|
|
@@ -32747,7 +33129,7 @@ function findBlockAtPosition(blocks, pos) {
|
|
|
32747
33129
|
}
|
|
32748
33130
|
return null;
|
|
32749
33131
|
}
|
|
32750
|
-
function isWordChar(char) {
|
|
33132
|
+
function isWordChar$2(char) {
|
|
32751
33133
|
return /[\p{L}\p{N}_]/u.test(char);
|
|
32752
33134
|
}
|
|
32753
33135
|
function isWhitespace(char) {
|
|
@@ -32782,6 +33164,29 @@ function fontString(run) {
|
|
|
32782
33164
|
function runText(run) {
|
|
32783
33165
|
return "src" in run || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation" ? "" : run.text ?? "";
|
|
32784
33166
|
}
|
|
33167
|
+
const isWordChar$1 = (char) => {
|
|
33168
|
+
if (!char) return false;
|
|
33169
|
+
const code = char.charCodeAt(0);
|
|
33170
|
+
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || char === "'";
|
|
33171
|
+
};
|
|
33172
|
+
const capitalizeText$1 = (text, fullText, startOffset) => {
|
|
33173
|
+
if (!text) return text;
|
|
33174
|
+
const hasFullText = typeof startOffset === "number" && fullText != null;
|
|
33175
|
+
let result = "";
|
|
33176
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
33177
|
+
const prevChar = hasFullText ? startOffset + i > 0 ? fullText[startOffset + i - 1] : "" : i > 0 ? text[i - 1] : "";
|
|
33178
|
+
const ch = text[i];
|
|
33179
|
+
result += isWordChar$1(ch) && !isWordChar$1(prevChar) ? ch.toUpperCase() : ch;
|
|
33180
|
+
}
|
|
33181
|
+
return result;
|
|
33182
|
+
};
|
|
33183
|
+
const applyTextTransform$1 = (text, transform, fullText, startOffset) => {
|
|
33184
|
+
if (!text || !transform || transform === "none") return text;
|
|
33185
|
+
if (transform === "uppercase") return text.toUpperCase();
|
|
33186
|
+
if (transform === "lowercase") return text.toLowerCase();
|
|
33187
|
+
if (transform === "capitalize") return capitalizeText$1(text, fullText, startOffset);
|
|
33188
|
+
return text;
|
|
33189
|
+
};
|
|
32785
33190
|
const DEFAULT_TAB_INTERVAL_TWIPS$1 = 720;
|
|
32786
33191
|
const TWIPS_PER_INCH$4 = 1440;
|
|
32787
33192
|
const PX_PER_INCH$3 = 96;
|
|
@@ -32790,6 +33195,13 @@ const TAB_EPSILON$1 = 0.1;
|
|
|
32790
33195
|
const WIDTH_FUDGE_PX = 0.5;
|
|
32791
33196
|
const twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$1;
|
|
32792
33197
|
const pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1);
|
|
33198
|
+
const markerFontString = (run) => {
|
|
33199
|
+
const size2 = run?.fontSize ?? 16;
|
|
33200
|
+
const family = run?.fontFamily ?? "Arial";
|
|
33201
|
+
const italic = run?.italic ? "italic " : "";
|
|
33202
|
+
const bold = run?.bold ? "bold " : "";
|
|
33203
|
+
return `${italic}${bold}${size2}px ${family}`.trim();
|
|
33204
|
+
};
|
|
32793
33205
|
const buildTabStopsPx$1 = (indent, tabs, tabIntervalTwips) => {
|
|
32794
33206
|
const paragraphIndentTwips = {
|
|
32795
33207
|
left: pxToTwips$1(Math.max(0, indent?.left ?? 0)),
|
|
@@ -32820,7 +33232,9 @@ const getNextTabStopPx$1 = (currentX, tabStops, startIndex) => {
|
|
|
32820
33232
|
};
|
|
32821
33233
|
function measureRunSliceWidth(run, fromChar, toChar) {
|
|
32822
33234
|
const context = getCtx();
|
|
32823
|
-
const
|
|
33235
|
+
const fullText = runText(run);
|
|
33236
|
+
const transform = isTextRun$2(run) ? run.textTransform : void 0;
|
|
33237
|
+
const text = applyTextTransform$1(fullText.slice(fromChar, toChar), transform, fullText, fromChar);
|
|
32824
33238
|
if (!context) {
|
|
32825
33239
|
const textRun = isTextRun$2(run) ? run : null;
|
|
32826
33240
|
const size2 = textRun?.fontSize ?? 16;
|
|
@@ -32866,8 +33280,21 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
32866
33280
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
32867
33281
|
const markerTextStartX = wordLayout?.marker?.textStartX;
|
|
32868
33282
|
const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : void 0;
|
|
32869
|
-
const
|
|
32870
|
-
|
|
33283
|
+
const resolvedTextStartPx = resolveListTextStartPx(
|
|
33284
|
+
wordLayout,
|
|
33285
|
+
indentLeft,
|
|
33286
|
+
indentFirstLine,
|
|
33287
|
+
indentHanging,
|
|
33288
|
+
(markerText, marker) => {
|
|
33289
|
+
const context = getCtx();
|
|
33290
|
+
if (!context) return 0;
|
|
33291
|
+
context.font = markerFontString(marker.run);
|
|
33292
|
+
return context.measureText(markerText).width;
|
|
33293
|
+
}
|
|
33294
|
+
);
|
|
33295
|
+
const effectiveTextStartPx = resolvedTextStartPx ?? textStartPx;
|
|
33296
|
+
const treatAsHanging = !wordLayout?.marker && effectiveTextStartPx && indentLeft === 0 && indentHanging === 0;
|
|
33297
|
+
const firstLineWidth = typeof effectiveTextStartPx === "number" && effectiveTextStartPx > indentLeft && !treatAsHanging ? Math.max(1, maxWidth - effectiveTextStartPx - indentRight) : Math.max(1, contentWidth - rawFirstLineOffset);
|
|
32871
33298
|
const tabStops = buildTabStopsPx$1(indent, attrs?.tabs, attrs?.tabIntervalTwips);
|
|
32872
33299
|
let currentRun = 0;
|
|
32873
33300
|
let currentChar = 0;
|
|
@@ -33407,7 +33834,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
33407
33834
|
if (dirty.deletedBlockIds.length > 0) {
|
|
33408
33835
|
measureCache.invalidate(dirty.deletedBlockIds);
|
|
33409
33836
|
}
|
|
33410
|
-
const { measurementWidth, measurementHeight } = resolveMeasurementConstraints(options);
|
|
33837
|
+
const { measurementWidth, measurementHeight } = resolveMeasurementConstraints(options, nextBlocks);
|
|
33411
33838
|
if (measurementWidth <= 0 || measurementHeight <= 0) {
|
|
33412
33839
|
throw new Error("incrementalLayout: invalid measurement constraints resolved from options");
|
|
33413
33840
|
}
|
|
@@ -33676,7 +34103,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
33676
34103
|
const DEFAULT_PAGE_SIZE$1 = { w: 612, h: 792 };
|
|
33677
34104
|
const DEFAULT_MARGINS$1 = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
33678
34105
|
const normalizeMargin = (value, fallback) => Number.isFinite(value) ? value : fallback;
|
|
33679
|
-
function resolveMeasurementConstraints(options) {
|
|
34106
|
+
function resolveMeasurementConstraints(options, blocks) {
|
|
33680
34107
|
const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
|
|
33681
34108
|
const margins = {
|
|
33682
34109
|
top: normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top),
|
|
@@ -33684,23 +34111,41 @@ function resolveMeasurementConstraints(options) {
|
|
|
33684
34111
|
bottom: normalizeMargin(options.margins?.bottom, DEFAULT_MARGINS$1.bottom),
|
|
33685
34112
|
left: normalizeMargin(options.margins?.left, DEFAULT_MARGINS$1.left)
|
|
33686
34113
|
};
|
|
33687
|
-
const
|
|
33688
|
-
const
|
|
33689
|
-
const
|
|
33690
|
-
|
|
34114
|
+
const baseContentWidth = pageSize.w - (margins.left + margins.right);
|
|
34115
|
+
const baseContentHeight = pageSize.h - (margins.top + margins.bottom);
|
|
34116
|
+
const computeColumnWidth = (contentWidth, columns) => {
|
|
34117
|
+
if (!columns || columns.count <= 1) return contentWidth;
|
|
33691
34118
|
const gap = Math.max(0, columns.gap ?? 0);
|
|
33692
34119
|
const totalGap = gap * (columns.count - 1);
|
|
33693
|
-
|
|
33694
|
-
|
|
33695
|
-
|
|
33696
|
-
|
|
33697
|
-
|
|
34120
|
+
return (contentWidth - totalGap) / columns.count;
|
|
34121
|
+
};
|
|
34122
|
+
let measurementWidth = computeColumnWidth(baseContentWidth, options.columns);
|
|
34123
|
+
let measurementHeight = baseContentHeight;
|
|
34124
|
+
if (blocks && blocks.length > 0) {
|
|
34125
|
+
for (const block of blocks) {
|
|
34126
|
+
if (block.kind !== "sectionBreak") continue;
|
|
34127
|
+
const sectionPageSize = block.pageSize ?? pageSize;
|
|
34128
|
+
const sectionMargins = {
|
|
34129
|
+
top: normalizeMargin(block.margins?.top, margins.top),
|
|
34130
|
+
right: normalizeMargin(block.margins?.right, margins.right),
|
|
34131
|
+
bottom: normalizeMargin(block.margins?.bottom, margins.bottom),
|
|
34132
|
+
left: normalizeMargin(block.margins?.left, margins.left)
|
|
33698
34133
|
};
|
|
34134
|
+
const contentWidth = sectionPageSize.w - (sectionMargins.left + sectionMargins.right);
|
|
34135
|
+
const contentHeight = sectionPageSize.h - (sectionMargins.top + sectionMargins.bottom);
|
|
34136
|
+
if (contentWidth <= 0 || contentHeight <= 0) continue;
|
|
34137
|
+
const columnWidth = computeColumnWidth(contentWidth, block.columns ?? options.columns);
|
|
34138
|
+
if (columnWidth > measurementWidth) {
|
|
34139
|
+
measurementWidth = columnWidth;
|
|
34140
|
+
}
|
|
34141
|
+
if (contentHeight > measurementHeight) {
|
|
34142
|
+
measurementHeight = contentHeight;
|
|
34143
|
+
}
|
|
33699
34144
|
}
|
|
33700
34145
|
}
|
|
33701
34146
|
return {
|
|
33702
|
-
measurementWidth
|
|
33703
|
-
measurementHeight
|
|
34147
|
+
measurementWidth,
|
|
34148
|
+
measurementHeight
|
|
33704
34149
|
};
|
|
33705
34150
|
}
|
|
33706
34151
|
const serializeHeaderFooterResults = (kind, batch) => {
|
|
@@ -35767,6 +36212,7 @@ function isInRegisteredSurface(event) {
|
|
|
35767
36212
|
}
|
|
35768
36213
|
return false;
|
|
35769
36214
|
}
|
|
36215
|
+
const SLASH_MENU_HANDLED_FLAG = "__sdHandledBySlashMenu";
|
|
35770
36216
|
class PresentationInputBridge {
|
|
35771
36217
|
/**
|
|
35772
36218
|
* Creates a new PresentationInputBridge that forwards user input events from the visible layout
|
|
@@ -36002,9 +36448,19 @@ forwardCompositionEvent_fn = function(event) {
|
|
|
36002
36448
|
/**
|
|
36003
36449
|
* Forwards context menu events to the hidden editor.
|
|
36004
36450
|
*
|
|
36451
|
+
* Checks if the SlashMenu component has already handled the event by inspecting
|
|
36452
|
+
* the SLASH_MENU_HANDLED_FLAG. If the flag is set, the event is not forwarded,
|
|
36453
|
+
* preventing duplicate context menu handling. This coordination allows SlashMenu
|
|
36454
|
+
* to intercept right-clicks in the capture phase and prevent the default editor
|
|
36455
|
+
* context menu from appearing.
|
|
36456
|
+
*
|
|
36005
36457
|
* @param event - The context menu event from the layout surface
|
|
36006
36458
|
*/
|
|
36007
36459
|
forwardContextMenu_fn = function(event) {
|
|
36460
|
+
const handledBySlashMenu = Boolean(event[SLASH_MENU_HANDLED_FLAG]);
|
|
36461
|
+
if (handledBySlashMenu) {
|
|
36462
|
+
return;
|
|
36463
|
+
}
|
|
36008
36464
|
if (!__privateGet(this, _isEditable).call(this)) {
|
|
36009
36465
|
return;
|
|
36010
36466
|
}
|
|
@@ -36148,14 +36604,15 @@ function getAtomNodeTypes(schema) {
|
|
|
36148
36604
|
if (!schema) return [];
|
|
36149
36605
|
const types = [];
|
|
36150
36606
|
try {
|
|
36151
|
-
schema.nodes
|
|
36607
|
+
for (const name in schema.nodes) {
|
|
36152
36608
|
if (name === "text") {
|
|
36153
|
-
|
|
36609
|
+
continue;
|
|
36154
36610
|
}
|
|
36155
|
-
|
|
36611
|
+
const nodeType = schema.nodes[name];
|
|
36612
|
+
if (nodeType && (nodeType.isAtom || nodeType.isLeaf)) {
|
|
36156
36613
|
types.push(name);
|
|
36157
36614
|
}
|
|
36158
|
-
}
|
|
36615
|
+
}
|
|
36159
36616
|
} catch {
|
|
36160
36617
|
return [];
|
|
36161
36618
|
}
|
|
@@ -37558,6 +38015,7 @@ function shouldRequirePageBoundary(current, next) {
|
|
|
37558
38015
|
function hasIntrinsicBoundarySignals(_) {
|
|
37559
38016
|
return false;
|
|
37560
38017
|
}
|
|
38018
|
+
const DEFAULT_HEADER_FOOTER_MARGIN_PX = 0;
|
|
37561
38019
|
function shouldIgnoreSectionBreak(paragraph, index2, total, hasBodySectPr) {
|
|
37562
38020
|
const paragraphAttrs = paragraph.attrs ?? {};
|
|
37563
38021
|
const paragraphProperties = paragraphAttrs?.paragraphProperties;
|
|
@@ -37598,14 +38056,15 @@ function buildSectionRangesFromParagraphs(paragraphs, hasBodySectPr) {
|
|
|
37598
38056
|
const sectionData = extractSectionData(item.node);
|
|
37599
38057
|
if (!sectionData) return;
|
|
37600
38058
|
const sectPr = getSectPrFromNode(item.node);
|
|
38059
|
+
const hasAnyMargin = sectionData.headerPx != null || sectionData.footerPx != null || sectionData.topPx != null || sectionData.rightPx != null || sectionData.bottomPx != null || sectionData.leftPx != null;
|
|
37601
38060
|
const range = {
|
|
37602
38061
|
sectionIndex: idx,
|
|
37603
38062
|
startParagraphIndex: currentStart,
|
|
37604
38063
|
endParagraphIndex: item.index,
|
|
37605
38064
|
sectPr,
|
|
37606
|
-
margins:
|
|
37607
|
-
header: sectionData.headerPx ??
|
|
37608
|
-
footer: sectionData.footerPx ??
|
|
38065
|
+
margins: hasAnyMargin ? {
|
|
38066
|
+
header: sectionData.headerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
|
|
38067
|
+
footer: sectionData.footerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
|
|
37609
38068
|
top: sectionData.topPx,
|
|
37610
38069
|
right: sectionData.rightPx,
|
|
37611
38070
|
bottom: sectionData.bottomPx,
|
|
@@ -37647,14 +38106,15 @@ function createFinalSectionFromBodySectPr(bodySectPr, currentStart, totalParagra
|
|
|
37647
38106
|
};
|
|
37648
38107
|
const bodySectionData = extractSectionData(tempNode);
|
|
37649
38108
|
if (!bodySectionData) return null;
|
|
38109
|
+
const hasAnyMargin = bodySectionData.headerPx != null || bodySectionData.footerPx != null || bodySectionData.topPx != null || bodySectionData.rightPx != null || bodySectionData.bottomPx != null || bodySectionData.leftPx != null;
|
|
37650
38110
|
return {
|
|
37651
38111
|
sectionIndex,
|
|
37652
38112
|
startParagraphIndex: currentStart,
|
|
37653
38113
|
endParagraphIndex: totalParagraphs - 1,
|
|
37654
38114
|
sectPr: bodySectPr,
|
|
37655
|
-
margins:
|
|
37656
|
-
header: bodySectionData.headerPx ??
|
|
37657
|
-
footer: bodySectionData.footerPx ??
|
|
38115
|
+
margins: hasAnyMargin ? {
|
|
38116
|
+
header: bodySectionData.headerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
|
|
38117
|
+
footer: bodySectionData.footerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
|
|
37658
38118
|
top: bodySectionData.topPx,
|
|
37659
38119
|
right: bodySectionData.rightPx,
|
|
37660
38120
|
bottom: bodySectionData.bottomPx,
|
|
@@ -38638,11 +39098,27 @@ const collectTrackedChangeFromMarks = (marks) => {
|
|
|
38638
39098
|
}, void 0);
|
|
38639
39099
|
};
|
|
38640
39100
|
const normalizeUnderlineStyle = (value) => {
|
|
38641
|
-
if (value ===
|
|
38642
|
-
return
|
|
39101
|
+
if (value === void 0 || value === null) {
|
|
39102
|
+
return "single";
|
|
38643
39103
|
}
|
|
38644
|
-
if (
|
|
38645
|
-
return value;
|
|
39104
|
+
if (typeof value === "boolean") {
|
|
39105
|
+
return value ? "single" : void 0;
|
|
39106
|
+
}
|
|
39107
|
+
if (typeof value === "number") {
|
|
39108
|
+
return value === 0 ? void 0 : "single";
|
|
39109
|
+
}
|
|
39110
|
+
if (typeof value === "string") {
|
|
39111
|
+
const normalized = value.trim().toLowerCase();
|
|
39112
|
+
if (!normalized) {
|
|
39113
|
+
return "single";
|
|
39114
|
+
}
|
|
39115
|
+
if (normalized === "none" || normalized === "0" || normalized === "false" || normalized === "off") {
|
|
39116
|
+
return void 0;
|
|
39117
|
+
}
|
|
39118
|
+
if (normalized === "double" || normalized === "dotted" || normalized === "dashed" || normalized === "wavy") {
|
|
39119
|
+
return normalized;
|
|
39120
|
+
}
|
|
39121
|
+
return "single";
|
|
38646
39122
|
}
|
|
38647
39123
|
return "single";
|
|
38648
39124
|
};
|
|
@@ -38794,13 +39270,16 @@ const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG,
|
|
|
38794
39270
|
break;
|
|
38795
39271
|
}
|
|
38796
39272
|
case "underline": {
|
|
38797
|
-
const
|
|
39273
|
+
const underlineValue = mark.attrs?.underlineType ?? mark.attrs?.value ?? mark.attrs?.underline ?? mark.attrs?.style;
|
|
39274
|
+
const style = normalizeUnderlineStyle(underlineValue);
|
|
38798
39275
|
if (style) {
|
|
38799
39276
|
const underlineColor = resolveColorFromAttributes(mark.attrs ?? {}, themeColors);
|
|
38800
39277
|
run.underline = {
|
|
38801
39278
|
style,
|
|
38802
39279
|
color: underlineColor ?? run.underline?.color
|
|
38803
39280
|
};
|
|
39281
|
+
} else if (underlineValue !== void 0 && underlineValue !== null) {
|
|
39282
|
+
delete run.underline;
|
|
38804
39283
|
}
|
|
38805
39284
|
break;
|
|
38806
39285
|
}
|
|
@@ -39736,8 +40215,8 @@ function buildSdtCacheKey(nodeType, attrs, explicitKey) {
|
|
|
39736
40215
|
}
|
|
39737
40216
|
return void 0;
|
|
39738
40217
|
}
|
|
39739
|
-
const DEFAULT_LIST_HANGING_PX
|
|
39740
|
-
const LIST_MARKER_GAP
|
|
40218
|
+
const DEFAULT_LIST_HANGING_PX = 18;
|
|
40219
|
+
const LIST_MARKER_GAP = 8;
|
|
39741
40220
|
const DEFAULT_BULLET_GLYPH = "•";
|
|
39742
40221
|
const DEFAULT_DECIMAL_PATTERN = "%1.";
|
|
39743
40222
|
const ASCII_UPPERCASE_A = 65;
|
|
@@ -40148,7 +40627,7 @@ function computeWordParagraphLayout(input) {
|
|
|
40148
40627
|
let markerBoxWidthPx;
|
|
40149
40628
|
let markerX;
|
|
40150
40629
|
if (hasFirstLineIndent) {
|
|
40151
|
-
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP
|
|
40630
|
+
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP : DEFAULT_LIST_HANGING_PX;
|
|
40152
40631
|
markerX = indentLeftPx + (firstLinePx ?? 0);
|
|
40153
40632
|
layout.textStartPx = markerX + markerBoxWidthPx;
|
|
40154
40633
|
layout.hangingPx = 0;
|
|
@@ -40248,12 +40727,12 @@ const resolveMarkerBoxWidth = (hangingPxRaw, glyphWidthPx) => {
|
|
|
40248
40727
|
let markerBox = Math.max(hangingPxRaw || 0, 0);
|
|
40249
40728
|
if (markerBox <= 0) {
|
|
40250
40729
|
if (glyphWidthPx != null && glyphWidthPx > 0) {
|
|
40251
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP
|
|
40730
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP;
|
|
40252
40731
|
} else {
|
|
40253
|
-
markerBox = DEFAULT_LIST_HANGING_PX
|
|
40732
|
+
markerBox = DEFAULT_LIST_HANGING_PX;
|
|
40254
40733
|
}
|
|
40255
|
-
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP
|
|
40256
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP
|
|
40734
|
+
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP > markerBox) {
|
|
40735
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP;
|
|
40257
40736
|
}
|
|
40258
40737
|
return markerBox;
|
|
40259
40738
|
};
|
|
@@ -40273,7 +40752,7 @@ const buildMarkerLayout = ({
|
|
|
40273
40752
|
textStartX: textStartPx,
|
|
40274
40753
|
baselineOffsetPx: markerRun.baselineShift ?? 0,
|
|
40275
40754
|
// Gutter is the small gap between marker and text, not the full marker box width
|
|
40276
|
-
gutterWidthPx: LIST_MARKER_GAP
|
|
40755
|
+
gutterWidthPx: LIST_MARKER_GAP,
|
|
40277
40756
|
justification: numbering.lvlJc ?? "left",
|
|
40278
40757
|
suffix: normalizeSuffix$1(numbering.suffix) ?? "tab",
|
|
40279
40758
|
run: markerRun,
|
|
@@ -40363,7 +40842,10 @@ const hydrateParagraphStyleAttrs = (para, context, preResolved) => {
|
|
|
40363
40842
|
tabStops: cloneIfObject(resolvedExtended.tabStops),
|
|
40364
40843
|
keepLines: resolvedExtended.keepLines,
|
|
40365
40844
|
keepNext: resolvedExtended.keepNext,
|
|
40366
|
-
numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties)
|
|
40845
|
+
numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties),
|
|
40846
|
+
// Extract contextualSpacing from style resolution - this is a sibling to spacing in OOXML,
|
|
40847
|
+
// not nested within it. When true, suppresses spacing between paragraphs of the same style.
|
|
40848
|
+
contextualSpacing: resolvedExtended.contextualSpacing
|
|
40367
40849
|
};
|
|
40368
40850
|
return hydrated;
|
|
40369
40851
|
};
|
|
@@ -40965,6 +41447,31 @@ const computeWordLayoutForParagraph = (paragraphAttrs, numberingProps, styleCont
|
|
|
40965
41447
|
return null;
|
|
40966
41448
|
}
|
|
40967
41449
|
};
|
|
41450
|
+
const normalizeWordLayoutForIndent = (wordLayout, paragraphIndent) => {
|
|
41451
|
+
const resolvedIndent = wordLayout.resolvedIndent ?? paragraphIndent ?? {};
|
|
41452
|
+
const indentLeft = isFiniteNumber(resolvedIndent.left) ? resolvedIndent.left : 0;
|
|
41453
|
+
const firstLine = isFiniteNumber(resolvedIndent.firstLine) ? resolvedIndent.firstLine : 0;
|
|
41454
|
+
const hanging = isFiniteNumber(resolvedIndent.hanging) ? resolvedIndent.hanging : 0;
|
|
41455
|
+
const shouldFirstLineIndentMode = firstLine > 0 && !hanging;
|
|
41456
|
+
if (wordLayout.firstLineIndentMode === true && !shouldFirstLineIndentMode) {
|
|
41457
|
+
wordLayout.firstLineIndentMode = false;
|
|
41458
|
+
}
|
|
41459
|
+
if (wordLayout.firstLineIndentMode === true) {
|
|
41460
|
+
if (isFiniteNumber(wordLayout.textStartPx)) {
|
|
41461
|
+
if (wordLayout.marker && (!isFiniteNumber(wordLayout.marker.textStartX) || wordLayout.marker.textStartX !== wordLayout.textStartPx)) {
|
|
41462
|
+
wordLayout.marker.textStartX = wordLayout.textStartPx;
|
|
41463
|
+
}
|
|
41464
|
+
} else if (wordLayout.marker && isFiniteNumber(wordLayout.marker.textStartX)) {
|
|
41465
|
+
wordLayout.textStartPx = wordLayout.marker.textStartX;
|
|
41466
|
+
}
|
|
41467
|
+
} else {
|
|
41468
|
+
wordLayout.textStartPx = indentLeft;
|
|
41469
|
+
if (wordLayout.marker) {
|
|
41470
|
+
wordLayout.marker.textStartX = indentLeft;
|
|
41471
|
+
}
|
|
41472
|
+
}
|
|
41473
|
+
return wordLayout;
|
|
41474
|
+
};
|
|
40968
41475
|
const computeParagraphAttrs = (para, styleContext, listCounterContext, converterContext, hydrationOverride) => {
|
|
40969
41476
|
const attrs = para.attrs ?? {};
|
|
40970
41477
|
const paragraphProps = typeof attrs.paragraphProperties === "object" && attrs.paragraphProperties !== null ? attrs.paragraphProperties : {};
|
|
@@ -41073,7 +41580,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
41073
41580
|
paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
|
|
41074
41581
|
}
|
|
41075
41582
|
}
|
|
41076
|
-
const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
|
|
41583
|
+
const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing") ?? hydrated?.contextualSpacing;
|
|
41077
41584
|
if (contextualSpacingValue != null) {
|
|
41078
41585
|
paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
|
|
41079
41586
|
}
|
|
@@ -41287,8 +41794,11 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
41287
41794
|
let wordLayout = computeWordLayoutForParagraph(paragraphAttrs, enrichedNumberingProps, styleContext);
|
|
41288
41795
|
if (!wordLayout && enrichedNumberingProps.resolvedLevelIndent) {
|
|
41289
41796
|
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
41290
|
-
const
|
|
41291
|
-
|
|
41797
|
+
const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
|
|
41798
|
+
const mergedIndent = { ...baseIndent, ...paragraphAttrs.indent ?? {} };
|
|
41799
|
+
const firstLinePx = isFiniteNumber(mergedIndent.firstLine) ? mergedIndent.firstLine : 0;
|
|
41800
|
+
const hangingPx = isFiniteNumber(mergedIndent.hanging) ? mergedIndent.hanging : 0;
|
|
41801
|
+
if (firstLinePx > 0 && !hangingPx) {
|
|
41292
41802
|
wordLayout = {
|
|
41293
41803
|
// Treat as first-line-indent mode: text starts after the marker+firstLine offset.
|
|
41294
41804
|
firstLineIndentMode: true,
|
|
@@ -41296,10 +41806,13 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
41296
41806
|
};
|
|
41297
41807
|
}
|
|
41298
41808
|
}
|
|
41299
|
-
if (wordLayout &&
|
|
41809
|
+
if (wordLayout && !Number.isFinite(wordLayout.textStartPx) && enrichedNumberingProps.resolvedLevelIndent) {
|
|
41300
41810
|
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
41301
|
-
const
|
|
41302
|
-
|
|
41811
|
+
const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
|
|
41812
|
+
const mergedIndent = { ...baseIndent, ...paragraphAttrs.indent ?? {} };
|
|
41813
|
+
const firstLinePx = isFiniteNumber(mergedIndent.firstLine) ? mergedIndent.firstLine : 0;
|
|
41814
|
+
const hangingPx = isFiniteNumber(mergedIndent.hanging) ? mergedIndent.hanging : 0;
|
|
41815
|
+
if (firstLinePx > 0 && !hangingPx) {
|
|
41303
41816
|
wordLayout = {
|
|
41304
41817
|
...wordLayout,
|
|
41305
41818
|
firstLineIndentMode: wordLayout.firstLineIndentMode ?? true,
|
|
@@ -41319,6 +41832,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
41319
41832
|
wordLayout.marker.suffix = listRendering.suffix;
|
|
41320
41833
|
}
|
|
41321
41834
|
}
|
|
41835
|
+
wordLayout = normalizeWordLayoutForIndent(wordLayout, paragraphAttrs.indent);
|
|
41322
41836
|
paragraphAttrs.wordLayout = wordLayout;
|
|
41323
41837
|
}
|
|
41324
41838
|
if (enrichedNumberingProps.resolvedLevelIndent) {
|
|
@@ -45552,11 +46066,6 @@ function initHeaderFooterRegistry({
|
|
|
45552
46066
|
cleanups
|
|
45553
46067
|
};
|
|
45554
46068
|
}
|
|
45555
|
-
const LIST_MARKER_GAP = 8;
|
|
45556
|
-
const MIN_MARKER_GUTTER = 24;
|
|
45557
|
-
const DEFAULT_LIST_INDENT_BASE_PX = 24;
|
|
45558
|
-
const DEFAULT_LIST_INDENT_STEP_PX = 24;
|
|
45559
|
-
const DEFAULT_LIST_HANGING_PX = 18;
|
|
45560
46069
|
function calculateRotatedBounds(input) {
|
|
45561
46070
|
const width = Math.max(0, input.width);
|
|
45562
46071
|
const height = Math.max(0, input.height);
|
|
@@ -45726,7 +46235,7 @@ function measureText(text, font, ctx2, _fontFamily, _letterSpacing) {
|
|
|
45726
46235
|
return Math.max(advanceWidth, paintedWidth);
|
|
45727
46236
|
}
|
|
45728
46237
|
const MIN_SINGLE_LINE_PX = 12 * 96 / 72;
|
|
45729
|
-
const
|
|
46238
|
+
const WORD_SINGLE_LINE_SPACING_MULTIPLIER = 1.15;
|
|
45730
46239
|
function calculateTypographyMetrics(fontSize, spacing, fontInfo) {
|
|
45731
46240
|
let ascent;
|
|
45732
46241
|
let descent;
|
|
@@ -45739,7 +46248,7 @@ function calculateTypographyMetrics(fontSize, spacing, fontInfo) {
|
|
|
45739
46248
|
ascent = roundValue(fontSize * 0.8);
|
|
45740
46249
|
descent = roundValue(fontSize * 0.2);
|
|
45741
46250
|
}
|
|
45742
|
-
const baseLineHeight = Math.max(ascent + descent
|
|
46251
|
+
const baseLineHeight = Math.max(fontSize * WORD_SINGLE_LINE_SPACING_MULTIPLIER, ascent + descent, MIN_SINGLE_LINE_PX);
|
|
45743
46252
|
const lineHeight = roundValue(resolveLineHeight(spacing, baseLineHeight));
|
|
45744
46253
|
return {
|
|
45745
46254
|
ascent,
|
|
@@ -45820,8 +46329,25 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
45820
46329
|
const rawTextStartPx = wordLayout?.textStartPx;
|
|
45821
46330
|
const markerTextStartX = wordLayout?.marker?.textStartX;
|
|
45822
46331
|
const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof rawTextStartPx === "number" && Number.isFinite(rawTextStartPx) ? rawTextStartPx : void 0;
|
|
45823
|
-
|
|
45824
|
-
|
|
46332
|
+
const resolvedTextStartPx = resolveListTextStartPx(
|
|
46333
|
+
wordLayout,
|
|
46334
|
+
indentLeft,
|
|
46335
|
+
firstLine,
|
|
46336
|
+
hanging,
|
|
46337
|
+
(markerText, marker) => {
|
|
46338
|
+
const markerRun = {
|
|
46339
|
+
fontFamily: toCssFontFamily(marker.run?.fontFamily) ?? marker.run?.fontFamily ?? "Arial",
|
|
46340
|
+
fontSize: marker.run?.fontSize ?? 16,
|
|
46341
|
+
bold: marker.run?.bold ?? false,
|
|
46342
|
+
italic: marker.run?.italic ?? false
|
|
46343
|
+
};
|
|
46344
|
+
const { font: markerFont } = buildFontString(markerRun);
|
|
46345
|
+
return measureText(markerText, markerFont, ctx2);
|
|
46346
|
+
}
|
|
46347
|
+
);
|
|
46348
|
+
const effectiveTextStartPx = resolvedTextStartPx ?? textStartPx;
|
|
46349
|
+
if (typeof effectiveTextStartPx === "number" && effectiveTextStartPx > indentLeft) {
|
|
46350
|
+
initialAvailableWidth = Math.max(1, maxWidth - effectiveTextStartPx - indentRight);
|
|
45825
46351
|
} else {
|
|
45826
46352
|
initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
|
|
45827
46353
|
}
|
|
@@ -45908,7 +46434,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
45908
46434
|
pendingTabAlignment = null;
|
|
45909
46435
|
return startX;
|
|
45910
46436
|
};
|
|
45911
|
-
const alignSegmentAtTab = (segmentText, font, runContext) => {
|
|
46437
|
+
const alignSegmentAtTab = (segmentText, font, runContext, segmentStartChar) => {
|
|
45912
46438
|
if (!pendingTabAlignment || !currentLine) return void 0;
|
|
45913
46439
|
const { val } = pendingTabAlignment;
|
|
45914
46440
|
let segmentWidth = 0;
|
|
@@ -45917,11 +46443,11 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
45917
46443
|
const idx = segmentText.indexOf(decimalSeparator);
|
|
45918
46444
|
if (idx >= 0) {
|
|
45919
46445
|
const beforeText = segmentText.slice(0, idx);
|
|
45920
|
-
beforeDecimalWidth = beforeText.length > 0 ? measureRunWidth(beforeText, font, ctx2, runContext) : 0;
|
|
46446
|
+
beforeDecimalWidth = beforeText.length > 0 ? measureRunWidth(beforeText, font, ctx2, runContext, segmentStartChar) : 0;
|
|
45921
46447
|
}
|
|
45922
|
-
segmentWidth = segmentText.length > 0 ? measureRunWidth(segmentText, font, ctx2, runContext) : 0;
|
|
46448
|
+
segmentWidth = segmentText.length > 0 ? measureRunWidth(segmentText, font, ctx2, runContext, segmentStartChar) : 0;
|
|
45923
46449
|
} else if (val === "end" || val === "center") {
|
|
45924
|
-
segmentWidth = segmentText.length > 0 ? measureRunWidth(segmentText, font, ctx2, runContext) : 0;
|
|
46450
|
+
segmentWidth = segmentText.length > 0 ? measureRunWidth(segmentText, font, ctx2, runContext, segmentStartChar) : 0;
|
|
45925
46451
|
}
|
|
45926
46452
|
return alignPendingTabForWidth(segmentWidth, beforeDecimalWidth);
|
|
45927
46453
|
};
|
|
@@ -45973,8 +46499,8 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
45973
46499
|
const { font } = buildFontString(
|
|
45974
46500
|
lastRun
|
|
45975
46501
|
);
|
|
45976
|
-
const fullWidth = measureRunWidth(sliceText, font, ctx2, lastRun);
|
|
45977
|
-
const keptWidth = keptText.length > 0 ? measureRunWidth(keptText, font, ctx2, lastRun) : 0;
|
|
46502
|
+
const fullWidth = measureRunWidth(sliceText, font, ctx2, lastRun, sliceStart);
|
|
46503
|
+
const keptWidth = keptText.length > 0 ? measureRunWidth(keptText, font, ctx2, lastRun, sliceStart) : 0;
|
|
45978
46504
|
const delta = Math.max(0, fullWidth - keptWidth);
|
|
45979
46505
|
lineToTrim.width = roundValue(Math.max(0, lineToTrim.width - delta));
|
|
45980
46506
|
lineToTrim.spaceCount = Math.max(0, lineToTrim.spaceCount - trimCount);
|
|
@@ -46185,7 +46711,8 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
46185
46711
|
continue;
|
|
46186
46712
|
}
|
|
46187
46713
|
if (isFieldAnnotationRun(run)) {
|
|
46188
|
-
const
|
|
46714
|
+
const rawDisplayText = run.displayLabel || "";
|
|
46715
|
+
const displayText = applyTextTransform(rawDisplayText, run);
|
|
46189
46716
|
const annotationFontSize = typeof run.fontSize === "number" ? run.fontSize : typeof run.fontSize === "string" ? parseFloat(run.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
46190
46717
|
const annotationFontFamily = run.fontFamily || "Arial, sans-serif";
|
|
46191
46718
|
const fontWeight = run.bold ? "bold" : "normal";
|
|
@@ -46288,7 +46815,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
46288
46815
|
const spacesLength = segment.length;
|
|
46289
46816
|
const spacesStartChar = charPosInRun;
|
|
46290
46817
|
const spacesEndChar = charPosInRun + spacesLength;
|
|
46291
|
-
const spacesWidth = measureRunWidth(segment, font, ctx2, run);
|
|
46818
|
+
const spacesWidth = measureRunWidth(segment, font, ctx2, run, spacesStartChar);
|
|
46292
46819
|
if (!currentLine) {
|
|
46293
46820
|
currentLine = {
|
|
46294
46821
|
fromRun: runIndex,
|
|
@@ -46352,7 +46879,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
46352
46879
|
}
|
|
46353
46880
|
let segmentStartX;
|
|
46354
46881
|
if (currentLine && pendingTabAlignment) {
|
|
46355
|
-
segmentStartX = alignSegmentAtTab(segment, font, run);
|
|
46882
|
+
segmentStartX = alignSegmentAtTab(segment, font, run, charPosInRun);
|
|
46356
46883
|
if (segmentStartX == null) {
|
|
46357
46884
|
segmentStartX = currentLine.width;
|
|
46358
46885
|
}
|
|
@@ -46362,7 +46889,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
46362
46889
|
if (word2 === "") {
|
|
46363
46890
|
const spaceStartChar = charPosInRun;
|
|
46364
46891
|
const spaceEndChar = charPosInRun + 1;
|
|
46365
|
-
const singleSpaceWidth = measureRunWidth(" ", font, ctx2, run);
|
|
46892
|
+
const singleSpaceWidth = measureRunWidth(" ", font, ctx2, run, spaceStartChar);
|
|
46366
46893
|
if (!currentLine) {
|
|
46367
46894
|
currentLine = {
|
|
46368
46895
|
fromRun: runIndex,
|
|
@@ -46413,12 +46940,12 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
46413
46940
|
charPosInRun = spaceEndChar;
|
|
46414
46941
|
continue;
|
|
46415
46942
|
}
|
|
46416
|
-
const wordOnlyWidth = measureRunWidth(word2, font, ctx2, run);
|
|
46417
|
-
const shouldIncludeDelimiterSpace = wordIndex < lastNonEmptyWordIndex;
|
|
46418
|
-
const spaceWidth = shouldIncludeDelimiterSpace ? measureRunWidth(" ", font, ctx2, run) : 0;
|
|
46419
|
-
const wordCommitWidth = wordOnlyWidth + spaceWidth;
|
|
46420
46943
|
const wordStartChar = charPosInRun;
|
|
46944
|
+
const wordOnlyWidth = measureRunWidth(word2, font, ctx2, run, wordStartChar);
|
|
46945
|
+
const shouldIncludeDelimiterSpace = wordIndex < lastNonEmptyWordIndex;
|
|
46421
46946
|
const wordEndNoSpace = charPosInRun + word2.length;
|
|
46947
|
+
const spaceWidth = shouldIncludeDelimiterSpace ? measureRunWidth(" ", font, ctx2, run, wordEndNoSpace) : 0;
|
|
46948
|
+
const wordCommitWidth = wordOnlyWidth + spaceWidth;
|
|
46422
46949
|
const wordEndWithSpace = wordEndNoSpace + (shouldIncludeDelimiterSpace ? 1 : 0);
|
|
46423
46950
|
const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
46424
46951
|
if (wordOnlyWidth > effectiveMaxWidth && word2.length > 1) {
|
|
@@ -46437,7 +46964,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
46437
46964
|
const hasTabOnlyLine = currentLine && currentLine.segments && currentLine.segments.length === 0 && currentLine.width > 0;
|
|
46438
46965
|
const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
|
|
46439
46966
|
const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
|
|
46440
|
-
const chunks = breakWordIntoChunks(word2, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run);
|
|
46967
|
+
const chunks = breakWordIntoChunks(word2, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run, wordStartChar);
|
|
46441
46968
|
let chunkCharOffset = wordStartChar;
|
|
46442
46969
|
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
46443
46970
|
const chunk = chunks[chunkIndex];
|
|
@@ -46561,7 +47088,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
46561
47088
|
if (candidateSpaces > 0) {
|
|
46562
47089
|
const overflow = totalWidthWithWord - availableWidth;
|
|
46563
47090
|
if (overflow > 0) {
|
|
46564
|
-
const baseSpaceWidth = spaceWidth || measureRunWidth(" ", font, ctx2, run) || Math.max(1, boundarySpacing);
|
|
47091
|
+
const baseSpaceWidth = spaceWidth || measureRunWidth(" ", font, ctx2, run, wordEndNoSpace) || Math.max(1, boundarySpacing);
|
|
46565
47092
|
const perSpaceCompression = overflow / candidateSpaces;
|
|
46566
47093
|
const maxPerSpaceCompression = baseSpaceWidth * 0.25;
|
|
46567
47094
|
if (perSpaceCompression <= maxPerSpaceCompression) {
|
|
@@ -46736,8 +47263,8 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
46736
47263
|
const { font: markerFont } = buildFontString(markerRun);
|
|
46737
47264
|
const markerText = wordLayout.marker.markerText ?? "";
|
|
46738
47265
|
const glyphWidth = markerText ? measureText(markerText, markerFont, ctx2) : 0;
|
|
46739
|
-
const gutter = typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx >= 0 ? wordLayout.marker.gutterWidthPx : LIST_MARKER_GAP;
|
|
46740
|
-
const markerBoxWidth = Math.max(wordLayout.marker.markerBoxWidthPx ?? 0, glyphWidth + LIST_MARKER_GAP);
|
|
47266
|
+
const gutter = typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx >= 0 ? wordLayout.marker.gutterWidthPx : LIST_MARKER_GAP$1;
|
|
47267
|
+
const markerBoxWidth = Math.max(wordLayout.marker.markerBoxWidthPx ?? 0, glyphWidth + LIST_MARKER_GAP$1);
|
|
46741
47268
|
markerInfo = {
|
|
46742
47269
|
markerWidth: markerBoxWidth,
|
|
46743
47270
|
markerTextWidth: glyphWidth,
|
|
@@ -47081,7 +47608,7 @@ async function measureListBlock(block, constraints) {
|
|
|
47081
47608
|
markerTextWidth = markerText ? measureText(markerText, markerFont, ctx2) : 0;
|
|
47082
47609
|
indentLeft = resolveIndentLeft(item);
|
|
47083
47610
|
const indentHanging = resolveIndentHanging(item);
|
|
47084
|
-
markerWidth = Math.max(MIN_MARKER_GUTTER, markerTextWidth + LIST_MARKER_GAP, indentHanging);
|
|
47611
|
+
markerWidth = Math.max(MIN_MARKER_GUTTER, markerTextWidth + LIST_MARKER_GAP$1, indentHanging);
|
|
47085
47612
|
}
|
|
47086
47613
|
const paragraphWidth = Math.max(1, constraints.maxWidth - indentLeft - markerWidth);
|
|
47087
47614
|
const paragraphMeasure = await measureParagraphBlock(item.paragraph, paragraphWidth);
|
|
@@ -47107,16 +47634,46 @@ const getPrimaryRun = (paragraph) => {
|
|
|
47107
47634
|
fontSize: 16
|
|
47108
47635
|
};
|
|
47109
47636
|
};
|
|
47110
|
-
const
|
|
47637
|
+
const isWordChar = (char) => {
|
|
47638
|
+
if (!char) return false;
|
|
47639
|
+
const code = char.charCodeAt(0);
|
|
47640
|
+
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || char === "'";
|
|
47641
|
+
};
|
|
47642
|
+
const capitalizeText = (text, fullText, startOffset) => {
|
|
47643
|
+
if (!text) return text;
|
|
47644
|
+
const hasFullText = typeof startOffset === "number" && fullText != null;
|
|
47645
|
+
let result = "";
|
|
47646
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
47647
|
+
const prevChar = hasFullText ? startOffset + i > 0 ? fullText[startOffset + i - 1] : "" : i > 0 ? text[i - 1] : "";
|
|
47648
|
+
const ch = text[i];
|
|
47649
|
+
result += isWordChar(ch) && !isWordChar(prevChar) ? ch.toUpperCase() : ch;
|
|
47650
|
+
}
|
|
47651
|
+
return result;
|
|
47652
|
+
};
|
|
47653
|
+
const applyTextTransform = (text, run, startOffset) => {
|
|
47654
|
+
const transform = "textTransform" in run ? run.textTransform : void 0;
|
|
47655
|
+
if (!text || !transform || transform === "none") return text;
|
|
47656
|
+
if (transform === "uppercase") return text.toUpperCase();
|
|
47657
|
+
if (transform === "lowercase") return text.toLowerCase();
|
|
47658
|
+
if (transform === "capitalize") {
|
|
47659
|
+
const fullText = "text" in run && typeof run.text === "string" ? run.text : text;
|
|
47660
|
+
return capitalizeText(text, fullText, startOffset);
|
|
47661
|
+
}
|
|
47662
|
+
return text;
|
|
47663
|
+
};
|
|
47664
|
+
const measureRunWidth = (text, font, ctx2, run, startOffset) => {
|
|
47111
47665
|
const letterSpacing = run.kind === "text" || run.kind === void 0 ? run.letterSpacing || 0 : 0;
|
|
47112
|
-
const
|
|
47666
|
+
const displayText = applyTextTransform(text, run, startOffset);
|
|
47667
|
+
const width = getMeasuredTextWidth(displayText, font, letterSpacing, ctx2);
|
|
47113
47668
|
return roundValue(width);
|
|
47114
47669
|
};
|
|
47115
|
-
const breakWordIntoChunks = (word2, maxWidth, font, ctx2, run) => {
|
|
47670
|
+
const breakWordIntoChunks = (word2, maxWidth, font, ctx2, run, startOffset) => {
|
|
47116
47671
|
const chunks = [];
|
|
47672
|
+
const baseOffset = typeof startOffset === "number" ? startOffset : 0;
|
|
47117
47673
|
if (maxWidth <= 0) {
|
|
47118
|
-
for (
|
|
47119
|
-
const
|
|
47674
|
+
for (let i = 0; i < word2.length; i++) {
|
|
47675
|
+
const char = word2[i];
|
|
47676
|
+
const charWidth = measureRunWidth(char, font, ctx2, run, baseOffset + i);
|
|
47120
47677
|
chunks.push({ text: char, width: charWidth });
|
|
47121
47678
|
}
|
|
47122
47679
|
return chunks;
|
|
@@ -47126,11 +47683,11 @@ const breakWordIntoChunks = (word2, maxWidth, font, ctx2, run) => {
|
|
|
47126
47683
|
for (let i = 0; i < word2.length; i++) {
|
|
47127
47684
|
const char = word2[i];
|
|
47128
47685
|
const testChunk = currentChunk + char;
|
|
47129
|
-
const testWidth = measureRunWidth(testChunk, font, ctx2, run);
|
|
47686
|
+
const testWidth = measureRunWidth(testChunk, font, ctx2, run, baseOffset);
|
|
47130
47687
|
if (testWidth > maxWidth && currentChunk.length > 0) {
|
|
47131
47688
|
chunks.push({ text: currentChunk, width: currentWidth });
|
|
47132
47689
|
currentChunk = char;
|
|
47133
|
-
currentWidth = measureRunWidth(char, font, ctx2, run);
|
|
47690
|
+
currentWidth = measureRunWidth(char, font, ctx2, run, baseOffset + i);
|
|
47134
47691
|
} else {
|
|
47135
47692
|
currentChunk = testChunk;
|
|
47136
47693
|
currentWidth = testWidth;
|
|
@@ -47184,12 +47741,13 @@ const measureDropCap = (ctx2, descriptor, spacing) => {
|
|
|
47184
47741
|
italic: run.italic
|
|
47185
47742
|
});
|
|
47186
47743
|
ctx2.font = font;
|
|
47187
|
-
const
|
|
47744
|
+
const displayText = applyTextTransform(run.text, run);
|
|
47745
|
+
const metrics = ctx2.measureText(displayText);
|
|
47188
47746
|
const advanceWidth = metrics.width;
|
|
47189
47747
|
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
47190
47748
|
const textWidth = Math.max(advanceWidth, paintedWidth);
|
|
47191
47749
|
const width = roundValue(textWidth + DROP_CAP_PADDING_PX);
|
|
47192
|
-
const baseLineHeight = resolveLineHeight(spacing, run.fontSize *
|
|
47750
|
+
const baseLineHeight = resolveLineHeight(spacing, run.fontSize * WORD_SINGLE_LINE_SPACING_MULTIPLIER);
|
|
47193
47751
|
const height = roundValue(baseLineHeight * lines);
|
|
47194
47752
|
return {
|
|
47195
47753
|
width,
|
|
@@ -47210,7 +47768,7 @@ const resolveIndentHanging = (item) => {
|
|
|
47210
47768
|
if (indentHanging > 0) {
|
|
47211
47769
|
return indentHanging;
|
|
47212
47770
|
}
|
|
47213
|
-
return DEFAULT_LIST_HANGING_PX;
|
|
47771
|
+
return DEFAULT_LIST_HANGING_PX$1;
|
|
47214
47772
|
};
|
|
47215
47773
|
const buildTabStopsPx = (indent, tabs, tabIntervalTwips) => {
|
|
47216
47774
|
const paragraphIndentTwips = {
|
|
@@ -47432,6 +47990,9 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
47432
47990
|
if (event.button !== 0) {
|
|
47433
47991
|
return;
|
|
47434
47992
|
}
|
|
47993
|
+
if (event.ctrlKey && navigator.platform.includes("Mac")) {
|
|
47994
|
+
return;
|
|
47995
|
+
}
|
|
47435
47996
|
__privateSet(this, _pendingMarginClick, null);
|
|
47436
47997
|
const target = event.target;
|
|
47437
47998
|
if (target?.closest?.(".superdoc-ruler-handle") != null) {
|
|
@@ -53357,6 +53918,8 @@ const SlashMenu = Extension.create({
|
|
|
53357
53918
|
const cbRect = containingBlock.getBoundingClientRect();
|
|
53358
53919
|
left2 -= cbRect.left;
|
|
53359
53920
|
top2 -= cbRect.top;
|
|
53921
|
+
left2 += containingBlock.scrollLeft || 0;
|
|
53922
|
+
top2 += containingBlock.scrollTop || 0;
|
|
53360
53923
|
} catch (error) {
|
|
53361
53924
|
console.warn("SlashMenu: Failed to adjust for containing block", error);
|
|
53362
53925
|
}
|
|
@@ -69660,19 +70223,20 @@ const getStarterExtensions = () => {
|
|
|
69660
70223
|
];
|
|
69661
70224
|
};
|
|
69662
70225
|
export {
|
|
69663
|
-
|
|
69664
|
-
|
|
69665
|
-
index as C,
|
|
70226
|
+
Extension as A,
|
|
70227
|
+
Attribute as B,
|
|
70228
|
+
index$1 as C,
|
|
69666
70229
|
DecorationSet as D,
|
|
69667
70230
|
Editor as E,
|
|
69668
|
-
|
|
69669
|
-
|
|
69670
|
-
|
|
69671
|
-
|
|
70231
|
+
index as F,
|
|
70232
|
+
AnnotatorHelpers as G,
|
|
70233
|
+
SectionHelpers as H,
|
|
70234
|
+
getAllowedImageDimensions as I,
|
|
70235
|
+
CommentsPluginKey as J,
|
|
69672
70236
|
Mark as M,
|
|
69673
70237
|
Node$1 as N,
|
|
69674
70238
|
PresentationEditor as P,
|
|
69675
|
-
|
|
70239
|
+
SLASH_MENU_HANDLED_FLAG as S,
|
|
69676
70240
|
TrackChangesBasePluginKey as T,
|
|
69677
70241
|
_export_sfc as _,
|
|
69678
70242
|
getQuickFormatList as a,
|
|
@@ -69687,18 +70251,18 @@ export {
|
|
|
69687
70251
|
redoDepth as j,
|
|
69688
70252
|
getEditorSurfaceElement as k,
|
|
69689
70253
|
collectTrackedChangesForContext as l,
|
|
69690
|
-
|
|
69691
|
-
|
|
69692
|
-
|
|
69693
|
-
|
|
69694
|
-
|
|
70254
|
+
SlashMenuPluginKey as m,
|
|
70255
|
+
generateRulerDefinition as n,
|
|
70256
|
+
clampHandlePosition as o,
|
|
70257
|
+
calculateMarginFromHandle as p,
|
|
70258
|
+
measureCache as q,
|
|
69695
70259
|
replaceSelectionWithImagePlaceholder as r,
|
|
69696
70260
|
shouldBypassContextMenu as s,
|
|
69697
|
-
|
|
70261
|
+
isHeadless as t,
|
|
69698
70262
|
useHighContrastMode as u,
|
|
69699
|
-
|
|
69700
|
-
|
|
69701
|
-
|
|
70263
|
+
getStarterExtensions as v,
|
|
70264
|
+
Placeholder as w,
|
|
70265
|
+
getRichTextExtensions as x,
|
|
69702
70266
|
yUndoPluginKey as y,
|
|
69703
|
-
|
|
70267
|
+
Decoration as z
|
|
69704
70268
|
};
|