@harbour-enterprises/superdoc 1.0.0-beta.5 → 1.0.0-beta.7
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-B2yJpudB.cjs → PdfViewer-T4fTm1XF.cjs} +1 -1
- package/dist/chunks/{PdfViewer-Ebg4DPUi.es.js → PdfViewer-hAYAlKzI.es.js} +1 -1
- package/dist/chunks/{index-DcKcwu3F.cjs → index-CYQjWGo5.cjs} +3 -3
- package/dist/chunks/{index-6_t69RiQ.es.js → index-DGYP5Xod.es.js} +3 -3
- package/dist/chunks/{index-D653XgvV-B-4_BIjA.es.js → index-DV613LhK-BY095UD2.es.js} +1 -1
- package/dist/chunks/{index-D653XgvV-BN--CbY4.cjs → index-DV613LhK-CqFLIBmd.cjs} +1 -1
- package/dist/chunks/{super-editor.es-0TS__OEc.es.js → super-editor.es-CcaD69pQ.es.js} +533 -217
- package/dist/chunks/{super-editor.es-Bt9VCC9D.cjs → super-editor.es-DmhQckCV.cjs} +533 -217
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +9 -9
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BiUZIOjP.js → converter-BM6gXTRC.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-Dz6dcXS4.js → docx-zipper-fwXPJGKu.js} +1 -1
- package/dist/super-editor/chunks/{editor-BtePjrrv.js → editor-RPTrfArg.js} +577 -206
- package/dist/super-editor/chunks/{index-D653XgvV.js → index-DV613LhK.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-D6JNBgna.js → toolbar-DacKXz_n.js} +5 -4
- 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 +9 -9
- package/dist/super-editor/super-editor.es.js +22 -16
- 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 +535 -219
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
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, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _headerLayoutResults, _footerLayoutResults, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, updateDecorationProviders_fn, createDecorationProvider_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, computeHeaderFooterCaretRect_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot,
|
|
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, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _headerLayoutResults, _footerLayoutResults, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, updateDecorationProviders_fn, createDecorationProvider_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, computeHeaderFooterCaretRect_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateDOMStyles_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;
|
|
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 ListHelpers, O as updateNumberingProperties, Q as changeListLevel, U as findParentNode, V as isList, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName, $ as TrackInsertMarkName, a0 as v4, a1 as TrackFormatMarkName, 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 resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as calculateResolvedParagraphProperties, ar as encodeCSSFromPPr, as as twipsToPixels$2, at as resolveRunProperties, au as encodeCSSFromRPr, av as generateOrderedListIndex, aw as docxNumberingHelpers, ax as InputRule, ay as convertSizeToCSS, az as SelectionRange, aA as Transform, aB as findParentNodeClosestToPos, aC as isInTable$1, aD as generateDocxRandomId, aE as insertNewRelationship, aF as inchesToPixels, aG as kebabCase, aH 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 ListHelpers, O as updateNumberingProperties, Q as changeListLevel, U as findParentNode, V as isList, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName, $ as TrackInsertMarkName, a0 as v4, a1 as TrackFormatMarkName, 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 resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as calculateResolvedParagraphProperties, ar as encodeCSSFromPPr, as as twipsToPixels$2, at as resolveRunProperties, au as encodeCSSFromRPr, av as generateOrderedListIndex, aw as docxNumberingHelpers, ax as InputRule, ay as convertSizeToCSS, az as SelectionRange, aA as Transform, aB as findParentNodeClosestToPos, aC as isInTable$1, aD as generateDocxRandomId, aE as insertNewRelationship, aF as inchesToPixels, aG as kebabCase, aH as getUnderlineCssString } from "./converter-BM6gXTRC.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-fwXPJGKu.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() {
|
|
@@ -13553,7 +13553,7 @@ const isHeadless = (editor) => {
|
|
|
13553
13553
|
const shouldSkipNodeView = (editor) => {
|
|
13554
13554
|
return isHeadless(editor);
|
|
13555
13555
|
};
|
|
13556
|
-
const summaryVersion = "1.0.0-beta.
|
|
13556
|
+
const summaryVersion = "1.0.0-beta.7";
|
|
13557
13557
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13558
13558
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13559
13559
|
function mapAttributes(attrs) {
|
|
@@ -14335,7 +14335,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14335
14335
|
{ default: remarkStringify },
|
|
14336
14336
|
{ default: remarkGfm }
|
|
14337
14337
|
] = await Promise.all([
|
|
14338
|
-
import("./index-
|
|
14338
|
+
import("./index-DV613LhK.js"),
|
|
14339
14339
|
import("./index-DRCvimau.js"),
|
|
14340
14340
|
import("./index-C_x_N6Uh.js"),
|
|
14341
14341
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14540,7 +14540,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14540
14540
|
* Process collaboration migrations
|
|
14541
14541
|
*/
|
|
14542
14542
|
processCollaborationMigrations() {
|
|
14543
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
14543
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.7");
|
|
14544
14544
|
if (!this.options.ydoc) return;
|
|
14545
14545
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14546
14546
|
let docVersion = metaMap.get("version");
|
|
@@ -16760,9 +16760,10 @@ function extractTableBorders(bordersInput) {
|
|
|
16760
16760
|
}
|
|
16761
16761
|
function extractCellBorders(cellAttrs) {
|
|
16762
16762
|
if (!cellAttrs?.borders) return void 0;
|
|
16763
|
+
const bordersData = cellAttrs.borders;
|
|
16763
16764
|
const borders = {};
|
|
16764
16765
|
for (const side of ["top", "right", "bottom", "left"]) {
|
|
16765
|
-
const spec = convertBorderSpec(
|
|
16766
|
+
const spec = convertBorderSpec(bordersData[side]);
|
|
16766
16767
|
if (spec) {
|
|
16767
16768
|
borders[side] = spec;
|
|
16768
16769
|
}
|
|
@@ -16866,7 +16867,7 @@ const normalizeString = (value) => {
|
|
|
16866
16867
|
return trimmed ? trimmed : void 0;
|
|
16867
16868
|
};
|
|
16868
16869
|
const MAX_AUTO_LINE_MULTIPLIER = 10;
|
|
16869
|
-
const TWIPS_THRESHOLD = 50;
|
|
16870
|
+
const TWIPS_THRESHOLD$1 = 50;
|
|
16870
16871
|
const spacingPxToPt = (spacing) => {
|
|
16871
16872
|
const result = {};
|
|
16872
16873
|
if (spacing.before != null) result.before = pxToPt(spacing.before);
|
|
@@ -17006,7 +17007,7 @@ const normalizeParagraphIndent = (value) => {
|
|
|
17006
17007
|
const convert = (value2) => {
|
|
17007
17008
|
const num = pickNumber(value2);
|
|
17008
17009
|
if (num == null) return void 0;
|
|
17009
|
-
if (Math.abs(num) <= TWIPS_THRESHOLD) {
|
|
17010
|
+
if (Math.abs(num) <= TWIPS_THRESHOLD$1) {
|
|
17010
17011
|
return num;
|
|
17011
17012
|
}
|
|
17012
17013
|
return twipsToPx$1(Number(num));
|
|
@@ -17021,24 +17022,18 @@ const normalizeParagraphIndent = (value) => {
|
|
|
17021
17022
|
if (hanging != null) indent.hanging = hanging;
|
|
17022
17023
|
return Object.keys(indent).length > 0 ? indent : void 0;
|
|
17023
17024
|
};
|
|
17025
|
+
const PX_TO_TWIPS = 15;
|
|
17026
|
+
const TWIPS_THRESHOLD = 1e3;
|
|
17024
17027
|
const normalizeOoxmlTabs = (tabs) => {
|
|
17025
17028
|
if (!Array.isArray(tabs)) return void 0;
|
|
17026
17029
|
const normalized = [];
|
|
17027
17030
|
for (const entry of tabs) {
|
|
17028
17031
|
if (!entry || typeof entry !== "object") continue;
|
|
17029
|
-
const
|
|
17030
|
-
|
|
17031
|
-
const
|
|
17032
|
-
if (originalPos != null) {
|
|
17033
|
-
posTwips = originalPos;
|
|
17034
|
-
} else {
|
|
17035
|
-
const posPx = pickNumber(source.pos ?? source.position ?? source.offset);
|
|
17036
|
-
if (posPx != null) {
|
|
17037
|
-
posTwips = Math.round(posPx * 15);
|
|
17038
|
-
}
|
|
17039
|
-
}
|
|
17032
|
+
const rawEntry = entry;
|
|
17033
|
+
const source = rawEntry.tab && typeof rawEntry.tab === "object" ? rawEntry.tab : rawEntry;
|
|
17034
|
+
const posTwips = resolveTabPosition(source);
|
|
17040
17035
|
if (posTwips == null) continue;
|
|
17041
|
-
const val = normalizeTabVal(source.val ?? source.align ?? source.alignment ?? source.type);
|
|
17036
|
+
const val = normalizeTabVal(source.val ?? source.align ?? source.alignment ?? source.type ?? source.tabType);
|
|
17042
17037
|
if (!val) continue;
|
|
17043
17038
|
const tab = {
|
|
17044
17039
|
val,
|
|
@@ -17050,6 +17045,21 @@ const normalizeOoxmlTabs = (tabs) => {
|
|
|
17050
17045
|
}
|
|
17051
17046
|
return normalized.length > 0 ? normalized : void 0;
|
|
17052
17047
|
};
|
|
17048
|
+
const resolveTabPosition = (source) => {
|
|
17049
|
+
const originalPos = pickNumber(source.originalPos);
|
|
17050
|
+
if (originalPos != null) {
|
|
17051
|
+
return originalPos;
|
|
17052
|
+
}
|
|
17053
|
+
const posValue = pickNumber(source.pos ?? source.position ?? source.offset);
|
|
17054
|
+
if (posValue == null) {
|
|
17055
|
+
return void 0;
|
|
17056
|
+
}
|
|
17057
|
+
if (posValue > TWIPS_THRESHOLD) {
|
|
17058
|
+
return posValue;
|
|
17059
|
+
} else {
|
|
17060
|
+
return Math.round(posValue * PX_TO_TWIPS);
|
|
17061
|
+
}
|
|
17062
|
+
};
|
|
17053
17063
|
const normalizeTabVal = (value) => {
|
|
17054
17064
|
switch (value) {
|
|
17055
17065
|
case "start":
|
|
@@ -17061,12 +17071,13 @@ const normalizeTabVal = (value) => {
|
|
|
17061
17071
|
return value;
|
|
17062
17072
|
case "left":
|
|
17063
17073
|
return "start";
|
|
17064
|
-
// Legacy mapping
|
|
17074
|
+
// Legacy mapping for RTL support
|
|
17065
17075
|
case "right":
|
|
17066
17076
|
return "end";
|
|
17067
|
-
// Legacy mapping
|
|
17077
|
+
// Legacy mapping for RTL support
|
|
17068
17078
|
case "dec":
|
|
17069
17079
|
return "decimal";
|
|
17080
|
+
// Abbreviation mapping
|
|
17070
17081
|
default:
|
|
17071
17082
|
return void 0;
|
|
17072
17083
|
}
|
|
@@ -17082,7 +17093,7 @@ const normalizeTabLeader = (value) => {
|
|
|
17082
17093
|
return value;
|
|
17083
17094
|
case "thick":
|
|
17084
17095
|
return "heavy";
|
|
17085
|
-
//
|
|
17096
|
+
// Legacy mapping
|
|
17086
17097
|
default:
|
|
17087
17098
|
return void 0;
|
|
17088
17099
|
}
|
|
@@ -18010,29 +18021,6 @@ const normalizeSuffix = (suffix) => {
|
|
|
18010
18021
|
}
|
|
18011
18022
|
return void 0;
|
|
18012
18023
|
};
|
|
18013
|
-
function resolveSpacingIndent$1(style, numbering) {
|
|
18014
|
-
const spacing = {
|
|
18015
|
-
before: style.spacing?.before ?? 0,
|
|
18016
|
-
after: style.spacing?.after ?? 0,
|
|
18017
|
-
line: style.spacing?.line ?? 12,
|
|
18018
|
-
// Default line spacing
|
|
18019
|
-
lineRule: style.spacing?.lineRule ?? "auto"
|
|
18020
|
-
};
|
|
18021
|
-
let indent = {
|
|
18022
|
-
left: style.indent?.left ?? 0,
|
|
18023
|
-
right: style.indent?.right ?? 0,
|
|
18024
|
-
firstLine: style.indent?.firstLine ?? 0,
|
|
18025
|
-
hanging: style.indent?.hanging ?? 0
|
|
18026
|
-
};
|
|
18027
|
-
if (numbering?.indent) {
|
|
18028
|
-
indent = {
|
|
18029
|
-
...indent,
|
|
18030
|
-
left: numbering.indent.left ?? indent.left,
|
|
18031
|
-
hanging: numbering.indent.hanging ?? indent.hanging
|
|
18032
|
-
};
|
|
18033
|
-
}
|
|
18034
|
-
return { spacing, indent };
|
|
18035
|
-
}
|
|
18036
18024
|
function computeTabStops$1(context) {
|
|
18037
18025
|
const { explicitStops, defaultTabInterval, paragraphIndent } = context;
|
|
18038
18026
|
const leftIndent = paragraphIndent.left ?? 0;
|
|
@@ -18144,6 +18132,90 @@ function computeEndAlignedX(entry, stop) {
|
|
|
18144
18132
|
const targetX = stop.pos - width;
|
|
18145
18133
|
return targetX < 0 ? 0 : targetX;
|
|
18146
18134
|
}
|
|
18135
|
+
function calculateTabWidth(params2) {
|
|
18136
|
+
const {
|
|
18137
|
+
currentX,
|
|
18138
|
+
tabStops,
|
|
18139
|
+
paragraphWidth,
|
|
18140
|
+
defaultTabDistance: defaultTabDistance2,
|
|
18141
|
+
defaultLineLength: defaultLineLength2,
|
|
18142
|
+
followingText = "",
|
|
18143
|
+
measureText: measureText2,
|
|
18144
|
+
decimalSeparator = "."
|
|
18145
|
+
} = params2;
|
|
18146
|
+
const nextStop = tabStops.find((stop) => stop.val !== "clear" && stop.pos > currentX);
|
|
18147
|
+
const fallbackWidth = () => {
|
|
18148
|
+
let tabWidth = defaultTabDistance2 - currentX % defaultLineLength2 % defaultTabDistance2;
|
|
18149
|
+
if (tabWidth <= 0) tabWidth = defaultTabDistance2;
|
|
18150
|
+
return {
|
|
18151
|
+
width: tabWidth,
|
|
18152
|
+
alignment: "default",
|
|
18153
|
+
tabStopPosUsed: "default"
|
|
18154
|
+
};
|
|
18155
|
+
};
|
|
18156
|
+
if (!nextStop) {
|
|
18157
|
+
return fallbackWidth();
|
|
18158
|
+
}
|
|
18159
|
+
let width = Math.min(nextStop.pos, paragraphWidth) - currentX;
|
|
18160
|
+
const alignment = nextStop.val;
|
|
18161
|
+
if (alignment === "bar") {
|
|
18162
|
+
return {
|
|
18163
|
+
width: 0,
|
|
18164
|
+
leader: nextStop.leader,
|
|
18165
|
+
alignment,
|
|
18166
|
+
tabStopPosUsed: nextStop.pos
|
|
18167
|
+
};
|
|
18168
|
+
}
|
|
18169
|
+
if (alignment === "center" || alignment === "end") {
|
|
18170
|
+
const textWidth = measureText2 ? measureText2(followingText) : 0;
|
|
18171
|
+
if (alignment === "center") {
|
|
18172
|
+
width -= textWidth / 2;
|
|
18173
|
+
} else {
|
|
18174
|
+
width -= textWidth;
|
|
18175
|
+
}
|
|
18176
|
+
} else if (alignment === "decimal") {
|
|
18177
|
+
const decimalIndex = followingText.indexOf(decimalSeparator);
|
|
18178
|
+
if (decimalIndex >= 0) {
|
|
18179
|
+
const before = followingText.slice(0, decimalIndex);
|
|
18180
|
+
const beforeWidth = measureText2 ? measureText2(before) : 0;
|
|
18181
|
+
width -= beforeWidth;
|
|
18182
|
+
}
|
|
18183
|
+
} else if (alignment === "bar") {
|
|
18184
|
+
width = 0;
|
|
18185
|
+
}
|
|
18186
|
+
if (width < 1) {
|
|
18187
|
+
return fallbackWidth();
|
|
18188
|
+
}
|
|
18189
|
+
return {
|
|
18190
|
+
width,
|
|
18191
|
+
leader: nextStop.leader,
|
|
18192
|
+
alignment,
|
|
18193
|
+
tabStopPosUsed: nextStop.pos
|
|
18194
|
+
};
|
|
18195
|
+
}
|
|
18196
|
+
function resolveSpacingIndent$1(style, numbering) {
|
|
18197
|
+
const spacing = {
|
|
18198
|
+
before: style.spacing?.before ?? 0,
|
|
18199
|
+
after: style.spacing?.after ?? 0,
|
|
18200
|
+
line: style.spacing?.line ?? 12,
|
|
18201
|
+
// Default line spacing
|
|
18202
|
+
lineRule: style.spacing?.lineRule ?? "auto"
|
|
18203
|
+
};
|
|
18204
|
+
let indent = {
|
|
18205
|
+
left: style.indent?.left ?? 0,
|
|
18206
|
+
right: style.indent?.right ?? 0,
|
|
18207
|
+
firstLine: style.indent?.firstLine ?? 0,
|
|
18208
|
+
hanging: style.indent?.hanging ?? 0
|
|
18209
|
+
};
|
|
18210
|
+
if (numbering?.indent) {
|
|
18211
|
+
indent = {
|
|
18212
|
+
...indent,
|
|
18213
|
+
left: numbering.indent.left ?? indent.left,
|
|
18214
|
+
hanging: numbering.indent.hanging ?? indent.hanging
|
|
18215
|
+
};
|
|
18216
|
+
}
|
|
18217
|
+
return { spacing, indent };
|
|
18218
|
+
}
|
|
18147
18219
|
function formatListLabel(level, indices) {
|
|
18148
18220
|
const { format, text: template, start: start2 } = level;
|
|
18149
18221
|
if (format === "bullet" || format === "custom") {
|
|
@@ -18309,6 +18381,7 @@ function measureRowHeights(cells, _columnWidths) {
|
|
|
18309
18381
|
}
|
|
18310
18382
|
const Engines = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
18311
18383
|
__proto__: null,
|
|
18384
|
+
calculateTabWidth,
|
|
18312
18385
|
computeListIndent,
|
|
18313
18386
|
computeTabStops: computeTabStops$1,
|
|
18314
18387
|
computeWrapExclusion,
|
|
@@ -18357,17 +18430,18 @@ const hydrateParagraphStyleAttrs = (para, context, preResolved) => {
|
|
|
18357
18430
|
return null;
|
|
18358
18431
|
}
|
|
18359
18432
|
const resolvedExtended = resolved;
|
|
18433
|
+
const resolvedAsRecord = resolved;
|
|
18360
18434
|
const hydrated = {
|
|
18361
18435
|
resolved,
|
|
18362
|
-
spacing: cloneIfObject(
|
|
18363
|
-
indent: cloneIfObject(
|
|
18436
|
+
spacing: cloneIfObject(resolvedAsRecord.spacing),
|
|
18437
|
+
indent: cloneIfObject(resolvedAsRecord.indent),
|
|
18364
18438
|
borders: cloneIfObject(resolvedExtended.borders),
|
|
18365
18439
|
shading: cloneIfObject(resolvedExtended.shading),
|
|
18366
18440
|
alignment: resolvedExtended.justification,
|
|
18367
18441
|
tabStops: cloneIfObject(resolvedExtended.tabStops),
|
|
18368
18442
|
keepLines: resolvedExtended.keepLines,
|
|
18369
18443
|
keepNext: resolvedExtended.keepNext,
|
|
18370
|
-
numberingProperties: cloneIfObject(
|
|
18444
|
+
numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties)
|
|
18371
18445
|
};
|
|
18372
18446
|
return hydrated;
|
|
18373
18447
|
};
|
|
@@ -18580,6 +18654,9 @@ const normalizeResolvedTabAlignment = (value) => {
|
|
|
18580
18654
|
}
|
|
18581
18655
|
};
|
|
18582
18656
|
const computeWordLayoutForParagraph = (paragraphAttrs, numberingProps, styleContext) => {
|
|
18657
|
+
if (numberingProps === null) {
|
|
18658
|
+
return null;
|
|
18659
|
+
}
|
|
18583
18660
|
try {
|
|
18584
18661
|
let effectiveIndent = paragraphAttrs.indent;
|
|
18585
18662
|
if (numberingProps?.resolvedLevelIndent) {
|
|
@@ -18614,7 +18691,7 @@ const computeWordLayoutForParagraph = (paragraphAttrs, numberingProps, styleCont
|
|
|
18614
18691
|
return computeWordParagraphLayout({
|
|
18615
18692
|
paragraph: resolvedParagraph,
|
|
18616
18693
|
numbering: numberingProps,
|
|
18617
|
-
markerRun: numberingProps
|
|
18694
|
+
markerRun: numberingProps?.resolvedMarkerRpr,
|
|
18618
18695
|
// Use cached if available
|
|
18619
18696
|
docDefaults
|
|
18620
18697
|
});
|
|
@@ -19060,7 +19137,7 @@ function processImageChild(child, sectionMetadata, context, output, converters)
|
|
|
19060
19137
|
function processNestedStructuredContent(child, sectionMetadata, context, output, converters) {
|
|
19061
19138
|
const { getListCounter, incrementListCounter, resetListCounter } = context.listCounterContext;
|
|
19062
19139
|
const nestedMetadata = resolveNodeSdtMetadata(child, "structuredContentBlock");
|
|
19063
|
-
child.content
|
|
19140
|
+
child.content?.forEach((grandchild) => {
|
|
19064
19141
|
if (grandchild.type === "paragraph") {
|
|
19065
19142
|
const paragraphBlocks = converters.paragraphToFlowBlocks(
|
|
19066
19143
|
grandchild,
|
|
@@ -19112,7 +19189,7 @@ function processDocumentPartObject(child, sectionMetadata, context, output, conv
|
|
|
19112
19189
|
if (docPartGallery === "Table of Contents") {
|
|
19113
19190
|
const blocksBeforeToc = output.blocks.length;
|
|
19114
19191
|
processTocChildren(
|
|
19115
|
-
Array.from(child.content),
|
|
19192
|
+
Array.from(child.content ?? []),
|
|
19116
19193
|
{ docPartGallery, docPartObjectId, tocInstruction, sdtMetadata: docPartSdtMetadata },
|
|
19117
19194
|
{
|
|
19118
19195
|
nextBlockId: context.nextBlockId,
|
|
@@ -19790,7 +19867,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
19790
19867
|
trackedChanges,
|
|
19791
19868
|
bookmarks,
|
|
19792
19869
|
hyperlinkConfig,
|
|
19793
|
-
|
|
19870
|
+
themeColors,
|
|
19871
|
+
...converterContext !== void 0 ? [converterContext] : []
|
|
19794
19872
|
);
|
|
19795
19873
|
if (tableBlock) {
|
|
19796
19874
|
blocks.push(tableBlock);
|
|
@@ -19916,6 +19994,8 @@ function handleParagraphNode(node, context) {
|
|
|
19916
19994
|
trackedChangesConfig,
|
|
19917
19995
|
bookmarks,
|
|
19918
19996
|
hyperlinkConfig,
|
|
19997
|
+
void 0,
|
|
19998
|
+
// themeColors - not available in NodeHandlerContext
|
|
19919
19999
|
context.converterContext
|
|
19920
20000
|
);
|
|
19921
20001
|
paragraphBlocks.forEach((block) => {
|
|
@@ -20425,9 +20505,9 @@ const parseTableCell = (args) => {
|
|
|
20425
20505
|
const paragraph = paragraphBlocks.find((b) => b.kind === "paragraph");
|
|
20426
20506
|
if (!paragraph) return null;
|
|
20427
20507
|
const cellAttrs = {};
|
|
20428
|
-
const borders = extractCellBorders(cellNode.attrs);
|
|
20508
|
+
const borders = extractCellBorders(cellNode.attrs ?? {});
|
|
20429
20509
|
if (borders) cellAttrs.borders = borders;
|
|
20430
|
-
const padding = extractCellPadding(cellNode.attrs) ?? (defaultCellPadding ? { ...defaultCellPadding } : void 0);
|
|
20510
|
+
const padding = extractCellPadding(cellNode.attrs ?? {}) ?? (defaultCellPadding ? { ...defaultCellPadding } : void 0);
|
|
20431
20511
|
if (padding) cellAttrs.padding = padding;
|
|
20432
20512
|
const verticalAlign = cellNode.attrs?.verticalAlign;
|
|
20433
20513
|
if (verticalAlign === "top" || verticalAlign === "middle" || verticalAlign === "bottom") {
|
|
@@ -20764,7 +20844,7 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
20764
20844
|
themeColors,
|
|
20765
20845
|
converterContext
|
|
20766
20846
|
);
|
|
20767
|
-
const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2) => tableNodeToBlock(
|
|
20847
|
+
const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
|
|
20768
20848
|
node,
|
|
20769
20849
|
nextBlockId2,
|
|
20770
20850
|
positions2,
|
|
@@ -20774,8 +20854,8 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
20774
20854
|
trackedChanges,
|
|
20775
20855
|
bookmarks2,
|
|
20776
20856
|
hyperlinkConfig2,
|
|
20777
|
-
themeColors,
|
|
20778
|
-
converterContext
|
|
20857
|
+
themeColorsParam ?? themeColors,
|
|
20858
|
+
converterCtx ?? converterContext
|
|
20779
20859
|
);
|
|
20780
20860
|
const handlerContext = {
|
|
20781
20861
|
blocks,
|
|
@@ -27457,7 +27537,7 @@ const _DomPainter = class _DomPainter {
|
|
|
27457
27537
|
markerEl.style.display = "inline-block";
|
|
27458
27538
|
markerEl.style.width = `${Math.max(0, fragment.markerWidth - LIST_MARKER_GAP$1)}px`;
|
|
27459
27539
|
markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
|
|
27460
|
-
markerEl.style.textAlign = marker.justification ?? "";
|
|
27540
|
+
markerEl.style.textAlign = marker.justification ?? "left";
|
|
27461
27541
|
markerEl.style.fontFamily = marker.run.fontFamily;
|
|
27462
27542
|
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
27463
27543
|
if (marker.run.bold) markerEl.style.fontWeight = "bold";
|
|
@@ -27845,7 +27925,7 @@ const _DomPainter = class _DomPainter {
|
|
|
27845
27925
|
buildLinkRenderData(link) {
|
|
27846
27926
|
const dataset = buildLinkDataset(link);
|
|
27847
27927
|
const sanitized = typeof link.href === "string" ? sanitizeHref(link.href) : null;
|
|
27848
|
-
const anchorHref = normalizeAnchor(link.anchor ?? link.name ??
|
|
27928
|
+
const anchorHref = normalizeAnchor(link.anchor ?? link.name ?? "");
|
|
27849
27929
|
let href = sanitized?.href ?? anchorHref;
|
|
27850
27930
|
if (link.version === 2) {
|
|
27851
27931
|
href = appendDocLocation(href, link.docLocation ?? null);
|
|
@@ -28023,6 +28103,10 @@ const _DomPainter = class _DomPainter {
|
|
|
28023
28103
|
const el = this.doc.createElement("div");
|
|
28024
28104
|
el.classList.add(CLASS_NAMES.line);
|
|
28025
28105
|
applyStyles$2(el, lineStyles(line.lineHeight));
|
|
28106
|
+
const styleId = block.attrs?.styleId;
|
|
28107
|
+
if (styleId) {
|
|
28108
|
+
el.setAttribute("styleid", styleId);
|
|
28109
|
+
}
|
|
28026
28110
|
const lineRange = computeLinePmRange(block, line);
|
|
28027
28111
|
if (lineRange.pmStart != null) {
|
|
28028
28112
|
el.dataset.pmStart = String(lineRange.pmStart);
|
|
@@ -28050,7 +28134,7 @@ const _DomPainter = class _DomPainter {
|
|
|
28050
28134
|
leaderEl.style.height = ld.style === "heavy" ? "2px" : "1px";
|
|
28051
28135
|
leaderEl.style.pointerEvents = "none";
|
|
28052
28136
|
leaderEl.style.zIndex = "0";
|
|
28053
|
-
if (ld.style === "dot") {
|
|
28137
|
+
if (ld.style === "dot" || ld.style === "middleDot") {
|
|
28054
28138
|
leaderEl.style.borderBottom = "1px dotted currentColor";
|
|
28055
28139
|
} else if (ld.style === "hyphen") {
|
|
28056
28140
|
leaderEl.style.borderBottom = "1px dashed currentColor";
|
|
@@ -28087,6 +28171,9 @@ const _DomPainter = class _DomPainter {
|
|
|
28087
28171
|
const segmentRun = { ...baseRun, text: segmentText };
|
|
28088
28172
|
const elem = this.renderRun(segmentRun, context, trackedConfig);
|
|
28089
28173
|
if (elem) {
|
|
28174
|
+
if (styleId) {
|
|
28175
|
+
elem.setAttribute("styleid", styleId);
|
|
28176
|
+
}
|
|
28090
28177
|
let xPos;
|
|
28091
28178
|
if (segment.x !== void 0) {
|
|
28092
28179
|
xPos = segment.x;
|
|
@@ -28112,6 +28199,9 @@ const _DomPainter = class _DomPainter {
|
|
|
28112
28199
|
runs.forEach((run) => {
|
|
28113
28200
|
const elem = this.renderRun(run, context, trackedConfig);
|
|
28114
28201
|
if (elem) {
|
|
28202
|
+
if (styleId) {
|
|
28203
|
+
elem.setAttribute("styleid", styleId);
|
|
28204
|
+
}
|
|
28115
28205
|
el.appendChild(elem);
|
|
28116
28206
|
}
|
|
28117
28207
|
});
|
|
@@ -28531,6 +28621,9 @@ const applyRunDataAttributes = (element, dataAttrs) => {
|
|
|
28531
28621
|
};
|
|
28532
28622
|
const applyParagraphBlockStyles = (element, attrs) => {
|
|
28533
28623
|
if (!attrs) return;
|
|
28624
|
+
if (attrs.styleId) {
|
|
28625
|
+
element.setAttribute("styleid", attrs.styleId);
|
|
28626
|
+
}
|
|
28534
28627
|
if (attrs.alignment) {
|
|
28535
28628
|
element.style.textAlign = attrs.alignment;
|
|
28536
28629
|
}
|
|
@@ -28752,6 +28845,7 @@ const pxToTwips = (px) => Math.round(px * TWIPS_PER_PX);
|
|
|
28752
28845
|
const DEFAULT_TAB_INTERVAL_PX = twipsToPx(DEFAULT_TAB_INTERVAL_TWIPS);
|
|
28753
28846
|
const TAB_EPSILON = 0.1;
|
|
28754
28847
|
const DEFAULT_DECIMAL_SEPARATOR = ".";
|
|
28848
|
+
const ALLOWED_TAB_VALS = /* @__PURE__ */ new Set(["start", "center", "end", "decimal", "bar", "clear"]);
|
|
28755
28849
|
const roundValue = (value) => value;
|
|
28756
28850
|
function getCanvasContext() {
|
|
28757
28851
|
if (!canvasContext) {
|
|
@@ -28874,6 +28968,14 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
28874
28968
|
let tabStopCursor = 0;
|
|
28875
28969
|
let pendingTabAlignment = null;
|
|
28876
28970
|
let lastAppliedTabAlign = null;
|
|
28971
|
+
const warnedTabVals = /* @__PURE__ */ new Set();
|
|
28972
|
+
const validateTabStopVal = (stop) => {
|
|
28973
|
+
if (!ALLOWED_TAB_VALS.has(stop.val) && !warnedTabVals.has(stop.val)) {
|
|
28974
|
+
warnedTabVals.add(stop.val);
|
|
28975
|
+
return false;
|
|
28976
|
+
}
|
|
28977
|
+
return true;
|
|
28978
|
+
};
|
|
28877
28979
|
const alignSegmentAtTab = (segmentText, font, runContext) => {
|
|
28878
28980
|
if (!pendingTabAlignment || !currentLine) return;
|
|
28879
28981
|
const { target, val } = pendingTabAlignment;
|
|
@@ -28922,8 +29024,13 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
28922
29024
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, 12);
|
|
28923
29025
|
currentLine.toRun = runIndex;
|
|
28924
29026
|
currentLine.toChar = 1;
|
|
28925
|
-
|
|
28926
|
-
|
|
29027
|
+
if (stop) {
|
|
29028
|
+
validateTabStopVal(stop);
|
|
29029
|
+
pendingTabAlignment = { target, val: stop.val };
|
|
29030
|
+
} else {
|
|
29031
|
+
pendingTabAlignment = null;
|
|
29032
|
+
}
|
|
29033
|
+
if (stop && stop.leader && stop.leader !== "none") {
|
|
28927
29034
|
const leaderStyle = stop.leader;
|
|
28928
29035
|
const from2 = Math.min(originX, target);
|
|
28929
29036
|
const to = Math.max(originX, target);
|
|
@@ -29069,7 +29176,12 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
29069
29176
|
currentLine.toRun = runIndex;
|
|
29070
29177
|
currentLine.toChar = charPosInRun;
|
|
29071
29178
|
charPosInRun += 1;
|
|
29072
|
-
|
|
29179
|
+
if (stop) {
|
|
29180
|
+
validateTabStopVal(stop);
|
|
29181
|
+
pendingTabAlignment = { target, val: stop.val };
|
|
29182
|
+
} else {
|
|
29183
|
+
pendingTabAlignment = null;
|
|
29184
|
+
}
|
|
29073
29185
|
if (stop && stop.leader && stop.leader !== "none" && stop.leader !== "middleDot") {
|
|
29074
29186
|
const leaderStyle = stop.leader;
|
|
29075
29187
|
const from2 = Math.min(originX, target);
|
|
@@ -29121,10 +29233,6 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
29121
29233
|
markerTextWidth: glyphWidth,
|
|
29122
29234
|
indentLeft: wordLayout.indentLeftPx ?? 0
|
|
29123
29235
|
};
|
|
29124
|
-
console.log(
|
|
29125
|
-
"[measure] Marker:",
|
|
29126
|
-
JSON.stringify({ text: markerText, width: markerInfo.markerWidth, indent: markerInfo.indentLeft })
|
|
29127
|
-
);
|
|
29128
29236
|
}
|
|
29129
29237
|
return {
|
|
29130
29238
|
kind: "paragraph",
|
|
@@ -30285,6 +30393,24 @@ getConverterContext_fn = function() {
|
|
|
30285
30393
|
}
|
|
30286
30394
|
return Object.keys(context).length > 0 ? context : void 0;
|
|
30287
30395
|
};
|
|
30396
|
+
const uiSurfaces = /* @__PURE__ */ new WeakSet();
|
|
30397
|
+
function isInRegisteredSurface(event) {
|
|
30398
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
30399
|
+
if (path.length > 0) {
|
|
30400
|
+
for (const node2 of path) {
|
|
30401
|
+
if (uiSurfaces.has(node2)) return true;
|
|
30402
|
+
if (node2?.hasAttribute?.("data-editor-ui-surface")) return true;
|
|
30403
|
+
}
|
|
30404
|
+
return false;
|
|
30405
|
+
}
|
|
30406
|
+
let node = event.target;
|
|
30407
|
+
while (node) {
|
|
30408
|
+
if (uiSurfaces.has(node)) return true;
|
|
30409
|
+
if (node.hasAttribute?.("data-editor-ui-surface")) return true;
|
|
30410
|
+
node = node.parentElement;
|
|
30411
|
+
}
|
|
30412
|
+
return false;
|
|
30413
|
+
}
|
|
30288
30414
|
const DEFAULT_PAGE_SIZE = { w: 612, h: 792 };
|
|
30289
30415
|
const DEFAULT_MARGINS = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
30290
30416
|
const WORD_CHARACTER_REGEX = /[\p{L}\p{N}''_~-]/u;
|
|
@@ -33261,39 +33387,49 @@ _PresentationEditor.CURSOR_STYLES = {
|
|
|
33261
33387
|
};
|
|
33262
33388
|
let PresentationEditor = _PresentationEditor;
|
|
33263
33389
|
class PresentationInputBridge {
|
|
33264
|
-
constructor(windowRoot,
|
|
33390
|
+
constructor(windowRoot, layoutSurface, getTargetDom, onTargetChanged, options) {
|
|
33265
33391
|
__privateAdd(this, _PresentationInputBridge_instances);
|
|
33266
33392
|
__privateAdd(this, _windowRoot);
|
|
33267
|
-
__privateAdd(this,
|
|
33393
|
+
__privateAdd(this, _layoutSurfaces);
|
|
33268
33394
|
__privateAdd(this, _getTargetDom);
|
|
33269
33395
|
__privateAdd(this, _onTargetChanged);
|
|
33270
33396
|
__privateAdd(this, _listeners);
|
|
33271
33397
|
__privateAdd(this, _currentTarget, null);
|
|
33272
33398
|
__privateAdd(this, _destroyed, false);
|
|
33399
|
+
__privateAdd(this, _useWindowFallback);
|
|
33273
33400
|
__privateSet(this, _windowRoot, windowRoot);
|
|
33274
|
-
__privateSet(this,
|
|
33401
|
+
__privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
|
|
33275
33402
|
__privateSet(this, _getTargetDom, getTargetDom);
|
|
33276
33403
|
__privateSet(this, _onTargetChanged, onTargetChanged);
|
|
33277
33404
|
__privateSet(this, _listeners, []);
|
|
33405
|
+
__privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
|
|
33278
33406
|
}
|
|
33279
33407
|
bind() {
|
|
33280
|
-
|
|
33281
|
-
|
|
33282
|
-
|
|
33283
|
-
|
|
33284
|
-
|
|
33285
|
-
|
|
33286
|
-
|
|
33287
|
-
|
|
33288
|
-
|
|
33289
|
-
|
|
33290
|
-
|
|
33291
|
-
|
|
33292
|
-
|
|
33408
|
+
const keyboardTargets = __privateMethod(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
33409
|
+
keyboardTargets.forEach((target) => {
|
|
33410
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "keydown", __privateMethod(this, _PresentationInputBridge_instances, forwardKeyboardEvent_fn), target);
|
|
33411
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "keyup", __privateMethod(this, _PresentationInputBridge_instances, forwardKeyboardEvent_fn), target);
|
|
33412
|
+
});
|
|
33413
|
+
const compositionTargets = __privateMethod(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
33414
|
+
compositionTargets.forEach((target) => {
|
|
33415
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionstart", __privateMethod(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
33416
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionupdate", __privateMethod(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
33417
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionend", __privateMethod(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
33418
|
+
});
|
|
33419
|
+
const textTargets = __privateMethod(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
33420
|
+
textTargets.forEach((target) => {
|
|
33421
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "beforeinput", __privateMethod(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
33422
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "input", __privateMethod(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
33423
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "textInput", __privateMethod(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
33424
|
+
});
|
|
33425
|
+
const contextTargets = __privateMethod(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
33426
|
+
contextTargets.forEach((target) => {
|
|
33427
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "contextmenu", __privateMethod(this, _PresentationInputBridge_instances, forwardContextMenu_fn), target);
|
|
33428
|
+
});
|
|
33293
33429
|
}
|
|
33294
33430
|
destroy() {
|
|
33295
|
-
__privateGet(this, _listeners).forEach(({ type, handler, target }) => {
|
|
33296
|
-
target.removeEventListener(type, handler,
|
|
33431
|
+
__privateGet(this, _listeners).forEach(({ type, handler, target, useCapture }) => {
|
|
33432
|
+
target.removeEventListener(type, handler, useCapture);
|
|
33297
33433
|
});
|
|
33298
33434
|
__privateSet(this, _listeners, []);
|
|
33299
33435
|
__privateSet(this, _currentTarget, null);
|
|
@@ -33328,17 +33464,18 @@ class PresentationInputBridge {
|
|
|
33328
33464
|
}
|
|
33329
33465
|
}
|
|
33330
33466
|
_windowRoot = new WeakMap();
|
|
33331
|
-
|
|
33467
|
+
_layoutSurfaces = new WeakMap();
|
|
33332
33468
|
_getTargetDom = new WeakMap();
|
|
33333
33469
|
_onTargetChanged = new WeakMap();
|
|
33334
33470
|
_listeners = new WeakMap();
|
|
33335
33471
|
_currentTarget = new WeakMap();
|
|
33336
33472
|
_destroyed = new WeakMap();
|
|
33473
|
+
_useWindowFallback = new WeakMap();
|
|
33337
33474
|
_PresentationInputBridge_instances = new WeakSet();
|
|
33338
|
-
addListener_fn = function(type, handler, target) {
|
|
33475
|
+
addListener_fn = function(type, handler, target, useCapture = false) {
|
|
33339
33476
|
const bound = handler.bind(this);
|
|
33340
|
-
__privateGet(this, _listeners).push({ type, handler: bound, target });
|
|
33341
|
-
target.addEventListener(type, bound,
|
|
33477
|
+
__privateGet(this, _listeners).push({ type, handler: bound, target, useCapture });
|
|
33478
|
+
target.addEventListener(type, bound, useCapture);
|
|
33342
33479
|
};
|
|
33343
33480
|
dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
33344
33481
|
if (__privateGet(this, _destroyed)) return;
|
|
@@ -33358,8 +33495,24 @@ dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
|
33358
33495
|
}
|
|
33359
33496
|
}
|
|
33360
33497
|
};
|
|
33498
|
+
/**
|
|
33499
|
+
* Forwards keyboard events to the hidden editor, skipping IME composition events
|
|
33500
|
+
* and plain character keys (which are handled by beforeinput instead).
|
|
33501
|
+
* Uses microtask deferral to allow other handlers to preventDefault first.
|
|
33502
|
+
*
|
|
33503
|
+
* @param event - The keyboard event from the layout surface
|
|
33504
|
+
*/
|
|
33361
33505
|
forwardKeyboardEvent_fn = function(event) {
|
|
33362
|
-
if (__privateMethod(this, _PresentationInputBridge_instances,
|
|
33506
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
33507
|
+
return;
|
|
33508
|
+
}
|
|
33509
|
+
if (event.defaultPrevented) {
|
|
33510
|
+
return;
|
|
33511
|
+
}
|
|
33512
|
+
if (event.isComposing || event.keyCode === 229) {
|
|
33513
|
+
return;
|
|
33514
|
+
}
|
|
33515
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, isPlainCharacterKey_fn).call(this, event)) {
|
|
33363
33516
|
return;
|
|
33364
33517
|
}
|
|
33365
33518
|
const synthetic = new KeyboardEvent(event.type, {
|
|
@@ -33376,27 +33529,53 @@ forwardKeyboardEvent_fn = function(event) {
|
|
|
33376
33529
|
});
|
|
33377
33530
|
__privateMethod(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
33378
33531
|
};
|
|
33532
|
+
/**
|
|
33533
|
+
* Forwards text input events (beforeinput) to the hidden editor.
|
|
33534
|
+
* Skips composition events and uses microtask deferral for cooperative handling.
|
|
33535
|
+
*
|
|
33536
|
+
* @param event - The input event from the layout surface
|
|
33537
|
+
*/
|
|
33379
33538
|
forwardTextEvent_fn = function(event) {
|
|
33380
|
-
if (__privateMethod(this, _PresentationInputBridge_instances,
|
|
33539
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
33381
33540
|
return;
|
|
33382
33541
|
}
|
|
33383
|
-
|
|
33384
|
-
|
|
33385
|
-
synthetic = new InputEvent(event.type, {
|
|
33386
|
-
data: event.data ?? event.data ?? null,
|
|
33387
|
-
inputType: event.inputType ?? "insertText",
|
|
33388
|
-
dataTransfer: event.dataTransfer ?? null,
|
|
33389
|
-
isComposing: event.isComposing ?? false,
|
|
33390
|
-
bubbles: true,
|
|
33391
|
-
cancelable: true
|
|
33392
|
-
});
|
|
33393
|
-
} else {
|
|
33394
|
-
synthetic = new Event(event.type, { bubbles: true, cancelable: true });
|
|
33542
|
+
if (event.defaultPrevented) {
|
|
33543
|
+
return;
|
|
33395
33544
|
}
|
|
33396
|
-
|
|
33545
|
+
if (event.isComposing) {
|
|
33546
|
+
return;
|
|
33547
|
+
}
|
|
33548
|
+
queueMicrotask(() => {
|
|
33549
|
+
if (event.defaultPrevented) {
|
|
33550
|
+
return;
|
|
33551
|
+
}
|
|
33552
|
+
let synthetic;
|
|
33553
|
+
if (typeof InputEvent !== "undefined") {
|
|
33554
|
+
synthetic = new InputEvent(event.type, {
|
|
33555
|
+
data: event.data ?? event.data ?? null,
|
|
33556
|
+
inputType: event.inputType ?? "insertText",
|
|
33557
|
+
dataTransfer: event.dataTransfer ?? null,
|
|
33558
|
+
isComposing: event.isComposing ?? false,
|
|
33559
|
+
bubbles: true,
|
|
33560
|
+
cancelable: true
|
|
33561
|
+
});
|
|
33562
|
+
} else {
|
|
33563
|
+
synthetic = new Event(event.type, { bubbles: true, cancelable: true });
|
|
33564
|
+
}
|
|
33565
|
+
__privateMethod(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
33566
|
+
});
|
|
33397
33567
|
};
|
|
33568
|
+
/**
|
|
33569
|
+
* Forwards composition events (compositionstart, compositionupdate, compositionend)
|
|
33570
|
+
* to the hidden editor for IME input handling.
|
|
33571
|
+
*
|
|
33572
|
+
* @param event - The composition event from the layout surface
|
|
33573
|
+
*/
|
|
33398
33574
|
forwardCompositionEvent_fn = function(event) {
|
|
33399
|
-
if (__privateMethod(this, _PresentationInputBridge_instances,
|
|
33575
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
33576
|
+
return;
|
|
33577
|
+
}
|
|
33578
|
+
if (event.defaultPrevented) {
|
|
33400
33579
|
return;
|
|
33401
33580
|
}
|
|
33402
33581
|
let synthetic;
|
|
@@ -33411,8 +33590,16 @@ forwardCompositionEvent_fn = function(event) {
|
|
|
33411
33590
|
}
|
|
33412
33591
|
__privateMethod(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
33413
33592
|
};
|
|
33593
|
+
/**
|
|
33594
|
+
* Forwards context menu events to the hidden editor.
|
|
33595
|
+
*
|
|
33596
|
+
* @param event - The context menu event from the layout surface
|
|
33597
|
+
*/
|
|
33414
33598
|
forwardContextMenu_fn = function(event) {
|
|
33415
|
-
if (__privateMethod(this, _PresentationInputBridge_instances,
|
|
33599
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
33600
|
+
return;
|
|
33601
|
+
}
|
|
33602
|
+
if (event.defaultPrevented) {
|
|
33416
33603
|
return;
|
|
33417
33604
|
}
|
|
33418
33605
|
const synthetic = new MouseEvent("contextmenu", {
|
|
@@ -33446,6 +33633,74 @@ isEventOnActiveTarget_fn = function(event) {
|
|
|
33446
33633
|
}
|
|
33447
33634
|
return false;
|
|
33448
33635
|
};
|
|
33636
|
+
/**
|
|
33637
|
+
* Determines if an event originated from a UI surface that should be excluded
|
|
33638
|
+
* from keyboard forwarding (e.g., toolbars, dropdowns).
|
|
33639
|
+
*
|
|
33640
|
+
* Checks three conditions in order:
|
|
33641
|
+
* 1. Event is already on the active target (hidden editor) - skip to prevent loops
|
|
33642
|
+
* 2. Event is not in a layout surface - skip non-editor events
|
|
33643
|
+
* 3. Event is in a registered UI surface - skip toolbar/dropdown events
|
|
33644
|
+
*
|
|
33645
|
+
* @param event - The event to check
|
|
33646
|
+
* @returns true if the event should be skipped, false if it should be forwarded
|
|
33647
|
+
*/
|
|
33648
|
+
shouldSkipSurface_fn = function(event) {
|
|
33649
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, isEventOnActiveTarget_fn).call(this, event)) {
|
|
33650
|
+
return true;
|
|
33651
|
+
}
|
|
33652
|
+
if (!__privateMethod(this, _PresentationInputBridge_instances, isInLayoutSurface_fn).call(this, event)) {
|
|
33653
|
+
return true;
|
|
33654
|
+
}
|
|
33655
|
+
if (isInRegisteredSurface(event)) {
|
|
33656
|
+
return true;
|
|
33657
|
+
}
|
|
33658
|
+
return false;
|
|
33659
|
+
};
|
|
33660
|
+
/**
|
|
33661
|
+
* Checks if an event originated within a layout surface by walking the
|
|
33662
|
+
* event's composed path. Falls back to checking event.target directly
|
|
33663
|
+
* if composedPath is unavailable.
|
|
33664
|
+
*
|
|
33665
|
+
* @param event - The event to check
|
|
33666
|
+
* @returns true if event originated in a layout surface
|
|
33667
|
+
*/
|
|
33668
|
+
isInLayoutSurface_fn = function(event) {
|
|
33669
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
33670
|
+
if (path.length) {
|
|
33671
|
+
return path.some((node) => __privateGet(this, _layoutSurfaces).has(node));
|
|
33672
|
+
}
|
|
33673
|
+
const origin = event.target;
|
|
33674
|
+
return origin ? __privateGet(this, _layoutSurfaces).has(origin) : false;
|
|
33675
|
+
};
|
|
33676
|
+
/**
|
|
33677
|
+
* Returns the set of event targets to attach listeners to.
|
|
33678
|
+
* Includes registered layout surfaces and optionally the window for fallback.
|
|
33679
|
+
*
|
|
33680
|
+
* @returns Set of EventTargets for listener attachment
|
|
33681
|
+
*/
|
|
33682
|
+
getListenerTargets_fn = function() {
|
|
33683
|
+
const targets = new Set(__privateGet(this, _layoutSurfaces));
|
|
33684
|
+
if (__privateGet(this, _useWindowFallback)) {
|
|
33685
|
+
targets.add(__privateGet(this, _windowRoot));
|
|
33686
|
+
}
|
|
33687
|
+
return Array.from(targets);
|
|
33688
|
+
};
|
|
33689
|
+
/**
|
|
33690
|
+
* Determines if a keyboard event represents a plain character key without
|
|
33691
|
+
* modifiers. Plain character keys are filtered out because they should be
|
|
33692
|
+
* handled by the beforeinput event instead to avoid double-handling.
|
|
33693
|
+
*
|
|
33694
|
+
* Note: Shift is intentionally not considered a modifier here since
|
|
33695
|
+
* Shift+character produces a different character (e.g., uppercase) that
|
|
33696
|
+
* should still go through beforeinput.
|
|
33697
|
+
*
|
|
33698
|
+
* @param event - The keyboard event to check
|
|
33699
|
+
* @returns true if event is a single character without Ctrl/Meta/Alt modifiers
|
|
33700
|
+
*/
|
|
33701
|
+
isPlainCharacterKey_fn = function(event) {
|
|
33702
|
+
return event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;
|
|
33703
|
+
};
|
|
33449
33704
|
const Color = Extension.create({
|
|
33450
33705
|
name: "color",
|
|
33451
33706
|
addOptions() {
|
|
@@ -36206,29 +36461,6 @@ const restartNumbering = ({ editor, tr, state, dispatch }) => {
|
|
|
36206
36461
|
};
|
|
36207
36462
|
const defaultTabDistance = 48;
|
|
36208
36463
|
const defaultLineLength = 816;
|
|
36209
|
-
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
36210
|
-
const decorations = [];
|
|
36211
|
-
const paragraphCache = /* @__PURE__ */ new Map();
|
|
36212
|
-
const coordCache = /* @__PURE__ */ new Map();
|
|
36213
|
-
const domPosCache = /* @__PURE__ */ new Map();
|
|
36214
|
-
const end2 = to ?? doc2.content.size;
|
|
36215
|
-
doc2.nodesBetween(from2, end2, (node, pos) => {
|
|
36216
|
-
if (node.type.name !== "tab") return;
|
|
36217
|
-
const $pos = doc2.resolve(pos);
|
|
36218
|
-
const paragraphContext = findParagraphContext($pos, paragraphCache, helpers2);
|
|
36219
|
-
if (!paragraphContext) return;
|
|
36220
|
-
const blockParent2 = $pos.node(paragraphContext.paragraphDepth);
|
|
36221
|
-
const style = calculateTabStyle(node.nodeSize, view, pos, blockParent2, paragraphContext, coordCache, domPosCache);
|
|
36222
|
-
if (style) {
|
|
36223
|
-
decorations.push(
|
|
36224
|
-
Decoration.node(pos, pos + node.nodeSize, {
|
|
36225
|
-
style
|
|
36226
|
-
})
|
|
36227
|
-
);
|
|
36228
|
-
}
|
|
36229
|
-
});
|
|
36230
|
-
return decorations;
|
|
36231
|
-
};
|
|
36232
36464
|
function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext, coordCache = null, domPosCache = null) {
|
|
36233
36465
|
let extraStyles = "";
|
|
36234
36466
|
try {
|
|
@@ -36280,14 +36512,14 @@ function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext,
|
|
|
36280
36512
|
tabWidth -= integralWidth;
|
|
36281
36513
|
}
|
|
36282
36514
|
if (tabStop.leader) {
|
|
36283
|
-
const
|
|
36515
|
+
const leaderStyles2 = {
|
|
36284
36516
|
dot: "border-bottom: 1px dotted black;",
|
|
36285
36517
|
heavy: "border-bottom: 2px solid black;",
|
|
36286
36518
|
hyphen: "border-bottom: 1px solid black;",
|
|
36287
36519
|
middleDot: "border-bottom: 1px dotted black; margin-bottom: 2px;",
|
|
36288
36520
|
underscore: "border-bottom: 1px solid black;"
|
|
36289
36521
|
};
|
|
36290
|
-
extraStyles +=
|
|
36522
|
+
extraStyles += leaderStyles2[tabStop.leader] || "";
|
|
36291
36523
|
}
|
|
36292
36524
|
}
|
|
36293
36525
|
}
|
|
@@ -36299,7 +36531,7 @@ function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext,
|
|
|
36299
36531
|
paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
|
|
36300
36532
|
return `width: ${tabWidth}px; height: ${tabHeight}; ${extraStyles}`;
|
|
36301
36533
|
} catch (error) {
|
|
36302
|
-
|
|
36534
|
+
return null;
|
|
36303
36535
|
}
|
|
36304
36536
|
}
|
|
36305
36537
|
function findParagraphContext($pos, cache, helpers2) {
|
|
@@ -36318,13 +36550,16 @@ function findParagraphContext($pos, cache, helpers2) {
|
|
|
36318
36550
|
}
|
|
36319
36551
|
function extractParagraphContext(node, startPos, helpers2, depth = 0) {
|
|
36320
36552
|
const paragraphProperties = getResolvedParagraphProperties(node);
|
|
36553
|
+
const alignmentAliases = { left: "start", right: "end" };
|
|
36321
36554
|
let tabStops = [];
|
|
36322
36555
|
if (Array.isArray(paragraphProperties.tabStops)) {
|
|
36323
36556
|
tabStops = paragraphProperties.tabStops.map((stop) => {
|
|
36324
36557
|
const ref2 = stop?.tab;
|
|
36325
36558
|
if (!ref2) return stop || null;
|
|
36559
|
+
const rawType = ref2.tabType || "start";
|
|
36560
|
+
const mappedVal = alignmentAliases[rawType] || rawType;
|
|
36326
36561
|
return {
|
|
36327
|
-
val:
|
|
36562
|
+
val: mappedVal,
|
|
36328
36563
|
pos: twipsToPixels(Number(ref2.pos) || 0),
|
|
36329
36564
|
leader: ref2.leader
|
|
36330
36565
|
};
|
|
@@ -37437,6 +37672,184 @@ const CommentsMark = Mark.create({
|
|
|
37437
37672
|
return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
37438
37673
|
}
|
|
37439
37674
|
});
|
|
37675
|
+
const leaderStyles = {
|
|
37676
|
+
dot: "border-bottom: 1px dotted black;",
|
|
37677
|
+
heavy: "border-bottom: 2px solid black;",
|
|
37678
|
+
hyphen: "border-bottom: 1px solid black;",
|
|
37679
|
+
middleDot: "border-bottom: 1px dotted black; margin-bottom: 2px;",
|
|
37680
|
+
underscore: "border-bottom: 1px solid black;"
|
|
37681
|
+
};
|
|
37682
|
+
const paragraphIdFromPos = (startPos) => `para-${startPos}`;
|
|
37683
|
+
const tabIdForIndex = (paragraphId, index2) => `${paragraphId}-tab-${index2}`;
|
|
37684
|
+
function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, paragraphWidthOverride) {
|
|
37685
|
+
const $pos = doc2.resolve(paragraphPos);
|
|
37686
|
+
const paragraphCache = /* @__PURE__ */ new Map();
|
|
37687
|
+
const paragraphContext = findParagraphContext($pos, paragraphCache, helpers2);
|
|
37688
|
+
if (!paragraphContext) return null;
|
|
37689
|
+
const paragraphId = paragraphIdFromPos(paragraphContext.startPos);
|
|
37690
|
+
const paragraphNode = paragraphContext.paragraph;
|
|
37691
|
+
const { entries } = flattenParagraph(paragraphNode, paragraphContext.startPos);
|
|
37692
|
+
const spans = [];
|
|
37693
|
+
let tabIndex = 0;
|
|
37694
|
+
entries.forEach((entry, idx) => {
|
|
37695
|
+
const node = entry.node;
|
|
37696
|
+
const spanId = `${paragraphId}-span-${idx}`;
|
|
37697
|
+
const from2 = entry.pos;
|
|
37698
|
+
const to = entry.pos + node.nodeSize;
|
|
37699
|
+
if (node.type.name === "tab") {
|
|
37700
|
+
spans.push({
|
|
37701
|
+
type: "tab",
|
|
37702
|
+
spanId,
|
|
37703
|
+
tabId: tabIdForIndex(paragraphId, tabIndex++),
|
|
37704
|
+
pos: entry.pos,
|
|
37705
|
+
nodeSize: node.nodeSize
|
|
37706
|
+
});
|
|
37707
|
+
} else if (node.type.name === "text") {
|
|
37708
|
+
spans.push({
|
|
37709
|
+
type: "text",
|
|
37710
|
+
spanId,
|
|
37711
|
+
text: node.text || "",
|
|
37712
|
+
style: node.marks?.find((mark) => mark.type.name === "textStyle")?.attrs || {},
|
|
37713
|
+
from: from2,
|
|
37714
|
+
to
|
|
37715
|
+
});
|
|
37716
|
+
}
|
|
37717
|
+
});
|
|
37718
|
+
const tabStops = Array.isArray(paragraphContext.tabStops) ? [...paragraphContext.tabStops] : [];
|
|
37719
|
+
const hangingPx = twipsToPixels(Number(paragraphContext.indent?.hanging) || 0);
|
|
37720
|
+
if (hangingPx > 0 && paragraphContext.indentWidth != null) {
|
|
37721
|
+
tabStops.unshift({ val: "start", pos: paragraphContext.indentWidth + hangingPx, leader: "none" });
|
|
37722
|
+
}
|
|
37723
|
+
const paragraphWidth = getBlockNodeWidth(view, paragraphContext.startPos) ?? defaultLineLength;
|
|
37724
|
+
const indentWidth = paragraphContext.indentWidth ?? getIndentWidth(view, paragraphContext.startPos, paragraphContext.indent);
|
|
37725
|
+
return {
|
|
37726
|
+
paragraphId,
|
|
37727
|
+
revision,
|
|
37728
|
+
paragraphWidth,
|
|
37729
|
+
defaultTabDistance,
|
|
37730
|
+
defaultLineLength,
|
|
37731
|
+
indents: {
|
|
37732
|
+
left: twipsToPixels(Number(paragraphContext.indent?.left) || 0),
|
|
37733
|
+
right: twipsToPixels(Number(paragraphContext.indent?.right) || 0),
|
|
37734
|
+
firstLine: twipsToPixels(Number(paragraphContext.indent?.firstLine) || 0),
|
|
37735
|
+
hanging: hangingPx
|
|
37736
|
+
},
|
|
37737
|
+
tabStops,
|
|
37738
|
+
spans,
|
|
37739
|
+
indentWidth,
|
|
37740
|
+
paragraphNode
|
|
37741
|
+
};
|
|
37742
|
+
}
|
|
37743
|
+
function calculateTabLayout(request, measurement, view) {
|
|
37744
|
+
const {
|
|
37745
|
+
spans,
|
|
37746
|
+
tabStops,
|
|
37747
|
+
paragraphWidth,
|
|
37748
|
+
defaultTabDistance: defaultTabDistance2,
|
|
37749
|
+
defaultLineLength: defaultLineLength2,
|
|
37750
|
+
paragraphId,
|
|
37751
|
+
revision,
|
|
37752
|
+
indentWidth = 0,
|
|
37753
|
+
paragraphNode
|
|
37754
|
+
} = request;
|
|
37755
|
+
const tabs = {};
|
|
37756
|
+
let currentX = indentWidth;
|
|
37757
|
+
const measureText2 = (span) => {
|
|
37758
|
+
if (view && typeof span.from === "number" && typeof span.to === "number") {
|
|
37759
|
+
return measureRangeWidth(view, span.from, span.to);
|
|
37760
|
+
}
|
|
37761
|
+
return 0;
|
|
37762
|
+
};
|
|
37763
|
+
const tabHeight = paragraphNode ? calcTabHeight(paragraphNode) : void 0;
|
|
37764
|
+
for (let i = 0; i < spans.length; i++) {
|
|
37765
|
+
const span = spans[i];
|
|
37766
|
+
if (span.type === "text") {
|
|
37767
|
+
currentX += measureText2(span);
|
|
37768
|
+
} else if (span.type === "tab") {
|
|
37769
|
+
const followingText = collectFollowingText(spans, i + 1);
|
|
37770
|
+
let measureTextCallback;
|
|
37771
|
+
if (view) {
|
|
37772
|
+
const followingRange = getFollowingTextRange(spans, i + 1);
|
|
37773
|
+
if (followingRange) {
|
|
37774
|
+
const fullWidth = measureRangeWidth(view, followingRange.from, followingRange.to);
|
|
37775
|
+
const fullText = followingText;
|
|
37776
|
+
measureTextCallback = (text) => {
|
|
37777
|
+
if (text === fullText) return fullWidth;
|
|
37778
|
+
if (fullText.length > 0) {
|
|
37779
|
+
return text.length / fullText.length * fullWidth;
|
|
37780
|
+
}
|
|
37781
|
+
return 0;
|
|
37782
|
+
};
|
|
37783
|
+
}
|
|
37784
|
+
}
|
|
37785
|
+
const result = calculateTabWidth({
|
|
37786
|
+
currentX,
|
|
37787
|
+
tabStops,
|
|
37788
|
+
paragraphWidth,
|
|
37789
|
+
defaultTabDistance: defaultTabDistance2,
|
|
37790
|
+
defaultLineLength: defaultLineLength2,
|
|
37791
|
+
followingText,
|
|
37792
|
+
measureText: measureTextCallback
|
|
37793
|
+
});
|
|
37794
|
+
tabs[span.tabId] = {
|
|
37795
|
+
width: result.width,
|
|
37796
|
+
height: tabHeight,
|
|
37797
|
+
leader: result.leader,
|
|
37798
|
+
alignment: result.alignment,
|
|
37799
|
+
tabStopPosUsed: result.tabStopPosUsed
|
|
37800
|
+
};
|
|
37801
|
+
currentX += result.width;
|
|
37802
|
+
}
|
|
37803
|
+
}
|
|
37804
|
+
return {
|
|
37805
|
+
paragraphId,
|
|
37806
|
+
revision,
|
|
37807
|
+
tabs
|
|
37808
|
+
};
|
|
37809
|
+
}
|
|
37810
|
+
function applyLayoutResult(result, paragraph, paragraphPos) {
|
|
37811
|
+
const decorations = [];
|
|
37812
|
+
let tabIndex = 0;
|
|
37813
|
+
paragraph.forEach((node, offset2) => {
|
|
37814
|
+
if (node.type.name !== "tab") return;
|
|
37815
|
+
const pos = paragraphPos + offset2 + 1;
|
|
37816
|
+
const tabId = tabIdForIndex(result.paragraphId, tabIndex++);
|
|
37817
|
+
const layout = result.tabs[tabId];
|
|
37818
|
+
if (!layout) return;
|
|
37819
|
+
let style = `width: ${layout.width}px;`;
|
|
37820
|
+
if (layout.height) style += ` height: ${layout.height};`;
|
|
37821
|
+
if (layout.leader && leaderStyles[layout.leader]) {
|
|
37822
|
+
style += ` ${leaderStyles[layout.leader]}`;
|
|
37823
|
+
}
|
|
37824
|
+
decorations.push(Decoration.node(pos, pos + node.nodeSize, { style }));
|
|
37825
|
+
});
|
|
37826
|
+
return decorations;
|
|
37827
|
+
}
|
|
37828
|
+
function collectFollowingText(spans, startIndex) {
|
|
37829
|
+
let text = "";
|
|
37830
|
+
for (let i = startIndex; i < spans.length; i++) {
|
|
37831
|
+
const span = spans[i];
|
|
37832
|
+
if (span.type === "tab") break;
|
|
37833
|
+
if (span.type === "text") text += span.text || "";
|
|
37834
|
+
}
|
|
37835
|
+
return text;
|
|
37836
|
+
}
|
|
37837
|
+
function getFollowingTextRange(spans, startIndex) {
|
|
37838
|
+
let from2 = null;
|
|
37839
|
+
let to = null;
|
|
37840
|
+
for (let i = startIndex; i < spans.length; i++) {
|
|
37841
|
+
const span = spans[i];
|
|
37842
|
+
if (span.type === "tab") break;
|
|
37843
|
+
if (span.type === "text" && typeof span.from === "number" && typeof span.to === "number") {
|
|
37844
|
+
if (from2 === null) from2 = span.from;
|
|
37845
|
+
to = span.to;
|
|
37846
|
+
}
|
|
37847
|
+
}
|
|
37848
|
+
if (from2 !== null && to !== null) {
|
|
37849
|
+
return { from: from2, to };
|
|
37850
|
+
}
|
|
37851
|
+
return null;
|
|
37852
|
+
}
|
|
37440
37853
|
const TabNode = Node$1.create({
|
|
37441
37854
|
name: "tab",
|
|
37442
37855
|
group: "inline",
|
|
@@ -37478,87 +37891,24 @@ const TabNode = Node$1.create({
|
|
|
37478
37891
|
return [];
|
|
37479
37892
|
}
|
|
37480
37893
|
const { view, helpers: helpers2 } = this.editor;
|
|
37481
|
-
const mergeRanges2 = (ranges) => {
|
|
37482
|
-
if (ranges.length === 0) return [];
|
|
37483
|
-
const sorted = ranges.slice().sort((a, b) => a[0] - b[0]);
|
|
37484
|
-
const merged = [sorted[0]];
|
|
37485
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
37486
|
-
const [start2, end2] = sorted[i];
|
|
37487
|
-
const last = merged[merged.length - 1];
|
|
37488
|
-
if (start2 <= last[1]) {
|
|
37489
|
-
last[1] = Math.max(last[1], end2);
|
|
37490
|
-
} else {
|
|
37491
|
-
merged.push([start2, end2]);
|
|
37492
|
-
}
|
|
37493
|
-
}
|
|
37494
|
-
return merged;
|
|
37495
|
-
};
|
|
37496
37894
|
const tabPlugin = new Plugin({
|
|
37497
37895
|
name: "tabPlugin",
|
|
37498
37896
|
key: new PluginKey("tabPlugin"),
|
|
37499
37897
|
state: {
|
|
37500
37898
|
init() {
|
|
37501
|
-
return { decorations: false };
|
|
37899
|
+
return { decorations: false, revision: 0 };
|
|
37502
37900
|
},
|
|
37503
|
-
apply(tr, { decorations }, _oldState, newState) {
|
|
37901
|
+
apply(tr, { decorations, revision }, _oldState, newState) {
|
|
37504
37902
|
if (!decorations) {
|
|
37505
|
-
|
|
37506
|
-
return { decorations };
|
|
37903
|
+
const newDecorations2 = buildDecorations(newState.doc, view, helpers2, 0);
|
|
37904
|
+
return { decorations: newDecorations2, revision: 0 };
|
|
37507
37905
|
}
|
|
37508
37906
|
if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
|
|
37509
|
-
return { decorations };
|
|
37510
|
-
}
|
|
37511
|
-
decorations = decorations.map(tr.mapping, tr.doc);
|
|
37512
|
-
const rangesToRecalculate = [];
|
|
37513
|
-
const containsTab = (node) => node.type.name === "tab";
|
|
37514
|
-
tr.steps.forEach((step, index2) => {
|
|
37515
|
-
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1)) {
|
|
37516
|
-
return;
|
|
37517
|
-
}
|
|
37518
|
-
let hasTabInRange = false;
|
|
37519
|
-
if (step.slice?.content) {
|
|
37520
|
-
step.slice.content.descendants((node) => {
|
|
37521
|
-
if (containsTab(node)) {
|
|
37522
|
-
hasTabInRange = true;
|
|
37523
|
-
return false;
|
|
37524
|
-
}
|
|
37525
|
-
});
|
|
37526
|
-
}
|
|
37527
|
-
if (!hasTabInRange) {
|
|
37528
|
-
tr.docs[index2].nodesBetween(step.from, step.to, (node) => {
|
|
37529
|
-
if (containsTab(node)) {
|
|
37530
|
-
hasTabInRange = true;
|
|
37531
|
-
return false;
|
|
37532
|
-
}
|
|
37533
|
-
});
|
|
37534
|
-
}
|
|
37535
|
-
if (!hasTabInRange) {
|
|
37536
|
-
return;
|
|
37537
|
-
}
|
|
37538
|
-
let fromPos = step.from;
|
|
37539
|
-
let toPos = step.to;
|
|
37540
|
-
for (let i = index2; i < tr.steps.length; i++) {
|
|
37541
|
-
const stepMap = tr.steps[i].getMap();
|
|
37542
|
-
fromPos = stepMap.map(fromPos, -1);
|
|
37543
|
-
toPos = stepMap.map(toPos, 1);
|
|
37544
|
-
}
|
|
37545
|
-
const $from = newState.doc.resolve(fromPos);
|
|
37546
|
-
const $to = newState.doc.resolve(toPos);
|
|
37547
|
-
const start2 = $from.start(Math.min($from.depth, 1));
|
|
37548
|
-
const end2 = $to.end(Math.min($to.depth, 1));
|
|
37549
|
-
rangesToRecalculate.push([start2, end2]);
|
|
37550
|
-
});
|
|
37551
|
-
if (rangesToRecalculate.length === 0) {
|
|
37552
|
-
return { decorations };
|
|
37907
|
+
return { decorations, revision };
|
|
37553
37908
|
}
|
|
37554
|
-
const
|
|
37555
|
-
|
|
37556
|
-
|
|
37557
|
-
decorations = decorations.remove(oldDecorations);
|
|
37558
|
-
const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
|
|
37559
|
-
decorations = decorations.add(newState.doc, newDecorations);
|
|
37560
|
-
});
|
|
37561
|
-
return { decorations };
|
|
37909
|
+
const nextRevision = revision + 1;
|
|
37910
|
+
const newDecorations = buildDecorations(newState.doc, view, helpers2, nextRevision);
|
|
37911
|
+
return { decorations: newDecorations, revision: nextRevision };
|
|
37562
37912
|
}
|
|
37563
37913
|
},
|
|
37564
37914
|
props: {
|
|
@@ -37570,6 +37920,27 @@ const TabNode = Node$1.create({
|
|
|
37570
37920
|
return [tabPlugin];
|
|
37571
37921
|
}
|
|
37572
37922
|
});
|
|
37923
|
+
function buildDecorations(doc2, view, helpers2, revision) {
|
|
37924
|
+
const decorations = [];
|
|
37925
|
+
doc2.descendants((node, pos) => {
|
|
37926
|
+
if (node.type.name !== "paragraph") return;
|
|
37927
|
+
let hasTab = false;
|
|
37928
|
+
node.descendants((child) => {
|
|
37929
|
+
if (child.type.name === "tab") {
|
|
37930
|
+
hasTab = true;
|
|
37931
|
+
return false;
|
|
37932
|
+
}
|
|
37933
|
+
return true;
|
|
37934
|
+
});
|
|
37935
|
+
if (!hasTab) return;
|
|
37936
|
+
const request = createLayoutRequest(doc2, pos + 1, view, helpers2, revision);
|
|
37937
|
+
if (!request) return;
|
|
37938
|
+
const result = calculateTabLayout(request, void 0, view);
|
|
37939
|
+
const paragraphDecorations = applyLayoutResult(result, node, pos);
|
|
37940
|
+
decorations.push(...paragraphDecorations);
|
|
37941
|
+
});
|
|
37942
|
+
return DecorationSet.create(doc2, decorations);
|
|
37943
|
+
}
|
|
37573
37944
|
const LineBreak = Node$1.create({
|
|
37574
37945
|
name: "lineBreak",
|
|
37575
37946
|
group: "inline",
|