@harbour-enterprises/superdoc 1.0.0-beta.7 → 1.0.0-beta.9
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-hAYAlKzI.es.js → PdfViewer-CuFLNmIu.es.js} +1 -1
- package/dist/chunks/{PdfViewer-T4fTm1XF.cjs → PdfViewer-IfeBMKsU.cjs} +1 -1
- package/dist/chunks/{index-DV613LhK-BY095UD2.es.js → index-BVhSHfFK-4HejWjUD.es.js} +1 -1
- package/dist/chunks/{index-DV613LhK-CqFLIBmd.cjs → index-BVhSHfFK-CTmHktSn.cjs} +1 -1
- package/dist/chunks/{index-CYQjWGo5.cjs → index-CICIPNZT.cjs} +3 -3
- package/dist/chunks/{index-DGYP5Xod.es.js → index-WwpxSzB1.es.js} +3 -3
- package/dist/chunks/{super-editor.es-CcaD69pQ.es.js → super-editor.es-BJP3oxNX.es.js} +250 -47
- package/dist/chunks/{super-editor.es-DmhQckCV.cjs → super-editor.es-CCq8j_qB.cjs} +250 -47
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BM6gXTRC.js → converter-VnZK3P1W.js} +27 -2
- package/dist/super-editor/chunks/{docx-zipper-fwXPJGKu.js → docx-zipper-Bw5zXmBh.js} +1 -1
- package/dist/super-editor/chunks/{editor-RPTrfArg.js → editor-CKkHVssy.js} +259 -60
- package/dist/super-editor/chunks/{index-DV613LhK.js → index-BVhSHfFK.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DacKXz_n.js → toolbar-DPzMju-T.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +252 -49
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { y as defineComponent, z as h, O as Transition, $ as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-CztqUvm1.es.js";
|
|
2
|
-
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-
|
|
2
|
+
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-WwpxSzB1.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-ARQSyfaw.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-CICIPNZT.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
+
const superEditor_es = require("./super-editor.es-CCq8j_qB.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-CCq8j_qB.cjs");
|
|
3
3
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
4
4
|
const eventemitter3 = require("./eventemitter3-CFCpOk3d.cjs");
|
|
5
5
|
const provider = require("@hocuspocus/provider");
|
|
@@ -17227,7 +17227,7 @@ const _sfc_main = {
|
|
|
17227
17227
|
__name: "SuperDoc",
|
|
17228
17228
|
emits: ["selection-update"],
|
|
17229
17229
|
setup(__props, { emit: __emit }) {
|
|
17230
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17230
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-IfeBMKsU.cjs")));
|
|
17231
17231
|
const superdocStore = useSuperdocStore();
|
|
17232
17232
|
const commentsStore = useCommentsStore();
|
|
17233
17233
|
const {
|
|
@@ -18080,7 +18080,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18080
18080
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18081
18081
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18082
18082
|
this.colorIndex = 0;
|
|
18083
|
-
this.version = "1.0.0-beta.
|
|
18083
|
+
this.version = "1.0.0-beta.9";
|
|
18084
18084
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18085
18085
|
this.superdocId = config.superdocId || uuid.v4();
|
|
18086
18086
|
this.colors = this.config.colors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
1
|
+
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BJP3oxNX.es.js";
|
|
2
2
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
3
3
|
import { E as EventEmitter } from "./eventemitter3-ByBH0NYV.es.js";
|
|
4
4
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -17210,7 +17210,7 @@ const _sfc_main = {
|
|
|
17210
17210
|
__name: "SuperDoc",
|
|
17211
17211
|
emits: ["selection-update"],
|
|
17212
17212
|
setup(__props, { emit: __emit }) {
|
|
17213
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17213
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CuFLNmIu.es.js"));
|
|
17214
17214
|
const superdocStore = useSuperdocStore();
|
|
17215
17215
|
const commentsStore = useCommentsStore();
|
|
17216
17216
|
const {
|
|
@@ -18063,7 +18063,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18063
18063
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18064
18064
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18065
18065
|
this.colorIndex = 0;
|
|
18066
|
-
this.version = "1.0.0-beta.
|
|
18066
|
+
this.version = "1.0.0-beta.9";
|
|
18067
18067
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18068
18068
|
this.superdocId = config.superdocId || v4();
|
|
18069
18069
|
this.colors = this.config.colors;
|
|
@@ -19512,18 +19512,43 @@ function encodeMarksFromRPr(runProperties, docx) {
|
|
|
19512
19512
|
}
|
|
19513
19513
|
return marks;
|
|
19514
19514
|
}
|
|
19515
|
-
function encodeCSSFromPPr(paragraphProperties) {
|
|
19515
|
+
function encodeCSSFromPPr(paragraphProperties, hasPreviousParagraph, nextParagraphProps) {
|
|
19516
19516
|
if (!paragraphProperties || typeof paragraphProperties !== "object") {
|
|
19517
19517
|
return {};
|
|
19518
19518
|
}
|
|
19519
19519
|
let css = {};
|
|
19520
19520
|
const { spacing, indent, borders, justification } = paragraphProperties;
|
|
19521
|
+
const nextStyleId = nextParagraphProps?.styleId;
|
|
19521
19522
|
if (spacing) {
|
|
19523
|
+
const getEffectiveBefore = (nextSpacing, isListItem) => {
|
|
19524
|
+
if (!nextSpacing) return 0;
|
|
19525
|
+
if (nextSpacing.beforeAutospacing && isListItem) {
|
|
19526
|
+
return 0;
|
|
19527
|
+
}
|
|
19528
|
+
return nextSpacing.before || 0;
|
|
19529
|
+
};
|
|
19522
19530
|
const isDropCap = Boolean(paragraphProperties.framePr?.dropCap);
|
|
19523
19531
|
const spacingCopy = { ...spacing };
|
|
19532
|
+
if (hasPreviousParagraph) {
|
|
19533
|
+
delete spacingCopy.before;
|
|
19534
|
+
}
|
|
19524
19535
|
if (isDropCap) {
|
|
19525
19536
|
spacingCopy.line = linesToTwips(1);
|
|
19526
19537
|
spacingCopy.lineRule = "auto";
|
|
19538
|
+
delete spacingCopy.after;
|
|
19539
|
+
} else {
|
|
19540
|
+
const nextBefore = getEffectiveBefore(
|
|
19541
|
+
nextParagraphProps?.spacing,
|
|
19542
|
+
Boolean(nextParagraphProps?.numberingProperties)
|
|
19543
|
+
);
|
|
19544
|
+
spacingCopy.after = Math.max(spacingCopy.after || 0, nextBefore);
|
|
19545
|
+
if (paragraphProperties.contextualSpacing && nextStyleId != null && nextStyleId === paragraphProperties.styleId) {
|
|
19546
|
+
spacingCopy.after -= paragraphProperties.spacing?.after || 0;
|
|
19547
|
+
}
|
|
19548
|
+
if (nextParagraphProps?.contextualSpacing && nextStyleId != null && nextStyleId === paragraphProperties.styleId) {
|
|
19549
|
+
spacingCopy.after -= nextBefore;
|
|
19550
|
+
}
|
|
19551
|
+
spacingCopy.after = Math.max(spacingCopy.after, 0);
|
|
19527
19552
|
}
|
|
19528
19553
|
const spacingStyle = getSpacingStyle(spacingCopy, Boolean(paragraphProperties.numberingProperties));
|
|
19529
19554
|
css = { ...css, ...spacingStyle };
|
|
@@ -35563,7 +35588,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35563
35588
|
static getStoredSuperdocVersion(docx) {
|
|
35564
35589
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35565
35590
|
}
|
|
35566
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
35591
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.9") {
|
|
35567
35592
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35568
35593
|
}
|
|
35569
35594
|
/**
|
|
@@ -38763,7 +38788,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
38763
38788
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
38764
38789
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
38765
38790
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
38766
|
-
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;
|
|
38791
|
+
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, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
38767
38792
|
var GOOD_LEAF_SIZE = 200;
|
|
38768
38793
|
var RopeSequence = function RopeSequence2() {
|
|
38769
38794
|
};
|
|
@@ -52270,7 +52295,7 @@ const isHeadless = (editor) => {
|
|
|
52270
52295
|
const shouldSkipNodeView = (editor) => {
|
|
52271
52296
|
return isHeadless(editor);
|
|
52272
52297
|
};
|
|
52273
|
-
const summaryVersion = "1.0.0-beta.
|
|
52298
|
+
const summaryVersion = "1.0.0-beta.9";
|
|
52274
52299
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
52275
52300
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
52276
52301
|
function mapAttributes(attrs) {
|
|
@@ -53049,7 +53074,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53049
53074
|
{ default: remarkStringify },
|
|
53050
53075
|
{ default: remarkGfm }
|
|
53051
53076
|
] = await Promise.all([
|
|
53052
|
-
import("./index-
|
|
53077
|
+
import("./index-BVhSHfFK-4HejWjUD.es.js"),
|
|
53053
53078
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
53054
53079
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
53055
53080
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -53254,7 +53279,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53254
53279
|
* Process collaboration migrations
|
|
53255
53280
|
*/
|
|
53256
53281
|
processCollaborationMigrations() {
|
|
53257
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
53282
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.9");
|
|
53258
53283
|
if (!this.options.ydoc) return;
|
|
53259
53284
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
53260
53285
|
let docVersion = metaMap.get("version");
|
|
@@ -56806,8 +56831,6 @@ function calculateTabWidth(params2) {
|
|
|
56806
56831
|
const beforeWidth = measureText2 ? measureText2(before) : 0;
|
|
56807
56832
|
width -= beforeWidth;
|
|
56808
56833
|
}
|
|
56809
|
-
} else if (alignment2 === "bar") {
|
|
56810
|
-
width = 0;
|
|
56811
56834
|
}
|
|
56812
56835
|
if (width < 1) {
|
|
56813
56836
|
return fallbackWidth();
|
|
@@ -61850,14 +61873,14 @@ function measureRunSliceWidth(run2, fromChar, toChar) {
|
|
|
61850
61873
|
return metrics.width;
|
|
61851
61874
|
}
|
|
61852
61875
|
function lineHeightForRuns(runs, fromRun, toRun) {
|
|
61853
|
-
let
|
|
61876
|
+
let maxSize2 = 0;
|
|
61854
61877
|
for (let i = fromRun; i <= toRun; i += 1) {
|
|
61855
61878
|
const run2 = runs[i];
|
|
61856
61879
|
const textRun = run2 && isTextRun(run2) ? run2 : null;
|
|
61857
61880
|
const size2 = textRun?.fontSize ?? 16;
|
|
61858
|
-
if (size2 >
|
|
61881
|
+
if (size2 > maxSize2) maxSize2 = size2;
|
|
61859
61882
|
}
|
|
61860
|
-
return
|
|
61883
|
+
return maxSize2 * 1.2;
|
|
61861
61884
|
}
|
|
61862
61885
|
function remeasureParagraph(block, maxWidth) {
|
|
61863
61886
|
const runs = block.runs ?? [];
|
|
@@ -67460,6 +67483,45 @@ function normalizeRotation(rotation) {
|
|
|
67460
67483
|
function degToRad(degrees) {
|
|
67461
67484
|
return degrees * Math.PI / 180;
|
|
67462
67485
|
}
|
|
67486
|
+
const defaultMaxSize = 5e3;
|
|
67487
|
+
let maxSize = defaultMaxSize;
|
|
67488
|
+
const cache$1 = /* @__PURE__ */ new Map();
|
|
67489
|
+
const makeKey = (text, font, letterSpacing) => {
|
|
67490
|
+
return `${text}|${font}|${letterSpacing || 0}`;
|
|
67491
|
+
};
|
|
67492
|
+
function getMeasuredTextWidth(text, font, letterSpacing, ctx2) {
|
|
67493
|
+
if (text.length > 32e3) {
|
|
67494
|
+
text = text.substring(0, 32e3);
|
|
67495
|
+
}
|
|
67496
|
+
const key2 = makeKey(text, font, letterSpacing);
|
|
67497
|
+
const hit = cache$1.get(key2);
|
|
67498
|
+
if (hit !== void 0) {
|
|
67499
|
+
cache$1.delete(key2);
|
|
67500
|
+
cache$1.set(key2, hit);
|
|
67501
|
+
return hit.width;
|
|
67502
|
+
}
|
|
67503
|
+
try {
|
|
67504
|
+
ctx2.font = font;
|
|
67505
|
+
const metrics = ctx2.measureText(text);
|
|
67506
|
+
const advanceWidth = metrics.width;
|
|
67507
|
+
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
67508
|
+
const baseWidth = Math.max(advanceWidth, paintedWidth);
|
|
67509
|
+
const extra = letterSpacing ? Math.max(0, text.length - 1) * letterSpacing : 0;
|
|
67510
|
+
const width = baseWidth + extra;
|
|
67511
|
+
cache$1.set(key2, { width });
|
|
67512
|
+
evictIfNeeded();
|
|
67513
|
+
return width;
|
|
67514
|
+
} catch {
|
|
67515
|
+
return 0;
|
|
67516
|
+
}
|
|
67517
|
+
}
|
|
67518
|
+
function evictIfNeeded() {
|
|
67519
|
+
while (cache$1.size > maxSize) {
|
|
67520
|
+
const oldestKey = cache$1.keys().next().value;
|
|
67521
|
+
if (oldestKey === void 0) break;
|
|
67522
|
+
cache$1.delete(oldestKey);
|
|
67523
|
+
}
|
|
67524
|
+
}
|
|
67463
67525
|
const { computeTabStops } = Engines;
|
|
67464
67526
|
let canvasContext = null;
|
|
67465
67527
|
const DEFAULT_TAB_INTERVAL_TWIPS = 720;
|
|
@@ -67504,8 +67566,7 @@ function measureText(text, font, ctx2, _fontFamily, _letterSpacing) {
|
|
|
67504
67566
|
const metrics = ctx2.measureText(text);
|
|
67505
67567
|
const advanceWidth = metrics.width;
|
|
67506
67568
|
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
67507
|
-
|
|
67508
|
-
return baseWidth;
|
|
67569
|
+
return Math.max(advanceWidth, paintedWidth);
|
|
67509
67570
|
}
|
|
67510
67571
|
const MIN_SINGLE_LINE_PX = 12 * 96 / 72;
|
|
67511
67572
|
function calculateTypographyMetrics(fontSize2, spacing) {
|
|
@@ -68086,13 +68147,9 @@ const getPrimaryRun = (paragraph) => {
|
|
|
68086
68147
|
};
|
|
68087
68148
|
};
|
|
68088
68149
|
const measureRunWidth = (text, font, ctx2, run2) => {
|
|
68089
|
-
const
|
|
68090
|
-
const
|
|
68091
|
-
|
|
68092
|
-
return baseWidth;
|
|
68093
|
-
}
|
|
68094
|
-
const extra = Math.max(0, text.length - 1) * letterSpacing;
|
|
68095
|
-
return roundValue(baseWidth + extra);
|
|
68150
|
+
const letterSpacing = run2.kind !== "tab" ? run2.letterSpacing || 0 : 0;
|
|
68151
|
+
const width = getMeasuredTextWidth(text, font, letterSpacing, ctx2);
|
|
68152
|
+
return roundValue(width);
|
|
68096
68153
|
};
|
|
68097
68154
|
const appendSegment = (segments, runIndex, fromChar, toChar, width, x2) => {
|
|
68098
68155
|
if (!segments) return;
|
|
@@ -74841,7 +74898,7 @@ function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext,
|
|
|
74841
74898
|
const tabHeight = paragraphContext.tabHeight;
|
|
74842
74899
|
paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
|
|
74843
74900
|
return `width: ${tabWidth}px; height: ${tabHeight}; ${extraStyles}`;
|
|
74844
|
-
} catch
|
|
74901
|
+
} catch {
|
|
74845
74902
|
return null;
|
|
74846
74903
|
}
|
|
74847
74904
|
}
|
|
@@ -75033,6 +75090,7 @@ function calcTabHeight(blockParent2) {
|
|
|
75033
75090
|
const fontSize2 = parseInt(parentTextStyleMark?.attrs.fontSize) * ptToPxRatio || defaultFontSize;
|
|
75034
75091
|
return `${fontSize2 * defaultLineHeight}px`;
|
|
75035
75092
|
}
|
|
75093
|
+
const nodeViewMap = /* @__PURE__ */ new WeakMap();
|
|
75036
75094
|
class ParagraphNodeView {
|
|
75037
75095
|
/**
|
|
75038
75096
|
* @param {import('prosemirror-model').Node} node Current paragraph node.
|
|
@@ -75049,6 +75107,8 @@ class ParagraphNodeView {
|
|
|
75049
75107
|
this.decorations = decorations;
|
|
75050
75108
|
this.extensionAttrs = extensionAttrs;
|
|
75051
75109
|
this._animationFrameRequest = null;
|
|
75110
|
+
this.surroundingContext = {};
|
|
75111
|
+
nodeViewMap.set(this.node, this);
|
|
75052
75112
|
calculateResolvedParagraphProperties(this.editor, this.node, this.editor.state.doc.resolve(this.getPos()));
|
|
75053
75113
|
this.dom = document.createElement("p");
|
|
75054
75114
|
this.contentDOM = document.createElement("span");
|
|
@@ -75068,18 +75128,26 @@ class ParagraphNodeView {
|
|
|
75068
75128
|
/**
|
|
75069
75129
|
* @param {import('prosemirror-model').Node} node
|
|
75070
75130
|
* @param {import('prosemirror-view').Decoration[]} decorations
|
|
75131
|
+
* @param {import('prosemirror-view').Decoration[]} innerDecorations
|
|
75132
|
+
* @param {boolean} [forceUpdate=false]
|
|
75133
|
+
* @returns {boolean}
|
|
75071
75134
|
*/
|
|
75072
|
-
update(node, decorations) {
|
|
75135
|
+
update(node, decorations, innerDecorations, forceUpdate = false) {
|
|
75136
|
+
if (nodeViewMap.get(this.node) === this) {
|
|
75137
|
+
nodeViewMap.delete(this.node);
|
|
75138
|
+
}
|
|
75139
|
+
const oldProps = getResolvedParagraphProperties(this.node);
|
|
75073
75140
|
const oldAttrs = this.node.attrs;
|
|
75074
|
-
const newAttrs = node.attrs;
|
|
75075
75141
|
this.node = node;
|
|
75076
75142
|
this.decorations = decorations;
|
|
75077
|
-
|
|
75143
|
+
this.innerDecorations = innerDecorations;
|
|
75144
|
+
nodeViewMap.set(this.node, this);
|
|
75145
|
+
if (!forceUpdate && !__privateMethod$1(this, _ParagraphNodeView_instances, checkShouldUpdate_fn).call(this, oldProps, oldAttrs, this.surroundingContext)) {
|
|
75078
75146
|
return true;
|
|
75079
75147
|
}
|
|
75080
75148
|
calculateResolvedParagraphProperties(this.editor, this.node, this.editor.state.doc.resolve(this.getPos()));
|
|
75081
75149
|
__privateMethod$1(this, _ParagraphNodeView_instances, updateHTMLAttributes_fn).call(this);
|
|
75082
|
-
__privateMethod$1(this, _ParagraphNodeView_instances, updateDOMStyles_fn).call(this);
|
|
75150
|
+
__privateMethod$1(this, _ParagraphNodeView_instances, updateDOMStyles_fn).call(this, oldProps);
|
|
75083
75151
|
if (!__privateMethod$1(this, _ParagraphNodeView_instances, checkIsList_fn).call(this)) {
|
|
75084
75152
|
__privateMethod$1(this, _ParagraphNodeView_instances, removeList_fn).call(this);
|
|
75085
75153
|
return true;
|
|
@@ -75122,9 +75190,16 @@ class ParagraphNodeView {
|
|
|
75122
75190
|
}
|
|
75123
75191
|
destroy() {
|
|
75124
75192
|
__privateMethod$1(this, _ParagraphNodeView_instances, cancelScheduledAnimation_fn).call(this);
|
|
75193
|
+
if (nodeViewMap.get(this.node) === this) {
|
|
75194
|
+
nodeViewMap.delete(this.node);
|
|
75195
|
+
}
|
|
75125
75196
|
}
|
|
75126
75197
|
}
|
|
75127
75198
|
_ParagraphNodeView_instances = /* @__PURE__ */ new WeakSet();
|
|
75199
|
+
checkShouldUpdate_fn = function(oldProps, oldAttrs, oldSurroundingContext) {
|
|
75200
|
+
__privateMethod$1(this, _ParagraphNodeView_instances, resolveNeighborParagraphProperties_fn).call(this);
|
|
75201
|
+
return JSON.stringify(oldAttrs) !== JSON.stringify(this.node.attrs) || JSON.stringify(oldProps) !== JSON.stringify(getResolvedParagraphProperties(this.node)) || JSON.stringify(oldSurroundingContext) !== JSON.stringify(this.surroundingContext);
|
|
75202
|
+
};
|
|
75128
75203
|
updateHTMLAttributes_fn = function() {
|
|
75129
75204
|
const htmlAttributes = Attribute2.getAttributesToRender(this.node, this.extensionAttrs);
|
|
75130
75205
|
htmlAttributes.style = htmlAttributes.style || "";
|
|
@@ -75152,13 +75227,62 @@ updateHTMLAttributes_fn = function() {
|
|
|
75152
75227
|
this.dom.setAttribute("styleid", paragraphProperties.styleId);
|
|
75153
75228
|
}
|
|
75154
75229
|
};
|
|
75155
|
-
updateDOMStyles_fn = function() {
|
|
75230
|
+
updateDOMStyles_fn = function(oldParagraphProperties = null) {
|
|
75156
75231
|
this.dom.style.cssText = "";
|
|
75157
75232
|
const paragraphProperties = getResolvedParagraphProperties(this.node);
|
|
75158
|
-
|
|
75233
|
+
__privateMethod$1(this, _ParagraphNodeView_instances, resolveNeighborParagraphProperties_fn).call(this);
|
|
75234
|
+
const style2 = encodeCSSFromPPr(
|
|
75235
|
+
paragraphProperties,
|
|
75236
|
+
this.surroundingContext.hasPreviousParagraph,
|
|
75237
|
+
this.surroundingContext.nextParagraphProps
|
|
75238
|
+
);
|
|
75159
75239
|
Object.entries(style2).forEach(([k2, v2]) => {
|
|
75160
75240
|
this.dom.style[k2] = v2;
|
|
75161
75241
|
});
|
|
75242
|
+
if (JSON.stringify(paragraphProperties.spacing) !== JSON.stringify(oldParagraphProperties?.spacing) || paragraphProperties.styleId !== oldParagraphProperties?.styleId || paragraphProperties.contextualSpacing !== oldParagraphProperties?.contextualSpacing) {
|
|
75243
|
+
const previousNodeView = this.surroundingContext.previousParagraph ? nodeViewMap.get(this.surroundingContext.previousParagraph) : null;
|
|
75244
|
+
if (previousNodeView) {
|
|
75245
|
+
try {
|
|
75246
|
+
previousNodeView.getPos();
|
|
75247
|
+
} catch {
|
|
75248
|
+
return;
|
|
75249
|
+
}
|
|
75250
|
+
previousNodeView.update(
|
|
75251
|
+
previousNodeView.node,
|
|
75252
|
+
previousNodeView.decorations,
|
|
75253
|
+
previousNodeView.innerDecorations,
|
|
75254
|
+
true
|
|
75255
|
+
);
|
|
75256
|
+
}
|
|
75257
|
+
}
|
|
75258
|
+
};
|
|
75259
|
+
resolveNeighborParagraphProperties_fn = function() {
|
|
75260
|
+
const $pos = this.editor.state.doc.resolve(this.getPos());
|
|
75261
|
+
const parent = $pos.parent;
|
|
75262
|
+
const index2 = $pos.index();
|
|
75263
|
+
let hasPreviousParagraph = false;
|
|
75264
|
+
let previousParagraph = null;
|
|
75265
|
+
let nextParagraphProps = null;
|
|
75266
|
+
if (index2 > 0) {
|
|
75267
|
+
const previousNode = parent.child(index2 - 1);
|
|
75268
|
+
hasPreviousParagraph = previousNode.type.name === "paragraph" && !getResolvedParagraphProperties(previousNode)?.framePr?.dropCap;
|
|
75269
|
+
if (hasPreviousParagraph) {
|
|
75270
|
+
previousParagraph = previousNode;
|
|
75271
|
+
}
|
|
75272
|
+
}
|
|
75273
|
+
if (parent) {
|
|
75274
|
+
if (index2 < parent.childCount - 1) {
|
|
75275
|
+
const nextNode = parent.child(index2 + 1);
|
|
75276
|
+
if (nextNode.type.name === "paragraph") {
|
|
75277
|
+
nextParagraphProps = getResolvedParagraphProperties(nextNode);
|
|
75278
|
+
}
|
|
75279
|
+
}
|
|
75280
|
+
}
|
|
75281
|
+
this.surroundingContext = {
|
|
75282
|
+
hasPreviousParagraph,
|
|
75283
|
+
previousParagraph,
|
|
75284
|
+
nextParagraphProps
|
|
75285
|
+
};
|
|
75162
75286
|
};
|
|
75163
75287
|
updateListStyles_fn = function() {
|
|
75164
75288
|
let { suffix: suffix2, justification } = this.node.attrs.listRendering;
|
|
@@ -75935,6 +76059,19 @@ const CommentsMark = Mark2.create({
|
|
|
75935
76059
|
return [CommentMarkName, Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
75936
76060
|
}
|
|
75937
76061
|
});
|
|
76062
|
+
let cache$2 = /* @__PURE__ */ new WeakMap();
|
|
76063
|
+
function getParagraphContext(paragraph, startPos, helpers2, revision, compute) {
|
|
76064
|
+
const cached = cache$2.get(paragraph);
|
|
76065
|
+
if (cached && cached.revision === revision) {
|
|
76066
|
+
return cached.context;
|
|
76067
|
+
}
|
|
76068
|
+
const context = compute(paragraph, startPos, helpers2);
|
|
76069
|
+
cache$2.set(paragraph, { revision, context });
|
|
76070
|
+
return context;
|
|
76071
|
+
}
|
|
76072
|
+
function clearAllParagraphContexts() {
|
|
76073
|
+
cache$2 = /* @__PURE__ */ new WeakMap();
|
|
76074
|
+
}
|
|
75938
76075
|
const leaderStyles = {
|
|
75939
76076
|
dot: "border-bottom: 1px dotted black;",
|
|
75940
76077
|
heavy: "border-bottom: 2px solid black;",
|
|
@@ -75951,6 +76088,14 @@ function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, parag
|
|
|
75951
76088
|
if (!paragraphContext) return null;
|
|
75952
76089
|
const paragraphId = paragraphIdFromPos(paragraphContext.startPos);
|
|
75953
76090
|
const paragraphNode = paragraphContext.paragraph;
|
|
76091
|
+
const cachedContext = getParagraphContext(
|
|
76092
|
+
paragraphNode,
|
|
76093
|
+
paragraphContext.startPos,
|
|
76094
|
+
helpers2,
|
|
76095
|
+
revision,
|
|
76096
|
+
() => extractParagraphContext(paragraphNode, paragraphContext.startPos, helpers2, paragraphContext.paragraphDepth)
|
|
76097
|
+
);
|
|
76098
|
+
const effectiveContext = cachedContext || paragraphContext;
|
|
75954
76099
|
const { entries } = flattenParagraph(paragraphNode, paragraphContext.startPos);
|
|
75955
76100
|
const spans = [];
|
|
75956
76101
|
let tabIndex = 0;
|
|
@@ -75978,13 +76123,13 @@ function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, parag
|
|
|
75978
76123
|
});
|
|
75979
76124
|
}
|
|
75980
76125
|
});
|
|
75981
|
-
const tabStops = Array.isArray(
|
|
75982
|
-
const hangingPx = twipsToPixels(Number(
|
|
75983
|
-
if (hangingPx > 0 &&
|
|
75984
|
-
tabStops.unshift({ val: "start", pos:
|
|
76126
|
+
const tabStops = Array.isArray(effectiveContext.tabStops) ? [...effectiveContext.tabStops] : [];
|
|
76127
|
+
const hangingPx = twipsToPixels(Number(effectiveContext.indent?.hanging) || 0);
|
|
76128
|
+
if (hangingPx > 0 && effectiveContext.indentWidth != null) {
|
|
76129
|
+
tabStops.unshift({ val: "start", pos: effectiveContext.indentWidth + hangingPx, leader: "none" });
|
|
75985
76130
|
}
|
|
75986
|
-
const paragraphWidth = getBlockNodeWidth(view,
|
|
75987
|
-
const indentWidth =
|
|
76131
|
+
const paragraphWidth = getBlockNodeWidth(view, effectiveContext.startPos) ?? defaultLineLength;
|
|
76132
|
+
const indentWidth = effectiveContext.indentWidth ?? getIndentWidth(view, effectiveContext.startPos, effectiveContext.indent);
|
|
75988
76133
|
return {
|
|
75989
76134
|
paragraphId,
|
|
75990
76135
|
revision,
|
|
@@ -75992,9 +76137,9 @@ function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, parag
|
|
|
75992
76137
|
defaultTabDistance,
|
|
75993
76138
|
defaultLineLength,
|
|
75994
76139
|
indents: {
|
|
75995
|
-
left: twipsToPixels(Number(
|
|
75996
|
-
right: twipsToPixels(Number(
|
|
75997
|
-
firstLine: twipsToPixels(Number(
|
|
76140
|
+
left: twipsToPixels(Number(effectiveContext.indent?.left) || 0),
|
|
76141
|
+
right: twipsToPixels(Number(effectiveContext.indent?.right) || 0),
|
|
76142
|
+
firstLine: twipsToPixels(Number(effectiveContext.indent?.firstLine) || 0),
|
|
75998
76143
|
hanging: hangingPx
|
|
75999
76144
|
},
|
|
76000
76145
|
tabStops,
|
|
@@ -76159,31 +76304,58 @@ const TabNode = Node$1.create({
|
|
|
76159
76304
|
key: new PluginKey("tabPlugin"),
|
|
76160
76305
|
state: {
|
|
76161
76306
|
init() {
|
|
76162
|
-
|
|
76307
|
+
const initialDecorations = buildInitialDecorations(view.state.doc, view, helpers2, 0);
|
|
76308
|
+
return { decorations: initialDecorations, revision: 0 };
|
|
76163
76309
|
},
|
|
76164
76310
|
apply(tr, { decorations, revision }, _oldState, newState) {
|
|
76165
|
-
|
|
76166
|
-
const newDecorations2 = buildDecorations(newState.doc, view, helpers2, 0);
|
|
76167
|
-
return { decorations: newDecorations2, revision: 0 };
|
|
76168
|
-
}
|
|
76311
|
+
const currentDecorations = decorations && decorations.map ? decorations.map(tr.mapping, tr.doc) : DecorationSet.empty;
|
|
76169
76312
|
if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
|
|
76170
|
-
return { decorations, revision };
|
|
76171
|
-
}
|
|
76172
|
-
const
|
|
76173
|
-
|
|
76174
|
-
|
|
76313
|
+
return { decorations: currentDecorations, revision };
|
|
76314
|
+
}
|
|
76315
|
+
const affectedParagraphs = getAffectedParagraphStarts(tr, newState);
|
|
76316
|
+
if (affectedParagraphs.size === 0) {
|
|
76317
|
+
return { decorations: currentDecorations, revision };
|
|
76318
|
+
}
|
|
76319
|
+
let nextDecorations = currentDecorations;
|
|
76320
|
+
affectedParagraphs.forEach((pos) => {
|
|
76321
|
+
const paragraph = newState.doc.nodeAt(pos);
|
|
76322
|
+
if (!paragraph || paragraph.type.name !== "paragraph") return;
|
|
76323
|
+
const from2 = pos;
|
|
76324
|
+
const to = pos + paragraph.nodeSize;
|
|
76325
|
+
const existing = nextDecorations.find(from2, to);
|
|
76326
|
+
if (existing?.length) {
|
|
76327
|
+
nextDecorations = nextDecorations.remove(existing);
|
|
76328
|
+
}
|
|
76329
|
+
const paragraphDecorations = buildParagraphDecorations(
|
|
76330
|
+
newState.doc,
|
|
76331
|
+
pos + 1,
|
|
76332
|
+
paragraph,
|
|
76333
|
+
view,
|
|
76334
|
+
helpers2,
|
|
76335
|
+
revision + 1
|
|
76336
|
+
);
|
|
76337
|
+
nextDecorations = nextDecorations.add(newState.doc, paragraphDecorations);
|
|
76338
|
+
});
|
|
76339
|
+
return { decorations: nextDecorations, revision: revision + 1 };
|
|
76175
76340
|
}
|
|
76176
76341
|
},
|
|
76177
76342
|
props: {
|
|
76178
76343
|
decorations(state2) {
|
|
76179
76344
|
return this.getState(state2).decorations;
|
|
76180
76345
|
}
|
|
76346
|
+
},
|
|
76347
|
+
view() {
|
|
76348
|
+
return {
|
|
76349
|
+
destroy() {
|
|
76350
|
+
clearAllParagraphContexts();
|
|
76351
|
+
}
|
|
76352
|
+
};
|
|
76181
76353
|
}
|
|
76182
76354
|
});
|
|
76183
76355
|
return [tabPlugin];
|
|
76184
76356
|
}
|
|
76185
76357
|
});
|
|
76186
|
-
function
|
|
76358
|
+
function buildInitialDecorations(doc2, view, helpers2, revision) {
|
|
76187
76359
|
const decorations = [];
|
|
76188
76360
|
doc2.descendants((node, pos) => {
|
|
76189
76361
|
if (node.type.name !== "paragraph") return;
|
|
@@ -76204,6 +76376,37 @@ function buildDecorations(doc2, view, helpers2, revision) {
|
|
|
76204
76376
|
});
|
|
76205
76377
|
return DecorationSet.create(doc2, decorations);
|
|
76206
76378
|
}
|
|
76379
|
+
function buildParagraphDecorations(doc2, paragraphContentPos, paragraphNode, view, helpers2, revision) {
|
|
76380
|
+
const request = createLayoutRequest(doc2, paragraphContentPos, view, helpers2, revision);
|
|
76381
|
+
if (!request) return [];
|
|
76382
|
+
const result = calculateTabLayout(request, void 0, view);
|
|
76383
|
+
return applyLayoutResult(result, paragraphNode, paragraphContentPos - 1);
|
|
76384
|
+
}
|
|
76385
|
+
function getAffectedParagraphStarts(tr, newState) {
|
|
76386
|
+
const affected = /* @__PURE__ */ new Set();
|
|
76387
|
+
tr.steps.forEach((step, index2) => {
|
|
76388
|
+
if (step.from == null && step.to == null) return;
|
|
76389
|
+
let fromPos = step.from;
|
|
76390
|
+
let toPos = step.to;
|
|
76391
|
+
if (typeof fromPos !== "number" || typeof toPos !== "number") return;
|
|
76392
|
+
for (let i = index2; i < tr.steps.length; i++) {
|
|
76393
|
+
const stepMap = tr.steps[i].getMap();
|
|
76394
|
+
fromPos = stepMap.map(fromPos, -1);
|
|
76395
|
+
toPos = stepMap.map(toPos, 1);
|
|
76396
|
+
}
|
|
76397
|
+
if (fromPos < 0 || toPos < 0 || fromPos > newState.doc.content.size || toPos > newState.doc.content.size) {
|
|
76398
|
+
return;
|
|
76399
|
+
}
|
|
76400
|
+
newState.doc.nodesBetween(fromPos, toPos, (node, pos) => {
|
|
76401
|
+
if (node.type.name === "paragraph") {
|
|
76402
|
+
affected.add(pos);
|
|
76403
|
+
return false;
|
|
76404
|
+
}
|
|
76405
|
+
return true;
|
|
76406
|
+
});
|
|
76407
|
+
});
|
|
76408
|
+
return affected;
|
|
76409
|
+
}
|
|
76207
76410
|
const LineBreak = Node$1.create({
|
|
76208
76411
|
name: "lineBreak",
|
|
76209
76412
|
group: "inline",
|