@harbour-enterprises/superdoc 1.0.0-beta.96 → 1.0.0-beta.97
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-Cdp1WJ9e.es.js → PdfViewer-BHcBfUWj.es.js} +1 -1
- package/dist/chunks/{PdfViewer-BGTfnD4T.cjs → PdfViewer-YvkZg201.cjs} +1 -1
- package/dist/chunks/{index-C-IS20yQ.cjs → index-DZ_AI-HW.cjs} +3 -3
- package/dist/chunks/{index-BV9YtiyI.es.js → index-DeQfFbTb.es.js} +3 -3
- package/dist/chunks/{index-lfdM_gm7-qtx-V4oF.cjs → index-Pvlqsxge-IH3eauKE.cjs} +1 -1
- package/dist/chunks/{index-lfdM_gm7-_EQjLyqH.es.js → index-Pvlqsxge-vW641SZt.es.js} +1 -1
- package/dist/chunks/{super-editor.es-D2zn943K.cjs → super-editor.es-BP3PKkwh.cjs} +190 -72
- package/dist/chunks/{super-editor.es-De2XS3A1.es.js → super-editor.es-BinyZw4F.es.js} +190 -72
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B29ATZFC.js → converter-BEVM5t3i.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-BPktKUBx.js → docx-zipper-vETk3IMG.js} +1 -1
- package/dist/super-editor/chunks/{editor-BRHMYtPA.js → editor-B8k1bwD_.js} +191 -73
- package/dist/super-editor/chunks/{index-lfdM_gm7.js → index-Pvlqsxge.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CB2cJCLh.js → toolbar-j1GSUGWU.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/super-editor.es.js +6 -6
- 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 +192 -74
- 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 _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, applyDomCorrectionToRects_fn, renderCellSelectionOverlay_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-
|
|
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$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-BEVM5t3i.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-vETk3IMG.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -13952,7 +13952,7 @@ const isHeadless = (editor) => {
|
|
|
13952
13952
|
const shouldSkipNodeView = (editor) => {
|
|
13953
13953
|
return isHeadless(editor);
|
|
13954
13954
|
};
|
|
13955
|
-
const summaryVersion = "1.0.0-beta.
|
|
13955
|
+
const summaryVersion = "1.0.0-beta.97";
|
|
13956
13956
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13957
13957
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13958
13958
|
function mapAttributes(attrs) {
|
|
@@ -14744,7 +14744,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14744
14744
|
{ default: remarkStringify },
|
|
14745
14745
|
{ default: remarkGfm }
|
|
14746
14746
|
] = await Promise.all([
|
|
14747
|
-
import("./index-
|
|
14747
|
+
import("./index-Pvlqsxge.js"),
|
|
14748
14748
|
import("./index-DRCvimau.js"),
|
|
14749
14749
|
import("./index-C_x_N6Uh.js"),
|
|
14750
14750
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14949,7 +14949,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14949
14949
|
* Process collaboration migrations
|
|
14950
14950
|
*/
|
|
14951
14951
|
processCollaborationMigrations() {
|
|
14952
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
14952
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.97");
|
|
14953
14953
|
if (!this.options.ydoc) return;
|
|
14954
14954
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14955
14955
|
let docVersion = metaMap.get("version");
|
|
@@ -17361,12 +17361,12 @@ var SectionType = /* @__PURE__ */ ((SectionType2) => {
|
|
|
17361
17361
|
})(SectionType || {});
|
|
17362
17362
|
const DEFAULT_PARAGRAPH_SECTION_TYPE = "nextPage";
|
|
17363
17363
|
const DEFAULT_BODY_SECTION_TYPE = "continuous";
|
|
17364
|
-
const TWIPS_PER_INCH$
|
|
17365
|
-
const PX_PER_INCH$
|
|
17364
|
+
const TWIPS_PER_INCH$4 = 1440;
|
|
17365
|
+
const PX_PER_INCH$3 = 96;
|
|
17366
17366
|
const DEFAULT_COLUMN_GAP_INCHES = 0.5;
|
|
17367
17367
|
function twipsToPixels$1(twips) {
|
|
17368
17368
|
const n = Number(twips);
|
|
17369
|
-
return Number.isFinite(n) ? n / TWIPS_PER_INCH$
|
|
17369
|
+
return Number.isFinite(n) ? n / TWIPS_PER_INCH$4 * PX_PER_INCH$3 : void 0;
|
|
17370
17370
|
}
|
|
17371
17371
|
function parseColumnCount(rawValue) {
|
|
17372
17372
|
if (rawValue == null) return 1;
|
|
@@ -17376,7 +17376,7 @@ function parseColumnCount(rawValue) {
|
|
|
17376
17376
|
function parseColumnGap(gapTwips) {
|
|
17377
17377
|
if (gapTwips == null) return DEFAULT_COLUMN_GAP_INCHES;
|
|
17378
17378
|
const gap = Number(gapTwips);
|
|
17379
|
-
return Number.isFinite(gap) ? gap / TWIPS_PER_INCH$
|
|
17379
|
+
return Number.isFinite(gap) ? gap / TWIPS_PER_INCH$4 : DEFAULT_COLUMN_GAP_INCHES;
|
|
17380
17380
|
}
|
|
17381
17381
|
function extractNormalizedMargins(attrs) {
|
|
17382
17382
|
const sectionMargins = attrs.sectionMargins;
|
|
@@ -17460,7 +17460,7 @@ function extractColumns(elements) {
|
|
|
17460
17460
|
const gapInches = parseColumnGap(cols.attributes["w:space"]);
|
|
17461
17461
|
return {
|
|
17462
17462
|
count,
|
|
17463
|
-
gap: gapInches * PX_PER_INCH$
|
|
17463
|
+
gap: gapInches * PX_PER_INCH$3
|
|
17464
17464
|
};
|
|
17465
17465
|
}
|
|
17466
17466
|
function extractVerticalAlign(elements) {
|
|
@@ -17696,8 +17696,8 @@ function analyzeSectionRanges(doc2, bodySectPr) {
|
|
|
17696
17696
|
}
|
|
17697
17697
|
return ranges;
|
|
17698
17698
|
}
|
|
17699
|
-
const TWIPS_PER_INCH$
|
|
17700
|
-
const PX_PER_INCH$
|
|
17699
|
+
const TWIPS_PER_INCH$3 = 1440;
|
|
17700
|
+
const PX_PER_INCH$2 = 96;
|
|
17701
17701
|
const PX_PER_PT = 96 / 72;
|
|
17702
17702
|
SectionType.NEXT_PAGE;
|
|
17703
17703
|
SectionType.CONTINUOUS;
|
|
@@ -17836,7 +17836,7 @@ const applyTrackedChangesModeToRuns = (runs, config, hyperlinkConfig, applyMarks
|
|
|
17836
17836
|
}
|
|
17837
17837
|
return filtered;
|
|
17838
17838
|
};
|
|
17839
|
-
const twipsToPx$
|
|
17839
|
+
const twipsToPx$2 = (value) => value / TWIPS_PER_INCH$3 * PX_PER_INCH$2;
|
|
17840
17840
|
const ptToPx = (pt) => {
|
|
17841
17841
|
if (pt == null || !Number.isFinite(pt)) return void 0;
|
|
17842
17842
|
return pt * PX_PER_PT;
|
|
@@ -19346,8 +19346,8 @@ const normalizeParagraphSpacing = (value) => {
|
|
|
19346
19346
|
const beforeAutospacing = toBooleanFlag(source.beforeAutospacing ?? source.beforeAutoSpacing);
|
|
19347
19347
|
const afterAutospacing = toBooleanFlag(source.afterAutospacing ?? source.afterAutoSpacing);
|
|
19348
19348
|
const contextualSpacing = toBooleanFlag(source.contextualSpacing);
|
|
19349
|
-
const before = beforeRaw != null ? twipsToPx$
|
|
19350
|
-
const after = afterRaw != null ? twipsToPx$
|
|
19349
|
+
const before = beforeRaw != null ? twipsToPx$2(beforeRaw) : pickNumber(source.lineSpaceBefore);
|
|
19350
|
+
const after = afterRaw != null ? twipsToPx$2(afterRaw) : pickNumber(source.lineSpaceAfter);
|
|
19351
19351
|
const line = normalizeLineValue(lineRaw, lineRule);
|
|
19352
19352
|
if (before != null) spacing.before = before;
|
|
19353
19353
|
if (after != null) spacing.after = after;
|
|
@@ -19377,9 +19377,9 @@ const normalizeLineValue = (value, lineRule) => {
|
|
|
19377
19377
|
if (value > 0 && value <= MAX_AUTO_LINE_MULTIPLIER) {
|
|
19378
19378
|
return value;
|
|
19379
19379
|
}
|
|
19380
|
-
return twipsToPx$
|
|
19380
|
+
return twipsToPx$2(value);
|
|
19381
19381
|
}
|
|
19382
|
-
return twipsToPx$
|
|
19382
|
+
return twipsToPx$2(value);
|
|
19383
19383
|
};
|
|
19384
19384
|
const normalizeLineRule = (value) => {
|
|
19385
19385
|
if (value === "auto" || value === "exact" || value === "atLeast") {
|
|
@@ -19416,7 +19416,7 @@ const normalizeParagraphIndent = (value) => {
|
|
|
19416
19416
|
if (Math.abs(num) <= TWIPS_THRESHOLD$1) {
|
|
19417
19417
|
return num;
|
|
19418
19418
|
}
|
|
19419
|
-
return twipsToPx$
|
|
19419
|
+
return twipsToPx$2(Number(num));
|
|
19420
19420
|
};
|
|
19421
19421
|
const left2 = convert(pickNumber(source.left));
|
|
19422
19422
|
const right2 = convert(pickNumber(source.right));
|
|
@@ -19996,9 +19996,9 @@ const buildFontCss = (run) => {
|
|
|
19996
19996
|
const family = run.fontFamily ?? "Times New Roman";
|
|
19997
19997
|
return `${style}${weight}${size} ${family}`;
|
|
19998
19998
|
};
|
|
19999
|
-
const TWIPS_PER_INCH$
|
|
19999
|
+
const TWIPS_PER_INCH$2 = 1440;
|
|
20000
20000
|
const PIXELS_PER_INCH = 96;
|
|
20001
|
-
const TWIPS_PER_PIXEL = Math.round(TWIPS_PER_INCH$
|
|
20001
|
+
const TWIPS_PER_PIXEL = Math.round(TWIPS_PER_INCH$2 / PIXELS_PER_INCH);
|
|
20002
20002
|
const PIXELS_PER_TWIP = 1 / TWIPS_PER_PIXEL;
|
|
20003
20003
|
const toFiniteNumber = (value) => {
|
|
20004
20004
|
if (value == null) return null;
|
|
@@ -21022,7 +21022,7 @@ const extractMarkerRun = (lvl) => {
|
|
|
21022
21022
|
}
|
|
21023
21023
|
const spacingTwips = parseNumberAttr(getAttribute(findChild(rPr, "w:spacing"), "w:val"));
|
|
21024
21024
|
if (spacingTwips != null && Number.isFinite(spacingTwips)) {
|
|
21025
|
-
run.letterSpacing = twipsToPx$
|
|
21025
|
+
run.letterSpacing = twipsToPx$2(spacingTwips);
|
|
21026
21026
|
}
|
|
21027
21027
|
return Object.keys(run).length ? run : void 0;
|
|
21028
21028
|
};
|
|
@@ -21246,10 +21246,19 @@ const buildNumberingPath = (numId, ilvl, counterValue, listCounterContext) => {
|
|
|
21246
21246
|
const convertIndentTwipsToPx = (indent) => {
|
|
21247
21247
|
if (!indent) return void 0;
|
|
21248
21248
|
const result = {};
|
|
21249
|
-
|
|
21250
|
-
|
|
21251
|
-
|
|
21252
|
-
|
|
21249
|
+
const toNum = (v) => {
|
|
21250
|
+
if (typeof v === "string" && v.trim() !== "" && isFinite(Number(v))) return Number(v);
|
|
21251
|
+
if (isFiniteNumber(v)) return Number(v);
|
|
21252
|
+
return void 0;
|
|
21253
|
+
};
|
|
21254
|
+
const left2 = toNum(indent.left);
|
|
21255
|
+
const right2 = toNum(indent.right);
|
|
21256
|
+
const firstLine = toNum(indent.firstLine);
|
|
21257
|
+
const hanging = toNum(indent.hanging);
|
|
21258
|
+
if (left2 != null) result.left = twipsToPx$2(left2);
|
|
21259
|
+
if (right2 != null) result.right = twipsToPx$2(right2);
|
|
21260
|
+
if (firstLine != null) result.firstLine = twipsToPx$2(firstLine);
|
|
21261
|
+
if (hanging != null) result.hanging = twipsToPx$2(hanging);
|
|
21253
21262
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
21254
21263
|
};
|
|
21255
21264
|
const toAdapterNumberingProps = (value) => {
|
|
@@ -21274,7 +21283,7 @@ const toResolvedTabStops = (tabs) => {
|
|
|
21274
21283
|
if (!stop || typeof stop.pos !== "number") continue;
|
|
21275
21284
|
const alignment = normalizeResolvedTabAlignment(stop.val);
|
|
21276
21285
|
if (!alignment) continue;
|
|
21277
|
-
const position = twipsToPx$
|
|
21286
|
+
const position = twipsToPx$2(stop.pos);
|
|
21278
21287
|
if (!Number.isFinite(position)) continue;
|
|
21279
21288
|
const resolvedStop = {
|
|
21280
21289
|
position,
|
|
@@ -21715,9 +21724,9 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
21715
21724
|
const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
|
|
21716
21725
|
if (vAnchor) frame.vAnchor = vAnchor;
|
|
21717
21726
|
const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
|
|
21718
|
-
if (xTwips != null) frame.x = twipsToPx$
|
|
21727
|
+
if (xTwips != null) frame.x = twipsToPx$2(xTwips);
|
|
21719
21728
|
const yTwips = pickNumber(framePr["w:y"] ?? framePr.y);
|
|
21720
|
-
if (yTwips != null) frame.y = twipsToPx$
|
|
21729
|
+
if (yTwips != null) frame.y = twipsToPx$2(yTwips);
|
|
21721
21730
|
if (Object.keys(frame).length > 0) {
|
|
21722
21731
|
paragraphAttrs.frame = frame;
|
|
21723
21732
|
}
|
|
@@ -21805,7 +21814,29 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
21805
21814
|
}
|
|
21806
21815
|
}
|
|
21807
21816
|
}
|
|
21808
|
-
|
|
21817
|
+
let wordLayout = computeWordLayoutForParagraph(paragraphAttrs, enrichedNumberingProps, styleContext);
|
|
21818
|
+
if (!wordLayout && enrichedNumberingProps.resolvedLevelIndent) {
|
|
21819
|
+
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
21820
|
+
const firstLinePx = resolvedIndentPx?.firstLine ?? 0;
|
|
21821
|
+
if (firstLinePx > 0) {
|
|
21822
|
+
wordLayout = {
|
|
21823
|
+
// Treat as first-line-indent mode: text starts after the marker+firstLine offset.
|
|
21824
|
+
firstLineIndentMode: true,
|
|
21825
|
+
textStartPx: firstLinePx
|
|
21826
|
+
};
|
|
21827
|
+
}
|
|
21828
|
+
}
|
|
21829
|
+
if (wordLayout && (!wordLayout.textStartPx || !Number.isFinite(wordLayout.textStartPx)) && enrichedNumberingProps.resolvedLevelIndent) {
|
|
21830
|
+
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
21831
|
+
const firstLinePx = resolvedIndentPx?.firstLine ?? 0;
|
|
21832
|
+
if (firstLinePx > 0) {
|
|
21833
|
+
wordLayout = {
|
|
21834
|
+
...wordLayout,
|
|
21835
|
+
firstLineIndentMode: wordLayout.firstLineIndentMode ?? true,
|
|
21836
|
+
textStartPx: firstLinePx
|
|
21837
|
+
};
|
|
21838
|
+
}
|
|
21839
|
+
}
|
|
21809
21840
|
if (wordLayout) {
|
|
21810
21841
|
if (wordLayout.marker) {
|
|
21811
21842
|
if (listRendering?.markerText) {
|
|
@@ -23716,7 +23747,7 @@ const measurementToPx = (value) => {
|
|
|
23716
23747
|
const entry = value;
|
|
23717
23748
|
if (typeof entry.value !== "number") return void 0;
|
|
23718
23749
|
if (!entry.type || entry.type === "px" || entry.type === "pixel") return entry.value;
|
|
23719
|
-
if (entry.type === "dxa") return twipsToPx$
|
|
23750
|
+
if (entry.type === "dxa") return twipsToPx$2(entry.value);
|
|
23720
23751
|
return void 0;
|
|
23721
23752
|
};
|
|
23722
23753
|
const normalizeTableWidth = (value) => {
|
|
@@ -23728,7 +23759,7 @@ const normalizeTableWidth = (value) => {
|
|
|
23728
23759
|
return { width: raw, type: measurement.type ?? "px" };
|
|
23729
23760
|
}
|
|
23730
23761
|
if (measurement.type === "dxa") {
|
|
23731
|
-
return { width: twipsToPx$
|
|
23762
|
+
return { width: twipsToPx$2(raw), type: "px" };
|
|
23732
23763
|
}
|
|
23733
23764
|
return { width: raw, type: measurement.type };
|
|
23734
23765
|
};
|
|
@@ -23756,13 +23787,13 @@ const extractTableStyleParagraphProps = (styleId, docx) => {
|
|
|
23756
23787
|
const line = parseIntSafe$1(attrs["w:line"]);
|
|
23757
23788
|
const rawLineRule = attrs["w:lineRule"];
|
|
23758
23789
|
const lineRule = rawLineRule === "auto" || rawLineRule === "exact" || rawLineRule === "atLeast" ? rawLineRule : void 0;
|
|
23759
|
-
if (before != null) spacing.before = twipsToPx$
|
|
23760
|
-
if (after != null) spacing.after = twipsToPx$
|
|
23790
|
+
if (before != null) spacing.before = twipsToPx$2(before);
|
|
23791
|
+
if (after != null) spacing.after = twipsToPx$2(after);
|
|
23761
23792
|
if (line != null) {
|
|
23762
23793
|
if (lineRule === "auto") {
|
|
23763
23794
|
spacing.line = line / 240;
|
|
23764
23795
|
} else {
|
|
23765
|
-
spacing.line = twipsToPx$
|
|
23796
|
+
spacing.line = twipsToPx$2(line);
|
|
23766
23797
|
}
|
|
23767
23798
|
}
|
|
23768
23799
|
if (lineRule) spacing.lineRule = lineRule;
|
|
@@ -23788,7 +23819,7 @@ const normalizeRowHeight = (rowProps) => {
|
|
|
23788
23819
|
if (rawValue == null) return void 0;
|
|
23789
23820
|
const rawRule = heightObj.rule ?? heightObj.hRule;
|
|
23790
23821
|
const rule = rawRule === "exact" || rawRule === "atLeast" || rawRule === "auto" ? rawRule : "atLeast";
|
|
23791
|
-
const valuePx = twipsToPx$
|
|
23822
|
+
const valuePx = twipsToPx$2(rawValue);
|
|
23792
23823
|
return {
|
|
23793
23824
|
value: valuePx,
|
|
23794
23825
|
rule
|
|
@@ -24038,10 +24069,10 @@ function extractFloatingTableAnchorWrap(node) {
|
|
|
24038
24069
|
anchor.alignV = floatingProps.tblpYSpec;
|
|
24039
24070
|
}
|
|
24040
24071
|
if (floatingProps.tblpX !== void 0) {
|
|
24041
|
-
anchor.offsetH = twipsToPx$
|
|
24072
|
+
anchor.offsetH = twipsToPx$2(floatingProps.tblpX);
|
|
24042
24073
|
}
|
|
24043
24074
|
if (floatingProps.tblpY !== void 0) {
|
|
24044
|
-
anchor.offsetV = twipsToPx$
|
|
24075
|
+
anchor.offsetV = twipsToPx$2(floatingProps.tblpY);
|
|
24045
24076
|
}
|
|
24046
24077
|
const hasDistances = floatingProps.leftFromText !== void 0 || floatingProps.rightFromText !== void 0 || floatingProps.topFromText !== void 0 || floatingProps.bottomFromText !== void 0;
|
|
24047
24078
|
const wrap = {
|
|
@@ -24052,16 +24083,16 @@ function extractFloatingTableAnchorWrap(node) {
|
|
|
24052
24083
|
};
|
|
24053
24084
|
if (hasDistances) {
|
|
24054
24085
|
if (floatingProps.topFromText !== void 0) {
|
|
24055
|
-
wrap.distTop = twipsToPx$
|
|
24086
|
+
wrap.distTop = twipsToPx$2(floatingProps.topFromText);
|
|
24056
24087
|
}
|
|
24057
24088
|
if (floatingProps.bottomFromText !== void 0) {
|
|
24058
|
-
wrap.distBottom = twipsToPx$
|
|
24089
|
+
wrap.distBottom = twipsToPx$2(floatingProps.bottomFromText);
|
|
24059
24090
|
}
|
|
24060
24091
|
if (floatingProps.leftFromText !== void 0) {
|
|
24061
|
-
wrap.distLeft = twipsToPx$
|
|
24092
|
+
wrap.distLeft = twipsToPx$2(floatingProps.leftFromText);
|
|
24062
24093
|
}
|
|
24063
24094
|
if (floatingProps.rightFromText !== void 0) {
|
|
24064
|
-
wrap.distRight = twipsToPx$
|
|
24095
|
+
wrap.distRight = twipsToPx$2(floatingProps.rightFromText);
|
|
24065
24096
|
}
|
|
24066
24097
|
}
|
|
24067
24098
|
return { anchor, wrap };
|
|
@@ -31234,7 +31265,7 @@ const _DomPainter = class _DomPainter {
|
|
|
31234
31265
|
}
|
|
31235
31266
|
const runsForLine = sliceRunsForLine(block, line);
|
|
31236
31267
|
const trackedConfig = this.resolveTrackedChangesConfig(block);
|
|
31237
|
-
|
|
31268
|
+
runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
|
|
31238
31269
|
if (runsForLine.length === 0) {
|
|
31239
31270
|
const span = this.doc.createElement("span");
|
|
31240
31271
|
span.innerHTML = " ";
|
|
@@ -31281,19 +31312,7 @@ const _DomPainter = class _DomPainter {
|
|
|
31281
31312
|
});
|
|
31282
31313
|
}
|
|
31283
31314
|
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
31284
|
-
|
|
31285
|
-
const shouldJustify = !skipJustify && effectiveAlignment === "justify" && !hasExplicitPositioning;
|
|
31286
|
-
if (shouldJustify) {
|
|
31287
|
-
const spaceCount = textSlices.reduce(
|
|
31288
|
-
(sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
|
|
31289
|
-
0
|
|
31290
|
-
);
|
|
31291
|
-
const slack = availableWidth - line.width;
|
|
31292
|
-
if (spaceCount > 0 && slack !== 0) {
|
|
31293
|
-
const spacingPerSpace = slack / spaceCount;
|
|
31294
|
-
el.style.wordSpacing = `${spacingPerSpace}px`;
|
|
31295
|
-
}
|
|
31296
|
-
}
|
|
31315
|
+
availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
31297
31316
|
if (hasExplicitPositioning && line.segments) {
|
|
31298
31317
|
const paraIndent = block.attrs?.indent;
|
|
31299
31318
|
const indentLeft = paraIndent?.left ?? 0;
|
|
@@ -36615,7 +36634,13 @@ function getCtx() {
|
|
|
36615
36634
|
return ctx;
|
|
36616
36635
|
}
|
|
36617
36636
|
function isTextRun(run) {
|
|
36618
|
-
|
|
36637
|
+
if (run.kind === "tab" || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation") {
|
|
36638
|
+
return false;
|
|
36639
|
+
}
|
|
36640
|
+
if ("src" in run) {
|
|
36641
|
+
return false;
|
|
36642
|
+
}
|
|
36643
|
+
return true;
|
|
36619
36644
|
}
|
|
36620
36645
|
function fontString(run) {
|
|
36621
36646
|
const textRun = isTextRun(run) ? run : null;
|
|
@@ -36628,6 +36653,42 @@ function fontString(run) {
|
|
|
36628
36653
|
function runText(run) {
|
|
36629
36654
|
return "src" in run || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation" ? "" : run.text ?? "";
|
|
36630
36655
|
}
|
|
36656
|
+
const DEFAULT_TAB_INTERVAL_TWIPS$1 = 720;
|
|
36657
|
+
const TWIPS_PER_INCH$1 = 1440;
|
|
36658
|
+
const PX_PER_INCH$1 = 96;
|
|
36659
|
+
const TWIPS_PER_PX$1 = TWIPS_PER_INCH$1 / PX_PER_INCH$1;
|
|
36660
|
+
const TAB_EPSILON$1 = 0.1;
|
|
36661
|
+
const WIDTH_FUDGE_PX = 0.5;
|
|
36662
|
+
const twipsToPx$1 = (twips) => twips / TWIPS_PER_PX$1;
|
|
36663
|
+
const pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1);
|
|
36664
|
+
const buildTabStopsPx$1 = (indent, tabs, tabIntervalTwips) => {
|
|
36665
|
+
const paragraphIndentTwips = {
|
|
36666
|
+
left: pxToTwips$1(Math.max(0, indent?.left ?? 0)),
|
|
36667
|
+
right: pxToTwips$1(Math.max(0, indent?.right ?? 0)),
|
|
36668
|
+
firstLine: pxToTwips$1(Math.max(0, indent?.firstLine ?? 0)),
|
|
36669
|
+
hanging: pxToTwips$1(Math.max(0, indent?.hanging ?? 0))
|
|
36670
|
+
};
|
|
36671
|
+
const stops = computeTabStops$1({
|
|
36672
|
+
explicitStops: tabs ?? [],
|
|
36673
|
+
defaultTabInterval: tabIntervalTwips ?? DEFAULT_TAB_INTERVAL_TWIPS$1,
|
|
36674
|
+
paragraphIndent: paragraphIndentTwips
|
|
36675
|
+
});
|
|
36676
|
+
return stops.map((stop) => ({
|
|
36677
|
+
pos: twipsToPx$1(stop.pos),
|
|
36678
|
+
val: stop.val,
|
|
36679
|
+
leader: stop.leader
|
|
36680
|
+
}));
|
|
36681
|
+
};
|
|
36682
|
+
const getNextTabStopPx$1 = (currentX, tabStops, startIndex) => {
|
|
36683
|
+
let index2 = startIndex;
|
|
36684
|
+
while (index2 < tabStops.length && tabStops[index2].pos <= currentX + TAB_EPSILON$1) {
|
|
36685
|
+
index2 += 1;
|
|
36686
|
+
}
|
|
36687
|
+
if (index2 < tabStops.length) {
|
|
36688
|
+
return { target: tabStops[index2].pos, nextIndex: index2 + 1 };
|
|
36689
|
+
}
|
|
36690
|
+
return { target: currentX + twipsToPx$1(DEFAULT_TAB_INTERVAL_TWIPS$1), nextIndex: index2 };
|
|
36691
|
+
};
|
|
36631
36692
|
function measureRunSliceWidth(run, fromChar, toChar) {
|
|
36632
36693
|
const context = getCtx();
|
|
36633
36694
|
const text = runText(run).slice(fromChar, toChar);
|
|
@@ -36651,13 +36712,38 @@ function lineHeightForRuns(runs, fromRun, toRun) {
|
|
|
36651
36712
|
return maxSize2 * 1.2;
|
|
36652
36713
|
}
|
|
36653
36714
|
function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
36715
|
+
if (!Number.isFinite(maxWidth) || maxWidth <= 0) {
|
|
36716
|
+
throw new Error(`remeasureParagraph: maxWidth must be a positive number, got ${maxWidth}`);
|
|
36717
|
+
}
|
|
36718
|
+
if (!Number.isFinite(firstLineIndent)) {
|
|
36719
|
+
throw new Error(`remeasureParagraph: firstLineIndent must be a finite number, got ${firstLineIndent}`);
|
|
36720
|
+
}
|
|
36721
|
+
if (!block) {
|
|
36722
|
+
throw new Error("remeasureParagraph: block must be defined");
|
|
36723
|
+
}
|
|
36724
|
+
if (!Array.isArray(block.runs)) {
|
|
36725
|
+
throw new Error(`remeasureParagraph: block.runs must be an array, got ${typeof block.runs}`);
|
|
36726
|
+
}
|
|
36654
36727
|
const runs = block.runs ?? [];
|
|
36655
36728
|
const lines = [];
|
|
36729
|
+
const attrs = block.attrs;
|
|
36730
|
+
const indent = attrs?.indent;
|
|
36731
|
+
const wordLayout = attrs?.wordLayout;
|
|
36732
|
+
const indentLeft = Math.max(0, indent?.left ?? 0);
|
|
36733
|
+
const indentRight = Math.max(0, indent?.right ?? 0);
|
|
36734
|
+
const indentFirstLine = Math.max(0, indent?.firstLine ?? 0);
|
|
36735
|
+
const indentHanging = Math.max(0, indent?.hanging ?? 0);
|
|
36736
|
+
const rawFirstLineOffset = Math.max(0, firstLineIndent || indentFirstLine - indentHanging);
|
|
36737
|
+
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
36738
|
+
const textStartPx = wordLayout?.textStartPx;
|
|
36739
|
+
const treatAsHanging = textStartPx && indentLeft === 0 && indentHanging === 0;
|
|
36740
|
+
const firstLineWidth = typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging ? Math.max(1, maxWidth - textStartPx - indentRight) : Math.max(1, contentWidth - rawFirstLineOffset);
|
|
36741
|
+
const tabStops = buildTabStopsPx$1(indent, attrs?.tabs, attrs?.tabIntervalTwips);
|
|
36656
36742
|
let currentRun = 0;
|
|
36657
36743
|
let currentChar = 0;
|
|
36658
36744
|
while (currentRun < runs.length) {
|
|
36659
36745
|
const isFirstLine = lines.length === 0;
|
|
36660
|
-
const effectiveMaxWidth = isFirstLine ?
|
|
36746
|
+
const effectiveMaxWidth = Math.max(1, isFirstLine ? firstLineWidth : contentWidth);
|
|
36661
36747
|
const startRun = currentRun;
|
|
36662
36748
|
const startChar = currentChar;
|
|
36663
36749
|
let width = 0;
|
|
@@ -36665,13 +36751,26 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
36665
36751
|
let lastBreakChar = -1;
|
|
36666
36752
|
let endRun = currentRun;
|
|
36667
36753
|
let endChar = currentChar;
|
|
36754
|
+
let tabStopCursor = 0;
|
|
36755
|
+
let didBreakInThisLine = false;
|
|
36668
36756
|
for (let r2 = currentRun; r2 < runs.length; r2 += 1) {
|
|
36669
36757
|
const run = runs[r2];
|
|
36758
|
+
if (run.kind === "tab") {
|
|
36759
|
+
const { target, nextIndex } = getNextTabStopPx$1(width, tabStops, tabStopCursor);
|
|
36760
|
+
const tabAdvance = Math.max(0, target - width);
|
|
36761
|
+
width += tabAdvance;
|
|
36762
|
+
tabStopCursor = nextIndex;
|
|
36763
|
+
endRun = r2;
|
|
36764
|
+
endChar = 1;
|
|
36765
|
+
lastBreakRun = r2;
|
|
36766
|
+
lastBreakChar = 1;
|
|
36767
|
+
continue;
|
|
36768
|
+
}
|
|
36670
36769
|
const text = runText(run);
|
|
36671
36770
|
const start2 = r2 === currentRun ? currentChar : 0;
|
|
36672
36771
|
for (let c = start2; c < text.length; c += 1) {
|
|
36673
36772
|
const w = measureRunSliceWidth(run, c, c + 1);
|
|
36674
|
-
if (width + w > effectiveMaxWidth && width > 0) {
|
|
36773
|
+
if (width + w > effectiveMaxWidth - WIDTH_FUDGE_PX && width > 0) {
|
|
36675
36774
|
if (lastBreakRun >= 0) {
|
|
36676
36775
|
endRun = lastBreakRun;
|
|
36677
36776
|
endChar = lastBreakChar;
|
|
@@ -36679,6 +36778,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
36679
36778
|
endRun = r2;
|
|
36680
36779
|
endChar = c;
|
|
36681
36780
|
}
|
|
36781
|
+
didBreakInThisLine = true;
|
|
36682
36782
|
break;
|
|
36683
36783
|
}
|
|
36684
36784
|
width += w;
|
|
@@ -36690,9 +36790,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
36690
36790
|
lastBreakChar = c + 1;
|
|
36691
36791
|
}
|
|
36692
36792
|
}
|
|
36693
|
-
if (
|
|
36694
|
-
break;
|
|
36695
|
-
}
|
|
36793
|
+
if (didBreakInThisLine) break;
|
|
36696
36794
|
}
|
|
36697
36795
|
if (startRun === endRun && startChar === endChar) {
|
|
36698
36796
|
endRun = startRun;
|
|
@@ -36706,11 +36804,15 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
36706
36804
|
width,
|
|
36707
36805
|
ascent: 0,
|
|
36708
36806
|
descent: 0,
|
|
36709
|
-
lineHeight: lineHeightForRuns(runs, startRun, endRun)
|
|
36807
|
+
lineHeight: lineHeightForRuns(runs, startRun, endRun),
|
|
36808
|
+
maxWidth: effectiveMaxWidth
|
|
36710
36809
|
};
|
|
36711
36810
|
lines.push(line);
|
|
36712
36811
|
currentRun = endRun;
|
|
36713
36812
|
currentChar = endChar;
|
|
36813
|
+
if (currentRun >= runs.length) {
|
|
36814
|
+
break;
|
|
36815
|
+
}
|
|
36714
36816
|
if (currentChar >= runText(runs[currentRun]).length) {
|
|
36715
36817
|
currentRun += 1;
|
|
36716
36818
|
currentChar = 0;
|
|
@@ -38923,7 +39025,7 @@ async function measureBlock(block, constraints) {
|
|
|
38923
39025
|
async function measureParagraphBlock(block, maxWidth) {
|
|
38924
39026
|
const ctx2 = getCanvasContext();
|
|
38925
39027
|
const wordLayout = block.attrs?.wordLayout;
|
|
38926
|
-
const
|
|
39028
|
+
const WIDTH_FUDGE_PX2 = 0.5;
|
|
38927
39029
|
const lines = [];
|
|
38928
39030
|
const indent = block.attrs?.indent;
|
|
38929
39031
|
const spacing = block.attrs?.spacing;
|
|
@@ -38939,7 +39041,8 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
38939
39041
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
38940
39042
|
let initialAvailableWidth;
|
|
38941
39043
|
const textStartPx = wordLayout?.textStartPx;
|
|
38942
|
-
|
|
39044
|
+
const treatAsHanging = isWordLayoutList && indentLeft === 0 && hanging === 0 && typeof textStartPx === "number";
|
|
39045
|
+
if (typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging) {
|
|
38943
39046
|
initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
|
|
38944
39047
|
} else {
|
|
38945
39048
|
initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
|
|
@@ -38986,6 +39089,21 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
38986
39089
|
totalHeight: metrics.lineHeight
|
|
38987
39090
|
};
|
|
38988
39091
|
}
|
|
39092
|
+
const isListLike = Boolean(block.attrs?.numId || wordLayout?.marker);
|
|
39093
|
+
if (isListLike) {
|
|
39094
|
+
console.log(
|
|
39095
|
+
"[measureParagraph][list]",
|
|
39096
|
+
JSON.stringify({
|
|
39097
|
+
blockId: block.id,
|
|
39098
|
+
maxWidth,
|
|
39099
|
+
indentLeft,
|
|
39100
|
+
indentRight,
|
|
39101
|
+
textStartPx: textStartPx ?? null,
|
|
39102
|
+
firstLineOffset: firstLineOffset ?? null,
|
|
39103
|
+
initialAvailableWidth
|
|
39104
|
+
})
|
|
39105
|
+
);
|
|
39106
|
+
}
|
|
38989
39107
|
let currentLine = null;
|
|
38990
39108
|
const getEffectiveWidth = (baseWidth) => {
|
|
38991
39109
|
if (dropCapMeasure && lines.length < dropCapMeasure.lines && dropCapMeasure.mode === "drop") {
|
|
@@ -39393,7 +39511,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39393
39511
|
};
|
|
39394
39512
|
} else {
|
|
39395
39513
|
const boundarySpacing = currentLine.width > 0 ? run.letterSpacing ?? 0 : 0;
|
|
39396
|
-
if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth -
|
|
39514
|
+
if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
|
|
39397
39515
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
39398
39516
|
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
39399
39517
|
const completedLine = {
|
|
@@ -39459,7 +39577,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39459
39577
|
};
|
|
39460
39578
|
} else {
|
|
39461
39579
|
const boundarySpacing2 = currentLine.width > 0 ? run.letterSpacing ?? 0 : 0;
|
|
39462
|
-
if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth -
|
|
39580
|
+
if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
|
|
39463
39581
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
39464
39582
|
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
39465
39583
|
const completedLine = { ...lineBase, ...metrics };
|
|
@@ -39517,7 +39635,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39517
39635
|
const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
|
|
39518
39636
|
const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
|
|
39519
39637
|
const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
|
|
39520
|
-
const chunks = breakWordIntoChunks(word, chunkWidth -
|
|
39638
|
+
const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run);
|
|
39521
39639
|
let chunkCharOffset = wordStartChar;
|
|
39522
39640
|
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
39523
39641
|
const chunk = chunks[chunkIndex];
|
|
@@ -39539,7 +39657,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39539
39657
|
});
|
|
39540
39658
|
if (isLastChunk) {
|
|
39541
39659
|
const ls = run.letterSpacing ?? 0;
|
|
39542
|
-
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth -
|
|
39660
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
39543
39661
|
currentLine.toChar = wordEndWithSpace;
|
|
39544
39662
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
39545
39663
|
charPosInRun = wordEndWithSpace;
|
|
@@ -39571,7 +39689,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39571
39689
|
spaceCount: 0
|
|
39572
39690
|
};
|
|
39573
39691
|
const ls = run.letterSpacing ?? 0;
|
|
39574
|
-
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth -
|
|
39692
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
39575
39693
|
currentLine.toChar = wordEndWithSpace;
|
|
39576
39694
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
39577
39695
|
charPosInRun = wordEndWithSpace;
|
|
@@ -39613,7 +39731,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39613
39731
|
spaceCount: 0
|
|
39614
39732
|
};
|
|
39615
39733
|
const ls = run.letterSpacing ?? 0;
|
|
39616
|
-
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth -
|
|
39734
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
39617
39735
|
currentLine.toChar = wordEndWithSpace;
|
|
39618
39736
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
39619
39737
|
charPosInRun = wordEndWithSpace;
|
|
@@ -39628,7 +39746,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39628
39746
|
const justifyAlignment = block.attrs?.alignment === "justify";
|
|
39629
39747
|
const totalWidthWithWord = currentLine.width + boundarySpacing + wordCommitWidth + // Safe cast: only TextRuns produce word segments from split(), other run types are handled earlier
|
|
39630
39748
|
(isLastWord ? 0 : run.letterSpacing ?? 0);
|
|
39631
|
-
const availableWidth = currentLine.maxWidth -
|
|
39749
|
+
const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX2;
|
|
39632
39750
|
let shouldBreak = currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
|
|
39633
39751
|
let compressedWidth = null;
|
|
39634
39752
|
if (shouldBreak && justifyAlignment) {
|
|
@@ -39673,7 +39791,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39673
39791
|
segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
|
|
39674
39792
|
spaceCount: 0
|
|
39675
39793
|
};
|
|
39676
|
-
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth -
|
|
39794
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
39677
39795
|
currentLine.toChar = wordEndWithSpace;
|
|
39678
39796
|
currentLine.width = roundValue(currentLine.width + spaceWidth + (run.letterSpacing ?? 0));
|
|
39679
39797
|
charPosInRun = wordEndWithSpace;
|
|
@@ -39683,7 +39801,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
39683
39801
|
}
|
|
39684
39802
|
} else {
|
|
39685
39803
|
currentLine.toRun = runIndex;
|
|
39686
|
-
if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth -
|
|
39804
|
+
if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
39687
39805
|
currentLine.toChar = wordEndNoSpace;
|
|
39688
39806
|
currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
|
|
39689
39807
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, onMounted, onBeforeUnmount, createVNode, readonly, watch, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
|
|
2
|
-
import { p as process$1 } from "./converter-
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { p as process$1 } from "./converter-BEVM5t3i.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-B8k1bwD_.js";
|
|
4
4
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
5
5
|
let sanitized = value.replace(/[^0-9.]/g, "");
|
|
6
6
|
sanitized = parseFloat(sanitized);
|