@harbour-enterprises/superdoc 1.0.0-beta.6 → 1.0.0-beta.8
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-CdGAVn-4.es.js → PdfViewer-BfEwF25T.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DmPiOFJ8.cjs → PdfViewer-DJ7BWUbW.cjs} +1 -1
- package/dist/chunks/{index-nXifzD54.es.js → index-BCZ82zY5.es.js} +3 -3
- package/dist/chunks/{index-hjUbJ86s-BLl65XJn.cjs → index-DJrRlj1_-E5dmStMF.cjs} +1 -1
- package/dist/chunks/{index-hjUbJ86s-BMiwCR8J.es.js → index-DJrRlj1_-HA-nVwDO.es.js} +1 -1
- package/dist/chunks/{index-QulG3CF7.cjs → index-DMwWcmrk.cjs} +3 -3
- package/dist/chunks/{super-editor.es-0GatZWs9.cjs → super-editor.es-Bo_fWMy6.cjs} +281 -83
- package/dist/chunks/{super-editor.es-BYVEYLjl.es.js → super-editor.es-MRWI4sfo.es.js} +281 -83
- 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-CZF9SnYh.js → converter-CflxlFnM.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DWypbE0V.js → docx-zipper-DKWL4mo2.js} +1 -1
- package/dist/super-editor/chunks/{editor-BdXHlHt-.js → editor-B9V7oJbW.js} +351 -93
- package/dist/super-editor/chunks/{index-hjUbJ86s.js → index-DJrRlj1_.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CmelvLTd.js → toolbar-B5WlPN4s.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 +9 -8
- 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 +283 -85
- 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-CflxlFnM.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-DKWL4mo2.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.8";
|
|
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-DJrRlj1_.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.8");
|
|
14544
14544
|
if (!this.options.ydoc) return;
|
|
14545
14545
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14546
14546
|
let docVersion = metaMap.get("version");
|
|
@@ -18180,8 +18180,6 @@ function calculateTabWidth(params2) {
|
|
|
18180
18180
|
const beforeWidth = measureText2 ? measureText2(before) : 0;
|
|
18181
18181
|
width -= beforeWidth;
|
|
18182
18182
|
}
|
|
18183
|
-
} else if (alignment === "bar") {
|
|
18184
|
-
width = 0;
|
|
18185
18183
|
}
|
|
18186
18184
|
if (width < 1) {
|
|
18187
18185
|
return fallbackWidth();
|
|
@@ -23178,11 +23176,11 @@ class HeaderFooterLayoutCache {
|
|
|
23178
23176
|
}
|
|
23179
23177
|
}
|
|
23180
23178
|
const sharedHeaderFooterCache = new HeaderFooterLayoutCache();
|
|
23181
|
-
async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
23179
|
+
async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2, cache2 = sharedHeaderFooterCache) {
|
|
23182
23180
|
const result = {};
|
|
23183
23181
|
for (const [type, blocks] of Object.entries(sections)) {
|
|
23184
23182
|
if (!blocks || blocks.length === 0) continue;
|
|
23185
|
-
const measures = await
|
|
23183
|
+
const measures = await cache2.measureBlocks(blocks, constraints, measureBlock2);
|
|
23186
23184
|
const layout = layoutHeaderFooter(blocks, measures, constraints);
|
|
23187
23185
|
result[type] = { blocks, measures, layout };
|
|
23188
23186
|
}
|
|
@@ -23224,14 +23222,14 @@ function measureRunSliceWidth(run, fromChar, toChar) {
|
|
|
23224
23222
|
return metrics.width;
|
|
23225
23223
|
}
|
|
23226
23224
|
function lineHeightForRuns(runs, fromRun, toRun) {
|
|
23227
|
-
let
|
|
23225
|
+
let maxSize2 = 0;
|
|
23228
23226
|
for (let i = fromRun; i <= toRun; i += 1) {
|
|
23229
23227
|
const run = runs[i];
|
|
23230
23228
|
const textRun = run && isTextRun(run) ? run : null;
|
|
23231
23229
|
const size = textRun?.fontSize ?? 16;
|
|
23232
|
-
if (size >
|
|
23230
|
+
if (size > maxSize2) maxSize2 = size;
|
|
23233
23231
|
}
|
|
23234
|
-
return
|
|
23232
|
+
return maxSize2 * 1.2;
|
|
23235
23233
|
}
|
|
23236
23234
|
function remeasureParagraph(block, maxWidth) {
|
|
23237
23235
|
const runs = block.runs ?? [];
|
|
@@ -28834,6 +28832,45 @@ function normalizeRotation(rotation) {
|
|
|
28834
28832
|
function degToRad(degrees) {
|
|
28835
28833
|
return degrees * Math.PI / 180;
|
|
28836
28834
|
}
|
|
28835
|
+
const defaultMaxSize = 5e3;
|
|
28836
|
+
let maxSize = defaultMaxSize;
|
|
28837
|
+
const cache$1 = /* @__PURE__ */ new Map();
|
|
28838
|
+
const makeKey = (text, font, letterSpacing) => {
|
|
28839
|
+
return `${text}|${font}|${letterSpacing || 0}`;
|
|
28840
|
+
};
|
|
28841
|
+
function getMeasuredTextWidth(text, font, letterSpacing, ctx2) {
|
|
28842
|
+
if (text.length > 32e3) {
|
|
28843
|
+
text = text.substring(0, 32e3);
|
|
28844
|
+
}
|
|
28845
|
+
const key2 = makeKey(text, font, letterSpacing);
|
|
28846
|
+
const hit = cache$1.get(key2);
|
|
28847
|
+
if (hit !== void 0) {
|
|
28848
|
+
cache$1.delete(key2);
|
|
28849
|
+
cache$1.set(key2, hit);
|
|
28850
|
+
return hit.width;
|
|
28851
|
+
}
|
|
28852
|
+
try {
|
|
28853
|
+
ctx2.font = font;
|
|
28854
|
+
const metrics = ctx2.measureText(text);
|
|
28855
|
+
const advanceWidth = metrics.width;
|
|
28856
|
+
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
28857
|
+
const baseWidth = Math.max(advanceWidth, paintedWidth);
|
|
28858
|
+
const extra = letterSpacing ? Math.max(0, text.length - 1) * letterSpacing : 0;
|
|
28859
|
+
const width = baseWidth + extra;
|
|
28860
|
+
cache$1.set(key2, { width });
|
|
28861
|
+
evictIfNeeded();
|
|
28862
|
+
return width;
|
|
28863
|
+
} catch {
|
|
28864
|
+
return 0;
|
|
28865
|
+
}
|
|
28866
|
+
}
|
|
28867
|
+
function evictIfNeeded() {
|
|
28868
|
+
while (cache$1.size > maxSize) {
|
|
28869
|
+
const oldestKey = cache$1.keys().next().value;
|
|
28870
|
+
if (oldestKey === void 0) break;
|
|
28871
|
+
cache$1.delete(oldestKey);
|
|
28872
|
+
}
|
|
28873
|
+
}
|
|
28837
28874
|
const { computeTabStops } = Engines;
|
|
28838
28875
|
let canvasContext = null;
|
|
28839
28876
|
const DEFAULT_TAB_INTERVAL_TWIPS = 720;
|
|
@@ -28878,8 +28915,7 @@ function measureText(text, font, ctx2, _fontFamily, _letterSpacing) {
|
|
|
28878
28915
|
const metrics = ctx2.measureText(text);
|
|
28879
28916
|
const advanceWidth = metrics.width;
|
|
28880
28917
|
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
28881
|
-
|
|
28882
|
-
return baseWidth;
|
|
28918
|
+
return Math.max(advanceWidth, paintedWidth);
|
|
28883
28919
|
}
|
|
28884
28920
|
const MIN_SINGLE_LINE_PX = 12 * 96 / 72;
|
|
28885
28921
|
function calculateTypographyMetrics(fontSize, spacing) {
|
|
@@ -29460,13 +29496,9 @@ const getPrimaryRun = (paragraph) => {
|
|
|
29460
29496
|
};
|
|
29461
29497
|
};
|
|
29462
29498
|
const measureRunWidth = (text, font, ctx2, run) => {
|
|
29463
|
-
const
|
|
29464
|
-
const
|
|
29465
|
-
|
|
29466
|
-
return baseWidth;
|
|
29467
|
-
}
|
|
29468
|
-
const extra = Math.max(0, text.length - 1) * letterSpacing;
|
|
29469
|
-
return roundValue(baseWidth + extra);
|
|
29499
|
+
const letterSpacing = run.kind !== "tab" ? run.letterSpacing || 0 : 0;
|
|
29500
|
+
const width = getMeasuredTextWidth(text, font, letterSpacing, ctx2);
|
|
29501
|
+
return roundValue(width);
|
|
29470
29502
|
};
|
|
29471
29503
|
const appendSegment = (segments, runIndex, fromChar, toChar, width, x) => {
|
|
29472
29504
|
if (!segments) return;
|
|
@@ -30393,6 +30425,24 @@ getConverterContext_fn = function() {
|
|
|
30393
30425
|
}
|
|
30394
30426
|
return Object.keys(context).length > 0 ? context : void 0;
|
|
30395
30427
|
};
|
|
30428
|
+
const uiSurfaces = /* @__PURE__ */ new WeakSet();
|
|
30429
|
+
function isInRegisteredSurface(event) {
|
|
30430
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
30431
|
+
if (path.length > 0) {
|
|
30432
|
+
for (const node2 of path) {
|
|
30433
|
+
if (uiSurfaces.has(node2)) return true;
|
|
30434
|
+
if (node2?.hasAttribute?.("data-editor-ui-surface")) return true;
|
|
30435
|
+
}
|
|
30436
|
+
return false;
|
|
30437
|
+
}
|
|
30438
|
+
let node = event.target;
|
|
30439
|
+
while (node) {
|
|
30440
|
+
if (uiSurfaces.has(node)) return true;
|
|
30441
|
+
if (node.hasAttribute?.("data-editor-ui-surface")) return true;
|
|
30442
|
+
node = node.parentElement;
|
|
30443
|
+
}
|
|
30444
|
+
return false;
|
|
30445
|
+
}
|
|
30396
30446
|
const DEFAULT_PAGE_SIZE = { w: 612, h: 792 };
|
|
30397
30447
|
const DEFAULT_MARGINS = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
30398
30448
|
const WORD_CHARACTER_REGEX = /[\p{L}\p{N}''_~-]/u;
|
|
@@ -33369,39 +33419,49 @@ _PresentationEditor.CURSOR_STYLES = {
|
|
|
33369
33419
|
};
|
|
33370
33420
|
let PresentationEditor = _PresentationEditor;
|
|
33371
33421
|
class PresentationInputBridge {
|
|
33372
|
-
constructor(windowRoot,
|
|
33422
|
+
constructor(windowRoot, layoutSurface, getTargetDom, onTargetChanged, options) {
|
|
33373
33423
|
__privateAdd(this, _PresentationInputBridge_instances);
|
|
33374
33424
|
__privateAdd(this, _windowRoot);
|
|
33375
|
-
__privateAdd(this,
|
|
33425
|
+
__privateAdd(this, _layoutSurfaces);
|
|
33376
33426
|
__privateAdd(this, _getTargetDom);
|
|
33377
33427
|
__privateAdd(this, _onTargetChanged);
|
|
33378
33428
|
__privateAdd(this, _listeners);
|
|
33379
33429
|
__privateAdd(this, _currentTarget, null);
|
|
33380
33430
|
__privateAdd(this, _destroyed, false);
|
|
33431
|
+
__privateAdd(this, _useWindowFallback);
|
|
33381
33432
|
__privateSet(this, _windowRoot, windowRoot);
|
|
33382
|
-
__privateSet(this,
|
|
33433
|
+
__privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
|
|
33383
33434
|
__privateSet(this, _getTargetDom, getTargetDom);
|
|
33384
33435
|
__privateSet(this, _onTargetChanged, onTargetChanged);
|
|
33385
33436
|
__privateSet(this, _listeners, []);
|
|
33437
|
+
__privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
|
|
33386
33438
|
}
|
|
33387
33439
|
bind() {
|
|
33388
|
-
|
|
33389
|
-
|
|
33390
|
-
|
|
33391
|
-
|
|
33392
|
-
|
|
33393
|
-
|
|
33394
|
-
|
|
33395
|
-
|
|
33396
|
-
|
|
33397
|
-
|
|
33398
|
-
|
|
33399
|
-
|
|
33400
|
-
|
|
33440
|
+
const keyboardTargets = __privateMethod(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
33441
|
+
keyboardTargets.forEach((target) => {
|
|
33442
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "keydown", __privateMethod(this, _PresentationInputBridge_instances, forwardKeyboardEvent_fn), target);
|
|
33443
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "keyup", __privateMethod(this, _PresentationInputBridge_instances, forwardKeyboardEvent_fn), target);
|
|
33444
|
+
});
|
|
33445
|
+
const compositionTargets = __privateMethod(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
33446
|
+
compositionTargets.forEach((target) => {
|
|
33447
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionstart", __privateMethod(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
33448
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionupdate", __privateMethod(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
33449
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionend", __privateMethod(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
33450
|
+
});
|
|
33451
|
+
const textTargets = __privateMethod(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
33452
|
+
textTargets.forEach((target) => {
|
|
33453
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "beforeinput", __privateMethod(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
33454
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "input", __privateMethod(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
33455
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "textInput", __privateMethod(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
33456
|
+
});
|
|
33457
|
+
const contextTargets = __privateMethod(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
33458
|
+
contextTargets.forEach((target) => {
|
|
33459
|
+
__privateMethod(this, _PresentationInputBridge_instances, addListener_fn).call(this, "contextmenu", __privateMethod(this, _PresentationInputBridge_instances, forwardContextMenu_fn), target);
|
|
33460
|
+
});
|
|
33401
33461
|
}
|
|
33402
33462
|
destroy() {
|
|
33403
|
-
__privateGet(this, _listeners).forEach(({ type, handler, target }) => {
|
|
33404
|
-
target.removeEventListener(type, handler,
|
|
33463
|
+
__privateGet(this, _listeners).forEach(({ type, handler, target, useCapture }) => {
|
|
33464
|
+
target.removeEventListener(type, handler, useCapture);
|
|
33405
33465
|
});
|
|
33406
33466
|
__privateSet(this, _listeners, []);
|
|
33407
33467
|
__privateSet(this, _currentTarget, null);
|
|
@@ -33436,17 +33496,18 @@ class PresentationInputBridge {
|
|
|
33436
33496
|
}
|
|
33437
33497
|
}
|
|
33438
33498
|
_windowRoot = new WeakMap();
|
|
33439
|
-
|
|
33499
|
+
_layoutSurfaces = new WeakMap();
|
|
33440
33500
|
_getTargetDom = new WeakMap();
|
|
33441
33501
|
_onTargetChanged = new WeakMap();
|
|
33442
33502
|
_listeners = new WeakMap();
|
|
33443
33503
|
_currentTarget = new WeakMap();
|
|
33444
33504
|
_destroyed = new WeakMap();
|
|
33505
|
+
_useWindowFallback = new WeakMap();
|
|
33445
33506
|
_PresentationInputBridge_instances = new WeakSet();
|
|
33446
|
-
addListener_fn = function(type, handler, target) {
|
|
33507
|
+
addListener_fn = function(type, handler, target, useCapture = false) {
|
|
33447
33508
|
const bound = handler.bind(this);
|
|
33448
|
-
__privateGet(this, _listeners).push({ type, handler: bound, target });
|
|
33449
|
-
target.addEventListener(type, bound,
|
|
33509
|
+
__privateGet(this, _listeners).push({ type, handler: bound, target, useCapture });
|
|
33510
|
+
target.addEventListener(type, bound, useCapture);
|
|
33450
33511
|
};
|
|
33451
33512
|
dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
33452
33513
|
if (__privateGet(this, _destroyed)) return;
|
|
@@ -33466,8 +33527,24 @@ dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
|
33466
33527
|
}
|
|
33467
33528
|
}
|
|
33468
33529
|
};
|
|
33530
|
+
/**
|
|
33531
|
+
* Forwards keyboard events to the hidden editor, skipping IME composition events
|
|
33532
|
+
* and plain character keys (which are handled by beforeinput instead).
|
|
33533
|
+
* Uses microtask deferral to allow other handlers to preventDefault first.
|
|
33534
|
+
*
|
|
33535
|
+
* @param event - The keyboard event from the layout surface
|
|
33536
|
+
*/
|
|
33469
33537
|
forwardKeyboardEvent_fn = function(event) {
|
|
33470
|
-
if (__privateMethod(this, _PresentationInputBridge_instances,
|
|
33538
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
33539
|
+
return;
|
|
33540
|
+
}
|
|
33541
|
+
if (event.defaultPrevented) {
|
|
33542
|
+
return;
|
|
33543
|
+
}
|
|
33544
|
+
if (event.isComposing || event.keyCode === 229) {
|
|
33545
|
+
return;
|
|
33546
|
+
}
|
|
33547
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, isPlainCharacterKey_fn).call(this, event)) {
|
|
33471
33548
|
return;
|
|
33472
33549
|
}
|
|
33473
33550
|
const synthetic = new KeyboardEvent(event.type, {
|
|
@@ -33484,27 +33561,53 @@ forwardKeyboardEvent_fn = function(event) {
|
|
|
33484
33561
|
});
|
|
33485
33562
|
__privateMethod(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
33486
33563
|
};
|
|
33564
|
+
/**
|
|
33565
|
+
* Forwards text input events (beforeinput) to the hidden editor.
|
|
33566
|
+
* Skips composition events and uses microtask deferral for cooperative handling.
|
|
33567
|
+
*
|
|
33568
|
+
* @param event - The input event from the layout surface
|
|
33569
|
+
*/
|
|
33487
33570
|
forwardTextEvent_fn = function(event) {
|
|
33488
|
-
if (__privateMethod(this, _PresentationInputBridge_instances,
|
|
33571
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
33489
33572
|
return;
|
|
33490
33573
|
}
|
|
33491
|
-
|
|
33492
|
-
|
|
33493
|
-
synthetic = new InputEvent(event.type, {
|
|
33494
|
-
data: event.data ?? event.data ?? null,
|
|
33495
|
-
inputType: event.inputType ?? "insertText",
|
|
33496
|
-
dataTransfer: event.dataTransfer ?? null,
|
|
33497
|
-
isComposing: event.isComposing ?? false,
|
|
33498
|
-
bubbles: true,
|
|
33499
|
-
cancelable: true
|
|
33500
|
-
});
|
|
33501
|
-
} else {
|
|
33502
|
-
synthetic = new Event(event.type, { bubbles: true, cancelable: true });
|
|
33574
|
+
if (event.defaultPrevented) {
|
|
33575
|
+
return;
|
|
33503
33576
|
}
|
|
33504
|
-
|
|
33577
|
+
if (event.isComposing) {
|
|
33578
|
+
return;
|
|
33579
|
+
}
|
|
33580
|
+
queueMicrotask(() => {
|
|
33581
|
+
if (event.defaultPrevented) {
|
|
33582
|
+
return;
|
|
33583
|
+
}
|
|
33584
|
+
let synthetic;
|
|
33585
|
+
if (typeof InputEvent !== "undefined") {
|
|
33586
|
+
synthetic = new InputEvent(event.type, {
|
|
33587
|
+
data: event.data ?? event.data ?? null,
|
|
33588
|
+
inputType: event.inputType ?? "insertText",
|
|
33589
|
+
dataTransfer: event.dataTransfer ?? null,
|
|
33590
|
+
isComposing: event.isComposing ?? false,
|
|
33591
|
+
bubbles: true,
|
|
33592
|
+
cancelable: true
|
|
33593
|
+
});
|
|
33594
|
+
} else {
|
|
33595
|
+
synthetic = new Event(event.type, { bubbles: true, cancelable: true });
|
|
33596
|
+
}
|
|
33597
|
+
__privateMethod(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
33598
|
+
});
|
|
33505
33599
|
};
|
|
33600
|
+
/**
|
|
33601
|
+
* Forwards composition events (compositionstart, compositionupdate, compositionend)
|
|
33602
|
+
* to the hidden editor for IME input handling.
|
|
33603
|
+
*
|
|
33604
|
+
* @param event - The composition event from the layout surface
|
|
33605
|
+
*/
|
|
33506
33606
|
forwardCompositionEvent_fn = function(event) {
|
|
33507
|
-
if (__privateMethod(this, _PresentationInputBridge_instances,
|
|
33607
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
33608
|
+
return;
|
|
33609
|
+
}
|
|
33610
|
+
if (event.defaultPrevented) {
|
|
33508
33611
|
return;
|
|
33509
33612
|
}
|
|
33510
33613
|
let synthetic;
|
|
@@ -33519,8 +33622,16 @@ forwardCompositionEvent_fn = function(event) {
|
|
|
33519
33622
|
}
|
|
33520
33623
|
__privateMethod(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
33521
33624
|
};
|
|
33625
|
+
/**
|
|
33626
|
+
* Forwards context menu events to the hidden editor.
|
|
33627
|
+
*
|
|
33628
|
+
* @param event - The context menu event from the layout surface
|
|
33629
|
+
*/
|
|
33522
33630
|
forwardContextMenu_fn = function(event) {
|
|
33523
|
-
if (__privateMethod(this, _PresentationInputBridge_instances,
|
|
33631
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
33632
|
+
return;
|
|
33633
|
+
}
|
|
33634
|
+
if (event.defaultPrevented) {
|
|
33524
33635
|
return;
|
|
33525
33636
|
}
|
|
33526
33637
|
const synthetic = new MouseEvent("contextmenu", {
|
|
@@ -33554,6 +33665,74 @@ isEventOnActiveTarget_fn = function(event) {
|
|
|
33554
33665
|
}
|
|
33555
33666
|
return false;
|
|
33556
33667
|
};
|
|
33668
|
+
/**
|
|
33669
|
+
* Determines if an event originated from a UI surface that should be excluded
|
|
33670
|
+
* from keyboard forwarding (e.g., toolbars, dropdowns).
|
|
33671
|
+
*
|
|
33672
|
+
* Checks three conditions in order:
|
|
33673
|
+
* 1. Event is already on the active target (hidden editor) - skip to prevent loops
|
|
33674
|
+
* 2. Event is not in a layout surface - skip non-editor events
|
|
33675
|
+
* 3. Event is in a registered UI surface - skip toolbar/dropdown events
|
|
33676
|
+
*
|
|
33677
|
+
* @param event - The event to check
|
|
33678
|
+
* @returns true if the event should be skipped, false if it should be forwarded
|
|
33679
|
+
*/
|
|
33680
|
+
shouldSkipSurface_fn = function(event) {
|
|
33681
|
+
if (__privateMethod(this, _PresentationInputBridge_instances, isEventOnActiveTarget_fn).call(this, event)) {
|
|
33682
|
+
return true;
|
|
33683
|
+
}
|
|
33684
|
+
if (!__privateMethod(this, _PresentationInputBridge_instances, isInLayoutSurface_fn).call(this, event)) {
|
|
33685
|
+
return true;
|
|
33686
|
+
}
|
|
33687
|
+
if (isInRegisteredSurface(event)) {
|
|
33688
|
+
return true;
|
|
33689
|
+
}
|
|
33690
|
+
return false;
|
|
33691
|
+
};
|
|
33692
|
+
/**
|
|
33693
|
+
* Checks if an event originated within a layout surface by walking the
|
|
33694
|
+
* event's composed path. Falls back to checking event.target directly
|
|
33695
|
+
* if composedPath is unavailable.
|
|
33696
|
+
*
|
|
33697
|
+
* @param event - The event to check
|
|
33698
|
+
* @returns true if event originated in a layout surface
|
|
33699
|
+
*/
|
|
33700
|
+
isInLayoutSurface_fn = function(event) {
|
|
33701
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
33702
|
+
if (path.length) {
|
|
33703
|
+
return path.some((node) => __privateGet(this, _layoutSurfaces).has(node));
|
|
33704
|
+
}
|
|
33705
|
+
const origin = event.target;
|
|
33706
|
+
return origin ? __privateGet(this, _layoutSurfaces).has(origin) : false;
|
|
33707
|
+
};
|
|
33708
|
+
/**
|
|
33709
|
+
* Returns the set of event targets to attach listeners to.
|
|
33710
|
+
* Includes registered layout surfaces and optionally the window for fallback.
|
|
33711
|
+
*
|
|
33712
|
+
* @returns Set of EventTargets for listener attachment
|
|
33713
|
+
*/
|
|
33714
|
+
getListenerTargets_fn = function() {
|
|
33715
|
+
const targets = new Set(__privateGet(this, _layoutSurfaces));
|
|
33716
|
+
if (__privateGet(this, _useWindowFallback)) {
|
|
33717
|
+
targets.add(__privateGet(this, _windowRoot));
|
|
33718
|
+
}
|
|
33719
|
+
return Array.from(targets);
|
|
33720
|
+
};
|
|
33721
|
+
/**
|
|
33722
|
+
* Determines if a keyboard event represents a plain character key without
|
|
33723
|
+
* modifiers. Plain character keys are filtered out because they should be
|
|
33724
|
+
* handled by the beforeinput event instead to avoid double-handling.
|
|
33725
|
+
*
|
|
33726
|
+
* Note: Shift is intentionally not considered a modifier here since
|
|
33727
|
+
* Shift+character produces a different character (e.g., uppercase) that
|
|
33728
|
+
* should still go through beforeinput.
|
|
33729
|
+
*
|
|
33730
|
+
* @param event - The keyboard event to check
|
|
33731
|
+
* @returns true if event is a single character without Ctrl/Meta/Alt modifiers
|
|
33732
|
+
*/
|
|
33733
|
+
isPlainCharacterKey_fn = function(event) {
|
|
33734
|
+
return event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;
|
|
33735
|
+
};
|
|
33557
33736
|
const Color = Extension.create({
|
|
33558
33737
|
name: "color",
|
|
33559
33738
|
addOptions() {
|
|
@@ -36383,20 +36562,20 @@ function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext,
|
|
|
36383
36562
|
const tabHeight = paragraphContext.tabHeight;
|
|
36384
36563
|
paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
|
|
36385
36564
|
return `width: ${tabWidth}px; height: ${tabHeight}; ${extraStyles}`;
|
|
36386
|
-
} catch
|
|
36565
|
+
} catch {
|
|
36387
36566
|
return null;
|
|
36388
36567
|
}
|
|
36389
36568
|
}
|
|
36390
|
-
function findParagraphContext($pos,
|
|
36569
|
+
function findParagraphContext($pos, cache2, helpers2) {
|
|
36391
36570
|
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
36392
36571
|
const node = $pos.node(depth);
|
|
36393
36572
|
if (node?.type?.name === "paragraph") {
|
|
36394
36573
|
const startPos = $pos.start(depth);
|
|
36395
|
-
if (!
|
|
36574
|
+
if (!cache2.has(startPos)) {
|
|
36396
36575
|
const paragraphContext = extractParagraphContext(node, startPos, helpers2, depth);
|
|
36397
|
-
|
|
36576
|
+
cache2.set(startPos, paragraphContext);
|
|
36398
36577
|
}
|
|
36399
|
-
return
|
|
36578
|
+
return cache2.get(startPos);
|
|
36400
36579
|
}
|
|
36401
36580
|
}
|
|
36402
36581
|
return null;
|
|
@@ -37525,6 +37704,19 @@ const CommentsMark = Mark.create({
|
|
|
37525
37704
|
return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
37526
37705
|
}
|
|
37527
37706
|
});
|
|
37707
|
+
let cache = /* @__PURE__ */ new WeakMap();
|
|
37708
|
+
function getParagraphContext(paragraph, startPos, helpers2, revision, compute) {
|
|
37709
|
+
const cached = cache.get(paragraph);
|
|
37710
|
+
if (cached && cached.revision === revision) {
|
|
37711
|
+
return cached.context;
|
|
37712
|
+
}
|
|
37713
|
+
const context = compute(paragraph, startPos, helpers2);
|
|
37714
|
+
cache.set(paragraph, { revision, context });
|
|
37715
|
+
return context;
|
|
37716
|
+
}
|
|
37717
|
+
function clearAllParagraphContexts() {
|
|
37718
|
+
cache = /* @__PURE__ */ new WeakMap();
|
|
37719
|
+
}
|
|
37528
37720
|
const leaderStyles = {
|
|
37529
37721
|
dot: "border-bottom: 1px dotted black;",
|
|
37530
37722
|
heavy: "border-bottom: 2px solid black;",
|
|
@@ -37541,6 +37733,14 @@ function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, parag
|
|
|
37541
37733
|
if (!paragraphContext) return null;
|
|
37542
37734
|
const paragraphId = paragraphIdFromPos(paragraphContext.startPos);
|
|
37543
37735
|
const paragraphNode = paragraphContext.paragraph;
|
|
37736
|
+
const cachedContext = getParagraphContext(
|
|
37737
|
+
paragraphNode,
|
|
37738
|
+
paragraphContext.startPos,
|
|
37739
|
+
helpers2,
|
|
37740
|
+
revision,
|
|
37741
|
+
() => extractParagraphContext(paragraphNode, paragraphContext.startPos, helpers2, paragraphContext.paragraphDepth)
|
|
37742
|
+
);
|
|
37743
|
+
const effectiveContext = cachedContext || paragraphContext;
|
|
37544
37744
|
const { entries } = flattenParagraph(paragraphNode, paragraphContext.startPos);
|
|
37545
37745
|
const spans = [];
|
|
37546
37746
|
let tabIndex = 0;
|
|
@@ -37568,13 +37768,13 @@ function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, parag
|
|
|
37568
37768
|
});
|
|
37569
37769
|
}
|
|
37570
37770
|
});
|
|
37571
|
-
const tabStops = Array.isArray(
|
|
37572
|
-
const hangingPx = twipsToPixels(Number(
|
|
37573
|
-
if (hangingPx > 0 &&
|
|
37574
|
-
tabStops.unshift({ val: "start", pos:
|
|
37771
|
+
const tabStops = Array.isArray(effectiveContext.tabStops) ? [...effectiveContext.tabStops] : [];
|
|
37772
|
+
const hangingPx = twipsToPixels(Number(effectiveContext.indent?.hanging) || 0);
|
|
37773
|
+
if (hangingPx > 0 && effectiveContext.indentWidth != null) {
|
|
37774
|
+
tabStops.unshift({ val: "start", pos: effectiveContext.indentWidth + hangingPx, leader: "none" });
|
|
37575
37775
|
}
|
|
37576
|
-
const paragraphWidth = getBlockNodeWidth(view,
|
|
37577
|
-
const indentWidth =
|
|
37776
|
+
const paragraphWidth = getBlockNodeWidth(view, effectiveContext.startPos) ?? defaultLineLength;
|
|
37777
|
+
const indentWidth = effectiveContext.indentWidth ?? getIndentWidth(view, effectiveContext.startPos, effectiveContext.indent);
|
|
37578
37778
|
return {
|
|
37579
37779
|
paragraphId,
|
|
37580
37780
|
revision,
|
|
@@ -37582,9 +37782,9 @@ function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, parag
|
|
|
37582
37782
|
defaultTabDistance,
|
|
37583
37783
|
defaultLineLength,
|
|
37584
37784
|
indents: {
|
|
37585
|
-
left: twipsToPixels(Number(
|
|
37586
|
-
right: twipsToPixels(Number(
|
|
37587
|
-
firstLine: twipsToPixels(Number(
|
|
37785
|
+
left: twipsToPixels(Number(effectiveContext.indent?.left) || 0),
|
|
37786
|
+
right: twipsToPixels(Number(effectiveContext.indent?.right) || 0),
|
|
37787
|
+
firstLine: twipsToPixels(Number(effectiveContext.indent?.firstLine) || 0),
|
|
37588
37788
|
hanging: hangingPx
|
|
37589
37789
|
},
|
|
37590
37790
|
tabStops,
|
|
@@ -37749,31 +37949,58 @@ const TabNode = Node$1.create({
|
|
|
37749
37949
|
key: new PluginKey("tabPlugin"),
|
|
37750
37950
|
state: {
|
|
37751
37951
|
init() {
|
|
37752
|
-
|
|
37952
|
+
const initialDecorations = buildInitialDecorations(view.state.doc, view, helpers2, 0);
|
|
37953
|
+
return { decorations: initialDecorations, revision: 0 };
|
|
37753
37954
|
},
|
|
37754
37955
|
apply(tr, { decorations, revision }, _oldState, newState) {
|
|
37755
|
-
|
|
37756
|
-
const newDecorations2 = buildDecorations(newState.doc, view, helpers2, 0);
|
|
37757
|
-
return { decorations: newDecorations2, revision: 0 };
|
|
37758
|
-
}
|
|
37956
|
+
const currentDecorations = decorations && decorations.map ? decorations.map(tr.mapping, tr.doc) : DecorationSet.empty;
|
|
37759
37957
|
if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
|
|
37760
|
-
return { decorations, revision };
|
|
37958
|
+
return { decorations: currentDecorations, revision };
|
|
37761
37959
|
}
|
|
37762
|
-
const
|
|
37763
|
-
|
|
37764
|
-
|
|
37960
|
+
const affectedParagraphs = getAffectedParagraphStarts(tr, newState);
|
|
37961
|
+
if (affectedParagraphs.size === 0) {
|
|
37962
|
+
return { decorations: currentDecorations, revision };
|
|
37963
|
+
}
|
|
37964
|
+
let nextDecorations = currentDecorations;
|
|
37965
|
+
affectedParagraphs.forEach((pos) => {
|
|
37966
|
+
const paragraph = newState.doc.nodeAt(pos);
|
|
37967
|
+
if (!paragraph || paragraph.type.name !== "paragraph") return;
|
|
37968
|
+
const from2 = pos;
|
|
37969
|
+
const to = pos + paragraph.nodeSize;
|
|
37970
|
+
const existing = nextDecorations.find(from2, to);
|
|
37971
|
+
if (existing?.length) {
|
|
37972
|
+
nextDecorations = nextDecorations.remove(existing);
|
|
37973
|
+
}
|
|
37974
|
+
const paragraphDecorations = buildParagraphDecorations(
|
|
37975
|
+
newState.doc,
|
|
37976
|
+
pos + 1,
|
|
37977
|
+
paragraph,
|
|
37978
|
+
view,
|
|
37979
|
+
helpers2,
|
|
37980
|
+
revision + 1
|
|
37981
|
+
);
|
|
37982
|
+
nextDecorations = nextDecorations.add(newState.doc, paragraphDecorations);
|
|
37983
|
+
});
|
|
37984
|
+
return { decorations: nextDecorations, revision: revision + 1 };
|
|
37765
37985
|
}
|
|
37766
37986
|
},
|
|
37767
37987
|
props: {
|
|
37768
37988
|
decorations(state) {
|
|
37769
37989
|
return this.getState(state).decorations;
|
|
37770
37990
|
}
|
|
37991
|
+
},
|
|
37992
|
+
view() {
|
|
37993
|
+
return {
|
|
37994
|
+
destroy() {
|
|
37995
|
+
clearAllParagraphContexts();
|
|
37996
|
+
}
|
|
37997
|
+
};
|
|
37771
37998
|
}
|
|
37772
37999
|
});
|
|
37773
38000
|
return [tabPlugin];
|
|
37774
38001
|
}
|
|
37775
38002
|
});
|
|
37776
|
-
function
|
|
38003
|
+
function buildInitialDecorations(doc2, view, helpers2, revision) {
|
|
37777
38004
|
const decorations = [];
|
|
37778
38005
|
doc2.descendants((node, pos) => {
|
|
37779
38006
|
if (node.type.name !== "paragraph") return;
|
|
@@ -37794,6 +38021,37 @@ function buildDecorations(doc2, view, helpers2, revision) {
|
|
|
37794
38021
|
});
|
|
37795
38022
|
return DecorationSet.create(doc2, decorations);
|
|
37796
38023
|
}
|
|
38024
|
+
function buildParagraphDecorations(doc2, paragraphContentPos, paragraphNode, view, helpers2, revision) {
|
|
38025
|
+
const request = createLayoutRequest(doc2, paragraphContentPos, view, helpers2, revision);
|
|
38026
|
+
if (!request) return [];
|
|
38027
|
+
const result = calculateTabLayout(request, void 0, view);
|
|
38028
|
+
return applyLayoutResult(result, paragraphNode, paragraphContentPos - 1);
|
|
38029
|
+
}
|
|
38030
|
+
function getAffectedParagraphStarts(tr, newState) {
|
|
38031
|
+
const affected = /* @__PURE__ */ new Set();
|
|
38032
|
+
tr.steps.forEach((step, index2) => {
|
|
38033
|
+
if (step.from == null && step.to == null) return;
|
|
38034
|
+
let fromPos = step.from;
|
|
38035
|
+
let toPos = step.to;
|
|
38036
|
+
if (typeof fromPos !== "number" || typeof toPos !== "number") return;
|
|
38037
|
+
for (let i = index2; i < tr.steps.length; i++) {
|
|
38038
|
+
const stepMap = tr.steps[i].getMap();
|
|
38039
|
+
fromPos = stepMap.map(fromPos, -1);
|
|
38040
|
+
toPos = stepMap.map(toPos, 1);
|
|
38041
|
+
}
|
|
38042
|
+
if (fromPos < 0 || toPos < 0 || fromPos > newState.doc.content.size || toPos > newState.doc.content.size) {
|
|
38043
|
+
return;
|
|
38044
|
+
}
|
|
38045
|
+
newState.doc.nodesBetween(fromPos, toPos, (node, pos) => {
|
|
38046
|
+
if (node.type.name === "paragraph") {
|
|
38047
|
+
affected.add(pos);
|
|
38048
|
+
return false;
|
|
38049
|
+
}
|
|
38050
|
+
return true;
|
|
38051
|
+
});
|
|
38052
|
+
});
|
|
38053
|
+
return affected;
|
|
38054
|
+
}
|
|
37797
38055
|
const LineBreak = Node$1.create({
|
|
37798
38056
|
name: "lineBreak",
|
|
37799
38057
|
group: "inline",
|
|
@@ -38168,24 +38426,24 @@ const createColGroup = (node, cellMinWidth, overrideCol, overrideValue) => {
|
|
|
38168
38426
|
var readFromCache;
|
|
38169
38427
|
var addToCache;
|
|
38170
38428
|
if (typeof WeakMap != "undefined") {
|
|
38171
|
-
let
|
|
38172
|
-
readFromCache = (key2) =>
|
|
38429
|
+
let cache2 = /* @__PURE__ */ new WeakMap();
|
|
38430
|
+
readFromCache = (key2) => cache2.get(key2);
|
|
38173
38431
|
addToCache = (key2, value) => {
|
|
38174
|
-
|
|
38432
|
+
cache2.set(key2, value);
|
|
38175
38433
|
return value;
|
|
38176
38434
|
};
|
|
38177
38435
|
} else {
|
|
38178
|
-
const
|
|
38436
|
+
const cache2 = [];
|
|
38179
38437
|
const cacheSize = 10;
|
|
38180
38438
|
let cachePos = 0;
|
|
38181
38439
|
readFromCache = (key2) => {
|
|
38182
|
-
for (let i = 0; i <
|
|
38183
|
-
if (
|
|
38440
|
+
for (let i = 0; i < cache2.length; i += 2)
|
|
38441
|
+
if (cache2[i] == key2) return cache2[i + 1];
|
|
38184
38442
|
};
|
|
38185
38443
|
addToCache = (key2, value) => {
|
|
38186
38444
|
if (cachePos == cacheSize) cachePos = 0;
|
|
38187
|
-
|
|
38188
|
-
return
|
|
38445
|
+
cache2[cachePos++] = key2;
|
|
38446
|
+
return cache2[cachePos++] = value;
|
|
38189
38447
|
};
|
|
38190
38448
|
}
|
|
38191
38449
|
var TableMap = class {
|