superdoc 1.0.0-beta.6 → 1.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-CdGAVn-4.es.js → PdfViewer-BfEwF25T.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DmPiOFJ8.cjs → PdfViewer-DJ7BWUbW.cjs} +1 -1
- package/dist/chunks/{index-nXifzD54.es.js → index-BCZ82zY5.es.js} +3 -3
- package/dist/chunks/{index-hjUbJ86s-BLl65XJn.cjs → index-DJrRlj1_-E5dmStMF.cjs} +1 -1
- package/dist/chunks/{index-hjUbJ86s-BMiwCR8J.es.js → index-DJrRlj1_-HA-nVwDO.es.js} +1 -1
- package/dist/chunks/{index-QulG3CF7.cjs → index-DMwWcmrk.cjs} +3 -3
- package/dist/chunks/{super-editor.es-0GatZWs9.cjs → super-editor.es-Bo_fWMy6.cjs} +281 -83
- package/dist/chunks/{super-editor.es-BYVEYLjl.es.js → super-editor.es-MRWI4sfo.es.js} +281 -83
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +9 -9
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CZF9SnYh.js → converter-CflxlFnM.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DWypbE0V.js → docx-zipper-DKWL4mo2.js} +1 -1
- package/dist/super-editor/chunks/{editor-BdXHlHt-.js → editor-B9V7oJbW.js} +351 -93
- package/dist/super-editor/chunks/{index-hjUbJ86s.js → index-DJrRlj1_.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CmelvLTd.js → toolbar-B5WlPN4s.js} +5 -4
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +9 -9
- package/dist/super-editor/super-editor.es.js +9 -8
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +283 -85
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -35581,7 +35581,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35581
35581
|
static getStoredSuperdocVersion(docx) {
|
|
35582
35582
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35583
35583
|
}
|
|
35584
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
35584
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.8") {
|
|
35585
35585
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35586
35586
|
}
|
|
35587
35587
|
/**
|
|
@@ -46562,7 +46562,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
46562
46562
|
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);
|
|
46563
46563
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
46564
46564
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
46565
|
-
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,
|
|
46565
|
+
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;
|
|
46566
46566
|
var GOOD_LEAF_SIZE = 200;
|
|
46567
46567
|
var RopeSequence = function RopeSequence2() {
|
|
46568
46568
|
};
|
|
@@ -60069,7 +60069,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60069
60069
|
const shouldSkipNodeView = (editor) => {
|
|
60070
60070
|
return isHeadless(editor);
|
|
60071
60071
|
};
|
|
60072
|
-
const summaryVersion = "1.0.0-beta.
|
|
60072
|
+
const summaryVersion = "1.0.0-beta.8";
|
|
60073
60073
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
60074
60074
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
60075
60075
|
function mapAttributes(attrs) {
|
|
@@ -60848,7 +60848,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60848
60848
|
{ default: remarkStringify2 },
|
|
60849
60849
|
{ default: remarkGfm2 }
|
|
60850
60850
|
] = await Promise.all([
|
|
60851
|
-
Promise.resolve().then(() =>
|
|
60851
|
+
Promise.resolve().then(() => indexDJrRlj1_),
|
|
60852
60852
|
Promise.resolve().then(() => indexDRCvimau),
|
|
60853
60853
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
60854
60854
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -61053,7 +61053,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61053
61053
|
* Process collaboration migrations
|
|
61054
61054
|
*/
|
|
61055
61055
|
processCollaborationMigrations() {
|
|
61056
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
61056
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.8");
|
|
61057
61057
|
if (!this.options.ydoc) return;
|
|
61058
61058
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
61059
61059
|
let docVersion = metaMap.get("version");
|
|
@@ -64605,8 +64605,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64605
64605
|
const beforeWidth = measureText2 ? measureText2(before) : 0;
|
|
64606
64606
|
width -= beforeWidth;
|
|
64607
64607
|
}
|
|
64608
|
-
} else if (alignment2 === "bar") {
|
|
64609
|
-
width = 0;
|
|
64610
64608
|
}
|
|
64611
64609
|
if (width < 1) {
|
|
64612
64610
|
return fallbackWidth();
|
|
@@ -69649,14 +69647,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69649
69647
|
return metrics.width;
|
|
69650
69648
|
}
|
|
69651
69649
|
function lineHeightForRuns(runs2, fromRun, toRun) {
|
|
69652
|
-
let
|
|
69650
|
+
let maxSize2 = 0;
|
|
69653
69651
|
for (let i2 = fromRun; i2 <= toRun; i2 += 1) {
|
|
69654
69652
|
const run2 = runs2[i2];
|
|
69655
69653
|
const textRun = run2 && isTextRun(run2) ? run2 : null;
|
|
69656
69654
|
const size2 = textRun?.fontSize ?? 16;
|
|
69657
|
-
if (size2 >
|
|
69655
|
+
if (size2 > maxSize2) maxSize2 = size2;
|
|
69658
69656
|
}
|
|
69659
|
-
return
|
|
69657
|
+
return maxSize2 * 1.2;
|
|
69660
69658
|
}
|
|
69661
69659
|
function remeasureParagraph(block, maxWidth) {
|
|
69662
69660
|
const runs2 = block.runs ?? [];
|
|
@@ -75259,6 +75257,45 @@ ${l}
|
|
|
75259
75257
|
function degToRad(degrees) {
|
|
75260
75258
|
return degrees * Math.PI / 180;
|
|
75261
75259
|
}
|
|
75260
|
+
const defaultMaxSize = 5e3;
|
|
75261
|
+
let maxSize = defaultMaxSize;
|
|
75262
|
+
const cache$1$1 = /* @__PURE__ */ new Map();
|
|
75263
|
+
const makeKey = (text2, font, letterSpacing) => {
|
|
75264
|
+
return `${text2}|${font}|${letterSpacing || 0}`;
|
|
75265
|
+
};
|
|
75266
|
+
function getMeasuredTextWidth(text2, font, letterSpacing, ctx2) {
|
|
75267
|
+
if (text2.length > 32e3) {
|
|
75268
|
+
text2 = text2.substring(0, 32e3);
|
|
75269
|
+
}
|
|
75270
|
+
const key2 = makeKey(text2, font, letterSpacing);
|
|
75271
|
+
const hit = cache$1$1.get(key2);
|
|
75272
|
+
if (hit !== void 0) {
|
|
75273
|
+
cache$1$1.delete(key2);
|
|
75274
|
+
cache$1$1.set(key2, hit);
|
|
75275
|
+
return hit.width;
|
|
75276
|
+
}
|
|
75277
|
+
try {
|
|
75278
|
+
ctx2.font = font;
|
|
75279
|
+
const metrics = ctx2.measureText(text2);
|
|
75280
|
+
const advanceWidth = metrics.width;
|
|
75281
|
+
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
75282
|
+
const baseWidth = Math.max(advanceWidth, paintedWidth);
|
|
75283
|
+
const extra = letterSpacing ? Math.max(0, text2.length - 1) * letterSpacing : 0;
|
|
75284
|
+
const width = baseWidth + extra;
|
|
75285
|
+
cache$1$1.set(key2, { width });
|
|
75286
|
+
evictIfNeeded();
|
|
75287
|
+
return width;
|
|
75288
|
+
} catch {
|
|
75289
|
+
return 0;
|
|
75290
|
+
}
|
|
75291
|
+
}
|
|
75292
|
+
function evictIfNeeded() {
|
|
75293
|
+
while (cache$1$1.size > maxSize) {
|
|
75294
|
+
const oldestKey = cache$1$1.keys().next().value;
|
|
75295
|
+
if (oldestKey === void 0) break;
|
|
75296
|
+
cache$1$1.delete(oldestKey);
|
|
75297
|
+
}
|
|
75298
|
+
}
|
|
75262
75299
|
const { computeTabStops } = Engines;
|
|
75263
75300
|
let canvasContext = null;
|
|
75264
75301
|
const DEFAULT_TAB_INTERVAL_TWIPS = 720;
|
|
@@ -75303,8 +75340,7 @@ ${l}
|
|
|
75303
75340
|
const metrics = ctx2.measureText(text2);
|
|
75304
75341
|
const advanceWidth = metrics.width;
|
|
75305
75342
|
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
75306
|
-
|
|
75307
|
-
return baseWidth;
|
|
75343
|
+
return Math.max(advanceWidth, paintedWidth);
|
|
75308
75344
|
}
|
|
75309
75345
|
const MIN_SINGLE_LINE_PX = 12 * 96 / 72;
|
|
75310
75346
|
function calculateTypographyMetrics(fontSize2, spacing) {
|
|
@@ -75885,13 +75921,9 @@ ${l}
|
|
|
75885
75921
|
};
|
|
75886
75922
|
};
|
|
75887
75923
|
const measureRunWidth = (text2, font, ctx2, run2) => {
|
|
75888
|
-
const
|
|
75889
|
-
const
|
|
75890
|
-
|
|
75891
|
-
return baseWidth;
|
|
75892
|
-
}
|
|
75893
|
-
const extra = Math.max(0, text2.length - 1) * letterSpacing;
|
|
75894
|
-
return roundValue(baseWidth + extra);
|
|
75924
|
+
const letterSpacing = run2.kind !== "tab" ? run2.letterSpacing || 0 : 0;
|
|
75925
|
+
const width = getMeasuredTextWidth(text2, font, letterSpacing, ctx2);
|
|
75926
|
+
return roundValue(width);
|
|
75895
75927
|
};
|
|
75896
75928
|
const appendSegment = (segments, runIndex, fromChar, toChar, width, x2) => {
|
|
75897
75929
|
if (!segments) return;
|
|
@@ -76765,6 +76797,24 @@ ${l}
|
|
|
76765
76797
|
}
|
|
76766
76798
|
return Object.keys(context).length > 0 ? context : void 0;
|
|
76767
76799
|
};
|
|
76800
|
+
const uiSurfaces = /* @__PURE__ */ new WeakSet();
|
|
76801
|
+
function isInRegisteredSurface(event) {
|
|
76802
|
+
const path2 = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
76803
|
+
if (path2.length > 0) {
|
|
76804
|
+
for (const node22 of path2) {
|
|
76805
|
+
if (uiSurfaces.has(node22)) return true;
|
|
76806
|
+
if (node22?.hasAttribute?.("data-editor-ui-surface")) return true;
|
|
76807
|
+
}
|
|
76808
|
+
return false;
|
|
76809
|
+
}
|
|
76810
|
+
let node2 = event.target;
|
|
76811
|
+
while (node2) {
|
|
76812
|
+
if (uiSurfaces.has(node2)) return true;
|
|
76813
|
+
if (node2.hasAttribute?.("data-editor-ui-surface")) return true;
|
|
76814
|
+
node2 = node2.parentElement;
|
|
76815
|
+
}
|
|
76816
|
+
return false;
|
|
76817
|
+
}
|
|
76768
76818
|
const DEFAULT_PAGE_SIZE = { w: 612, h: 792 };
|
|
76769
76819
|
const DEFAULT_MARGINS = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
76770
76820
|
const WORD_CHARACTER_REGEX = /[\p{L}\p{N}''_~-]/u;
|
|
@@ -79541,39 +79591,49 @@ ${l}
|
|
|
79541
79591
|
};
|
|
79542
79592
|
let PresentationEditor = _PresentationEditor;
|
|
79543
79593
|
class PresentationInputBridge {
|
|
79544
|
-
constructor(windowRoot,
|
|
79594
|
+
constructor(windowRoot, layoutSurface, getTargetDom, onTargetChanged, options) {
|
|
79545
79595
|
__privateAdd$1(this, _PresentationInputBridge_instances);
|
|
79546
79596
|
__privateAdd$1(this, _windowRoot);
|
|
79547
|
-
__privateAdd$1(this,
|
|
79597
|
+
__privateAdd$1(this, _layoutSurfaces);
|
|
79548
79598
|
__privateAdd$1(this, _getTargetDom);
|
|
79549
79599
|
__privateAdd$1(this, _onTargetChanged);
|
|
79550
79600
|
__privateAdd$1(this, _listeners);
|
|
79551
79601
|
__privateAdd$1(this, _currentTarget, null);
|
|
79552
79602
|
__privateAdd$1(this, _destroyed, false);
|
|
79603
|
+
__privateAdd$1(this, _useWindowFallback);
|
|
79553
79604
|
__privateSet(this, _windowRoot, windowRoot);
|
|
79554
|
-
__privateSet(this,
|
|
79605
|
+
__privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
|
|
79555
79606
|
__privateSet(this, _getTargetDom, getTargetDom);
|
|
79556
79607
|
__privateSet(this, _onTargetChanged, onTargetChanged);
|
|
79557
79608
|
__privateSet(this, _listeners, []);
|
|
79609
|
+
__privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
|
|
79558
79610
|
}
|
|
79559
79611
|
bind() {
|
|
79560
|
-
|
|
79561
|
-
|
|
79562
|
-
|
|
79563
|
-
|
|
79564
|
-
|
|
79565
|
-
|
|
79566
|
-
|
|
79567
|
-
|
|
79568
|
-
|
|
79569
|
-
|
|
79570
|
-
|
|
79571
|
-
|
|
79572
|
-
|
|
79612
|
+
const keyboardTargets = __privateMethod$1(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
79613
|
+
keyboardTargets.forEach((target) => {
|
|
79614
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "keydown", __privateMethod$1(this, _PresentationInputBridge_instances, forwardKeyboardEvent_fn), target);
|
|
79615
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "keyup", __privateMethod$1(this, _PresentationInputBridge_instances, forwardKeyboardEvent_fn), target);
|
|
79616
|
+
});
|
|
79617
|
+
const compositionTargets = __privateMethod$1(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
79618
|
+
compositionTargets.forEach((target) => {
|
|
79619
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionstart", __privateMethod$1(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
79620
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionupdate", __privateMethod$1(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
79621
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "compositionend", __privateMethod$1(this, _PresentationInputBridge_instances, forwardCompositionEvent_fn), target);
|
|
79622
|
+
});
|
|
79623
|
+
const textTargets = __privateMethod$1(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
79624
|
+
textTargets.forEach((target) => {
|
|
79625
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "beforeinput", __privateMethod$1(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
79626
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "input", __privateMethod$1(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
79627
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "textInput", __privateMethod$1(this, _PresentationInputBridge_instances, forwardTextEvent_fn), target);
|
|
79628
|
+
});
|
|
79629
|
+
const contextTargets = __privateMethod$1(this, _PresentationInputBridge_instances, getListenerTargets_fn).call(this);
|
|
79630
|
+
contextTargets.forEach((target) => {
|
|
79631
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, addListener_fn).call(this, "contextmenu", __privateMethod$1(this, _PresentationInputBridge_instances, forwardContextMenu_fn), target);
|
|
79632
|
+
});
|
|
79573
79633
|
}
|
|
79574
79634
|
destroy() {
|
|
79575
|
-
__privateGet$1(this, _listeners).forEach(({ type: type2, handler: handler2, target }) => {
|
|
79576
|
-
target.removeEventListener(type2, handler2,
|
|
79635
|
+
__privateGet$1(this, _listeners).forEach(({ type: type2, handler: handler2, target, useCapture }) => {
|
|
79636
|
+
target.removeEventListener(type2, handler2, useCapture);
|
|
79577
79637
|
});
|
|
79578
79638
|
__privateSet(this, _listeners, []);
|
|
79579
79639
|
__privateSet(this, _currentTarget, null);
|
|
@@ -79608,17 +79668,18 @@ ${l}
|
|
|
79608
79668
|
}
|
|
79609
79669
|
}
|
|
79610
79670
|
_windowRoot = /* @__PURE__ */ new WeakMap();
|
|
79611
|
-
|
|
79671
|
+
_layoutSurfaces = /* @__PURE__ */ new WeakMap();
|
|
79612
79672
|
_getTargetDom = /* @__PURE__ */ new WeakMap();
|
|
79613
79673
|
_onTargetChanged = /* @__PURE__ */ new WeakMap();
|
|
79614
79674
|
_listeners = /* @__PURE__ */ new WeakMap();
|
|
79615
79675
|
_currentTarget = /* @__PURE__ */ new WeakMap();
|
|
79616
79676
|
_destroyed = /* @__PURE__ */ new WeakMap();
|
|
79677
|
+
_useWindowFallback = /* @__PURE__ */ new WeakMap();
|
|
79617
79678
|
_PresentationInputBridge_instances = /* @__PURE__ */ new WeakSet();
|
|
79618
|
-
addListener_fn = function(type2, handler2, target) {
|
|
79679
|
+
addListener_fn = function(type2, handler2, target, useCapture = false) {
|
|
79619
79680
|
const bound = handler2.bind(this);
|
|
79620
|
-
__privateGet$1(this, _listeners).push({ type: type2, handler: bound, target });
|
|
79621
|
-
target.addEventListener(type2, bound,
|
|
79681
|
+
__privateGet$1(this, _listeners).push({ type: type2, handler: bound, target, useCapture });
|
|
79682
|
+
target.addEventListener(type2, bound, useCapture);
|
|
79622
79683
|
};
|
|
79623
79684
|
dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
79624
79685
|
if (__privateGet$1(this, _destroyed)) return;
|
|
@@ -79639,7 +79700,16 @@ ${l}
|
|
|
79639
79700
|
}
|
|
79640
79701
|
};
|
|
79641
79702
|
forwardKeyboardEvent_fn = function(event) {
|
|
79642
|
-
if (__privateMethod$1(this, _PresentationInputBridge_instances,
|
|
79703
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
79704
|
+
return;
|
|
79705
|
+
}
|
|
79706
|
+
if (event.defaultPrevented) {
|
|
79707
|
+
return;
|
|
79708
|
+
}
|
|
79709
|
+
if (event.isComposing || event.keyCode === 229) {
|
|
79710
|
+
return;
|
|
79711
|
+
}
|
|
79712
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, isPlainCharacterKey_fn).call(this, event)) {
|
|
79643
79713
|
return;
|
|
79644
79714
|
}
|
|
79645
79715
|
const synthetic = new KeyboardEvent(event.type, {
|
|
@@ -79657,26 +79727,40 @@ ${l}
|
|
|
79657
79727
|
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
79658
79728
|
};
|
|
79659
79729
|
forwardTextEvent_fn = function(event) {
|
|
79660
|
-
if (__privateMethod$1(this, _PresentationInputBridge_instances,
|
|
79730
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
79661
79731
|
return;
|
|
79662
79732
|
}
|
|
79663
|
-
|
|
79664
|
-
|
|
79665
|
-
synthetic = new InputEvent(event.type, {
|
|
79666
|
-
data: event.data ?? event.data ?? null,
|
|
79667
|
-
inputType: event.inputType ?? "insertText",
|
|
79668
|
-
dataTransfer: event.dataTransfer ?? null,
|
|
79669
|
-
isComposing: event.isComposing ?? false,
|
|
79670
|
-
bubbles: true,
|
|
79671
|
-
cancelable: true
|
|
79672
|
-
});
|
|
79673
|
-
} else {
|
|
79674
|
-
synthetic = new Event(event.type, { bubbles: true, cancelable: true });
|
|
79733
|
+
if (event.defaultPrevented) {
|
|
79734
|
+
return;
|
|
79675
79735
|
}
|
|
79676
|
-
|
|
79736
|
+
if (event.isComposing) {
|
|
79737
|
+
return;
|
|
79738
|
+
}
|
|
79739
|
+
queueMicrotask(() => {
|
|
79740
|
+
if (event.defaultPrevented) {
|
|
79741
|
+
return;
|
|
79742
|
+
}
|
|
79743
|
+
let synthetic;
|
|
79744
|
+
if (typeof InputEvent !== "undefined") {
|
|
79745
|
+
synthetic = new InputEvent(event.type, {
|
|
79746
|
+
data: event.data ?? event.data ?? null,
|
|
79747
|
+
inputType: event.inputType ?? "insertText",
|
|
79748
|
+
dataTransfer: event.dataTransfer ?? null,
|
|
79749
|
+
isComposing: event.isComposing ?? false,
|
|
79750
|
+
bubbles: true,
|
|
79751
|
+
cancelable: true
|
|
79752
|
+
});
|
|
79753
|
+
} else {
|
|
79754
|
+
synthetic = new Event(event.type, { bubbles: true, cancelable: true });
|
|
79755
|
+
}
|
|
79756
|
+
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
79757
|
+
});
|
|
79677
79758
|
};
|
|
79678
79759
|
forwardCompositionEvent_fn = function(event) {
|
|
79679
|
-
if (__privateMethod$1(this, _PresentationInputBridge_instances,
|
|
79760
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
79761
|
+
return;
|
|
79762
|
+
}
|
|
79763
|
+
if (event.defaultPrevented) {
|
|
79680
79764
|
return;
|
|
79681
79765
|
}
|
|
79682
79766
|
let synthetic;
|
|
@@ -79692,7 +79776,10 @@ ${l}
|
|
|
79692
79776
|
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
79693
79777
|
};
|
|
79694
79778
|
forwardContextMenu_fn = function(event) {
|
|
79695
|
-
if (__privateMethod$1(this, _PresentationInputBridge_instances,
|
|
79779
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
79780
|
+
return;
|
|
79781
|
+
}
|
|
79782
|
+
if (event.defaultPrevented) {
|
|
79696
79783
|
return;
|
|
79697
79784
|
}
|
|
79698
79785
|
const synthetic = new MouseEvent("contextmenu", {
|
|
@@ -79726,6 +79813,36 @@ ${l}
|
|
|
79726
79813
|
}
|
|
79727
79814
|
return false;
|
|
79728
79815
|
};
|
|
79816
|
+
shouldSkipSurface_fn = function(event) {
|
|
79817
|
+
if (__privateMethod$1(this, _PresentationInputBridge_instances, isEventOnActiveTarget_fn).call(this, event)) {
|
|
79818
|
+
return true;
|
|
79819
|
+
}
|
|
79820
|
+
if (!__privateMethod$1(this, _PresentationInputBridge_instances, isInLayoutSurface_fn).call(this, event)) {
|
|
79821
|
+
return true;
|
|
79822
|
+
}
|
|
79823
|
+
if (isInRegisteredSurface(event)) {
|
|
79824
|
+
return true;
|
|
79825
|
+
}
|
|
79826
|
+
return false;
|
|
79827
|
+
};
|
|
79828
|
+
isInLayoutSurface_fn = function(event) {
|
|
79829
|
+
const path2 = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
79830
|
+
if (path2.length) {
|
|
79831
|
+
return path2.some((node2) => __privateGet$1(this, _layoutSurfaces).has(node2));
|
|
79832
|
+
}
|
|
79833
|
+
const origin = event.target;
|
|
79834
|
+
return origin ? __privateGet$1(this, _layoutSurfaces).has(origin) : false;
|
|
79835
|
+
};
|
|
79836
|
+
getListenerTargets_fn = function() {
|
|
79837
|
+
const targets = new Set(__privateGet$1(this, _layoutSurfaces));
|
|
79838
|
+
if (__privateGet$1(this, _useWindowFallback)) {
|
|
79839
|
+
targets.add(__privateGet$1(this, _windowRoot));
|
|
79840
|
+
}
|
|
79841
|
+
return Array.from(targets);
|
|
79842
|
+
};
|
|
79843
|
+
isPlainCharacterKey_fn = function(event) {
|
|
79844
|
+
return event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;
|
|
79845
|
+
};
|
|
79729
79846
|
const Color = Extension.create({
|
|
79730
79847
|
name: "color",
|
|
79731
79848
|
addOptions() {
|
|
@@ -82555,7 +82672,7 @@ ${l}
|
|
|
82555
82672
|
const tabHeight = paragraphContext.tabHeight;
|
|
82556
82673
|
paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
|
|
82557
82674
|
return `width: ${tabWidth}px; height: ${tabHeight}; ${extraStyles}`;
|
|
82558
|
-
} catch
|
|
82675
|
+
} catch {
|
|
82559
82676
|
return null;
|
|
82560
82677
|
}
|
|
82561
82678
|
}
|
|
@@ -83649,6 +83766,19 @@ ${l}
|
|
|
83649
83766
|
return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
83650
83767
|
}
|
|
83651
83768
|
});
|
|
83769
|
+
let cache$2 = /* @__PURE__ */ new WeakMap();
|
|
83770
|
+
function getParagraphContext(paragraph2, startPos, helpers2, revision, compute) {
|
|
83771
|
+
const cached = cache$2.get(paragraph2);
|
|
83772
|
+
if (cached && cached.revision === revision) {
|
|
83773
|
+
return cached.context;
|
|
83774
|
+
}
|
|
83775
|
+
const context = compute(paragraph2, startPos, helpers2);
|
|
83776
|
+
cache$2.set(paragraph2, { revision, context });
|
|
83777
|
+
return context;
|
|
83778
|
+
}
|
|
83779
|
+
function clearAllParagraphContexts() {
|
|
83780
|
+
cache$2 = /* @__PURE__ */ new WeakMap();
|
|
83781
|
+
}
|
|
83652
83782
|
const leaderStyles = {
|
|
83653
83783
|
dot: "border-bottom: 1px dotted black;",
|
|
83654
83784
|
heavy: "border-bottom: 2px solid black;",
|
|
@@ -83665,6 +83795,14 @@ ${l}
|
|
|
83665
83795
|
if (!paragraphContext) return null;
|
|
83666
83796
|
const paragraphId = paragraphIdFromPos(paragraphContext.startPos);
|
|
83667
83797
|
const paragraphNode = paragraphContext.paragraph;
|
|
83798
|
+
const cachedContext = getParagraphContext(
|
|
83799
|
+
paragraphNode,
|
|
83800
|
+
paragraphContext.startPos,
|
|
83801
|
+
helpers2,
|
|
83802
|
+
revision,
|
|
83803
|
+
() => extractParagraphContext(paragraphNode, paragraphContext.startPos, helpers2, paragraphContext.paragraphDepth)
|
|
83804
|
+
);
|
|
83805
|
+
const effectiveContext = cachedContext || paragraphContext;
|
|
83668
83806
|
const { entries } = flattenParagraph(paragraphNode, paragraphContext.startPos);
|
|
83669
83807
|
const spans = [];
|
|
83670
83808
|
let tabIndex = 0;
|
|
@@ -83692,13 +83830,13 @@ ${l}
|
|
|
83692
83830
|
});
|
|
83693
83831
|
}
|
|
83694
83832
|
});
|
|
83695
|
-
const tabStops = Array.isArray(
|
|
83696
|
-
const hangingPx = twipsToPixels(Number(
|
|
83697
|
-
if (hangingPx > 0 &&
|
|
83698
|
-
tabStops.unshift({ val: "start", pos:
|
|
83833
|
+
const tabStops = Array.isArray(effectiveContext.tabStops) ? [...effectiveContext.tabStops] : [];
|
|
83834
|
+
const hangingPx = twipsToPixels(Number(effectiveContext.indent?.hanging) || 0);
|
|
83835
|
+
if (hangingPx > 0 && effectiveContext.indentWidth != null) {
|
|
83836
|
+
tabStops.unshift({ val: "start", pos: effectiveContext.indentWidth + hangingPx, leader: "none" });
|
|
83699
83837
|
}
|
|
83700
|
-
const paragraphWidth = getBlockNodeWidth(view,
|
|
83701
|
-
const indentWidth =
|
|
83838
|
+
const paragraphWidth = getBlockNodeWidth(view, effectiveContext.startPos) ?? defaultLineLength;
|
|
83839
|
+
const indentWidth = effectiveContext.indentWidth ?? getIndentWidth(view, effectiveContext.startPos, effectiveContext.indent);
|
|
83702
83840
|
return {
|
|
83703
83841
|
paragraphId,
|
|
83704
83842
|
revision,
|
|
@@ -83706,9 +83844,9 @@ ${l}
|
|
|
83706
83844
|
defaultTabDistance,
|
|
83707
83845
|
defaultLineLength,
|
|
83708
83846
|
indents: {
|
|
83709
|
-
left: twipsToPixels(Number(
|
|
83710
|
-
right: twipsToPixels(Number(
|
|
83711
|
-
firstLine: twipsToPixels(Number(
|
|
83847
|
+
left: twipsToPixels(Number(effectiveContext.indent?.left) || 0),
|
|
83848
|
+
right: twipsToPixels(Number(effectiveContext.indent?.right) || 0),
|
|
83849
|
+
firstLine: twipsToPixels(Number(effectiveContext.indent?.firstLine) || 0),
|
|
83712
83850
|
hanging: hangingPx
|
|
83713
83851
|
},
|
|
83714
83852
|
tabStops,
|
|
@@ -83873,31 +84011,58 @@ ${l}
|
|
|
83873
84011
|
key: new PluginKey("tabPlugin"),
|
|
83874
84012
|
state: {
|
|
83875
84013
|
init() {
|
|
83876
|
-
|
|
84014
|
+
const initialDecorations = buildInitialDecorations(view.state.doc, view, helpers2, 0);
|
|
84015
|
+
return { decorations: initialDecorations, revision: 0 };
|
|
83877
84016
|
},
|
|
83878
84017
|
apply(tr, { decorations, revision }, _oldState, newState) {
|
|
83879
|
-
|
|
83880
|
-
const newDecorations2 = buildDecorations(newState.doc, view, helpers2, 0);
|
|
83881
|
-
return { decorations: newDecorations2, revision: 0 };
|
|
83882
|
-
}
|
|
84018
|
+
const currentDecorations = decorations && decorations.map ? decorations.map(tr.mapping, tr.doc) : DecorationSet.empty;
|
|
83883
84019
|
if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
|
|
83884
|
-
return { decorations, revision };
|
|
83885
|
-
}
|
|
83886
|
-
const
|
|
83887
|
-
|
|
83888
|
-
|
|
84020
|
+
return { decorations: currentDecorations, revision };
|
|
84021
|
+
}
|
|
84022
|
+
const affectedParagraphs = getAffectedParagraphStarts(tr, newState);
|
|
84023
|
+
if (affectedParagraphs.size === 0) {
|
|
84024
|
+
return { decorations: currentDecorations, revision };
|
|
84025
|
+
}
|
|
84026
|
+
let nextDecorations = currentDecorations;
|
|
84027
|
+
affectedParagraphs.forEach((pos) => {
|
|
84028
|
+
const paragraph2 = newState.doc.nodeAt(pos);
|
|
84029
|
+
if (!paragraph2 || paragraph2.type.name !== "paragraph") return;
|
|
84030
|
+
const from2 = pos;
|
|
84031
|
+
const to = pos + paragraph2.nodeSize;
|
|
84032
|
+
const existing = nextDecorations.find(from2, to);
|
|
84033
|
+
if (existing?.length) {
|
|
84034
|
+
nextDecorations = nextDecorations.remove(existing);
|
|
84035
|
+
}
|
|
84036
|
+
const paragraphDecorations = buildParagraphDecorations(
|
|
84037
|
+
newState.doc,
|
|
84038
|
+
pos + 1,
|
|
84039
|
+
paragraph2,
|
|
84040
|
+
view,
|
|
84041
|
+
helpers2,
|
|
84042
|
+
revision + 1
|
|
84043
|
+
);
|
|
84044
|
+
nextDecorations = nextDecorations.add(newState.doc, paragraphDecorations);
|
|
84045
|
+
});
|
|
84046
|
+
return { decorations: nextDecorations, revision: revision + 1 };
|
|
83889
84047
|
}
|
|
83890
84048
|
},
|
|
83891
84049
|
props: {
|
|
83892
84050
|
decorations(state2) {
|
|
83893
84051
|
return this.getState(state2).decorations;
|
|
83894
84052
|
}
|
|
84053
|
+
},
|
|
84054
|
+
view() {
|
|
84055
|
+
return {
|
|
84056
|
+
destroy() {
|
|
84057
|
+
clearAllParagraphContexts();
|
|
84058
|
+
}
|
|
84059
|
+
};
|
|
83895
84060
|
}
|
|
83896
84061
|
});
|
|
83897
84062
|
return [tabPlugin];
|
|
83898
84063
|
}
|
|
83899
84064
|
});
|
|
83900
|
-
function
|
|
84065
|
+
function buildInitialDecorations(doc2, view, helpers2, revision) {
|
|
83901
84066
|
const decorations = [];
|
|
83902
84067
|
doc2.descendants((node2, pos) => {
|
|
83903
84068
|
if (node2.type.name !== "paragraph") return;
|
|
@@ -83918,6 +84083,37 @@ ${l}
|
|
|
83918
84083
|
});
|
|
83919
84084
|
return DecorationSet.create(doc2, decorations);
|
|
83920
84085
|
}
|
|
84086
|
+
function buildParagraphDecorations(doc2, paragraphContentPos, paragraphNode, view, helpers2, revision) {
|
|
84087
|
+
const request = createLayoutRequest(doc2, paragraphContentPos, view, helpers2, revision);
|
|
84088
|
+
if (!request) return [];
|
|
84089
|
+
const result = calculateTabLayout(request, void 0, view);
|
|
84090
|
+
return applyLayoutResult(result, paragraphNode, paragraphContentPos - 1);
|
|
84091
|
+
}
|
|
84092
|
+
function getAffectedParagraphStarts(tr, newState) {
|
|
84093
|
+
const affected = /* @__PURE__ */ new Set();
|
|
84094
|
+
tr.steps.forEach((step, index2) => {
|
|
84095
|
+
if (step.from == null && step.to == null) return;
|
|
84096
|
+
let fromPos = step.from;
|
|
84097
|
+
let toPos = step.to;
|
|
84098
|
+
if (typeof fromPos !== "number" || typeof toPos !== "number") return;
|
|
84099
|
+
for (let i2 = index2; i2 < tr.steps.length; i2++) {
|
|
84100
|
+
const stepMap = tr.steps[i2].getMap();
|
|
84101
|
+
fromPos = stepMap.map(fromPos, -1);
|
|
84102
|
+
toPos = stepMap.map(toPos, 1);
|
|
84103
|
+
}
|
|
84104
|
+
if (fromPos < 0 || toPos < 0 || fromPos > newState.doc.content.size || toPos > newState.doc.content.size) {
|
|
84105
|
+
return;
|
|
84106
|
+
}
|
|
84107
|
+
newState.doc.nodesBetween(fromPos, toPos, (node2, pos) => {
|
|
84108
|
+
if (node2.type.name === "paragraph") {
|
|
84109
|
+
affected.add(pos);
|
|
84110
|
+
return false;
|
|
84111
|
+
}
|
|
84112
|
+
return true;
|
|
84113
|
+
});
|
|
84114
|
+
});
|
|
84115
|
+
return affected;
|
|
84116
|
+
}
|
|
83921
84117
|
const LineBreak = Node$1.create({
|
|
83922
84118
|
name: "lineBreak",
|
|
83923
84119
|
group: "inline",
|
|
@@ -108113,7 +108309,8 @@ ${style2}
|
|
|
108113
108309
|
class: "superdoc-toolbar",
|
|
108114
108310
|
key: unref(toolbarKey),
|
|
108115
108311
|
role: "toolbar",
|
|
108116
|
-
"aria-label": "Toolbar"
|
|
108312
|
+
"aria-label": "Toolbar",
|
|
108313
|
+
"data-editor-ui-surface": ""
|
|
108117
108314
|
}, [
|
|
108118
108315
|
unref(showLeftSide) ? (openBlock(), createBlock(ButtonGroup, {
|
|
108119
108316
|
key: 0,
|
|
@@ -108145,7 +108342,7 @@ ${style2}
|
|
|
108145
108342
|
};
|
|
108146
108343
|
}
|
|
108147
108344
|
};
|
|
108148
|
-
const Toolbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__scopeId", "data-v-
|
|
108345
|
+
const Toolbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__scopeId", "data-v-3f5ec271"]]);
|
|
108149
108346
|
const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
|
|
108150
108347
|
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: ";
|
|
108151
108348
|
async function baseInsightsFetch(payload, options = {}) {
|
|
@@ -109157,7 +109354,8 @@ ${style2}
|
|
|
109157
109354
|
const DocumentMode = /* @__PURE__ */ _export_sfc$1(_sfc_main$e$1, [["__scopeId", "data-v-8730b752"]]);
|
|
109158
109355
|
const _hoisted_1$c$1 = {
|
|
109159
109356
|
key: 0,
|
|
109160
|
-
class: "linked-style-buttons"
|
|
109357
|
+
class: "linked-style-buttons",
|
|
109358
|
+
"data-editor-ui-surface": ""
|
|
109161
109359
|
};
|
|
109162
109360
|
const _hoisted_2$8$1 = ["onClick", "onKeydown", "aria-label"];
|
|
109163
109361
|
const _sfc_main$d$1 = {
|
|
@@ -109236,7 +109434,7 @@ ${style2}
|
|
|
109236
109434
|
};
|
|
109237
109435
|
}
|
|
109238
109436
|
};
|
|
109239
|
-
const LinkedStyle = /* @__PURE__ */ _export_sfc$1(_sfc_main$d$1, [["__scopeId", "data-v-
|
|
109437
|
+
const LinkedStyle = /* @__PURE__ */ _export_sfc$1(_sfc_main$d$1, [["__scopeId", "data-v-ecb78965"]]);
|
|
109240
109438
|
const _hoisted_1$b$1 = {
|
|
109241
109439
|
key: 0,
|
|
109242
109440
|
class: "link-title"
|
|
@@ -131443,7 +131641,7 @@ ${style2}
|
|
|
131443
131641
|
this.config.colors = shuffleArray(this.config.colors);
|
|
131444
131642
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
131445
131643
|
this.colorIndex = 0;
|
|
131446
|
-
this.version = "1.0.0-beta.
|
|
131644
|
+
this.version = "1.0.0-beta.8";
|
|
131447
131645
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
131448
131646
|
this.superdocId = config2.superdocId || v4();
|
|
131449
131647
|
this.colors = this.config.colors;
|
|
@@ -133886,7 +134084,7 @@ ${style2}
|
|
|
133886
134084
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
133887
134085
|
);
|
|
133888
134086
|
}
|
|
133889
|
-
const
|
|
134087
|
+
const indexDJrRlj1_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
133890
134088
|
__proto__: null,
|
|
133891
134089
|
unified
|
|
133892
134090
|
}, Symbol.toStringTag, { value: "Module" }));
|