oasis-editor 0.0.24 → 0.0.26

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.
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTable, w as createEditorTableRow, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as textStyleToFontSizePt, a6 as PX_PER_POINT, a7 as DEFAULT_FONT_SIZE_PX, a8 as isDoubleUnderlineStyle, a9 as isWavyUnderlineStyle, aa as underlineStyleLineWidthPx, ab as underlineStyleDashArray, ac as getListLabelInset, ad as getParagraphBorderInsets, ae as normalizeFamily, af as ROBOTO_FONT_FILES, ag as loadFontAsset, ah as OFFICE_COMPAT_FONT_FAMILIES, ai as buildSfnt, aj as defaultFontDecoderRegistry, ak as SfntFontProgram, al as collectPdfFontFamilies, am as projectDocumentLayout, an as getPageHeaderZoneTop, ao as getPageBodyTop, ap as getPageColumnRects, aq as findFootnoteReference, ar as FOOTNOTE_MARKER_GUTTER_PX, as as resolveImporterForFile, at as createEditorStateFromDocument, au as getDocumentParagraphsCanonical, av as getToolbarStyleState, aw as STANDARD_FONT_SIZES_PT, ax as fontSizePxToPt, ay as probeLocalFontFamilies, az as createInitialEditorState, aA as parseFontSizePtToPx, aB as formatFontSizePt, aC as listKindForTag, aD as isParagraphTag, aE as collectInlineRuns, aF as parseParagraphStyle, aG as t, aH as preciseFontModeVersion, aI as isPreciseFontModeEnabled, aJ as togglePreciseFontMode, aK as nextFontSizePt, aL as previousFontSizePt, aM as fontSizePtToPx, aN as createDefaultToolbarPreset, aO as defaultMenuItems, aP as MenuRegistry, aQ as createToolbarRegistry, aR as Editor, aS as resolveCommandRef, aT as commandRefName, aU as InlineShell, aV as BalloonShell, aW as DocumentShell, aX as createMemo, aY as getCaretRectFromSnapshot, aZ as getParagraphRectFromSnapshot, a_ as createComponent, a$ as CaretOverlay, b0 as Show, b1 as createRenderEffect, b2 as style, b3 as setAttribute, b4 as setStyleProperty, b5 as memo, b6 as template, b7 as insert, b8 as use, b9 as addEventListener, ba as Dialog, bb as delegateEvents, bc as className, bd as For, be as UNDERLINE_STYLE_OPTIONS, bf as Tabs, bg as measureParagraphMinContentWidthPx, bh as getEditableBlocksForZone, bi as findParagraphLocation, bj as createSectionBoundaryParagraph, bk as normalizePageSettings, bl as DEFAULT_EDITOR_PAGE_SETTINGS, bm as markStart, bn as markEnd, bo as getParagraphEntries, bp as getParagraphById, bq as PluginUiHost, br as OasisEditorEditor, bs as perfTimer, bt as OasisBrandMark, bu as setPreciseFontPreference, bv as setWelcomeSeen, bw as enablePreciseFontMode, bx as createOasisEditorClient, by as setLocale, bz as startLongTaskObserver, bA as installGlobalReport, bB as applyStoredPreciseFontPreference, bC as getWelcomeSeen, bD as isLocalFontAccessSupported, bE as EDITOR_SCROLL_PADDING_PX, bF as Toolbar, bG as OasisEditorLoading, bH as createEditorLogger, bI as getCachedCanvasImage, bJ as registerDomStatsSurface } from "./index-WKT6eKMj.js";
4
+ import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTable, w as createEditorTableRow, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as textStyleToFontSizePt, a6 as PX_PER_POINT, a7 as DEFAULT_FONT_SIZE_PX, a8 as isDoubleUnderlineStyle, a9 as isWavyUnderlineStyle, aa as underlineStyleLineWidthPx, ab as underlineStyleDashArray, ac as getListLabelInset, ad as getParagraphBorderInsets, ae as normalizeFamily, af as ROBOTO_FONT_FILES, ag as loadFontAsset, ah as OFFICE_COMPAT_FONT_FAMILIES, ai as buildSfnt, aj as defaultFontDecoderRegistry, ak as SfntFontProgram, al as collectPdfFontFamilies, am as projectDocumentLayout, an as getPageHeaderZoneTop, ao as getPageBodyTop, ap as getPageColumnRects, aq as findFootnoteReference, ar as FOOTNOTE_MARKER_GUTTER_PX, as as resolveImporterForFile, at as createEditorStateFromDocument, au as getDocumentParagraphsCanonical, av as getToolbarStyleState, aw as STANDARD_FONT_SIZES_PT, ax as fontSizePxToPt, ay as probeLocalFontFamilies, az as createInitialEditorState, aA as parseFontSizePtToPx, aB as formatFontSizePt, aC as listKindForTag, aD as isParagraphTag, aE as collectInlineRuns, aF as parseParagraphStyle, aG as t, aH as preciseFontModeVersion, aI as isPreciseFontModeEnabled, aJ as togglePreciseFontMode, aK as nextFontSizePt, aL as previousFontSizePt, aM as fontSizePtToPx, aN as createDefaultToolbarPreset, aO as defaultMenuItems, aP as MenuRegistry, aQ as createToolbarRegistry, aR as Editor, aS as resolveCommandRef, aT as commandRefName, aU as InlineShell, aV as BalloonShell, aW as DocumentShell, aX as createMemo, aY as getCaretRectFromSnapshot, aZ as getParagraphRectFromSnapshot, a_ as createComponent, a$ as CaretOverlay, b0 as Show, b1 as createRenderEffect, b2 as style, b3 as setAttribute, b4 as setStyleProperty, b5 as memo, b6 as template, b7 as insert, b8 as use, b9 as addEventListener, ba as Dialog, bb as delegateEvents, bc as className, bd as For, be as UNDERLINE_STYLE_OPTIONS, bf as Tabs, bg as measureParagraphMinContentWidthPx, bh as getEditableBlocksForZone, bi as findParagraphLocation, bj as createSectionBoundaryParagraph, bk as normalizePageSettings, bl as DEFAULT_EDITOR_PAGE_SETTINGS, bm as markStart, bn as markEnd, bo as getParagraphEntries, bp as getParagraphById, bq as PluginUiHost, br as OasisEditorEditor, bs as perfTimer, bt as OasisBrandMark, bu as setPreciseFontPreference, bv as setWelcomeSeen, bw as enablePreciseFontMode, bx as createOasisEditorClient, by as setLocale, bz as createEditorZoom, bA as startLongTaskObserver, bB as installGlobalReport, bC as applyStoredPreciseFontPreference, bD as getWelcomeSeen, bE as isLocalFontAccessSupported, bF as EDITOR_SCROLL_PADDING_PX, bG as Toolbar, bH as OasisEditorLoading, bI as createEditorLogger, bJ as getCachedCanvasImage, bK as registerDomStatsSurface } from "./index-nYpJ3a_R.js";
5
5
  function getSelectedObjectRun(state, predicate) {
6
6
  const normalized = normalizeSelection(state);
7
7
  if (normalized.isCollapsed || normalized.startIndex !== normalized.endIndex || normalized.endParagraphOffset - normalized.startParagraphOffset !== 1) {
@@ -5488,6 +5488,7 @@ function useEditorLayout(props) {
5488
5488
  );
5489
5489
  let syncRequestId = 0;
5490
5490
  const syncInputBox = (_reason = "selection") => {
5491
+ var _a;
5491
5492
  const surface = props.surfaceRef();
5492
5493
  if (!surface) {
5493
5494
  setSelectionBoxes([]);
@@ -5501,7 +5502,8 @@ function useEditorLayout(props) {
5501
5502
  surface,
5502
5503
  state: props.state,
5503
5504
  measuredBlockHeights: measuredBlockHeights(),
5504
- measuredParagraphLayouts: measuredParagraphLayouts()
5505
+ measuredParagraphLayouts: measuredParagraphLayouts(),
5506
+ zoomFactor: (_a = props.zoomFactor) == null ? void 0 : _a.call(props)
5505
5507
  });
5506
5508
  if (!snapshot) {
5507
5509
  setSelectionBoxes([]);
@@ -7253,12 +7255,14 @@ function createResizeSession(adapter, deps) {
7253
7255
  }
7254
7256
  });
7255
7257
  const handleMouseMove = (event) => {
7258
+ var _a;
7256
7259
  const resize = active;
7257
7260
  if (!resize) {
7258
7261
  return;
7259
7262
  }
7260
- const deltaX = event.clientX - resize.startClientX;
7261
- const deltaY = event.clientY - resize.startClientY;
7263
+ const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
7264
+ const deltaX = (event.clientX - resize.startClientX) / z;
7265
+ const deltaY = (event.clientY - resize.startClientY) / z;
7262
7266
  const maxWidth = adapter.getMaxWidth(deps.state, resize.paragraphId);
7263
7267
  const { width, height } = resolveResizedDimensions(
7264
7268
  resize,
@@ -7502,7 +7506,8 @@ function createEditorImageOperations(deps) {
7502
7506
  updateHistoryState: deps.updateHistoryState,
7503
7507
  cloneState: deps.cloneState,
7504
7508
  focusInput: deps.focusInput,
7505
- logger: deps.logger
7509
+ logger: deps.logger,
7510
+ zoomFactor: deps.zoomFactor
7506
7511
  }
7507
7512
  );
7508
7513
  const imageRotateSession = createRotateSession(
@@ -7703,7 +7708,8 @@ function createEditorTextBoxOperations(deps) {
7703
7708
  updateHistoryState: deps.updateHistoryState,
7704
7709
  cloneState: deps.cloneState,
7705
7710
  focusInput: deps.focusInput,
7706
- logger: deps.logger
7711
+ logger: deps.logger,
7712
+ zoomFactor: deps.zoomFactor
7707
7713
  }
7708
7714
  );
7709
7715
  const rotateSession = createRotateSession(
@@ -39179,7 +39185,8 @@ function cloneLayoutSnapshot(snapshot) {
39179
39185
  top: paragraph.tableCell.top,
39180
39186
  width: paragraph.tableCell.width,
39181
39187
  height: paragraph.tableCell.height
39182
- } : void 0
39188
+ } : void 0,
39189
+ verticalMode: paragraph.verticalMode
39183
39190
  })),
39184
39191
  inlineImages: snapshot.inlineImages.map((image) => ({
39185
39192
  paragraphId: image.paragraphId,
@@ -39193,6 +39200,21 @@ function cloneLayoutSnapshot(snapshot) {
39193
39200
  width: image.width,
39194
39201
  height: image.height
39195
39202
  })),
39203
+ inlineTextBoxes: snapshot.inlineTextBoxes.map(
39204
+ (box) => ({
39205
+ paragraphId: box.paragraphId,
39206
+ paragraphIndex: box.paragraphIndex,
39207
+ zone: box.zone,
39208
+ pageIndex: box.pageIndex,
39209
+ startOffset: box.startOffset,
39210
+ endOffset: box.endOffset,
39211
+ left: box.left,
39212
+ top: box.top,
39213
+ width: box.width,
39214
+ height: box.height,
39215
+ rotation: box.rotation
39216
+ })
39217
+ ),
39196
39218
  unsupportedRegions: snapshot.unsupportedRegions.map((region) => ({
39197
39219
  ...region
39198
39220
  }))
@@ -39222,6 +39244,9 @@ function buildApi() {
39222
39244
  inlineImages: lastLayoutSnapshot.inlineImages.map((image) => ({
39223
39245
  ...image
39224
39246
  })),
39247
+ inlineTextBoxes: lastLayoutSnapshot.inlineTextBoxes.map((box) => ({
39248
+ ...box
39249
+ })),
39225
39250
  unsupportedRegions: lastLayoutSnapshot.unsupportedRegions.map(
39226
39251
  (region) => ({
39227
39252
  ...region
@@ -39822,8 +39847,12 @@ function resolveImageAtPoint(snapshot, pageIndex, zone, clientX, clientY, pierce
39822
39847
  }
39823
39848
  function resolveCanvasSurfaceHitAtPoint(options) {
39824
39849
  var _a, _b, _c;
39825
- const { snapshot, state, clientX, clientY } = options;
39850
+ const { snapshot, state } = options;
39826
39851
  const pierce = options.pierce ?? false;
39852
+ const zoomFactor = options.zoomFactor && options.zoomFactor > 0 ? options.zoomFactor : 1;
39853
+ const surfaceRect = snapshot.surfaceRect;
39854
+ const clientX = surfaceRect.left + (options.clientX - surfaceRect.left) / zoomFactor;
39855
+ const clientY = surfaceRect.top + (options.clientY - surfaceRect.top) / zoomFactor;
39827
39856
  const page = resolveNearestPage(snapshot.pages, clientX, clientY);
39828
39857
  if (!page) {
39829
39858
  return null;
@@ -39982,12 +40011,14 @@ function createCanvasSurfaceHitResolver(deps) {
39982
40011
  const viewportScrollLeft = (currentViewportRef == null ? void 0 : currentViewportRef.scrollLeft) ?? 0;
39983
40012
  const windowWidth = window.innerWidth;
39984
40013
  const windowHeight = window.innerHeight;
39985
- const shouldReuseSnapshot = canvasSnapshotCache && canvasSnapshotCache.documentRef === currentState.document && canvasSnapshotCache.measuredBlockHeightsRef === currentMeasuredBlockHeights && canvasSnapshotCache.measuredParagraphLayoutsRef === currentMeasuredParagraphLayouts && canvasSnapshotCache.surfaceRef === currentSurfaceRef && canvasSnapshotCache.viewportScrollTop === viewportScrollTop && canvasSnapshotCache.viewportScrollLeft === viewportScrollLeft && canvasSnapshotCache.surfaceClientWidth === currentSurfaceRef.clientWidth && canvasSnapshotCache.surfaceClientHeight === currentSurfaceRef.clientHeight && canvasSnapshotCache.windowWidth === windowWidth && canvasSnapshotCache.windowHeight === windowHeight;
40014
+ const zoomFactor = deps.zoomFactor();
40015
+ const shouldReuseSnapshot = canvasSnapshotCache && canvasSnapshotCache.documentRef === currentState.document && canvasSnapshotCache.measuredBlockHeightsRef === currentMeasuredBlockHeights && canvasSnapshotCache.measuredParagraphLayoutsRef === currentMeasuredParagraphLayouts && canvasSnapshotCache.surfaceRef === currentSurfaceRef && canvasSnapshotCache.viewportScrollTop === viewportScrollTop && canvasSnapshotCache.viewportScrollLeft === viewportScrollLeft && canvasSnapshotCache.surfaceClientWidth === currentSurfaceRef.clientWidth && canvasSnapshotCache.surfaceClientHeight === currentSurfaceRef.clientHeight && canvasSnapshotCache.windowWidth === windowWidth && canvasSnapshotCache.windowHeight === windowHeight && canvasSnapshotCache.zoomFactor === zoomFactor;
39986
40016
  const snapshot = shouldReuseSnapshot ? canvasSnapshotCache.snapshot : buildCanvasLayoutSnapshot({
39987
40017
  surface: currentSurfaceRef,
39988
40018
  state: currentState,
39989
40019
  measuredBlockHeights: currentMeasuredBlockHeights,
39990
- measuredParagraphLayouts: currentMeasuredParagraphLayouts
40020
+ measuredParagraphLayouts: currentMeasuredParagraphLayouts,
40021
+ zoomFactor
39991
40022
  });
39992
40023
  if (!shouldReuseSnapshot) {
39993
40024
  canvasSnapshotCache = {
@@ -40001,7 +40032,8 @@ function createCanvasSurfaceHitResolver(deps) {
40001
40032
  surfaceClientWidth: currentSurfaceRef.clientWidth,
40002
40033
  surfaceClientHeight: currentSurfaceRef.clientHeight,
40003
40034
  windowWidth,
40004
- windowHeight
40035
+ windowHeight,
40036
+ zoomFactor
40005
40037
  };
40006
40038
  }
40007
40039
  recordCanvasDebugLayoutSnapshot(snapshot);
@@ -40014,7 +40046,8 @@ function createCanvasSurfaceHitResolver(deps) {
40014
40046
  state: currentState,
40015
40047
  clientX,
40016
40048
  clientY,
40017
- pierce: context.pierce ?? false
40049
+ pierce: context.pierce ?? false,
40050
+ zoomFactor
40018
40051
  });
40019
40052
  recordCanvasDebugHit(hit);
40020
40053
  return hit;
@@ -44762,9 +44795,11 @@ function createEditorTableResize(deps) {
44762
44795
  setActiveCursorClass(currentResizing.type === "column");
44763
44796
  };
44764
44797
  const handleWindowMouseUp = (event) => {
44798
+ var _a;
44765
44799
  const currentResizing = resizing();
44766
44800
  if (!currentResizing) return;
44767
- const delta = (currentResizing.type === "column" ? event.clientX : event.clientY) - currentResizing.initialPos;
44801
+ const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
44802
+ const delta = ((currentResizing.type === "column" ? event.clientX : event.clientY) - currentResizing.initialPos) / z;
44768
44803
  if (Math.abs(delta) >= DRAG_THRESHOLD_PX) {
44769
44804
  deps.applyTransactionalState((current) => {
44770
44805
  if (currentResizing.type === "row") {
@@ -45736,7 +45771,7 @@ function createEditorNavigation(deps) {
45736
45771
  return moveVerticalSelection(direction, false);
45737
45772
  };
45738
45773
  const moveVerticalSelection = (direction, extend) => {
45739
- var _a, _b, _c, _d, _e;
45774
+ var _a, _b, _c, _d, _e, _f;
45740
45775
  const state = deps.state();
45741
45776
  const paragraphs = getParagraphs(state);
45742
45777
  const currentIndex = paragraphs.findIndex(
@@ -45751,7 +45786,8 @@ function createEditorNavigation(deps) {
45751
45786
  const desiredX = preferredX === null ? deps.caretBox().left + ((surfaceRect == null ? void 0 : surfaceRect.left) ?? 0) : preferredX;
45752
45787
  const snapshot = surfaceRef ? buildCanvasLayoutSnapshot({
45753
45788
  surface: surfaceRef,
45754
- state
45789
+ state,
45790
+ zoomFactor: (_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)
45755
45791
  }) : null;
45756
45792
  let targetIndex = currentIndex + direction;
45757
45793
  const tableLocation = findParagraphTableLocation(
@@ -45793,7 +45829,7 @@ function createEditorNavigation(deps) {
45793
45829
  const distance = desiredX < left ? left - desiredX : desiredX > right ? desiredX - right : 0;
45794
45830
  return { entry, distance };
45795
45831
  }).sort((left, right) => left.distance - right.distance);
45796
- const candidate = (_a = scoredCandidates[0]) == null ? void 0 : _a.entry;
45832
+ const candidate = (_b = scoredCandidates[0]) == null ? void 0 : _b.entry;
45797
45833
  if (!candidate) {
45798
45834
  continue;
45799
45835
  }
@@ -45803,14 +45839,14 @@ function createEditorNavigation(deps) {
45803
45839
  }
45804
45840
  } else {
45805
45841
  if (direction < 0) {
45806
- const firstParaId = (_d = (_c = (_b = block.rows[0]) == null ? void 0 : _b.cells[0]) == null ? void 0 : _c.blocks[0]) == null ? void 0 : _d.id;
45842
+ const firstParaId = (_e = (_d = (_c = block.rows[0]) == null ? void 0 : _c.cells[0]) == null ? void 0 : _d.blocks[0]) == null ? void 0 : _e.id;
45807
45843
  if (firstParaId) {
45808
45844
  targetIndex = paragraphs.findIndex((p) => p.id === firstParaId) - 1;
45809
45845
  }
45810
45846
  } else {
45811
45847
  const lastRow = block.rows[block.rows.length - 1];
45812
45848
  const lastCell = lastRow == null ? void 0 : lastRow.cells[lastRow.cells.length - 1];
45813
- const lastParaId = (_e = lastCell == null ? void 0 : lastCell.blocks[lastCell.blocks.length - 1]) == null ? void 0 : _e.id;
45849
+ const lastParaId = (_f = lastCell == null ? void 0 : lastCell.blocks[lastCell.blocks.length - 1]) == null ? void 0 : _f.id;
45814
45850
  if (lastParaId) {
45815
45851
  targetIndex = paragraphs.findIndex((p) => p.id === lastParaId) + 1;
45816
45852
  }
@@ -45860,7 +45896,7 @@ function createEditorNavigation(deps) {
45860
45896
  function createEditorRevisionController(deps) {
45861
45897
  const [hoveredRevision, setHoveredRevision] = createSignal(null);
45862
45898
  const handleRevisionMouseEnter = (revisionId, event) => {
45863
- var _a, _b;
45899
+ var _a, _b, _c;
45864
45900
  const paragraphs = getParagraphs(deps.state());
45865
45901
  let foundRevision;
45866
45902
  for (const p of paragraphs) {
@@ -45876,13 +45912,14 @@ function createEditorRevisionController(deps) {
45876
45912
  const rect = event.currentTarget.getBoundingClientRect();
45877
45913
  const surfaceRect = (_b = deps.surfaceRef()) == null ? void 0 : _b.getBoundingClientRect();
45878
45914
  if (!surfaceRect) return;
45915
+ const z = ((_c = deps.zoomFactor) == null ? void 0 : _c.call(deps)) ?? 1;
45879
45916
  setHoveredRevision({
45880
45917
  revisionId: foundRevision.id,
45881
45918
  author: foundRevision.author,
45882
45919
  date: foundRevision.date,
45883
45920
  type: foundRevision.type,
45884
- left: rect.left - surfaceRect.left,
45885
- top: rect.top - surfaceRect.top
45921
+ left: (rect.left - surfaceRect.left) / z,
45922
+ top: (rect.top - surfaceRect.top) / z
45886
45923
  });
45887
45924
  };
45888
45925
  const handleRevisionMouseLeave = () => {
@@ -45900,7 +45937,8 @@ function useEditorInteractionWiring(ctx) {
45900
45937
  state,
45901
45938
  applyTransactionalState: ctx.applyTransactionalState,
45902
45939
  surfaceRef: ctx.surfaceRef,
45903
- viewportRef: ctx.viewportRef
45940
+ viewportRef: ctx.viewportRef,
45941
+ zoomFactor: ctx.zoomFactor
45904
45942
  });
45905
45943
  const tableDrag = createEditorTableDrag({
45906
45944
  state,
@@ -45910,7 +45948,8 @@ function useEditorInteractionWiring(ctx) {
45910
45948
  });
45911
45949
  const revisionController = createEditorRevisionController({
45912
45950
  state,
45913
- surfaceRef: () => ctx.surfaceRef() ?? null
45951
+ surfaceRef: () => ctx.surfaceRef() ?? null,
45952
+ zoomFactor: ctx.zoomFactor
45914
45953
  });
45915
45954
  const textDrag = createEditorTextDrag({
45916
45955
  state,
@@ -45959,7 +45998,8 @@ function useEditorInteractionWiring(ctx) {
45959
45998
  setPreferredColumnX: ctx.setPreferredColumnX,
45960
45999
  clearPreferredColumn: ctx.clearPreferredColumn,
45961
46000
  resetTransactionGrouping: ctx.resetTransactionGrouping,
45962
- focusInput: ctx.focusInput
46001
+ focusInput: ctx.focusInput,
46002
+ zoomFactor: ctx.zoomFactor
45963
46003
  });
45964
46004
  const { handleCopy, handleCut, handlePaste, handleDrop } = createEditorClipboardController({
45965
46005
  state,
@@ -45992,7 +46032,10 @@ function buildEditorViewProps(ctx) {
45992
46032
  const layout = {
45993
46033
  viewportHeight: ctx.viewportHeight,
45994
46034
  class: ctx.className,
45995
- style: ctx.style
46035
+ style: ctx.style,
46036
+ zoomPercent: ctx.zoomPercent,
46037
+ setZoomPercent: ctx.setZoomPercent,
46038
+ zoomFactor: ctx.zoomFactor
45996
46039
  };
45997
46040
  const overlays = {
45998
46041
  selectionBoxes: ctx.selectionBoxes,
@@ -46397,6 +46440,7 @@ function OasisEditorApp(props = {}) {
46397
46440
  const focusInput = focusController.focusInput;
46398
46441
  const focusInputAfterPointerSelection = focusController.focusInputAfterPointerSelection;
46399
46442
  const [initialLoading, setInitialLoading] = createSignal(ui().loading !== false);
46443
+ const zoom = createEditorZoom();
46400
46444
  const {
46401
46445
  linkDialog,
46402
46446
  setLinkDialog,
@@ -46456,7 +46500,8 @@ function OasisEditorApp(props = {}) {
46456
46500
  state,
46457
46501
  surfaceRef,
46458
46502
  viewportRef,
46459
- isImporting: isImportInProgress
46503
+ isImporting: isImportInProgress,
46504
+ zoomFactor: zoom.zoomFactor
46460
46505
  });
46461
46506
  const {
46462
46507
  status: persistenceStatus
@@ -46579,7 +46624,8 @@ function OasisEditorApp(props = {}) {
46579
46624
  surfaceRef: () => surfaceRef() ?? null,
46580
46625
  viewportRef: () => viewportRef() ?? null,
46581
46626
  measuredBlockHeights,
46582
- measuredParagraphLayouts
46627
+ measuredParagraphLayouts,
46628
+ zoomFactor: zoom.zoomFactor
46583
46629
  });
46584
46630
  const resolveSurfaceHitAtPoint = canvasHitResolver.resolveSurfaceHitAtPoint;
46585
46631
  const fr = useEditorFindReplace({
@@ -46618,7 +46664,8 @@ function OasisEditorApp(props = {}) {
46618
46664
  focusInput,
46619
46665
  focusInputAfterPointerSelection,
46620
46666
  cloneState,
46621
- logger
46667
+ logger,
46668
+ zoomFactor: zoom.zoomFactor
46622
46669
  });
46623
46670
  const textBoxOps = createEditorTextBoxOperations({
46624
46671
  state,
@@ -46627,7 +46674,8 @@ function OasisEditorApp(props = {}) {
46627
46674
  updateHistoryState,
46628
46675
  focusInput,
46629
46676
  cloneState,
46630
- logger
46677
+ logger,
46678
+ zoomFactor: zoom.zoomFactor
46631
46679
  });
46632
46680
  const styleController = createEditorStyleController({
46633
46681
  state: () => state,
@@ -46664,6 +46712,7 @@ function OasisEditorApp(props = {}) {
46664
46712
  caretBox: () => caretBox(),
46665
46713
  preferredColumnX: () => preferredColumnX(),
46666
46714
  setPreferredColumnX,
46715
+ zoomFactor: zoom.zoomFactor,
46667
46716
  resolveSurfaceHitAtPoint,
46668
46717
  resolvePositionAtSurfacePoint,
46669
46718
  tableOps,
@@ -46960,6 +47009,9 @@ function OasisEditorApp(props = {}) {
46960
47009
  viewportHeight: ui().viewportHeight,
46961
47010
  className: ui().class,
46962
47011
  style: ui().style,
47012
+ zoomPercent: zoom.zoomPercent,
47013
+ setZoomPercent: zoom.setZoomPercent,
47014
+ zoomFactor: zoom.zoomFactor,
46963
47015
  selectionBoxes,
46964
47016
  commentHighlights,
46965
47017
  selectedImageBox,
@@ -29,6 +29,8 @@ export interface ResizeSessionDeps {
29
29
  cloneState: (source: EditorState) => EditorState;
30
30
  focusInput: () => void;
31
31
  logger: EditorLogger;
32
+ /** Visual zoom factor `z`; pointer deltas (screen px) are divided by it. */
33
+ zoomFactor?: () => number;
32
34
  }
33
35
  /**
34
36
  * Drives a handle-based resize: it tracks the pointer, resolves the next size
@@ -31,6 +31,8 @@ export interface EditorImageOperationsDeps {
31
31
  focusInputAfterPointerSelection: () => void;
32
32
  cloneState: (source: EditorState) => EditorState;
33
33
  logger: EditorLogger;
34
+ /** Visual zoom factor `z`; resize pointer deltas are divided by it. */
35
+ zoomFactor?: () => number;
34
36
  }
35
37
  export declare function createEditorImageOperations(deps: EditorImageOperationsDeps): {
36
38
  dragging: import('solid-js').Accessor<boolean>;
@@ -7,6 +7,8 @@ interface UseEditorLayoutProps {
7
7
  surfaceRef: () => HTMLDivElement | undefined;
8
8
  viewportRef: () => HTMLDivElement | undefined;
9
9
  isImporting?: () => boolean;
10
+ /** Current visual zoom factor; the snapshot stays zoom-invariant. */
11
+ zoomFactor?: () => number;
10
12
  }
11
13
  type LayoutSyncReason = "selection" | "scroll" | "content-change" | "resize" | "import";
12
14
  export interface LayoutInvalidation {
@@ -12,6 +12,12 @@ export interface UseEditorNavigationProps {
12
12
  clearPreferredColumn: () => void;
13
13
  resetTransactionGrouping: () => void;
14
14
  focusInput: () => void;
15
+ /**
16
+ * Current visual zoom factor. `desiredX` and the snapshot slots both live in
17
+ * "screen-anchored local" space, so the comparison stays correct once the
18
+ * snapshot is built zoom-aware.
19
+ */
20
+ zoomFactor?: () => number;
15
21
  }
16
22
  export declare function createEditorNavigation(deps: UseEditorNavigationProps): {
17
23
  moveSelectionToParagraphBoundary: (boundary: "start" | "end", extend: boolean) => boolean;
@@ -4,6 +4,8 @@ import { RevisionBox } from '../../ui/editorUiTypes.js';
4
4
  export interface UseEditorRevisionProps {
5
5
  state: () => EditorState;
6
6
  surfaceRef: () => HTMLDivElement | null;
7
+ /** Visual zoom factor `z`; screen-px offsets are divided by it for px-local. */
8
+ zoomFactor?: () => number;
7
9
  }
8
10
  export declare function createEditorRevisionController(deps: UseEditorRevisionProps): {
9
11
  hoveredRevision: import('solid-js').Accessor<RevisionBox | null>;
@@ -7,4 +7,6 @@ export declare function createEditorTableResize(deps: {
7
7
  applyTransactionalState: (producer: (current: EditorState) => EditorState) => void;
8
8
  surfaceRef: () => HTMLElement | undefined;
9
9
  viewportRef: () => HTMLElement | undefined;
10
+ /** Visual zoom factor `z`; resize pointer deltas are divided by it. */
11
+ zoomFactor?: () => number;
10
12
  }): TableResizeOps;
@@ -11,6 +11,8 @@ export interface EditorTextBoxOperationsDeps {
11
11
  focusInput: () => void;
12
12
  cloneState: (source: EditorState) => EditorState;
13
13
  logger: EditorLogger;
14
+ /** Visual zoom factor `z`; resize pointer deltas are divided by it. */
15
+ zoomFactor?: () => number;
14
16
  }
15
17
  export declare function createEditorTextBoxOperations(deps: EditorTextBoxOperationsDeps): {
16
18
  handleTextBoxResizeHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: ResizeHandleDirection, event: MouseEvent & {