@harbour-enterprises/superdoc 1.0.0-beta.60 → 1.0.0-beta.61
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-C4HeazGQ.es.js → PdfViewer-BHLsVrSe.es.js} +1 -1
- package/dist/chunks/{PdfViewer-4-HewDUK.cjs → PdfViewer-CuTlpPQO.cjs} +1 -1
- package/dist/chunks/{index-BKfoD32c.es.js → index-DeFp1DEO.es.js} +13 -6
- package/dist/chunks/{index-9qSCXVF1.cjs → index-E5x6cBKw.cjs} +13 -6
- package/dist/chunks/{index-GAzIoyrZ-zhiF5zMK.es.js → index-u8dj63PM-Bfomc8Z6.es.js} +1 -1
- package/dist/chunks/{index-GAzIoyrZ-C17wg4bM.cjs → index-u8dj63PM-VgHx1nNP.cjs} +1 -1
- package/dist/chunks/{super-editor.es-CJ3Aw1GR.es.js → super-editor.es-CI3WoKIG.es.js} +571 -87
- package/dist/chunks/{super-editor.es-DCHFBNql.cjs → super-editor.es-nY9_xN6Z.cjs} +571 -87
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +44 -56
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DZ7Tkh7u.js → converter-DaSkPzA9.js} +3 -3
- package/dist/super-editor/chunks/{docx-zipper-CZQWEuyi.js → docx-zipper-Cx1zgQ8B.js} +1 -1
- package/dist/super-editor/chunks/{editor-CDMuD1Nx.js → editor-45pxcsTR.js} +508 -23
- package/dist/super-editor/chunks/{index-GAzIoyrZ.js → index-u8dj63PM.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DL3rTlKm.js → toolbar-C4OC-AnI.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +17 -29
- package/dist/super-editor/super-editor.es.js +96 -94
- 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 +583 -92
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_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, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_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, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as resolveRunProperties, at as encodeCSSFromPPr, au as twipsToPixels$2, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as resolveRunProperties, at as encodeCSSFromPPr, au as twipsToPixels$2, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-DaSkPzA9.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-Cx1zgQ8B.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -13923,7 +13923,7 @@ const isHeadless = (editor) => {
|
|
|
13923
13923
|
const shouldSkipNodeView = (editor) => {
|
|
13924
13924
|
return isHeadless(editor);
|
|
13925
13925
|
};
|
|
13926
|
-
const summaryVersion = "1.0.0-beta.
|
|
13926
|
+
const summaryVersion = "1.0.0-beta.61";
|
|
13927
13927
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13928
13928
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13929
13929
|
function mapAttributes(attrs) {
|
|
@@ -14715,7 +14715,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14715
14715
|
{ default: remarkStringify },
|
|
14716
14716
|
{ default: remarkGfm }
|
|
14717
14717
|
] = await Promise.all([
|
|
14718
|
-
import("./index-
|
|
14718
|
+
import("./index-u8dj63PM.js"),
|
|
14719
14719
|
import("./index-DRCvimau.js"),
|
|
14720
14720
|
import("./index-C_x_N6Uh.js"),
|
|
14721
14721
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14920,7 +14920,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14920
14920
|
* Process collaboration migrations
|
|
14921
14921
|
*/
|
|
14922
14922
|
processCollaborationMigrations() {
|
|
14923
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
14923
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.61");
|
|
14924
14924
|
if (!this.options.ydoc) return;
|
|
14925
14925
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14926
14926
|
let docVersion = metaMap.get("version");
|
|
@@ -26174,6 +26174,408 @@ function assertFragmentPmPositions(fragment, _context) {
|
|
|
26174
26174
|
const hasPmEnd = fragment.pmEnd != null;
|
|
26175
26175
|
globalValidationStats.record(hasPmStart, hasPmEnd);
|
|
26176
26176
|
}
|
|
26177
|
+
const DEFAULT_PPI = 96;
|
|
26178
|
+
const DEFAULT_RULER_HEIGHT = 25;
|
|
26179
|
+
const TICK_SPACING_PX = DEFAULT_PPI / 8;
|
|
26180
|
+
function generateRulerDefinition(config) {
|
|
26181
|
+
const ppi = config.ppi ?? DEFAULT_PPI;
|
|
26182
|
+
const heightPx = config.heightPx ?? DEFAULT_RULER_HEIGHT;
|
|
26183
|
+
const { pageSize, pageMargins } = config;
|
|
26184
|
+
if (!Number.isFinite(ppi) || ppi <= 0) {
|
|
26185
|
+
throw new Error(`Invalid PPI: ${ppi}. Must be a positive finite number.`);
|
|
26186
|
+
}
|
|
26187
|
+
if (!Number.isFinite(pageSize.width) || pageSize.width <= 0) {
|
|
26188
|
+
throw new Error(`Invalid page width: ${pageSize.width}. Must be a positive finite number.`);
|
|
26189
|
+
}
|
|
26190
|
+
if (!Number.isFinite(pageSize.height) || pageSize.height <= 0) {
|
|
26191
|
+
throw new Error(`Invalid page height: ${pageSize.height}. Must be a positive finite number.`);
|
|
26192
|
+
}
|
|
26193
|
+
if (!Number.isFinite(pageMargins.left) || pageMargins.left < 0) {
|
|
26194
|
+
throw new Error(`Invalid left margin: ${pageMargins.left}. Must be a non-negative finite number.`);
|
|
26195
|
+
}
|
|
26196
|
+
if (!Number.isFinite(pageMargins.right) || pageMargins.right < 0) {
|
|
26197
|
+
throw new Error(`Invalid right margin: ${pageMargins.right}. Must be a non-negative finite number.`);
|
|
26198
|
+
}
|
|
26199
|
+
if (pageMargins.left + pageMargins.right >= pageSize.width) {
|
|
26200
|
+
throw new Error(
|
|
26201
|
+
`Invalid margins: left (${pageMargins.left}) + right (${pageMargins.right}) must be less than page width (${pageSize.width}).`
|
|
26202
|
+
);
|
|
26203
|
+
}
|
|
26204
|
+
const widthPx = pageSize.width * ppi;
|
|
26205
|
+
const ticks = [];
|
|
26206
|
+
let currentX = 0;
|
|
26207
|
+
for (let inch = 0; inch < pageSize.width; inch++) {
|
|
26208
|
+
const remaining = pageSize.width - inch;
|
|
26209
|
+
ticks.push({
|
|
26210
|
+
size: "main",
|
|
26211
|
+
height: "20%",
|
|
26212
|
+
label: inch,
|
|
26213
|
+
x: currentX
|
|
26214
|
+
});
|
|
26215
|
+
currentX += TICK_SPACING_PX;
|
|
26216
|
+
for (let i = 0; i < 3; i++) {
|
|
26217
|
+
ticks.push({
|
|
26218
|
+
size: "eighth",
|
|
26219
|
+
height: "10%",
|
|
26220
|
+
x: currentX
|
|
26221
|
+
});
|
|
26222
|
+
currentX += TICK_SPACING_PX;
|
|
26223
|
+
}
|
|
26224
|
+
ticks.push({
|
|
26225
|
+
size: "half",
|
|
26226
|
+
height: "40%",
|
|
26227
|
+
x: currentX
|
|
26228
|
+
});
|
|
26229
|
+
currentX += TICK_SPACING_PX;
|
|
26230
|
+
if (remaining <= 0.5) break;
|
|
26231
|
+
for (let i = 0; i < 3; i++) {
|
|
26232
|
+
ticks.push({
|
|
26233
|
+
size: "eighth",
|
|
26234
|
+
height: "10%",
|
|
26235
|
+
x: currentX
|
|
26236
|
+
});
|
|
26237
|
+
currentX += TICK_SPACING_PX;
|
|
26238
|
+
}
|
|
26239
|
+
}
|
|
26240
|
+
return {
|
|
26241
|
+
widthPx,
|
|
26242
|
+
heightPx,
|
|
26243
|
+
ticks,
|
|
26244
|
+
leftMarginPx: pageMargins.left * ppi,
|
|
26245
|
+
rightMarginPx: widthPx - pageMargins.right * ppi,
|
|
26246
|
+
pageWidthInches: pageSize.width
|
|
26247
|
+
};
|
|
26248
|
+
}
|
|
26249
|
+
function calculateMarginFromHandle(handleX, side, pageWidthPx, ppi = DEFAULT_PPI) {
|
|
26250
|
+
if (side === "left") {
|
|
26251
|
+
return handleX / ppi;
|
|
26252
|
+
} else {
|
|
26253
|
+
return (pageWidthPx - handleX) / ppi;
|
|
26254
|
+
}
|
|
26255
|
+
}
|
|
26256
|
+
function clampHandlePosition(handleX, side, otherHandleX, pageWidthPx, minContentWidthPx = 200) {
|
|
26257
|
+
if (!Number.isFinite(handleX)) {
|
|
26258
|
+
throw new Error(`Invalid handleX: ${handleX}. Must be a finite number.`);
|
|
26259
|
+
}
|
|
26260
|
+
if (!Number.isFinite(otherHandleX)) {
|
|
26261
|
+
throw new Error(`Invalid otherHandleX: ${otherHandleX}. Must be a finite number.`);
|
|
26262
|
+
}
|
|
26263
|
+
if (!Number.isFinite(pageWidthPx)) {
|
|
26264
|
+
throw new Error(`Invalid pageWidthPx: ${pageWidthPx}. Must be a finite number.`);
|
|
26265
|
+
}
|
|
26266
|
+
if (!Number.isFinite(minContentWidthPx)) {
|
|
26267
|
+
throw new Error(`Invalid minContentWidthPx: ${minContentWidthPx}. Must be a finite number.`);
|
|
26268
|
+
}
|
|
26269
|
+
if (side === "left") {
|
|
26270
|
+
const min2 = 0;
|
|
26271
|
+
const max2 = otherHandleX - minContentWidthPx;
|
|
26272
|
+
return Math.max(min2, Math.min(max2, handleX));
|
|
26273
|
+
} else {
|
|
26274
|
+
const min2 = otherHandleX + minContentWidthPx;
|
|
26275
|
+
const max2 = pageWidthPx;
|
|
26276
|
+
return Math.max(min2, Math.min(max2, handleX));
|
|
26277
|
+
}
|
|
26278
|
+
}
|
|
26279
|
+
function generateRulerDefinitionFromPx(config) {
|
|
26280
|
+
const ppi = config.ppi ?? DEFAULT_PPI;
|
|
26281
|
+
const heightPx = config.heightPx ?? DEFAULT_RULER_HEIGHT;
|
|
26282
|
+
const { pageWidthPx, leftMarginPx, rightMarginPx } = config;
|
|
26283
|
+
if (!Number.isFinite(ppi) || ppi <= 0) {
|
|
26284
|
+
throw new Error(`Invalid PPI: ${ppi}. Must be a positive finite number.`);
|
|
26285
|
+
}
|
|
26286
|
+
if (!Number.isFinite(pageWidthPx) || pageWidthPx <= 0) {
|
|
26287
|
+
throw new Error(`Invalid page width: ${pageWidthPx}px. Must be a positive finite number.`);
|
|
26288
|
+
}
|
|
26289
|
+
if (!Number.isFinite(config.pageHeightPx) || config.pageHeightPx <= 0) {
|
|
26290
|
+
throw new Error(`Invalid page height: ${config.pageHeightPx}px. Must be a positive finite number.`);
|
|
26291
|
+
}
|
|
26292
|
+
if (!Number.isFinite(leftMarginPx) || leftMarginPx < 0) {
|
|
26293
|
+
throw new Error(`Invalid left margin: ${leftMarginPx}px. Must be a non-negative finite number.`);
|
|
26294
|
+
}
|
|
26295
|
+
if (!Number.isFinite(rightMarginPx) || rightMarginPx < 0) {
|
|
26296
|
+
throw new Error(`Invalid right margin: ${rightMarginPx}px. Must be a non-negative finite number.`);
|
|
26297
|
+
}
|
|
26298
|
+
if (leftMarginPx + rightMarginPx >= pageWidthPx) {
|
|
26299
|
+
throw new Error(
|
|
26300
|
+
`Invalid margins: left (${leftMarginPx}px) + right (${rightMarginPx}px) must be less than page width (${pageWidthPx}px).`
|
|
26301
|
+
);
|
|
26302
|
+
}
|
|
26303
|
+
const pageWidthInches = pageWidthPx / ppi;
|
|
26304
|
+
const ticks = [];
|
|
26305
|
+
let currentX = 0;
|
|
26306
|
+
for (let inch = 0; inch < pageWidthInches; inch++) {
|
|
26307
|
+
const remaining = pageWidthInches - inch;
|
|
26308
|
+
ticks.push({
|
|
26309
|
+
size: "main",
|
|
26310
|
+
height: "20%",
|
|
26311
|
+
label: inch,
|
|
26312
|
+
x: currentX
|
|
26313
|
+
});
|
|
26314
|
+
currentX += TICK_SPACING_PX;
|
|
26315
|
+
for (let i = 0; i < 3; i++) {
|
|
26316
|
+
ticks.push({
|
|
26317
|
+
size: "eighth",
|
|
26318
|
+
height: "10%",
|
|
26319
|
+
x: currentX
|
|
26320
|
+
});
|
|
26321
|
+
currentX += TICK_SPACING_PX;
|
|
26322
|
+
}
|
|
26323
|
+
ticks.push({
|
|
26324
|
+
size: "half",
|
|
26325
|
+
height: "40%",
|
|
26326
|
+
x: currentX
|
|
26327
|
+
});
|
|
26328
|
+
currentX += TICK_SPACING_PX;
|
|
26329
|
+
if (remaining <= 0.5) break;
|
|
26330
|
+
for (let i = 0; i < 3; i++) {
|
|
26331
|
+
ticks.push({
|
|
26332
|
+
size: "eighth",
|
|
26333
|
+
height: "10%",
|
|
26334
|
+
x: currentX
|
|
26335
|
+
});
|
|
26336
|
+
currentX += TICK_SPACING_PX;
|
|
26337
|
+
}
|
|
26338
|
+
}
|
|
26339
|
+
return {
|
|
26340
|
+
widthPx: pageWidthPx,
|
|
26341
|
+
heightPx,
|
|
26342
|
+
ticks,
|
|
26343
|
+
leftMarginPx,
|
|
26344
|
+
rightMarginPx: pageWidthPx - rightMarginPx,
|
|
26345
|
+
pageWidthInches
|
|
26346
|
+
};
|
|
26347
|
+
}
|
|
26348
|
+
const RULER_CLASS_NAMES = {
|
|
26349
|
+
/** Main ruler container */
|
|
26350
|
+
ruler: "superdoc-ruler",
|
|
26351
|
+
/** Tick mark element */
|
|
26352
|
+
tick: "superdoc-ruler-tick",
|
|
26353
|
+
/** Main (inch) tick */
|
|
26354
|
+
tickMain: "superdoc-ruler-tick--main",
|
|
26355
|
+
/** Half-inch tick */
|
|
26356
|
+
tickHalf: "superdoc-ruler-tick--half",
|
|
26357
|
+
/** Eighth-inch tick */
|
|
26358
|
+
tickEighth: "superdoc-ruler-tick--eighth",
|
|
26359
|
+
/** Inch label number */
|
|
26360
|
+
label: "superdoc-ruler-label",
|
|
26361
|
+
/** Margin handle */
|
|
26362
|
+
handle: "superdoc-ruler-handle",
|
|
26363
|
+
/** Left margin handle */
|
|
26364
|
+
handleLeft: "superdoc-ruler-handle--left",
|
|
26365
|
+
/** Right margin handle */
|
|
26366
|
+
handleRight: "superdoc-ruler-handle--right",
|
|
26367
|
+
/** Vertical indicator line during drag */
|
|
26368
|
+
indicator: "superdoc-ruler-indicator"
|
|
26369
|
+
};
|
|
26370
|
+
function createRulerElement(options) {
|
|
26371
|
+
const { definition, doc: doc2, interactive = false } = options;
|
|
26372
|
+
if (!Number.isFinite(definition.widthPx) || definition.widthPx <= 0) {
|
|
26373
|
+
console.warn(`[createRulerElement] Invalid ruler width: ${definition.widthPx}px. Using minimum width of 1px.`);
|
|
26374
|
+
definition.widthPx = Math.max(1, definition.widthPx || 1);
|
|
26375
|
+
}
|
|
26376
|
+
if (!definition.ticks || definition.ticks.length === 0) {
|
|
26377
|
+
console.warn("[createRulerElement] Ruler definition has no ticks. Ruler will be empty.");
|
|
26378
|
+
}
|
|
26379
|
+
const ruler = doc2.createElement("div");
|
|
26380
|
+
ruler.className = RULER_CLASS_NAMES.ruler;
|
|
26381
|
+
ruler.style.cssText = `
|
|
26382
|
+
position: relative;
|
|
26383
|
+
width: ${definition.widthPx}px;
|
|
26384
|
+
height: ${definition.heightPx}px;
|
|
26385
|
+
display: flex;
|
|
26386
|
+
align-items: flex-end;
|
|
26387
|
+
box-sizing: border-box;
|
|
26388
|
+
user-select: none;
|
|
26389
|
+
pointer-events: ${interactive ? "auto" : "none"};
|
|
26390
|
+
`;
|
|
26391
|
+
for (const tick of definition.ticks) {
|
|
26392
|
+
const tickEl = createTickElement(tick, doc2);
|
|
26393
|
+
ruler.appendChild(tickEl);
|
|
26394
|
+
}
|
|
26395
|
+
if (interactive) {
|
|
26396
|
+
const leftHandle = createHandleElement("left", definition.leftMarginPx, doc2, options);
|
|
26397
|
+
const rightHandle = createHandleElement("right", definition.rightMarginPx, doc2, options);
|
|
26398
|
+
ruler.appendChild(leftHandle);
|
|
26399
|
+
ruler.appendChild(rightHandle);
|
|
26400
|
+
}
|
|
26401
|
+
return ruler;
|
|
26402
|
+
}
|
|
26403
|
+
function createTickElement(tick, doc2) {
|
|
26404
|
+
const el = doc2.createElement("div");
|
|
26405
|
+
const sizeClass = tick.size === "main" ? RULER_CLASS_NAMES.tickMain : tick.size === "half" ? RULER_CLASS_NAMES.tickHalf : RULER_CLASS_NAMES.tickEighth;
|
|
26406
|
+
el.className = `${RULER_CLASS_NAMES.tick} ${sizeClass}`;
|
|
26407
|
+
el.style.cssText = `
|
|
26408
|
+
position: absolute;
|
|
26409
|
+
left: ${tick.x}px;
|
|
26410
|
+
bottom: 0;
|
|
26411
|
+
width: 1px;
|
|
26412
|
+
height: ${tick.height};
|
|
26413
|
+
background-color: #666;
|
|
26414
|
+
pointer-events: none;
|
|
26415
|
+
`;
|
|
26416
|
+
if (tick.label !== void 0) {
|
|
26417
|
+
const label = doc2.createElement("span");
|
|
26418
|
+
label.className = RULER_CLASS_NAMES.label;
|
|
26419
|
+
label.textContent = String(tick.label);
|
|
26420
|
+
label.style.cssText = `
|
|
26421
|
+
position: absolute;
|
|
26422
|
+
top: -16px;
|
|
26423
|
+
left: -2px;
|
|
26424
|
+
font-size: 10px;
|
|
26425
|
+
color: #666;
|
|
26426
|
+
pointer-events: none;
|
|
26427
|
+
user-select: none;
|
|
26428
|
+
`;
|
|
26429
|
+
el.appendChild(label);
|
|
26430
|
+
}
|
|
26431
|
+
return el;
|
|
26432
|
+
}
|
|
26433
|
+
function createHandleElement(side, x, doc2, options) {
|
|
26434
|
+
const handle = doc2.createElement("div");
|
|
26435
|
+
const sideClass = side === "left" ? RULER_CLASS_NAMES.handleLeft : RULER_CLASS_NAMES.handleRight;
|
|
26436
|
+
handle.className = `${RULER_CLASS_NAMES.handle} ${sideClass}`;
|
|
26437
|
+
handle.dataset.side = side;
|
|
26438
|
+
handle.style.cssText = `
|
|
26439
|
+
position: absolute;
|
|
26440
|
+
left: ${x}px;
|
|
26441
|
+
top: 0;
|
|
26442
|
+
width: 5px;
|
|
26443
|
+
height: 20px;
|
|
26444
|
+
margin-left: -2px;
|
|
26445
|
+
background-color: #ccc;
|
|
26446
|
+
border-radius: 4px 4px 0 0;
|
|
26447
|
+
cursor: grab;
|
|
26448
|
+
transition: background-color 150ms ease;
|
|
26449
|
+
z-index: 10;
|
|
26450
|
+
`;
|
|
26451
|
+
handle.addEventListener("mouseenter", () => {
|
|
26452
|
+
if (!handle.dataset.dragging) {
|
|
26453
|
+
handle.style.backgroundColor = "rgba(37, 99, 235, 0.4)";
|
|
26454
|
+
}
|
|
26455
|
+
});
|
|
26456
|
+
handle.addEventListener("mouseleave", () => {
|
|
26457
|
+
if (!handle.dataset.dragging) {
|
|
26458
|
+
handle.style.backgroundColor = "#ccc";
|
|
26459
|
+
}
|
|
26460
|
+
});
|
|
26461
|
+
if (options.onDragStart || options.onDrag || options.onDragEnd) {
|
|
26462
|
+
setupHandleDrag(handle, side, options);
|
|
26463
|
+
}
|
|
26464
|
+
return handle;
|
|
26465
|
+
}
|
|
26466
|
+
function setupHandleDrag(handle, side, options) {
|
|
26467
|
+
let offsetX = 0;
|
|
26468
|
+
const onPointerDown = (event) => {
|
|
26469
|
+
event.preventDefault();
|
|
26470
|
+
handle.dataset.dragging = "true";
|
|
26471
|
+
handle.style.backgroundColor = "rgba(37, 99, 235, 0.4)";
|
|
26472
|
+
handle.style.cursor = "grabbing";
|
|
26473
|
+
const rect = handle.getBoundingClientRect();
|
|
26474
|
+
offsetX = event.clientX - rect.left - rect.width / 2;
|
|
26475
|
+
handle.setPointerCapture(event.pointerId);
|
|
26476
|
+
options.onDragStart?.(side, event);
|
|
26477
|
+
};
|
|
26478
|
+
const onPointerMove = (event) => {
|
|
26479
|
+
if (handle.dataset.dragging !== "true") return;
|
|
26480
|
+
const ruler = handle.parentElement;
|
|
26481
|
+
if (!ruler) return;
|
|
26482
|
+
const rulerRect = ruler.getBoundingClientRect();
|
|
26483
|
+
const newX = event.clientX - rulerRect.left - offsetX;
|
|
26484
|
+
options.onDrag?.(side, newX, event);
|
|
26485
|
+
};
|
|
26486
|
+
const onPointerUp = (event) => {
|
|
26487
|
+
if (handle.dataset.dragging !== "true") return;
|
|
26488
|
+
handle.dataset.dragging = "";
|
|
26489
|
+
handle.style.backgroundColor = "#ccc";
|
|
26490
|
+
handle.style.cursor = "grab";
|
|
26491
|
+
handle.releasePointerCapture(event.pointerId);
|
|
26492
|
+
const ruler = handle.parentElement;
|
|
26493
|
+
if (!ruler) return;
|
|
26494
|
+
const rulerRect = ruler.getBoundingClientRect();
|
|
26495
|
+
const finalX = event.clientX - rulerRect.left - offsetX;
|
|
26496
|
+
options.onDragEnd?.(side, finalX, event);
|
|
26497
|
+
};
|
|
26498
|
+
handle.addEventListener("pointerdown", onPointerDown);
|
|
26499
|
+
handle.addEventListener("pointermove", onPointerMove);
|
|
26500
|
+
handle.addEventListener("pointerup", onPointerUp);
|
|
26501
|
+
handle.addEventListener("pointercancel", onPointerUp);
|
|
26502
|
+
}
|
|
26503
|
+
const RULER_STYLES = `
|
|
26504
|
+
/* Ruler container */
|
|
26505
|
+
.${RULER_CLASS_NAMES.ruler} {
|
|
26506
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
26507
|
+
background-color: transparent;
|
|
26508
|
+
}
|
|
26509
|
+
|
|
26510
|
+
/* Tick marks base styling */
|
|
26511
|
+
.${RULER_CLASS_NAMES.tick} {
|
|
26512
|
+
flex-shrink: 0;
|
|
26513
|
+
}
|
|
26514
|
+
|
|
26515
|
+
/* Handle hover and active states */
|
|
26516
|
+
.${RULER_CLASS_NAMES.handle}:hover {
|
|
26517
|
+
background-color: rgba(37, 99, 235, 0.4) !important;
|
|
26518
|
+
}
|
|
26519
|
+
|
|
26520
|
+
.${RULER_CLASS_NAMES.handle}:active,
|
|
26521
|
+
.${RULER_CLASS_NAMES.handle}[data-dragging="true"] {
|
|
26522
|
+
background-color: rgba(37, 99, 235, 0.6) !important;
|
|
26523
|
+
cursor: grabbing !important;
|
|
26524
|
+
}
|
|
26525
|
+
|
|
26526
|
+
/* Vertical indicator animation */
|
|
26527
|
+
.${RULER_CLASS_NAMES.indicator} {
|
|
26528
|
+
transition: left 16ms linear;
|
|
26529
|
+
}
|
|
26530
|
+
|
|
26531
|
+
/* Print mode: hide rulers */
|
|
26532
|
+
@media print {
|
|
26533
|
+
.${RULER_CLASS_NAMES.ruler} {
|
|
26534
|
+
display: none !important;
|
|
26535
|
+
}
|
|
26536
|
+
}
|
|
26537
|
+
|
|
26538
|
+
/* High contrast mode support */
|
|
26539
|
+
@media (prefers-contrast: high) {
|
|
26540
|
+
.${RULER_CLASS_NAMES.tick} {
|
|
26541
|
+
background-color: #000 !important;
|
|
26542
|
+
}
|
|
26543
|
+
|
|
26544
|
+
.${RULER_CLASS_NAMES.label} {
|
|
26545
|
+
color: #000 !important;
|
|
26546
|
+
}
|
|
26547
|
+
|
|
26548
|
+
.${RULER_CLASS_NAMES.handle} {
|
|
26549
|
+
background-color: #666 !important;
|
|
26550
|
+
border: 1px solid #000;
|
|
26551
|
+
}
|
|
26552
|
+
|
|
26553
|
+
.${RULER_CLASS_NAMES.handle}:hover,
|
|
26554
|
+
.${RULER_CLASS_NAMES.handle}:active {
|
|
26555
|
+
background-color: #0066cc !important;
|
|
26556
|
+
}
|
|
26557
|
+
}
|
|
26558
|
+
|
|
26559
|
+
/* Reduced motion support */
|
|
26560
|
+
@media (prefers-reduced-motion: reduce) {
|
|
26561
|
+
.${RULER_CLASS_NAMES.handle} {
|
|
26562
|
+
transition: none !important;
|
|
26563
|
+
}
|
|
26564
|
+
|
|
26565
|
+
.${RULER_CLASS_NAMES.indicator} {
|
|
26566
|
+
transition: none !important;
|
|
26567
|
+
}
|
|
26568
|
+
}
|
|
26569
|
+
`;
|
|
26570
|
+
let rulerStylesInjected = false;
|
|
26571
|
+
function ensureRulerStyles(doc2) {
|
|
26572
|
+
if (rulerStylesInjected || !doc2) return;
|
|
26573
|
+
const styleEl = doc2.createElement("style");
|
|
26574
|
+
styleEl.setAttribute("data-superdoc-ruler-styles", "true");
|
|
26575
|
+
styleEl.textContent = RULER_STYLES;
|
|
26576
|
+
doc2.head?.appendChild(styleEl);
|
|
26577
|
+
rulerStylesInjected = true;
|
|
26578
|
+
}
|
|
26177
26579
|
function isMinimalWordLayout(value) {
|
|
26178
26580
|
if (typeof value !== "object" || value === null) {
|
|
26179
26581
|
return false;
|
|
@@ -26220,6 +26622,7 @@ function isMinimalWordLayout(value) {
|
|
|
26220
26622
|
}
|
|
26221
26623
|
const LIST_MARKER_GAP$1 = 8;
|
|
26222
26624
|
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
26625
|
+
const DEFAULT_PAGE_HEIGHT_PX = 1056;
|
|
26223
26626
|
const COMMENT_EXTERNAL_COLOR = "#B1124B";
|
|
26224
26627
|
const COMMENT_INTERNAL_COLOR = "#078383";
|
|
26225
26628
|
const COMMENT_INACTIVE_ALPHA = "22";
|
|
@@ -26462,6 +26865,9 @@ const _DomPainter = class _DomPainter {
|
|
|
26462
26865
|
ensureFieldAnnotationStyles(doc2);
|
|
26463
26866
|
ensureSdtContainerStyles(doc2);
|
|
26464
26867
|
ensureImageSelectionStyles(doc2);
|
|
26868
|
+
if (this.options.ruler?.enabled) {
|
|
26869
|
+
ensureRulerStyles(doc2);
|
|
26870
|
+
}
|
|
26465
26871
|
mount.classList.add(CLASS_NAMES$1.container);
|
|
26466
26872
|
if (this.mount && this.mount !== mount) {
|
|
26467
26873
|
this.resetState();
|
|
@@ -26719,6 +27125,12 @@ const _DomPainter = class _DomPainter {
|
|
|
26719
27125
|
const el = this.doc.createElement("div");
|
|
26720
27126
|
el.classList.add(CLASS_NAMES$1.page);
|
|
26721
27127
|
applyStyles$2(el, pageStyles(width, height, this.getEffectivePageStyles()));
|
|
27128
|
+
if (this.options.ruler?.enabled) {
|
|
27129
|
+
const rulerEl = this.renderPageRuler(width, page);
|
|
27130
|
+
if (rulerEl) {
|
|
27131
|
+
el.appendChild(rulerEl);
|
|
27132
|
+
}
|
|
27133
|
+
}
|
|
26722
27134
|
const contextBase = {
|
|
26723
27135
|
pageNumber: page.number,
|
|
26724
27136
|
totalPages: this.totalPages,
|
|
@@ -26731,6 +27143,70 @@ const _DomPainter = class _DomPainter {
|
|
|
26731
27143
|
this.renderDecorationsForPage(el, page);
|
|
26732
27144
|
return el;
|
|
26733
27145
|
}
|
|
27146
|
+
/**
|
|
27147
|
+
* Render a ruler element for a page.
|
|
27148
|
+
*
|
|
27149
|
+
* Creates a horizontal ruler with tick marks and optional interactive margin handles.
|
|
27150
|
+
* The ruler is positioned at the top of the page and displays inch measurements.
|
|
27151
|
+
*
|
|
27152
|
+
* @param pageWidthPx - Page width in pixels
|
|
27153
|
+
* @param page - Page data containing margins and optional size information
|
|
27154
|
+
* @returns Ruler element, or null if this.doc is unavailable or page margins are missing
|
|
27155
|
+
*
|
|
27156
|
+
* Side effects:
|
|
27157
|
+
* - Creates DOM elements and applies inline styles
|
|
27158
|
+
* - May invoke the onMarginChange callback if interactive mode is enabled
|
|
27159
|
+
*
|
|
27160
|
+
* Fallback behavior:
|
|
27161
|
+
* - Uses DEFAULT_PAGE_HEIGHT_PX (1056px = 11 inches) if page.size.h is not available
|
|
27162
|
+
* - Defaults margins to 0 if not explicitly provided
|
|
27163
|
+
*/
|
|
27164
|
+
renderPageRuler(pageWidthPx, page) {
|
|
27165
|
+
if (!this.doc) {
|
|
27166
|
+
console.warn("[renderPageRuler] Cannot render ruler: document is not available.");
|
|
27167
|
+
return null;
|
|
27168
|
+
}
|
|
27169
|
+
if (!page.margins) {
|
|
27170
|
+
console.warn(`[renderPageRuler] Cannot render ruler for page ${page.number}: margins not available.`);
|
|
27171
|
+
return null;
|
|
27172
|
+
}
|
|
27173
|
+
const margins = page.margins;
|
|
27174
|
+
const leftMargin = margins.left ?? 0;
|
|
27175
|
+
const rightMargin = margins.right ?? 0;
|
|
27176
|
+
try {
|
|
27177
|
+
const rulerDefinition = generateRulerDefinitionFromPx({
|
|
27178
|
+
pageWidthPx,
|
|
27179
|
+
pageHeightPx: page.size?.h ?? DEFAULT_PAGE_HEIGHT_PX,
|
|
27180
|
+
leftMarginPx: leftMargin,
|
|
27181
|
+
rightMarginPx: rightMargin
|
|
27182
|
+
});
|
|
27183
|
+
const interactive = this.options.ruler?.interactive ?? false;
|
|
27184
|
+
const onMarginChange = this.options.ruler?.onMarginChange;
|
|
27185
|
+
const rulerEl = createRulerElement({
|
|
27186
|
+
definition: rulerDefinition,
|
|
27187
|
+
doc: this.doc,
|
|
27188
|
+
interactive,
|
|
27189
|
+
onDragEnd: interactive && onMarginChange ? (side, x) => {
|
|
27190
|
+
try {
|
|
27191
|
+
const ppi = 96;
|
|
27192
|
+
const marginInches = side === "left" ? x / ppi : (pageWidthPx - x) / ppi;
|
|
27193
|
+
onMarginChange(side, marginInches);
|
|
27194
|
+
} catch (error) {
|
|
27195
|
+
console.error("[renderPageRuler] Error in onMarginChange callback:", error);
|
|
27196
|
+
}
|
|
27197
|
+
} : void 0
|
|
27198
|
+
});
|
|
27199
|
+
rulerEl.style.position = "absolute";
|
|
27200
|
+
rulerEl.style.top = "0";
|
|
27201
|
+
rulerEl.style.left = "0";
|
|
27202
|
+
rulerEl.style.zIndex = "20";
|
|
27203
|
+
rulerEl.dataset.pageNumber = String(page.number);
|
|
27204
|
+
return rulerEl;
|
|
27205
|
+
} catch (error) {
|
|
27206
|
+
console.error(`[renderPageRuler] Failed to create ruler for page ${page.number}:`, error);
|
|
27207
|
+
return null;
|
|
27208
|
+
}
|
|
27209
|
+
}
|
|
26734
27210
|
renderDecorationsForPage(pageEl, page) {
|
|
26735
27211
|
this.renderDecorationSection(pageEl, page, "header");
|
|
26736
27212
|
this.renderDecorationSection(pageEl, page, "footer");
|
|
@@ -29531,7 +30007,8 @@ const createDomPainter = (options) => {
|
|
|
29531
30007
|
layoutMode: options.layoutMode,
|
|
29532
30008
|
headerProvider: options.headerProvider,
|
|
29533
30009
|
footerProvider: options.footerProvider,
|
|
29534
|
-
virtualization: options.virtualization
|
|
30010
|
+
virtualization: options.virtualization,
|
|
30011
|
+
ruler: options.ruler
|
|
29535
30012
|
});
|
|
29536
30013
|
return {
|
|
29537
30014
|
paint(layout, mount) {
|
|
@@ -40273,9 +40750,11 @@ updateLocalAwarenessCursor_fn = function() {
|
|
|
40273
40750
|
if (typeof provider.awareness.setLocalStateField !== "function") {
|
|
40274
40751
|
return;
|
|
40275
40752
|
}
|
|
40276
|
-
const
|
|
40753
|
+
const editorState = __privateGet(this, _editor3)?.state;
|
|
40754
|
+
if (!editorState) return;
|
|
40755
|
+
const ystate = ySyncPluginKey.getState(editorState);
|
|
40277
40756
|
if (!ystate?.binding?.mapping) return;
|
|
40278
|
-
const { selection } =
|
|
40757
|
+
const { selection } = editorState;
|
|
40279
40758
|
const { anchor, head } = selection;
|
|
40280
40759
|
try {
|
|
40281
40760
|
const relAnchor = absolutePositionToRelativePosition(anchor, ystate.type, ystate.binding.mapping);
|
|
@@ -40298,7 +40777,9 @@ updateLocalAwarenessCursor_fn = function() {
|
|
|
40298
40777
|
normalizeAwarenessStates_fn = function() {
|
|
40299
40778
|
const provider = __privateGet(this, _options).collaborationProvider;
|
|
40300
40779
|
if (!provider?.awareness) return /* @__PURE__ */ new Map();
|
|
40301
|
-
const
|
|
40780
|
+
const editorState = __privateGet(this, _editor3)?.state;
|
|
40781
|
+
if (!editorState) return /* @__PURE__ */ new Map();
|
|
40782
|
+
const ystate = ySyncPluginKey.getState(editorState);
|
|
40302
40783
|
if (!ystate) return /* @__PURE__ */ new Map();
|
|
40303
40784
|
const states = provider.awareness?.getStates();
|
|
40304
40785
|
const normalized = /* @__PURE__ */ new Map();
|
|
@@ -41305,7 +41786,8 @@ ensurePainter_fn = function(blocks, measures) {
|
|
|
41305
41786
|
virtualization: __privateGet(this, _layoutOptions).virtualization,
|
|
41306
41787
|
pageStyles: __privateGet(this, _layoutOptions).pageStyles,
|
|
41307
41788
|
headerProvider: __privateGet(this, _headerDecorationProvider),
|
|
41308
|
-
footerProvider: __privateGet(this, _footerDecorationProvider)
|
|
41789
|
+
footerProvider: __privateGet(this, _footerDecorationProvider),
|
|
41790
|
+
ruler: __privateGet(this, _layoutOptions).ruler
|
|
41309
41791
|
}));
|
|
41310
41792
|
}
|
|
41311
41793
|
return __privateGet(this, _domPainter);
|
|
@@ -62420,11 +62902,14 @@ const getStarterExtensions = () => {
|
|
|
62420
62902
|
};
|
|
62421
62903
|
export {
|
|
62422
62904
|
Attribute as A,
|
|
62423
|
-
|
|
62424
|
-
|
|
62905
|
+
index$1 as B,
|
|
62906
|
+
index as C,
|
|
62425
62907
|
DecorationSet as D,
|
|
62426
62908
|
Editor as E,
|
|
62427
|
-
|
|
62909
|
+
AnnotatorHelpers as F,
|
|
62910
|
+
SectionHelpers as G,
|
|
62911
|
+
getAllowedImageDimensions as H,
|
|
62912
|
+
CommentsPluginKey as I,
|
|
62428
62913
|
Mark as M,
|
|
62429
62914
|
Node$1 as N,
|
|
62430
62915
|
PresentationEditor as P,
|
|
@@ -62443,18 +62928,18 @@ export {
|
|
|
62443
62928
|
redoDepth as j,
|
|
62444
62929
|
getEditorSurfaceElement as k,
|
|
62445
62930
|
collectTrackedChangesForContext as l,
|
|
62446
|
-
|
|
62447
|
-
|
|
62448
|
-
|
|
62449
|
-
|
|
62450
|
-
|
|
62931
|
+
generateRulerDefinition as m,
|
|
62932
|
+
clampHandlePosition as n,
|
|
62933
|
+
calculateMarginFromHandle as o,
|
|
62934
|
+
measureCache as p,
|
|
62935
|
+
isHeadless as q,
|
|
62451
62936
|
replaceSelectionWithImagePlaceholder as r,
|
|
62452
62937
|
shouldBypassContextMenu as s,
|
|
62453
|
-
|
|
62938
|
+
getStarterExtensions as t,
|
|
62454
62939
|
useHighContrastMode as u,
|
|
62455
|
-
|
|
62456
|
-
|
|
62457
|
-
|
|
62940
|
+
Placeholder as v,
|
|
62941
|
+
getRichTextExtensions as w,
|
|
62942
|
+
Decoration as x,
|
|
62458
62943
|
yUndoPluginKey as y,
|
|
62459
|
-
|
|
62944
|
+
Extension as z
|
|
62460
62945
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, onMounted, onBeforeUnmount, createVNode, readonly, watch, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
|
|
2
|
-
import { p as process$1 } from "./converter-
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { p as process$1 } from "./converter-DaSkPzA9.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-45pxcsTR.js";
|
|
4
4
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
5
5
|
let sanitized = value.replace(/[^0-9.]/g, "");
|
|
6
6
|
sanitized = parseFloat(sanitized);
|