superdoc 1.0.0-beta.5 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-B2yJpudB.cjs → PdfViewer-T4fTm1XF.cjs} +1 -1
- package/dist/chunks/{PdfViewer-Ebg4DPUi.es.js → PdfViewer-hAYAlKzI.es.js} +1 -1
- package/dist/chunks/{index-DcKcwu3F.cjs → index-CYQjWGo5.cjs} +3 -3
- package/dist/chunks/{index-6_t69RiQ.es.js → index-DGYP5Xod.es.js} +3 -3
- package/dist/chunks/{index-D653XgvV-B-4_BIjA.es.js → index-DV613LhK-BY095UD2.es.js} +1 -1
- package/dist/chunks/{index-D653XgvV-BN--CbY4.cjs → index-DV613LhK-CqFLIBmd.cjs} +1 -1
- package/dist/chunks/{super-editor.es-0TS__OEc.es.js → super-editor.es-CcaD69pQ.es.js} +533 -217
- package/dist/chunks/{super-editor.es-Bt9VCC9D.cjs → super-editor.es-DmhQckCV.cjs} +533 -217
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +9 -9
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BiUZIOjP.js → converter-BM6gXTRC.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-Dz6dcXS4.js → docx-zipper-fwXPJGKu.js} +1 -1
- package/dist/super-editor/chunks/{editor-BtePjrrv.js → editor-RPTrfArg.js} +577 -206
- package/dist/super-editor/chunks/{index-D653XgvV.js → index-DV613LhK.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-D6JNBgna.js → toolbar-DacKXz_n.js} +5 -4
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +9 -9
- package/dist/super-editor/super-editor.es.js +22 -16
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +535 -219
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -35563,7 +35563,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35563
35563
|
static getStoredSuperdocVersion(docx) {
|
|
35564
35564
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35565
35565
|
}
|
|
35566
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
35566
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.7") {
|
|
35567
35567
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35568
35568
|
}
|
|
35569
35569
|
/**
|
|
@@ -38763,7 +38763,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
38763
38763
|
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
38764
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
38765
38765
|
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,
|
|
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;
|
|
38767
38767
|
var GOOD_LEAF_SIZE = 200;
|
|
38768
38768
|
var RopeSequence = function RopeSequence2() {
|
|
38769
38769
|
};
|
|
@@ -52270,7 +52270,7 @@ const isHeadless = (editor) => {
|
|
|
52270
52270
|
const shouldSkipNodeView = (editor) => {
|
|
52271
52271
|
return isHeadless(editor);
|
|
52272
52272
|
};
|
|
52273
|
-
const summaryVersion = "1.0.0-beta.
|
|
52273
|
+
const summaryVersion = "1.0.0-beta.7";
|
|
52274
52274
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
52275
52275
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
52276
52276
|
function mapAttributes(attrs) {
|
|
@@ -53049,7 +53049,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53049
53049
|
{ default: remarkStringify },
|
|
53050
53050
|
{ default: remarkGfm }
|
|
53051
53051
|
] = await Promise.all([
|
|
53052
|
-
import("./index-
|
|
53052
|
+
import("./index-DV613LhK-BY095UD2.es.js"),
|
|
53053
53053
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
53054
53054
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
53055
53055
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -53254,7 +53254,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53254
53254
|
* Process collaboration migrations
|
|
53255
53255
|
*/
|
|
53256
53256
|
processCollaborationMigrations() {
|
|
53257
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
53257
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.7");
|
|
53258
53258
|
if (!this.options.ydoc) return;
|
|
53259
53259
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
53260
53260
|
let docVersion = metaMap.get("version");
|
|
@@ -55386,9 +55386,10 @@ function extractTableBorders(bordersInput) {
|
|
|
55386
55386
|
}
|
|
55387
55387
|
function extractCellBorders(cellAttrs) {
|
|
55388
55388
|
if (!cellAttrs?.borders) return void 0;
|
|
55389
|
+
const bordersData = cellAttrs.borders;
|
|
55389
55390
|
const borders = {};
|
|
55390
55391
|
for (const side of ["top", "right", "bottom", "left"]) {
|
|
55391
|
-
const spec = convertBorderSpec(
|
|
55392
|
+
const spec = convertBorderSpec(bordersData[side]);
|
|
55392
55393
|
if (spec) {
|
|
55393
55394
|
borders[side] = spec;
|
|
55394
55395
|
}
|
|
@@ -55492,7 +55493,7 @@ const normalizeString = (value) => {
|
|
|
55492
55493
|
return trimmed ? trimmed : void 0;
|
|
55493
55494
|
};
|
|
55494
55495
|
const MAX_AUTO_LINE_MULTIPLIER = 10;
|
|
55495
|
-
const TWIPS_THRESHOLD = 50;
|
|
55496
|
+
const TWIPS_THRESHOLD$1 = 50;
|
|
55496
55497
|
const spacingPxToPt = (spacing) => {
|
|
55497
55498
|
const result = {};
|
|
55498
55499
|
if (spacing.before != null) result.before = pxToPt(spacing.before);
|
|
@@ -55632,7 +55633,7 @@ const normalizeParagraphIndent = (value) => {
|
|
|
55632
55633
|
const convert = (value2) => {
|
|
55633
55634
|
const num = pickNumber(value2);
|
|
55634
55635
|
if (num == null) return void 0;
|
|
55635
|
-
if (Math.abs(num) <= TWIPS_THRESHOLD) {
|
|
55636
|
+
if (Math.abs(num) <= TWIPS_THRESHOLD$1) {
|
|
55636
55637
|
return num;
|
|
55637
55638
|
}
|
|
55638
55639
|
return twipsToPx$1(Number(num));
|
|
@@ -55647,24 +55648,18 @@ const normalizeParagraphIndent = (value) => {
|
|
|
55647
55648
|
if (hanging != null) indent.hanging = hanging;
|
|
55648
55649
|
return Object.keys(indent).length > 0 ? indent : void 0;
|
|
55649
55650
|
};
|
|
55651
|
+
const PX_TO_TWIPS = 15;
|
|
55652
|
+
const TWIPS_THRESHOLD = 1e3;
|
|
55650
55653
|
const normalizeOoxmlTabs = (tabs) => {
|
|
55651
55654
|
if (!Array.isArray(tabs)) return void 0;
|
|
55652
55655
|
const normalized = [];
|
|
55653
55656
|
for (const entry of tabs) {
|
|
55654
55657
|
if (!entry || typeof entry !== "object") continue;
|
|
55655
|
-
const
|
|
55656
|
-
|
|
55657
|
-
const
|
|
55658
|
-
if (originalPos != null) {
|
|
55659
|
-
posTwips = originalPos;
|
|
55660
|
-
} else {
|
|
55661
|
-
const posPx = pickNumber(source.pos ?? source.position ?? source.offset);
|
|
55662
|
-
if (posPx != null) {
|
|
55663
|
-
posTwips = Math.round(posPx * 15);
|
|
55664
|
-
}
|
|
55665
|
-
}
|
|
55658
|
+
const rawEntry = entry;
|
|
55659
|
+
const source = rawEntry.tab && typeof rawEntry.tab === "object" ? rawEntry.tab : rawEntry;
|
|
55660
|
+
const posTwips = resolveTabPosition(source);
|
|
55666
55661
|
if (posTwips == null) continue;
|
|
55667
|
-
const val = normalizeTabVal(source.val ?? source.align ?? source.alignment ?? source.type);
|
|
55662
|
+
const val = normalizeTabVal(source.val ?? source.align ?? source.alignment ?? source.type ?? source.tabType);
|
|
55668
55663
|
if (!val) continue;
|
|
55669
55664
|
const tab = {
|
|
55670
55665
|
val,
|
|
@@ -55676,6 +55671,21 @@ const normalizeOoxmlTabs = (tabs) => {
|
|
|
55676
55671
|
}
|
|
55677
55672
|
return normalized.length > 0 ? normalized : void 0;
|
|
55678
55673
|
};
|
|
55674
|
+
const resolveTabPosition = (source) => {
|
|
55675
|
+
const originalPos = pickNumber(source.originalPos);
|
|
55676
|
+
if (originalPos != null) {
|
|
55677
|
+
return originalPos;
|
|
55678
|
+
}
|
|
55679
|
+
const posValue = pickNumber(source.pos ?? source.position ?? source.offset);
|
|
55680
|
+
if (posValue == null) {
|
|
55681
|
+
return void 0;
|
|
55682
|
+
}
|
|
55683
|
+
if (posValue > TWIPS_THRESHOLD) {
|
|
55684
|
+
return posValue;
|
|
55685
|
+
} else {
|
|
55686
|
+
return Math.round(posValue * PX_TO_TWIPS);
|
|
55687
|
+
}
|
|
55688
|
+
};
|
|
55679
55689
|
const normalizeTabVal = (value) => {
|
|
55680
55690
|
switch (value) {
|
|
55681
55691
|
case "start":
|
|
@@ -55687,12 +55697,13 @@ const normalizeTabVal = (value) => {
|
|
|
55687
55697
|
return value;
|
|
55688
55698
|
case "left":
|
|
55689
55699
|
return "start";
|
|
55690
|
-
// Legacy mapping
|
|
55700
|
+
// Legacy mapping for RTL support
|
|
55691
55701
|
case "right":
|
|
55692
55702
|
return "end";
|
|
55693
|
-
// Legacy mapping
|
|
55703
|
+
// Legacy mapping for RTL support
|
|
55694
55704
|
case "dec":
|
|
55695
55705
|
return "decimal";
|
|
55706
|
+
// Abbreviation mapping
|
|
55696
55707
|
default:
|
|
55697
55708
|
return void 0;
|
|
55698
55709
|
}
|
|
@@ -55708,7 +55719,7 @@ const normalizeTabLeader = (value) => {
|
|
|
55708
55719
|
return value;
|
|
55709
55720
|
case "thick":
|
|
55710
55721
|
return "heavy";
|
|
55711
|
-
//
|
|
55722
|
+
// Legacy mapping
|
|
55712
55723
|
default:
|
|
55713
55724
|
return void 0;
|
|
55714
55725
|
}
|
|
@@ -56636,29 +56647,6 @@ const normalizeSuffix = (suffix2) => {
|
|
|
56636
56647
|
}
|
|
56637
56648
|
return void 0;
|
|
56638
56649
|
};
|
|
56639
|
-
function resolveSpacingIndent$1(style2, numbering) {
|
|
56640
|
-
const spacing = {
|
|
56641
|
-
before: style2.spacing?.before ?? 0,
|
|
56642
|
-
after: style2.spacing?.after ?? 0,
|
|
56643
|
-
line: style2.spacing?.line ?? 12,
|
|
56644
|
-
// Default line spacing
|
|
56645
|
-
lineRule: style2.spacing?.lineRule ?? "auto"
|
|
56646
|
-
};
|
|
56647
|
-
let indent = {
|
|
56648
|
-
left: style2.indent?.left ?? 0,
|
|
56649
|
-
right: style2.indent?.right ?? 0,
|
|
56650
|
-
firstLine: style2.indent?.firstLine ?? 0,
|
|
56651
|
-
hanging: style2.indent?.hanging ?? 0
|
|
56652
|
-
};
|
|
56653
|
-
if (numbering?.indent) {
|
|
56654
|
-
indent = {
|
|
56655
|
-
...indent,
|
|
56656
|
-
left: numbering.indent.left ?? indent.left,
|
|
56657
|
-
hanging: numbering.indent.hanging ?? indent.hanging
|
|
56658
|
-
};
|
|
56659
|
-
}
|
|
56660
|
-
return { spacing, indent };
|
|
56661
|
-
}
|
|
56662
56650
|
function computeTabStops$1(context) {
|
|
56663
56651
|
const { explicitStops, defaultTabInterval, paragraphIndent } = context;
|
|
56664
56652
|
const leftIndent = paragraphIndent.left ?? 0;
|
|
@@ -56770,6 +56758,90 @@ function computeEndAlignedX(entry, stop) {
|
|
|
56770
56758
|
const targetX = stop.pos - width;
|
|
56771
56759
|
return targetX < 0 ? 0 : targetX;
|
|
56772
56760
|
}
|
|
56761
|
+
function calculateTabWidth(params2) {
|
|
56762
|
+
const {
|
|
56763
|
+
currentX,
|
|
56764
|
+
tabStops,
|
|
56765
|
+
paragraphWidth,
|
|
56766
|
+
defaultTabDistance: defaultTabDistance2,
|
|
56767
|
+
defaultLineLength: defaultLineLength2,
|
|
56768
|
+
followingText = "",
|
|
56769
|
+
measureText: measureText2,
|
|
56770
|
+
decimalSeparator = "."
|
|
56771
|
+
} = params2;
|
|
56772
|
+
const nextStop = tabStops.find((stop) => stop.val !== "clear" && stop.pos > currentX);
|
|
56773
|
+
const fallbackWidth = () => {
|
|
56774
|
+
let tabWidth = defaultTabDistance2 - currentX % defaultLineLength2 % defaultTabDistance2;
|
|
56775
|
+
if (tabWidth <= 0) tabWidth = defaultTabDistance2;
|
|
56776
|
+
return {
|
|
56777
|
+
width: tabWidth,
|
|
56778
|
+
alignment: "default",
|
|
56779
|
+
tabStopPosUsed: "default"
|
|
56780
|
+
};
|
|
56781
|
+
};
|
|
56782
|
+
if (!nextStop) {
|
|
56783
|
+
return fallbackWidth();
|
|
56784
|
+
}
|
|
56785
|
+
let width = Math.min(nextStop.pos, paragraphWidth) - currentX;
|
|
56786
|
+
const alignment2 = nextStop.val;
|
|
56787
|
+
if (alignment2 === "bar") {
|
|
56788
|
+
return {
|
|
56789
|
+
width: 0,
|
|
56790
|
+
leader: nextStop.leader,
|
|
56791
|
+
alignment: alignment2,
|
|
56792
|
+
tabStopPosUsed: nextStop.pos
|
|
56793
|
+
};
|
|
56794
|
+
}
|
|
56795
|
+
if (alignment2 === "center" || alignment2 === "end") {
|
|
56796
|
+
const textWidth = measureText2 ? measureText2(followingText) : 0;
|
|
56797
|
+
if (alignment2 === "center") {
|
|
56798
|
+
width -= textWidth / 2;
|
|
56799
|
+
} else {
|
|
56800
|
+
width -= textWidth;
|
|
56801
|
+
}
|
|
56802
|
+
} else if (alignment2 === "decimal") {
|
|
56803
|
+
const decimalIndex = followingText.indexOf(decimalSeparator);
|
|
56804
|
+
if (decimalIndex >= 0) {
|
|
56805
|
+
const before = followingText.slice(0, decimalIndex);
|
|
56806
|
+
const beforeWidth = measureText2 ? measureText2(before) : 0;
|
|
56807
|
+
width -= beforeWidth;
|
|
56808
|
+
}
|
|
56809
|
+
} else if (alignment2 === "bar") {
|
|
56810
|
+
width = 0;
|
|
56811
|
+
}
|
|
56812
|
+
if (width < 1) {
|
|
56813
|
+
return fallbackWidth();
|
|
56814
|
+
}
|
|
56815
|
+
return {
|
|
56816
|
+
width,
|
|
56817
|
+
leader: nextStop.leader,
|
|
56818
|
+
alignment: alignment2,
|
|
56819
|
+
tabStopPosUsed: nextStop.pos
|
|
56820
|
+
};
|
|
56821
|
+
}
|
|
56822
|
+
function resolveSpacingIndent$1(style2, numbering) {
|
|
56823
|
+
const spacing = {
|
|
56824
|
+
before: style2.spacing?.before ?? 0,
|
|
56825
|
+
after: style2.spacing?.after ?? 0,
|
|
56826
|
+
line: style2.spacing?.line ?? 12,
|
|
56827
|
+
// Default line spacing
|
|
56828
|
+
lineRule: style2.spacing?.lineRule ?? "auto"
|
|
56829
|
+
};
|
|
56830
|
+
let indent = {
|
|
56831
|
+
left: style2.indent?.left ?? 0,
|
|
56832
|
+
right: style2.indent?.right ?? 0,
|
|
56833
|
+
firstLine: style2.indent?.firstLine ?? 0,
|
|
56834
|
+
hanging: style2.indent?.hanging ?? 0
|
|
56835
|
+
};
|
|
56836
|
+
if (numbering?.indent) {
|
|
56837
|
+
indent = {
|
|
56838
|
+
...indent,
|
|
56839
|
+
left: numbering.indent.left ?? indent.left,
|
|
56840
|
+
hanging: numbering.indent.hanging ?? indent.hanging
|
|
56841
|
+
};
|
|
56842
|
+
}
|
|
56843
|
+
return { spacing, indent };
|
|
56844
|
+
}
|
|
56773
56845
|
function formatListLabel(level, indices) {
|
|
56774
56846
|
const { format, text: template, start: start2 } = level;
|
|
56775
56847
|
if (format === "bullet" || format === "custom") {
|
|
@@ -56935,6 +57007,7 @@ function measureRowHeights(cells, _columnWidths) {
|
|
|
56935
57007
|
}
|
|
56936
57008
|
const Engines = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
56937
57009
|
__proto__: null,
|
|
57010
|
+
calculateTabWidth,
|
|
56938
57011
|
computeListIndent,
|
|
56939
57012
|
computeTabStops: computeTabStops$1,
|
|
56940
57013
|
computeWrapExclusion,
|
|
@@ -56983,17 +57056,18 @@ const hydrateParagraphStyleAttrs = (para, context, preResolved) => {
|
|
|
56983
57056
|
return null;
|
|
56984
57057
|
}
|
|
56985
57058
|
const resolvedExtended = resolved;
|
|
57059
|
+
const resolvedAsRecord = resolved;
|
|
56986
57060
|
const hydrated = {
|
|
56987
57061
|
resolved,
|
|
56988
|
-
spacing: cloneIfObject(
|
|
56989
|
-
indent: cloneIfObject(
|
|
57062
|
+
spacing: cloneIfObject(resolvedAsRecord.spacing),
|
|
57063
|
+
indent: cloneIfObject(resolvedAsRecord.indent),
|
|
56990
57064
|
borders: cloneIfObject(resolvedExtended.borders),
|
|
56991
57065
|
shading: cloneIfObject(resolvedExtended.shading),
|
|
56992
57066
|
alignment: resolvedExtended.justification,
|
|
56993
57067
|
tabStops: cloneIfObject(resolvedExtended.tabStops),
|
|
56994
57068
|
keepLines: resolvedExtended.keepLines,
|
|
56995
57069
|
keepNext: resolvedExtended.keepNext,
|
|
56996
|
-
numberingProperties: cloneIfObject(
|
|
57070
|
+
numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties)
|
|
56997
57071
|
};
|
|
56998
57072
|
return hydrated;
|
|
56999
57073
|
};
|
|
@@ -57206,6 +57280,9 @@ const normalizeResolvedTabAlignment = (value) => {
|
|
|
57206
57280
|
}
|
|
57207
57281
|
};
|
|
57208
57282
|
const computeWordLayoutForParagraph = (paragraphAttrs, numberingProps, styleContext) => {
|
|
57283
|
+
if (numberingProps === null) {
|
|
57284
|
+
return null;
|
|
57285
|
+
}
|
|
57209
57286
|
try {
|
|
57210
57287
|
let effectiveIndent = paragraphAttrs.indent;
|
|
57211
57288
|
if (numberingProps?.resolvedLevelIndent) {
|
|
@@ -57240,7 +57317,7 @@ const computeWordLayoutForParagraph = (paragraphAttrs, numberingProps, styleCont
|
|
|
57240
57317
|
return computeWordParagraphLayout({
|
|
57241
57318
|
paragraph: resolvedParagraph,
|
|
57242
57319
|
numbering: numberingProps,
|
|
57243
|
-
markerRun: numberingProps
|
|
57320
|
+
markerRun: numberingProps?.resolvedMarkerRpr,
|
|
57244
57321
|
// Use cached if available
|
|
57245
57322
|
docDefaults
|
|
57246
57323
|
});
|
|
@@ -57686,7 +57763,7 @@ function processImageChild(child, sectionMetadata, context, output, converters)
|
|
|
57686
57763
|
function processNestedStructuredContent(child, sectionMetadata, context, output, converters) {
|
|
57687
57764
|
const { getListCounter, incrementListCounter, resetListCounter } = context.listCounterContext;
|
|
57688
57765
|
const nestedMetadata = resolveNodeSdtMetadata(child, "structuredContentBlock");
|
|
57689
|
-
child.content
|
|
57766
|
+
child.content?.forEach((grandchild) => {
|
|
57690
57767
|
if (grandchild.type === "paragraph") {
|
|
57691
57768
|
const paragraphBlocks = converters.paragraphToFlowBlocks(
|
|
57692
57769
|
grandchild,
|
|
@@ -57738,7 +57815,7 @@ function processDocumentPartObject(child, sectionMetadata, context, output, conv
|
|
|
57738
57815
|
if (docPartGallery === "Table of Contents") {
|
|
57739
57816
|
const blocksBeforeToc = output.blocks.length;
|
|
57740
57817
|
processTocChildren(
|
|
57741
|
-
Array.from(child.content),
|
|
57818
|
+
Array.from(child.content ?? []),
|
|
57742
57819
|
{ docPartGallery, docPartObjectId, tocInstruction, sdtMetadata: docPartSdtMetadata },
|
|
57743
57820
|
{
|
|
57744
57821
|
nextBlockId: context.nextBlockId,
|
|
@@ -58416,7 +58493,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
58416
58493
|
trackedChanges,
|
|
58417
58494
|
bookmarks,
|
|
58418
58495
|
hyperlinkConfig,
|
|
58419
|
-
|
|
58496
|
+
themeColors,
|
|
58497
|
+
...converterContext !== void 0 ? [converterContext] : []
|
|
58420
58498
|
);
|
|
58421
58499
|
if (tableBlock) {
|
|
58422
58500
|
blocks.push(tableBlock);
|
|
@@ -58542,6 +58620,8 @@ function handleParagraphNode(node, context) {
|
|
|
58542
58620
|
trackedChangesConfig,
|
|
58543
58621
|
bookmarks,
|
|
58544
58622
|
hyperlinkConfig,
|
|
58623
|
+
void 0,
|
|
58624
|
+
// themeColors - not available in NodeHandlerContext
|
|
58545
58625
|
context.converterContext
|
|
58546
58626
|
);
|
|
58547
58627
|
paragraphBlocks.forEach((block) => {
|
|
@@ -59051,9 +59131,9 @@ const parseTableCell = (args) => {
|
|
|
59051
59131
|
const paragraph = paragraphBlocks.find((b2) => b2.kind === "paragraph");
|
|
59052
59132
|
if (!paragraph) return null;
|
|
59053
59133
|
const cellAttrs = {};
|
|
59054
|
-
const borders = extractCellBorders(cellNode.attrs);
|
|
59134
|
+
const borders = extractCellBorders(cellNode.attrs ?? {});
|
|
59055
59135
|
if (borders) cellAttrs.borders = borders;
|
|
59056
|
-
const padding = extractCellPadding(cellNode.attrs) ?? (defaultCellPadding ? { ...defaultCellPadding } : void 0);
|
|
59136
|
+
const padding = extractCellPadding(cellNode.attrs ?? {}) ?? (defaultCellPadding ? { ...defaultCellPadding } : void 0);
|
|
59057
59137
|
if (padding) cellAttrs.padding = padding;
|
|
59058
59138
|
const verticalAlign = cellNode.attrs?.verticalAlign;
|
|
59059
59139
|
if (verticalAlign === "top" || verticalAlign === "middle" || verticalAlign === "bottom") {
|
|
@@ -59390,7 +59470,7 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
59390
59470
|
themeColors,
|
|
59391
59471
|
converterContext
|
|
59392
59472
|
);
|
|
59393
|
-
const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2) => tableNodeToBlock(
|
|
59473
|
+
const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
|
|
59394
59474
|
node,
|
|
59395
59475
|
nextBlockId2,
|
|
59396
59476
|
positions2,
|
|
@@ -59400,8 +59480,8 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
59400
59480
|
trackedChanges,
|
|
59401
59481
|
bookmarks2,
|
|
59402
59482
|
hyperlinkConfig2,
|
|
59403
|
-
themeColors,
|
|
59404
|
-
converterContext
|
|
59483
|
+
themeColorsParam ?? themeColors,
|
|
59484
|
+
converterCtx ?? converterContext
|
|
59405
59485
|
);
|
|
59406
59486
|
const handlerContext = {
|
|
59407
59487
|
blocks,
|
|
@@ -66083,7 +66163,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66083
66163
|
markerEl.style.display = "inline-block";
|
|
66084
66164
|
markerEl.style.width = `${Math.max(0, fragment.markerWidth - LIST_MARKER_GAP$1)}px`;
|
|
66085
66165
|
markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
|
|
66086
|
-
markerEl.style.textAlign = marker.justification ?? "";
|
|
66166
|
+
markerEl.style.textAlign = marker.justification ?? "left";
|
|
66087
66167
|
markerEl.style.fontFamily = marker.run.fontFamily;
|
|
66088
66168
|
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
66089
66169
|
if (marker.run.bold) markerEl.style.fontWeight = "bold";
|
|
@@ -66471,7 +66551,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66471
66551
|
buildLinkRenderData(link) {
|
|
66472
66552
|
const dataset = buildLinkDataset(link);
|
|
66473
66553
|
const sanitized = typeof link.href === "string" ? sanitizeHref(link.href) : null;
|
|
66474
|
-
const anchorHref = normalizeAnchor(link.anchor ?? link.name ??
|
|
66554
|
+
const anchorHref = normalizeAnchor(link.anchor ?? link.name ?? "");
|
|
66475
66555
|
let href = sanitized?.href ?? anchorHref;
|
|
66476
66556
|
if (link.version === 2) {
|
|
66477
66557
|
href = appendDocLocation(href, link.docLocation ?? null);
|
|
@@ -66649,6 +66729,10 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66649
66729
|
const el = this.doc.createElement("div");
|
|
66650
66730
|
el.classList.add(CLASS_NAMES.line);
|
|
66651
66731
|
applyStyles$2(el, lineStyles(line.lineHeight));
|
|
66732
|
+
const styleId = block.attrs?.styleId;
|
|
66733
|
+
if (styleId) {
|
|
66734
|
+
el.setAttribute("styleid", styleId);
|
|
66735
|
+
}
|
|
66652
66736
|
const lineRange = computeLinePmRange(block, line);
|
|
66653
66737
|
if (lineRange.pmStart != null) {
|
|
66654
66738
|
el.dataset.pmStart = String(lineRange.pmStart);
|
|
@@ -66676,7 +66760,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66676
66760
|
leaderEl.style.height = ld.style === "heavy" ? "2px" : "1px";
|
|
66677
66761
|
leaderEl.style.pointerEvents = "none";
|
|
66678
66762
|
leaderEl.style.zIndex = "0";
|
|
66679
|
-
if (ld.style === "dot") {
|
|
66763
|
+
if (ld.style === "dot" || ld.style === "middleDot") {
|
|
66680
66764
|
leaderEl.style.borderBottom = "1px dotted currentColor";
|
|
66681
66765
|
} else if (ld.style === "hyphen") {
|
|
66682
66766
|
leaderEl.style.borderBottom = "1px dashed currentColor";
|
|
@@ -66713,6 +66797,9 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66713
66797
|
const segmentRun = { ...baseRun, text: segmentText };
|
|
66714
66798
|
const elem = this.renderRun(segmentRun, context, trackedConfig);
|
|
66715
66799
|
if (elem) {
|
|
66800
|
+
if (styleId) {
|
|
66801
|
+
elem.setAttribute("styleid", styleId);
|
|
66802
|
+
}
|
|
66716
66803
|
let xPos;
|
|
66717
66804
|
if (segment.x !== void 0) {
|
|
66718
66805
|
xPos = segment.x;
|
|
@@ -66738,6 +66825,9 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66738
66825
|
runs.forEach((run2) => {
|
|
66739
66826
|
const elem = this.renderRun(run2, context, trackedConfig);
|
|
66740
66827
|
if (elem) {
|
|
66828
|
+
if (styleId) {
|
|
66829
|
+
elem.setAttribute("styleid", styleId);
|
|
66830
|
+
}
|
|
66741
66831
|
el.appendChild(elem);
|
|
66742
66832
|
}
|
|
66743
66833
|
});
|
|
@@ -67157,6 +67247,9 @@ const applyRunDataAttributes = (element, dataAttrs) => {
|
|
|
67157
67247
|
};
|
|
67158
67248
|
const applyParagraphBlockStyles = (element, attrs) => {
|
|
67159
67249
|
if (!attrs) return;
|
|
67250
|
+
if (attrs.styleId) {
|
|
67251
|
+
element.setAttribute("styleid", attrs.styleId);
|
|
67252
|
+
}
|
|
67160
67253
|
if (attrs.alignment) {
|
|
67161
67254
|
element.style.textAlign = attrs.alignment;
|
|
67162
67255
|
}
|
|
@@ -67378,6 +67471,7 @@ const pxToTwips = (px) => Math.round(px * TWIPS_PER_PX);
|
|
|
67378
67471
|
const DEFAULT_TAB_INTERVAL_PX = twipsToPx(DEFAULT_TAB_INTERVAL_TWIPS);
|
|
67379
67472
|
const TAB_EPSILON = 0.1;
|
|
67380
67473
|
const DEFAULT_DECIMAL_SEPARATOR = ".";
|
|
67474
|
+
const ALLOWED_TAB_VALS = /* @__PURE__ */ new Set(["start", "center", "end", "decimal", "bar", "clear"]);
|
|
67381
67475
|
const roundValue = (value) => value;
|
|
67382
67476
|
function getCanvasContext() {
|
|
67383
67477
|
if (!canvasContext) {
|
|
@@ -67500,6 +67594,14 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
67500
67594
|
let tabStopCursor = 0;
|
|
67501
67595
|
let pendingTabAlignment = null;
|
|
67502
67596
|
let lastAppliedTabAlign = null;
|
|
67597
|
+
const warnedTabVals = /* @__PURE__ */ new Set();
|
|
67598
|
+
const validateTabStopVal = (stop) => {
|
|
67599
|
+
if (!ALLOWED_TAB_VALS.has(stop.val) && !warnedTabVals.has(stop.val)) {
|
|
67600
|
+
warnedTabVals.add(stop.val);
|
|
67601
|
+
return false;
|
|
67602
|
+
}
|
|
67603
|
+
return true;
|
|
67604
|
+
};
|
|
67503
67605
|
const alignSegmentAtTab = (segmentText, font, runContext) => {
|
|
67504
67606
|
if (!pendingTabAlignment || !currentLine) return;
|
|
67505
67607
|
const { target, val } = pendingTabAlignment;
|
|
@@ -67548,8 +67650,13 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
67548
67650
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, 12);
|
|
67549
67651
|
currentLine.toRun = runIndex;
|
|
67550
67652
|
currentLine.toChar = 1;
|
|
67551
|
-
|
|
67552
|
-
|
|
67653
|
+
if (stop) {
|
|
67654
|
+
validateTabStopVal(stop);
|
|
67655
|
+
pendingTabAlignment = { target, val: stop.val };
|
|
67656
|
+
} else {
|
|
67657
|
+
pendingTabAlignment = null;
|
|
67658
|
+
}
|
|
67659
|
+
if (stop && stop.leader && stop.leader !== "none") {
|
|
67553
67660
|
const leaderStyle = stop.leader;
|
|
67554
67661
|
const from2 = Math.min(originX, target);
|
|
67555
67662
|
const to = Math.max(originX, target);
|
|
@@ -67695,7 +67802,12 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
67695
67802
|
currentLine.toRun = runIndex;
|
|
67696
67803
|
currentLine.toChar = charPosInRun;
|
|
67697
67804
|
charPosInRun += 1;
|
|
67698
|
-
|
|
67805
|
+
if (stop) {
|
|
67806
|
+
validateTabStopVal(stop);
|
|
67807
|
+
pendingTabAlignment = { target, val: stop.val };
|
|
67808
|
+
} else {
|
|
67809
|
+
pendingTabAlignment = null;
|
|
67810
|
+
}
|
|
67699
67811
|
if (stop && stop.leader && stop.leader !== "none" && stop.leader !== "middleDot") {
|
|
67700
67812
|
const leaderStyle = stop.leader;
|
|
67701
67813
|
const from2 = Math.min(originX, target);
|
|
@@ -67747,10 +67859,6 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
67747
67859
|
markerTextWidth: glyphWidth,
|
|
67748
67860
|
indentLeft: wordLayout.indentLeftPx ?? 0
|
|
67749
67861
|
};
|
|
67750
|
-
console.log(
|
|
67751
|
-
"[measure] Marker:",
|
|
67752
|
-
JSON.stringify({ text: markerText, width: markerInfo.markerWidth, indent: markerInfo.indentLeft })
|
|
67753
|
-
);
|
|
67754
67862
|
}
|
|
67755
67863
|
return {
|
|
67756
67864
|
kind: "paragraph",
|
|
@@ -68858,6 +68966,24 @@ getConverterContext_fn = function() {
|
|
|
68858
68966
|
}
|
|
68859
68967
|
return Object.keys(context).length > 0 ? context : void 0;
|
|
68860
68968
|
};
|
|
68969
|
+
const uiSurfaces = /* @__PURE__ */ new WeakSet();
|
|
68970
|
+
function isInRegisteredSurface(event) {
|
|
68971
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
68972
|
+
if (path.length > 0) {
|
|
68973
|
+
for (const node2 of path) {
|
|
68974
|
+
if (uiSurfaces.has(node2)) return true;
|
|
68975
|
+
if (node2?.hasAttribute?.("data-editor-ui-surface")) return true;
|
|
68976
|
+
}
|
|
68977
|
+
return false;
|
|
68978
|
+
}
|
|
68979
|
+
let node = event.target;
|
|
68980
|
+
while (node) {
|
|
68981
|
+
if (uiSurfaces.has(node)) return true;
|
|
68982
|
+
if (node.hasAttribute?.("data-editor-ui-surface")) return true;
|
|
68983
|
+
node = node.parentElement;
|
|
68984
|
+
}
|
|
68985
|
+
return false;
|
|
68986
|
+
}
|
|
68861
68987
|
const DEFAULT_PAGE_SIZE = { w: 612, h: 792 };
|
|
68862
68988
|
const DEFAULT_MARGINS = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
68863
68989
|
const WORD_CHARACTER_REGEX = /[\p{L}\p{N}''_~-]/u;
|
|
@@ -71634,39 +71760,49 @@ _PresentationEditor.CURSOR_STYLES = {
|
|
|
71634
71760
|
};
|
|
71635
71761
|
let PresentationEditor = _PresentationEditor;
|
|
71636
71762
|
class PresentationInputBridge {
|
|
71637
|
-
constructor(windowRoot,
|
|
71763
|
+
constructor(windowRoot, layoutSurface, getTargetDom, onTargetChanged, options) {
|
|
71638
71764
|
__privateAdd$1(this, _PresentationInputBridge_instances);
|
|
71639
71765
|
__privateAdd$1(this, _windowRoot);
|
|
71640
|
-
__privateAdd$1(this,
|
|
71766
|
+
__privateAdd$1(this, _layoutSurfaces);
|
|
71641
71767
|
__privateAdd$1(this, _getTargetDom);
|
|
71642
71768
|
__privateAdd$1(this, _onTargetChanged);
|
|
71643
71769
|
__privateAdd$1(this, _listeners);
|
|
71644
71770
|
__privateAdd$1(this, _currentTarget, null);
|
|
71645
71771
|
__privateAdd$1(this, _destroyed, false);
|
|
71772
|
+
__privateAdd$1(this, _useWindowFallback);
|
|
71646
71773
|
__privateSet(this, _windowRoot, windowRoot);
|
|
71647
|
-
__privateSet(this,
|
|
71774
|
+
__privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
|
|
71648
71775
|
__privateSet(this, _getTargetDom, getTargetDom);
|
|
71649
71776
|
__privateSet(this, _onTargetChanged, onTargetChanged);
|
|
71650
71777
|
__privateSet(this, _listeners, []);
|
|
71778
|
+
__privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
|
|
71651
71779
|
}
|
|
71652
71780
|
bind() {
|
|
71653
|
-
|
|
71654
|
-
|
|
71655
|
-
|
|
71656
|
-
|
|
71657
|
-
|
|
71658
|
-
|
|
71659
|
-
|
|
71660
|
-
|
|
71661
|
-
|
|
71662
|
-
|
|
71663
|
-
|
|
71664
|
-
|
|
71665
|
-
|
|
71781
|
+
const keyboardTargets = __privateMethod$1(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
71782
|
+
keyboardTargets.forEach((target) => {
|
|
71783
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "keydown", __privateMethod$1(this, _PresentationInputBridge_instances, forwardKeyboardEvent_fn), target);
|
|
71784
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "keyup", __privateMethod$1(this, _PresentationInputBridge_instances, forwardKeyboardEvent_fn), target);
|
|
71785
|
+
});
|
|
71786
|
+
const compositionTargets = __privateMethod$1(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
71787
|
+
compositionTargets.forEach((target) => {
|
|
71788
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionstart", __privateMethod$1(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
71789
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionupdate", __privateMethod$1(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
71790
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionend", __privateMethod$1(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
71791
|
+
});
|
|
71792
|
+
const textTargets = __privateMethod$1(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
71793
|
+
textTargets.forEach((target) => {
|
|
71794
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "beforeinput", __privateMethod$1(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
71795
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "input", __privateMethod$1(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
71796
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "textInput", __privateMethod$1(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
71797
|
+
});
|
|
71798
|
+
const contextTargets = __privateMethod$1(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
71799
|
+
contextTargets.forEach((target) => {
|
|
71800
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "contextmenu", __privateMethod$1(this, _PresentationInputBridge_instances, forwardContextMenu_fn), target);
|
|
71801
|
+
});
|
|
71666
71802
|
}
|
|
71667
71803
|
destroy() {
|
|
71668
|
-
__privateGet$1(this, _listeners).forEach(({ type: type2, handler: handler2, target }) => {
|
|
71669
|
-
target.removeEventListener(type2, handler2,
|
|
71804
|
+
__privateGet$1(this, _listeners).forEach(({ type: type2, handler: handler2, target, useCapture }) => {
|
|
71805
|
+
target.removeEventListener(type2, handler2, useCapture);
|
|
71670
71806
|
});
|
|
71671
71807
|
__privateSet(this, _listeners, []);
|
|
71672
71808
|
__privateSet(this, _currentTarget, null);
|
|
@@ -71701,17 +71837,18 @@ class PresentationInputBridge {
|
|
|
71701
71837
|
}
|
|
71702
71838
|
}
|
|
71703
71839
|
_windowRoot = /* @__PURE__ */ new WeakMap();
|
|
71704
|
-
|
|
71840
|
+
_layoutSurfaces = /* @__PURE__ */ new WeakMap();
|
|
71705
71841
|
_getTargetDom = /* @__PURE__ */ new WeakMap();
|
|
71706
71842
|
_onTargetChanged = /* @__PURE__ */ new WeakMap();
|
|
71707
71843
|
_listeners = /* @__PURE__ */ new WeakMap();
|
|
71708
71844
|
_currentTarget = /* @__PURE__ */ new WeakMap();
|
|
71709
71845
|
_destroyed = /* @__PURE__ */ new WeakMap();
|
|
71846
|
+
_useWindowFallback = /* @__PURE__ */ new WeakMap();
|
|
71710
71847
|
_PresentationInputBridge_instances = /* @__PURE__ */ new WeakSet();
|
|
71711
|
-
addListener_fn = function(type2, handler2, target) {
|
|
71848
|
+
addListener_fn = function(type2, handler2, target, useCapture = false) {
|
|
71712
71849
|
const bound = handler2.bind(this);
|
|
71713
|
-
__privateGet$1(this, _listeners).push({ type: type2, handler: bound, target });
|
|
71714
|
-
target.addEventListener(type2, bound,
|
|
71850
|
+
__privateGet$1(this, _listeners).push({ type: type2, handler: bound, target, useCapture });
|
|
71851
|
+
target.addEventListener(type2, bound, useCapture);
|
|
71715
71852
|
};
|
|
71716
71853
|
dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
71717
71854
|
if (__privateGet$1(this, _destroyed)) return;
|
|
@@ -71732,7 +71869,16 @@ dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
|
71732
71869
|
}
|
|
71733
71870
|
};
|
|
71734
71871
|
forwardKeyboardEvent_fn = function(event) {
|
|
71735
|
-
if (__privateMethod$1(this, _PresentationInputBridge_instances,
|
|
71872
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
71873
|
+
return;
|
|
71874
|
+
}
|
|
71875
|
+
if (event.defaultPrevented) {
|
|
71876
|
+
return;
|
|
71877
|
+
}
|
|
71878
|
+
if (event.isComposing || event.keyCode === 229) {
|
|
71879
|
+
return;
|
|
71880
|
+
}
|
|
71881
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, isPlainCharacterKey_fn).call(this, event)) {
|
|
71736
71882
|
return;
|
|
71737
71883
|
}
|
|
71738
71884
|
const synthetic = new KeyboardEvent(event.type, {
|
|
@@ -71750,26 +71896,40 @@ forwardKeyboardEvent_fn = function(event) {
|
|
|
71750
71896
|
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
71751
71897
|
};
|
|
71752
71898
|
forwardTextEvent_fn = function(event) {
|
|
71753
|
-
if (__privateMethod$1(this, _PresentationInputBridge_instances,
|
|
71899
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
71754
71900
|
return;
|
|
71755
71901
|
}
|
|
71756
|
-
|
|
71757
|
-
|
|
71758
|
-
synthetic = new InputEvent(event.type, {
|
|
71759
|
-
data: event.data ?? event.data ?? null,
|
|
71760
|
-
inputType: event.inputType ?? "insertText",
|
|
71761
|
-
dataTransfer: event.dataTransfer ?? null,
|
|
71762
|
-
isComposing: event.isComposing ?? false,
|
|
71763
|
-
bubbles: true,
|
|
71764
|
-
cancelable: true
|
|
71765
|
-
});
|
|
71766
|
-
} else {
|
|
71767
|
-
synthetic = new Event(event.type, { bubbles: true, cancelable: true });
|
|
71902
|
+
if (event.defaultPrevented) {
|
|
71903
|
+
return;
|
|
71768
71904
|
}
|
|
71769
|
-
|
|
71905
|
+
if (event.isComposing) {
|
|
71906
|
+
return;
|
|
71907
|
+
}
|
|
71908
|
+
queueMicrotask(() => {
|
|
71909
|
+
if (event.defaultPrevented) {
|
|
71910
|
+
return;
|
|
71911
|
+
}
|
|
71912
|
+
let synthetic;
|
|
71913
|
+
if (typeof InputEvent !== "undefined") {
|
|
71914
|
+
synthetic = new InputEvent(event.type, {
|
|
71915
|
+
data: event.data ?? event.data ?? null,
|
|
71916
|
+
inputType: event.inputType ?? "insertText",
|
|
71917
|
+
dataTransfer: event.dataTransfer ?? null,
|
|
71918
|
+
isComposing: event.isComposing ?? false,
|
|
71919
|
+
bubbles: true,
|
|
71920
|
+
cancelable: true
|
|
71921
|
+
});
|
|
71922
|
+
} else {
|
|
71923
|
+
synthetic = new Event(event.type, { bubbles: true, cancelable: true });
|
|
71924
|
+
}
|
|
71925
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
71926
|
+
});
|
|
71770
71927
|
};
|
|
71771
71928
|
forwardCompositionEvent_fn = function(event) {
|
|
71772
|
-
if (__privateMethod$1(this, _PresentationInputBridge_instances,
|
|
71929
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
71930
|
+
return;
|
|
71931
|
+
}
|
|
71932
|
+
if (event.defaultPrevented) {
|
|
71773
71933
|
return;
|
|
71774
71934
|
}
|
|
71775
71935
|
let synthetic;
|
|
@@ -71785,7 +71945,10 @@ forwardCompositionEvent_fn = function(event) {
|
|
|
71785
71945
|
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
71786
71946
|
};
|
|
71787
71947
|
forwardContextMenu_fn = function(event) {
|
|
71788
|
-
if (__privateMethod$1(this, _PresentationInputBridge_instances,
|
|
71948
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
71949
|
+
return;
|
|
71950
|
+
}
|
|
71951
|
+
if (event.defaultPrevented) {
|
|
71789
71952
|
return;
|
|
71790
71953
|
}
|
|
71791
71954
|
const synthetic = new MouseEvent("contextmenu", {
|
|
@@ -71819,6 +71982,36 @@ isEventOnActiveTarget_fn = function(event) {
|
|
|
71819
71982
|
}
|
|
71820
71983
|
return false;
|
|
71821
71984
|
};
|
|
71985
|
+
shouldSkipSurface_fn = function(event) {
|
|
71986
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, isEventOnActiveTarget_fn).call(this, event)) {
|
|
71987
|
+
return true;
|
|
71988
|
+
}
|
|
71989
|
+
if (!__privateMethod$1(this, _PresentationInputBridge_instances, isInLayoutSurface_fn).call(this, event)) {
|
|
71990
|
+
return true;
|
|
71991
|
+
}
|
|
71992
|
+
if (isInRegisteredSurface(event)) {
|
|
71993
|
+
return true;
|
|
71994
|
+
}
|
|
71995
|
+
return false;
|
|
71996
|
+
};
|
|
71997
|
+
isInLayoutSurface_fn = function(event) {
|
|
71998
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
71999
|
+
if (path.length) {
|
|
72000
|
+
return path.some((node) => __privateGet$1(this, _layoutSurfaces).has(node));
|
|
72001
|
+
}
|
|
72002
|
+
const origin = event.target;
|
|
72003
|
+
return origin ? __privateGet$1(this, _layoutSurfaces).has(origin) : false;
|
|
72004
|
+
};
|
|
72005
|
+
getListenerTargets_fn = function() {
|
|
72006
|
+
const targets = new Set(__privateGet$1(this, _layoutSurfaces));
|
|
72007
|
+
if (__privateGet$1(this, _useWindowFallback)) {
|
|
72008
|
+
targets.add(__privateGet$1(this, _windowRoot));
|
|
72009
|
+
}
|
|
72010
|
+
return Array.from(targets);
|
|
72011
|
+
};
|
|
72012
|
+
isPlainCharacterKey_fn = function(event) {
|
|
72013
|
+
return event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;
|
|
72014
|
+
};
|
|
71822
72015
|
const Color = Extension.create({
|
|
71823
72016
|
name: "color",
|
|
71824
72017
|
addOptions() {
|
|
@@ -74579,29 +74772,6 @@ const restartNumbering = ({ editor, tr, state: state2, dispatch }) => {
|
|
|
74579
74772
|
};
|
|
74580
74773
|
const defaultTabDistance = 48;
|
|
74581
74774
|
const defaultLineLength = 816;
|
|
74582
|
-
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
74583
|
-
const decorations = [];
|
|
74584
|
-
const paragraphCache = /* @__PURE__ */ new Map();
|
|
74585
|
-
const coordCache = /* @__PURE__ */ new Map();
|
|
74586
|
-
const domPosCache = /* @__PURE__ */ new Map();
|
|
74587
|
-
const end2 = to ?? doc2.content.size;
|
|
74588
|
-
doc2.nodesBetween(from2, end2, (node, pos) => {
|
|
74589
|
-
if (node.type.name !== "tab") return;
|
|
74590
|
-
const $pos = doc2.resolve(pos);
|
|
74591
|
-
const paragraphContext = findParagraphContext($pos, paragraphCache, helpers2);
|
|
74592
|
-
if (!paragraphContext) return;
|
|
74593
|
-
const blockParent2 = $pos.node(paragraphContext.paragraphDepth);
|
|
74594
|
-
const style2 = calculateTabStyle(node.nodeSize, view, pos, blockParent2, paragraphContext, coordCache, domPosCache);
|
|
74595
|
-
if (style2) {
|
|
74596
|
-
decorations.push(
|
|
74597
|
-
Decoration.node(pos, pos + node.nodeSize, {
|
|
74598
|
-
style: style2
|
|
74599
|
-
})
|
|
74600
|
-
);
|
|
74601
|
-
}
|
|
74602
|
-
});
|
|
74603
|
-
return decorations;
|
|
74604
|
-
};
|
|
74605
74775
|
function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext, coordCache = null, domPosCache = null) {
|
|
74606
74776
|
let extraStyles = "";
|
|
74607
74777
|
try {
|
|
@@ -74653,14 +74823,14 @@ function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext,
|
|
|
74653
74823
|
tabWidth -= integralWidth;
|
|
74654
74824
|
}
|
|
74655
74825
|
if (tabStop.leader) {
|
|
74656
|
-
const
|
|
74826
|
+
const leaderStyles2 = {
|
|
74657
74827
|
dot: "border-bottom: 1px dotted black;",
|
|
74658
74828
|
heavy: "border-bottom: 2px solid black;",
|
|
74659
74829
|
hyphen: "border-bottom: 1px solid black;",
|
|
74660
74830
|
middleDot: "border-bottom: 1px dotted black; margin-bottom: 2px;",
|
|
74661
74831
|
underscore: "border-bottom: 1px solid black;"
|
|
74662
74832
|
};
|
|
74663
|
-
extraStyles +=
|
|
74833
|
+
extraStyles += leaderStyles2[tabStop.leader] || "";
|
|
74664
74834
|
}
|
|
74665
74835
|
}
|
|
74666
74836
|
}
|
|
@@ -74672,7 +74842,7 @@ function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext,
|
|
|
74672
74842
|
paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
|
|
74673
74843
|
return `width: ${tabWidth}px; height: ${tabHeight}; ${extraStyles}`;
|
|
74674
74844
|
} catch (error) {
|
|
74675
|
-
|
|
74845
|
+
return null;
|
|
74676
74846
|
}
|
|
74677
74847
|
}
|
|
74678
74848
|
function findParagraphContext($pos, cache2, helpers2) {
|
|
@@ -74691,13 +74861,16 @@ function findParagraphContext($pos, cache2, helpers2) {
|
|
|
74691
74861
|
}
|
|
74692
74862
|
function extractParagraphContext(node, startPos, helpers2, depth = 0) {
|
|
74693
74863
|
const paragraphProperties = getResolvedParagraphProperties(node);
|
|
74864
|
+
const alignmentAliases = { left: "start", right: "end" };
|
|
74694
74865
|
let tabStops = [];
|
|
74695
74866
|
if (Array.isArray(paragraphProperties.tabStops)) {
|
|
74696
74867
|
tabStops = paragraphProperties.tabStops.map((stop) => {
|
|
74697
74868
|
const ref2 = stop?.tab;
|
|
74698
74869
|
if (!ref2) return stop || null;
|
|
74870
|
+
const rawType = ref2.tabType || "start";
|
|
74871
|
+
const mappedVal = alignmentAliases[rawType] || rawType;
|
|
74699
74872
|
return {
|
|
74700
|
-
val:
|
|
74873
|
+
val: mappedVal,
|
|
74701
74874
|
pos: twipsToPixels(Number(ref2.pos) || 0),
|
|
74702
74875
|
leader: ref2.leader
|
|
74703
74876
|
};
|
|
@@ -75762,6 +75935,184 @@ const CommentsMark = Mark2.create({
|
|
|
75762
75935
|
return [CommentMarkName, Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
75763
75936
|
}
|
|
75764
75937
|
});
|
|
75938
|
+
const leaderStyles = {
|
|
75939
|
+
dot: "border-bottom: 1px dotted black;",
|
|
75940
|
+
heavy: "border-bottom: 2px solid black;",
|
|
75941
|
+
hyphen: "border-bottom: 1px solid black;",
|
|
75942
|
+
middleDot: "border-bottom: 1px dotted black; margin-bottom: 2px;",
|
|
75943
|
+
underscore: "border-bottom: 1px solid black;"
|
|
75944
|
+
};
|
|
75945
|
+
const paragraphIdFromPos = (startPos) => `para-${startPos}`;
|
|
75946
|
+
const tabIdForIndex = (paragraphId, index2) => `${paragraphId}-tab-${index2}`;
|
|
75947
|
+
function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, paragraphWidthOverride) {
|
|
75948
|
+
const $pos = doc2.resolve(paragraphPos);
|
|
75949
|
+
const paragraphCache = /* @__PURE__ */ new Map();
|
|
75950
|
+
const paragraphContext = findParagraphContext($pos, paragraphCache, helpers2);
|
|
75951
|
+
if (!paragraphContext) return null;
|
|
75952
|
+
const paragraphId = paragraphIdFromPos(paragraphContext.startPos);
|
|
75953
|
+
const paragraphNode = paragraphContext.paragraph;
|
|
75954
|
+
const { entries } = flattenParagraph(paragraphNode, paragraphContext.startPos);
|
|
75955
|
+
const spans = [];
|
|
75956
|
+
let tabIndex = 0;
|
|
75957
|
+
entries.forEach((entry, idx) => {
|
|
75958
|
+
const node = entry.node;
|
|
75959
|
+
const spanId = `${paragraphId}-span-${idx}`;
|
|
75960
|
+
const from2 = entry.pos;
|
|
75961
|
+
const to = entry.pos + node.nodeSize;
|
|
75962
|
+
if (node.type.name === "tab") {
|
|
75963
|
+
spans.push({
|
|
75964
|
+
type: "tab",
|
|
75965
|
+
spanId,
|
|
75966
|
+
tabId: tabIdForIndex(paragraphId, tabIndex++),
|
|
75967
|
+
pos: entry.pos,
|
|
75968
|
+
nodeSize: node.nodeSize
|
|
75969
|
+
});
|
|
75970
|
+
} else if (node.type.name === "text") {
|
|
75971
|
+
spans.push({
|
|
75972
|
+
type: "text",
|
|
75973
|
+
spanId,
|
|
75974
|
+
text: node.text || "",
|
|
75975
|
+
style: node.marks?.find((mark) => mark.type.name === "textStyle")?.attrs || {},
|
|
75976
|
+
from: from2,
|
|
75977
|
+
to
|
|
75978
|
+
});
|
|
75979
|
+
}
|
|
75980
|
+
});
|
|
75981
|
+
const tabStops = Array.isArray(paragraphContext.tabStops) ? [...paragraphContext.tabStops] : [];
|
|
75982
|
+
const hangingPx = twipsToPixels(Number(paragraphContext.indent?.hanging) || 0);
|
|
75983
|
+
if (hangingPx > 0 && paragraphContext.indentWidth != null) {
|
|
75984
|
+
tabStops.unshift({ val: "start", pos: paragraphContext.indentWidth + hangingPx, leader: "none" });
|
|
75985
|
+
}
|
|
75986
|
+
const paragraphWidth = getBlockNodeWidth(view, paragraphContext.startPos) ?? defaultLineLength;
|
|
75987
|
+
const indentWidth = paragraphContext.indentWidth ?? getIndentWidth(view, paragraphContext.startPos, paragraphContext.indent);
|
|
75988
|
+
return {
|
|
75989
|
+
paragraphId,
|
|
75990
|
+
revision,
|
|
75991
|
+
paragraphWidth,
|
|
75992
|
+
defaultTabDistance,
|
|
75993
|
+
defaultLineLength,
|
|
75994
|
+
indents: {
|
|
75995
|
+
left: twipsToPixels(Number(paragraphContext.indent?.left) || 0),
|
|
75996
|
+
right: twipsToPixels(Number(paragraphContext.indent?.right) || 0),
|
|
75997
|
+
firstLine: twipsToPixels(Number(paragraphContext.indent?.firstLine) || 0),
|
|
75998
|
+
hanging: hangingPx
|
|
75999
|
+
},
|
|
76000
|
+
tabStops,
|
|
76001
|
+
spans,
|
|
76002
|
+
indentWidth,
|
|
76003
|
+
paragraphNode
|
|
76004
|
+
};
|
|
76005
|
+
}
|
|
76006
|
+
function calculateTabLayout(request, measurement, view) {
|
|
76007
|
+
const {
|
|
76008
|
+
spans,
|
|
76009
|
+
tabStops,
|
|
76010
|
+
paragraphWidth,
|
|
76011
|
+
defaultTabDistance: defaultTabDistance2,
|
|
76012
|
+
defaultLineLength: defaultLineLength2,
|
|
76013
|
+
paragraphId,
|
|
76014
|
+
revision,
|
|
76015
|
+
indentWidth = 0,
|
|
76016
|
+
paragraphNode
|
|
76017
|
+
} = request;
|
|
76018
|
+
const tabs = {};
|
|
76019
|
+
let currentX = indentWidth;
|
|
76020
|
+
const measureText2 = (span) => {
|
|
76021
|
+
if (view && typeof span.from === "number" && typeof span.to === "number") {
|
|
76022
|
+
return measureRangeWidth(view, span.from, span.to);
|
|
76023
|
+
}
|
|
76024
|
+
return 0;
|
|
76025
|
+
};
|
|
76026
|
+
const tabHeight = paragraphNode ? calcTabHeight(paragraphNode) : void 0;
|
|
76027
|
+
for (let i = 0; i < spans.length; i++) {
|
|
76028
|
+
const span = spans[i];
|
|
76029
|
+
if (span.type === "text") {
|
|
76030
|
+
currentX += measureText2(span);
|
|
76031
|
+
} else if (span.type === "tab") {
|
|
76032
|
+
const followingText = collectFollowingText(spans, i + 1);
|
|
76033
|
+
let measureTextCallback;
|
|
76034
|
+
if (view) {
|
|
76035
|
+
const followingRange = getFollowingTextRange(spans, i + 1);
|
|
76036
|
+
if (followingRange) {
|
|
76037
|
+
const fullWidth = measureRangeWidth(view, followingRange.from, followingRange.to);
|
|
76038
|
+
const fullText = followingText;
|
|
76039
|
+
measureTextCallback = (text) => {
|
|
76040
|
+
if (text === fullText) return fullWidth;
|
|
76041
|
+
if (fullText.length > 0) {
|
|
76042
|
+
return text.length / fullText.length * fullWidth;
|
|
76043
|
+
}
|
|
76044
|
+
return 0;
|
|
76045
|
+
};
|
|
76046
|
+
}
|
|
76047
|
+
}
|
|
76048
|
+
const result = calculateTabWidth({
|
|
76049
|
+
currentX,
|
|
76050
|
+
tabStops,
|
|
76051
|
+
paragraphWidth,
|
|
76052
|
+
defaultTabDistance: defaultTabDistance2,
|
|
76053
|
+
defaultLineLength: defaultLineLength2,
|
|
76054
|
+
followingText,
|
|
76055
|
+
measureText: measureTextCallback
|
|
76056
|
+
});
|
|
76057
|
+
tabs[span.tabId] = {
|
|
76058
|
+
width: result.width,
|
|
76059
|
+
height: tabHeight,
|
|
76060
|
+
leader: result.leader,
|
|
76061
|
+
alignment: result.alignment,
|
|
76062
|
+
tabStopPosUsed: result.tabStopPosUsed
|
|
76063
|
+
};
|
|
76064
|
+
currentX += result.width;
|
|
76065
|
+
}
|
|
76066
|
+
}
|
|
76067
|
+
return {
|
|
76068
|
+
paragraphId,
|
|
76069
|
+
revision,
|
|
76070
|
+
tabs
|
|
76071
|
+
};
|
|
76072
|
+
}
|
|
76073
|
+
function applyLayoutResult(result, paragraph, paragraphPos) {
|
|
76074
|
+
const decorations = [];
|
|
76075
|
+
let tabIndex = 0;
|
|
76076
|
+
paragraph.forEach((node, offset2) => {
|
|
76077
|
+
if (node.type.name !== "tab") return;
|
|
76078
|
+
const pos = paragraphPos + offset2 + 1;
|
|
76079
|
+
const tabId = tabIdForIndex(result.paragraphId, tabIndex++);
|
|
76080
|
+
const layout = result.tabs[tabId];
|
|
76081
|
+
if (!layout) return;
|
|
76082
|
+
let style2 = `width: ${layout.width}px;`;
|
|
76083
|
+
if (layout.height) style2 += ` height: ${layout.height};`;
|
|
76084
|
+
if (layout.leader && leaderStyles[layout.leader]) {
|
|
76085
|
+
style2 += ` ${leaderStyles[layout.leader]}`;
|
|
76086
|
+
}
|
|
76087
|
+
decorations.push(Decoration.node(pos, pos + node.nodeSize, { style: style2 }));
|
|
76088
|
+
});
|
|
76089
|
+
return decorations;
|
|
76090
|
+
}
|
|
76091
|
+
function collectFollowingText(spans, startIndex) {
|
|
76092
|
+
let text = "";
|
|
76093
|
+
for (let i = startIndex; i < spans.length; i++) {
|
|
76094
|
+
const span = spans[i];
|
|
76095
|
+
if (span.type === "tab") break;
|
|
76096
|
+
if (span.type === "text") text += span.text || "";
|
|
76097
|
+
}
|
|
76098
|
+
return text;
|
|
76099
|
+
}
|
|
76100
|
+
function getFollowingTextRange(spans, startIndex) {
|
|
76101
|
+
let from2 = null;
|
|
76102
|
+
let to = null;
|
|
76103
|
+
for (let i = startIndex; i < spans.length; i++) {
|
|
76104
|
+
const span = spans[i];
|
|
76105
|
+
if (span.type === "tab") break;
|
|
76106
|
+
if (span.type === "text" && typeof span.from === "number" && typeof span.to === "number") {
|
|
76107
|
+
if (from2 === null) from2 = span.from;
|
|
76108
|
+
to = span.to;
|
|
76109
|
+
}
|
|
76110
|
+
}
|
|
76111
|
+
if (from2 !== null && to !== null) {
|
|
76112
|
+
return { from: from2, to };
|
|
76113
|
+
}
|
|
76114
|
+
return null;
|
|
76115
|
+
}
|
|
75765
76116
|
const TabNode = Node$1.create({
|
|
75766
76117
|
name: "tab",
|
|
75767
76118
|
group: "inline",
|
|
@@ -75803,87 +76154,24 @@ const TabNode = Node$1.create({
|
|
|
75803
76154
|
return [];
|
|
75804
76155
|
}
|
|
75805
76156
|
const { view, helpers: helpers2 } = this.editor;
|
|
75806
|
-
const mergeRanges2 = (ranges) => {
|
|
75807
|
-
if (ranges.length === 0) return [];
|
|
75808
|
-
const sorted = ranges.slice().sort((a, b2) => a[0] - b2[0]);
|
|
75809
|
-
const merged = [sorted[0]];
|
|
75810
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
75811
|
-
const [start2, end2] = sorted[i];
|
|
75812
|
-
const last = merged[merged.length - 1];
|
|
75813
|
-
if (start2 <= last[1]) {
|
|
75814
|
-
last[1] = Math.max(last[1], end2);
|
|
75815
|
-
} else {
|
|
75816
|
-
merged.push([start2, end2]);
|
|
75817
|
-
}
|
|
75818
|
-
}
|
|
75819
|
-
return merged;
|
|
75820
|
-
};
|
|
75821
76157
|
const tabPlugin = new Plugin({
|
|
75822
76158
|
name: "tabPlugin",
|
|
75823
76159
|
key: new PluginKey("tabPlugin"),
|
|
75824
76160
|
state: {
|
|
75825
76161
|
init() {
|
|
75826
|
-
return { decorations: false };
|
|
76162
|
+
return { decorations: false, revision: 0 };
|
|
75827
76163
|
},
|
|
75828
|
-
apply(tr, { decorations }, _oldState, newState) {
|
|
76164
|
+
apply(tr, { decorations, revision }, _oldState, newState) {
|
|
75829
76165
|
if (!decorations) {
|
|
75830
|
-
|
|
75831
|
-
return { decorations };
|
|
76166
|
+
const newDecorations2 = buildDecorations(newState.doc, view, helpers2, 0);
|
|
76167
|
+
return { decorations: newDecorations2, revision: 0 };
|
|
75832
76168
|
}
|
|
75833
76169
|
if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
|
|
75834
|
-
return { decorations };
|
|
76170
|
+
return { decorations, revision };
|
|
75835
76171
|
}
|
|
75836
|
-
|
|
75837
|
-
const
|
|
75838
|
-
|
|
75839
|
-
tr.steps.forEach((step, index2) => {
|
|
75840
|
-
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1)) {
|
|
75841
|
-
return;
|
|
75842
|
-
}
|
|
75843
|
-
let hasTabInRange = false;
|
|
75844
|
-
if (step.slice?.content) {
|
|
75845
|
-
step.slice.content.descendants((node) => {
|
|
75846
|
-
if (containsTab(node)) {
|
|
75847
|
-
hasTabInRange = true;
|
|
75848
|
-
return false;
|
|
75849
|
-
}
|
|
75850
|
-
});
|
|
75851
|
-
}
|
|
75852
|
-
if (!hasTabInRange) {
|
|
75853
|
-
tr.docs[index2].nodesBetween(step.from, step.to, (node) => {
|
|
75854
|
-
if (containsTab(node)) {
|
|
75855
|
-
hasTabInRange = true;
|
|
75856
|
-
return false;
|
|
75857
|
-
}
|
|
75858
|
-
});
|
|
75859
|
-
}
|
|
75860
|
-
if (!hasTabInRange) {
|
|
75861
|
-
return;
|
|
75862
|
-
}
|
|
75863
|
-
let fromPos = step.from;
|
|
75864
|
-
let toPos = step.to;
|
|
75865
|
-
for (let i = index2; i < tr.steps.length; i++) {
|
|
75866
|
-
const stepMap = tr.steps[i].getMap();
|
|
75867
|
-
fromPos = stepMap.map(fromPos, -1);
|
|
75868
|
-
toPos = stepMap.map(toPos, 1);
|
|
75869
|
-
}
|
|
75870
|
-
const $from = newState.doc.resolve(fromPos);
|
|
75871
|
-
const $to = newState.doc.resolve(toPos);
|
|
75872
|
-
const start2 = $from.start(Math.min($from.depth, 1));
|
|
75873
|
-
const end2 = $to.end(Math.min($to.depth, 1));
|
|
75874
|
-
rangesToRecalculate.push([start2, end2]);
|
|
75875
|
-
});
|
|
75876
|
-
if (rangesToRecalculate.length === 0) {
|
|
75877
|
-
return { decorations };
|
|
75878
|
-
}
|
|
75879
|
-
const mergedRanges = mergeRanges2(rangesToRecalculate);
|
|
75880
|
-
mergedRanges.forEach(([start2, end2]) => {
|
|
75881
|
-
const oldDecorations = decorations.find(start2, end2);
|
|
75882
|
-
decorations = decorations.remove(oldDecorations);
|
|
75883
|
-
const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
|
|
75884
|
-
decorations = decorations.add(newState.doc, newDecorations);
|
|
75885
|
-
});
|
|
75886
|
-
return { decorations };
|
|
76172
|
+
const nextRevision = revision + 1;
|
|
76173
|
+
const newDecorations = buildDecorations(newState.doc, view, helpers2, nextRevision);
|
|
76174
|
+
return { decorations: newDecorations, revision: nextRevision };
|
|
75887
76175
|
}
|
|
75888
76176
|
},
|
|
75889
76177
|
props: {
|
|
@@ -75895,6 +76183,27 @@ const TabNode = Node$1.create({
|
|
|
75895
76183
|
return [tabPlugin];
|
|
75896
76184
|
}
|
|
75897
76185
|
});
|
|
76186
|
+
function buildDecorations(doc2, view, helpers2, revision) {
|
|
76187
|
+
const decorations = [];
|
|
76188
|
+
doc2.descendants((node, pos) => {
|
|
76189
|
+
if (node.type.name !== "paragraph") return;
|
|
76190
|
+
let hasTab = false;
|
|
76191
|
+
node.descendants((child) => {
|
|
76192
|
+
if (child.type.name === "tab") {
|
|
76193
|
+
hasTab = true;
|
|
76194
|
+
return false;
|
|
76195
|
+
}
|
|
76196
|
+
return true;
|
|
76197
|
+
});
|
|
76198
|
+
if (!hasTab) return;
|
|
76199
|
+
const request = createLayoutRequest(doc2, pos + 1, view, helpers2, revision);
|
|
76200
|
+
if (!request) return;
|
|
76201
|
+
const result = calculateTabLayout(request, void 0, view);
|
|
76202
|
+
const paragraphDecorations = applyLayoutResult(result, node, pos);
|
|
76203
|
+
decorations.push(...paragraphDecorations);
|
|
76204
|
+
});
|
|
76205
|
+
return DecorationSet.create(doc2, decorations);
|
|
76206
|
+
}
|
|
75898
76207
|
const LineBreak = Node$1.create({
|
|
75899
76208
|
name: "lineBreak",
|
|
75900
76209
|
group: "inline",
|
|
@@ -100090,7 +100399,8 @@ const _sfc_main$h = {
|
|
|
100090
100399
|
class: "superdoc-toolbar",
|
|
100091
100400
|
key: unref(toolbarKey),
|
|
100092
100401
|
role: "toolbar",
|
|
100093
|
-
"aria-label": "Toolbar"
|
|
100402
|
+
"aria-label": "Toolbar",
|
|
100403
|
+
"data-editor-ui-surface": ""
|
|
100094
100404
|
}, [
|
|
100095
100405
|
unref(showLeftSide) ? (openBlock(), createBlock(ButtonGroup, {
|
|
100096
100406
|
key: 0,
|
|
@@ -100122,7 +100432,7 @@ const _sfc_main$h = {
|
|
|
100122
100432
|
};
|
|
100123
100433
|
}
|
|
100124
100434
|
};
|
|
100125
|
-
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-
|
|
100435
|
+
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-3f5ec271"]]);
|
|
100126
100436
|
const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
|
|
100127
100437
|
const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
|
|
100128
100438
|
async function baseInsightsFetch(payload, options = {}) {
|
|
@@ -101134,7 +101444,8 @@ const _sfc_main$e = {
|
|
|
101134
101444
|
const DocumentMode = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-8730b752"]]);
|
|
101135
101445
|
const _hoisted_1$c = {
|
|
101136
101446
|
key: 0,
|
|
101137
|
-
class: "linked-style-buttons"
|
|
101447
|
+
class: "linked-style-buttons",
|
|
101448
|
+
"data-editor-ui-surface": ""
|
|
101138
101449
|
};
|
|
101139
101450
|
const _hoisted_2$8 = ["onClick", "onKeydown", "aria-label"];
|
|
101140
101451
|
const _sfc_main$d = {
|
|
@@ -101213,7 +101524,7 @@ const _sfc_main$d = {
|
|
|
101213
101524
|
};
|
|
101214
101525
|
}
|
|
101215
101526
|
};
|
|
101216
|
-
const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-
|
|
101527
|
+
const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-ecb78965"]]);
|
|
101217
101528
|
const _hoisted_1$b = {
|
|
101218
101529
|
key: 0,
|
|
101219
101530
|
class: "link-title"
|
|
@@ -103879,14 +104190,19 @@ deactivateAll_fn = function() {
|
|
|
103879
104190
|
});
|
|
103880
104191
|
};
|
|
103881
104192
|
updateToolbarHistory_fn = function() {
|
|
103882
|
-
if (!this.activeEditor) return;
|
|
103883
|
-
|
|
103884
|
-
|
|
103885
|
-
|
|
103886
|
-
|
|
103887
|
-
|
|
103888
|
-
|
|
103889
|
-
|
|
104193
|
+
if (!this.activeEditor?.state) return;
|
|
104194
|
+
try {
|
|
104195
|
+
if (this.activeEditor.options.ydoc) {
|
|
104196
|
+
const undoManager = yUndoPluginKey.getState(this.activeEditor.state)?.undoManager;
|
|
104197
|
+
this.undoDepth = undoManager?.undoStack.length || 0;
|
|
104198
|
+
this.redoDepth = undoManager?.redoStack.length || 0;
|
|
104199
|
+
} else {
|
|
104200
|
+
this.undoDepth = undoDepth(this.activeEditor.state);
|
|
104201
|
+
this.redoDepth = redoDepth(this.activeEditor.state);
|
|
104202
|
+
}
|
|
104203
|
+
} catch {
|
|
104204
|
+
this.undoDepth = 0;
|
|
104205
|
+
this.redoDepth = 0;
|
|
103890
104206
|
}
|
|
103891
104207
|
};
|
|
103892
104208
|
enrichTrackedChanges_fn = function(trackedChanges = []) {
|