oasis-editor 0.0.24 → 0.0.25
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/{OasisEditorApp-Ckv1Glbw.js → OasisEditorApp-y3iUL8-k.js} +38 -16
- package/dist/app/controllers/useEditorLayout.d.ts +2 -0
- package/dist/app/controllers/useEditorNavigation.d.ts +6 -0
- package/dist/{index-WKT6eKMj.js → index-Df7Ob0Ek.js} +84 -53
- package/dist/oasis-editor.js +43 -43
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/OasisEditorEditor.d.ts +3 -0
- package/dist/ui/app/buildEditorViewProps.d.ts +3 -0
- package/dist/ui/app/editorZoom.d.ts +25 -0
- package/dist/ui/app/useCanvasSurfaceHitResolver.d.ts +1 -0
- package/dist/ui/app/useEditorInteractionWiring.d.ts +1 -0
- package/dist/ui/canvas/CanvasHitTestService.d.ts +6 -0
- package/dist/ui/canvas/CanvasLayoutSnapshot.d.ts +29 -0
- package/package.json +1 -1
|
@@ -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
|
|
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-Df7Ob0Ek.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([]);
|
|
@@ -39822,8 +39824,12 @@ function resolveImageAtPoint(snapshot, pageIndex, zone, clientX, clientY, pierce
|
|
|
39822
39824
|
}
|
|
39823
39825
|
function resolveCanvasSurfaceHitAtPoint(options) {
|
|
39824
39826
|
var _a, _b, _c;
|
|
39825
|
-
const { snapshot, state
|
|
39827
|
+
const { snapshot, state } = options;
|
|
39826
39828
|
const pierce = options.pierce ?? false;
|
|
39829
|
+
const zoomFactor = options.zoomFactor && options.zoomFactor > 0 ? options.zoomFactor : 1;
|
|
39830
|
+
const surfaceRect = snapshot.surfaceRect;
|
|
39831
|
+
const clientX = surfaceRect.left + (options.clientX - surfaceRect.left) / zoomFactor;
|
|
39832
|
+
const clientY = surfaceRect.top + (options.clientY - surfaceRect.top) / zoomFactor;
|
|
39827
39833
|
const page = resolveNearestPage(snapshot.pages, clientX, clientY);
|
|
39828
39834
|
if (!page) {
|
|
39829
39835
|
return null;
|
|
@@ -39982,12 +39988,14 @@ function createCanvasSurfaceHitResolver(deps) {
|
|
|
39982
39988
|
const viewportScrollLeft = (currentViewportRef == null ? void 0 : currentViewportRef.scrollLeft) ?? 0;
|
|
39983
39989
|
const windowWidth = window.innerWidth;
|
|
39984
39990
|
const windowHeight = window.innerHeight;
|
|
39985
|
-
const
|
|
39991
|
+
const zoomFactor = deps.zoomFactor();
|
|
39992
|
+
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
39993
|
const snapshot = shouldReuseSnapshot ? canvasSnapshotCache.snapshot : buildCanvasLayoutSnapshot({
|
|
39987
39994
|
surface: currentSurfaceRef,
|
|
39988
39995
|
state: currentState,
|
|
39989
39996
|
measuredBlockHeights: currentMeasuredBlockHeights,
|
|
39990
|
-
measuredParagraphLayouts: currentMeasuredParagraphLayouts
|
|
39997
|
+
measuredParagraphLayouts: currentMeasuredParagraphLayouts,
|
|
39998
|
+
zoomFactor
|
|
39991
39999
|
});
|
|
39992
40000
|
if (!shouldReuseSnapshot) {
|
|
39993
40001
|
canvasSnapshotCache = {
|
|
@@ -40001,7 +40009,8 @@ function createCanvasSurfaceHitResolver(deps) {
|
|
|
40001
40009
|
surfaceClientWidth: currentSurfaceRef.clientWidth,
|
|
40002
40010
|
surfaceClientHeight: currentSurfaceRef.clientHeight,
|
|
40003
40011
|
windowWidth,
|
|
40004
|
-
windowHeight
|
|
40012
|
+
windowHeight,
|
|
40013
|
+
zoomFactor
|
|
40005
40014
|
};
|
|
40006
40015
|
}
|
|
40007
40016
|
recordCanvasDebugLayoutSnapshot(snapshot);
|
|
@@ -40014,7 +40023,8 @@ function createCanvasSurfaceHitResolver(deps) {
|
|
|
40014
40023
|
state: currentState,
|
|
40015
40024
|
clientX,
|
|
40016
40025
|
clientY,
|
|
40017
|
-
pierce: context.pierce ?? false
|
|
40026
|
+
pierce: context.pierce ?? false,
|
|
40027
|
+
zoomFactor
|
|
40018
40028
|
});
|
|
40019
40029
|
recordCanvasDebugHit(hit);
|
|
40020
40030
|
return hit;
|
|
@@ -45736,7 +45746,7 @@ function createEditorNavigation(deps) {
|
|
|
45736
45746
|
return moveVerticalSelection(direction, false);
|
|
45737
45747
|
};
|
|
45738
45748
|
const moveVerticalSelection = (direction, extend) => {
|
|
45739
|
-
var _a, _b, _c, _d, _e;
|
|
45749
|
+
var _a, _b, _c, _d, _e, _f;
|
|
45740
45750
|
const state = deps.state();
|
|
45741
45751
|
const paragraphs = getParagraphs(state);
|
|
45742
45752
|
const currentIndex = paragraphs.findIndex(
|
|
@@ -45751,7 +45761,8 @@ function createEditorNavigation(deps) {
|
|
|
45751
45761
|
const desiredX = preferredX === null ? deps.caretBox().left + ((surfaceRect == null ? void 0 : surfaceRect.left) ?? 0) : preferredX;
|
|
45752
45762
|
const snapshot = surfaceRef ? buildCanvasLayoutSnapshot({
|
|
45753
45763
|
surface: surfaceRef,
|
|
45754
|
-
state
|
|
45764
|
+
state,
|
|
45765
|
+
zoomFactor: (_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)
|
|
45755
45766
|
}) : null;
|
|
45756
45767
|
let targetIndex = currentIndex + direction;
|
|
45757
45768
|
const tableLocation = findParagraphTableLocation(
|
|
@@ -45793,7 +45804,7 @@ function createEditorNavigation(deps) {
|
|
|
45793
45804
|
const distance = desiredX < left ? left - desiredX : desiredX > right ? desiredX - right : 0;
|
|
45794
45805
|
return { entry, distance };
|
|
45795
45806
|
}).sort((left, right) => left.distance - right.distance);
|
|
45796
|
-
const candidate = (
|
|
45807
|
+
const candidate = (_b = scoredCandidates[0]) == null ? void 0 : _b.entry;
|
|
45797
45808
|
if (!candidate) {
|
|
45798
45809
|
continue;
|
|
45799
45810
|
}
|
|
@@ -45803,14 +45814,14 @@ function createEditorNavigation(deps) {
|
|
|
45803
45814
|
}
|
|
45804
45815
|
} else {
|
|
45805
45816
|
if (direction < 0) {
|
|
45806
|
-
const firstParaId = (
|
|
45817
|
+
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
45818
|
if (firstParaId) {
|
|
45808
45819
|
targetIndex = paragraphs.findIndex((p) => p.id === firstParaId) - 1;
|
|
45809
45820
|
}
|
|
45810
45821
|
} else {
|
|
45811
45822
|
const lastRow = block.rows[block.rows.length - 1];
|
|
45812
45823
|
const lastCell = lastRow == null ? void 0 : lastRow.cells[lastRow.cells.length - 1];
|
|
45813
|
-
const lastParaId = (
|
|
45824
|
+
const lastParaId = (_f = lastCell == null ? void 0 : lastCell.blocks[lastCell.blocks.length - 1]) == null ? void 0 : _f.id;
|
|
45814
45825
|
if (lastParaId) {
|
|
45815
45826
|
targetIndex = paragraphs.findIndex((p) => p.id === lastParaId) + 1;
|
|
45816
45827
|
}
|
|
@@ -45959,7 +45970,8 @@ function useEditorInteractionWiring(ctx) {
|
|
|
45959
45970
|
setPreferredColumnX: ctx.setPreferredColumnX,
|
|
45960
45971
|
clearPreferredColumn: ctx.clearPreferredColumn,
|
|
45961
45972
|
resetTransactionGrouping: ctx.resetTransactionGrouping,
|
|
45962
|
-
focusInput: ctx.focusInput
|
|
45973
|
+
focusInput: ctx.focusInput,
|
|
45974
|
+
zoomFactor: ctx.zoomFactor
|
|
45963
45975
|
});
|
|
45964
45976
|
const { handleCopy, handleCut, handlePaste, handleDrop } = createEditorClipboardController({
|
|
45965
45977
|
state,
|
|
@@ -45992,7 +46004,10 @@ function buildEditorViewProps(ctx) {
|
|
|
45992
46004
|
const layout = {
|
|
45993
46005
|
viewportHeight: ctx.viewportHeight,
|
|
45994
46006
|
class: ctx.className,
|
|
45995
|
-
style: ctx.style
|
|
46007
|
+
style: ctx.style,
|
|
46008
|
+
zoomPercent: ctx.zoomPercent,
|
|
46009
|
+
setZoomPercent: ctx.setZoomPercent,
|
|
46010
|
+
zoomFactor: ctx.zoomFactor
|
|
45996
46011
|
};
|
|
45997
46012
|
const overlays = {
|
|
45998
46013
|
selectionBoxes: ctx.selectionBoxes,
|
|
@@ -46397,6 +46412,7 @@ function OasisEditorApp(props = {}) {
|
|
|
46397
46412
|
const focusInput = focusController.focusInput;
|
|
46398
46413
|
const focusInputAfterPointerSelection = focusController.focusInputAfterPointerSelection;
|
|
46399
46414
|
const [initialLoading, setInitialLoading] = createSignal(ui().loading !== false);
|
|
46415
|
+
const zoom = createEditorZoom();
|
|
46400
46416
|
const {
|
|
46401
46417
|
linkDialog,
|
|
46402
46418
|
setLinkDialog,
|
|
@@ -46456,7 +46472,8 @@ function OasisEditorApp(props = {}) {
|
|
|
46456
46472
|
state,
|
|
46457
46473
|
surfaceRef,
|
|
46458
46474
|
viewportRef,
|
|
46459
|
-
isImporting: isImportInProgress
|
|
46475
|
+
isImporting: isImportInProgress,
|
|
46476
|
+
zoomFactor: zoom.zoomFactor
|
|
46460
46477
|
});
|
|
46461
46478
|
const {
|
|
46462
46479
|
status: persistenceStatus
|
|
@@ -46579,7 +46596,8 @@ function OasisEditorApp(props = {}) {
|
|
|
46579
46596
|
surfaceRef: () => surfaceRef() ?? null,
|
|
46580
46597
|
viewportRef: () => viewportRef() ?? null,
|
|
46581
46598
|
measuredBlockHeights,
|
|
46582
|
-
measuredParagraphLayouts
|
|
46599
|
+
measuredParagraphLayouts,
|
|
46600
|
+
zoomFactor: zoom.zoomFactor
|
|
46583
46601
|
});
|
|
46584
46602
|
const resolveSurfaceHitAtPoint = canvasHitResolver.resolveSurfaceHitAtPoint;
|
|
46585
46603
|
const fr = useEditorFindReplace({
|
|
@@ -46664,6 +46682,7 @@ function OasisEditorApp(props = {}) {
|
|
|
46664
46682
|
caretBox: () => caretBox(),
|
|
46665
46683
|
preferredColumnX: () => preferredColumnX(),
|
|
46666
46684
|
setPreferredColumnX,
|
|
46685
|
+
zoomFactor: zoom.zoomFactor,
|
|
46667
46686
|
resolveSurfaceHitAtPoint,
|
|
46668
46687
|
resolvePositionAtSurfacePoint,
|
|
46669
46688
|
tableOps,
|
|
@@ -46960,6 +46979,9 @@ function OasisEditorApp(props = {}) {
|
|
|
46960
46979
|
viewportHeight: ui().viewportHeight,
|
|
46961
46980
|
className: ui().class,
|
|
46962
46981
|
style: ui().style,
|
|
46982
|
+
zoomPercent: zoom.zoomPercent,
|
|
46983
|
+
setZoomPercent: zoom.setZoomPercent,
|
|
46984
|
+
zoomFactor: zoom.zoomFactor,
|
|
46963
46985
|
selectionBoxes,
|
|
46964
46986
|
commentHighlights,
|
|
46965
46987
|
selectedImageBox,
|
|
@@ -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;
|
|
@@ -2438,7 +2438,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2438
2438
|
onCleanup(() => {
|
|
2439
2439
|
cancelled = true;
|
|
2440
2440
|
});
|
|
2441
|
-
import("./OasisEditorApp-
|
|
2441
|
+
import("./OasisEditorApp-y3iUL8-k.js").then((m) => {
|
|
2442
2442
|
cancelled = true;
|
|
2443
2443
|
setProgress(1);
|
|
2444
2444
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -18088,6 +18088,7 @@ function buildVerticalCellSnapshotLines(options) {
|
|
|
18088
18088
|
}
|
|
18089
18089
|
function buildCanvasLayoutSnapshot(options) {
|
|
18090
18090
|
const { surface, state } = options;
|
|
18091
|
+
const zoomFactor = options.zoomFactor && options.zoomFactor > 0 ? options.zoomFactor : 1;
|
|
18091
18092
|
const documentLayout = projectDocumentLayout(
|
|
18092
18093
|
state.document,
|
|
18093
18094
|
void 0,
|
|
@@ -18117,7 +18118,13 @@ function buildCanvasLayoutSnapshot(options) {
|
|
|
18117
18118
|
if (!pageElement) {
|
|
18118
18119
|
continue;
|
|
18119
18120
|
}
|
|
18120
|
-
const
|
|
18121
|
+
const rawPageRect = pageElement.getBoundingClientRect();
|
|
18122
|
+
const pageRect = {
|
|
18123
|
+
left: surfaceRect.left + (rawPageRect.left - surfaceRect.left) / zoomFactor,
|
|
18124
|
+
top: surfaceRect.top + (rawPageRect.top - surfaceRect.top) / zoomFactor,
|
|
18125
|
+
width: rawPageRect.width / zoomFactor,
|
|
18126
|
+
height: rawPageRect.height / zoomFactor
|
|
18127
|
+
};
|
|
18121
18128
|
const bodyTop = page.bodyTop ?? getPageBodyTop(page.pageSettings);
|
|
18122
18129
|
const bodyBottom = page.bodyBottom ?? getPageBodyBottom(page.pageSettings);
|
|
18123
18130
|
const headerTop = page.headerTop ?? getPageHeaderZoneTop(page.pageSettings);
|
|
@@ -36497,14 +36504,22 @@ function ResizeHandlesOverlay(props) {
|
|
|
36497
36504
|
})();
|
|
36498
36505
|
}
|
|
36499
36506
|
delegateEvents(["mousedown"]);
|
|
36500
|
-
var _tmpl$$m = /* @__PURE__ */ template(`<div data-testid=editor-editor-shell><div class=oasis-editor-editor data-testid=editor-editor><div class=oasis-editor-editor-zoom-sizer><div class=oasis-editor-editor-scroll-content data-testid=editor-editor-scroll-content style="position:absolute;top:0px;transform-origin:top left"><textarea aria-label="Editor input"autocomplete=off autocapitalize=off class=oasis-editor-input data-testid=editor-input value style=pointer-events:none></textarea><input data-testid=editor-import-docx-input type=file style=display:none><input accept="image/png, image/jpeg, image/gif"data-testid=editor-insert-image-input type=file style=display:none></div></div></div><div class=oasis-editor-statusbar data-testid=editor-statusbar><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-word-count></span><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-character-count></span><span class=oasis-editor-statusbar-item></span><div class=oasis-editor-statusbar-zoom data-testid=editor-statusbar-zoom-control><button type=button class=oasis-editor-zoom-button>−</button><input class=oasis-editor-zoom-slider type=range min=50 max=200 step=10><button type=button class=oasis-editor-zoom-button>+</button><span class="oasis-editor-statusbar-item oasis-editor-zoom-value"data-testid=editor-statusbar-zoom>%`), _tmpl$2$g = /* @__PURE__ */ template(`<div class=oasis-editor-import-overlay data-testid=editor-import-overlay role=status aria-live=polite><div class=oasis-editor-import-card><div class=oasis-editor-import-title></div><div class=oasis-editor-import-phase data-testid=editor-import-phase></div><div class=oasis-editor-import-progress-track><div class=oasis-editor-import-progress-bar data-testid=editor-import-progress-bar></div></div><div class=oasis-editor-import-progress-label>`), _tmpl$3$a = /* @__PURE__ */ template(`<span class=oasis-editor-import-done-icon>`), _tmpl$4$8 = /* @__PURE__ */ template(`<span class=oasis-editor-import-error-icon>`), _tmpl$5$7 = /* @__PURE__ */ template(`<span>`);
|
|
36501
36507
|
const ZOOM_MIN = 50;
|
|
36502
36508
|
const ZOOM_MAX = 200;
|
|
36503
36509
|
const ZOOM_STEP = 10;
|
|
36510
|
+
const ZOOM_DEFAULT = 100;
|
|
36504
36511
|
function clampZoom(value) {
|
|
36505
|
-
if (!Number.isFinite(value)) return
|
|
36512
|
+
if (!Number.isFinite(value)) return ZOOM_DEFAULT;
|
|
36506
36513
|
return Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, Math.round(value)));
|
|
36507
36514
|
}
|
|
36515
|
+
function createEditorZoom(initial = ZOOM_DEFAULT) {
|
|
36516
|
+
const [zoomPercent, setZoomPercentRaw] = createSignal(clampZoom(initial));
|
|
36517
|
+
const setZoomPercent = (value) => setZoomPercentRaw(clampZoom(value));
|
|
36518
|
+
const adjustZoom = (delta) => setZoomPercentRaw((current) => clampZoom(current + delta));
|
|
36519
|
+
const zoomFactor = createMemo(() => zoomPercent() / 100);
|
|
36520
|
+
return { zoomPercent, setZoomPercent, adjustZoom, zoomFactor };
|
|
36521
|
+
}
|
|
36522
|
+
var _tmpl$$m = /* @__PURE__ */ template(`<div data-testid=editor-editor-shell><div class=oasis-editor-editor data-testid=editor-editor><div class=oasis-editor-editor-zoom-sizer><div class=oasis-editor-editor-scroll-content data-testid=editor-editor-scroll-content style="position:absolute;top:0px;transform-origin:top left"><textarea aria-label="Editor input"autocomplete=off autocapitalize=off class=oasis-editor-input data-testid=editor-input value style=pointer-events:none></textarea><input data-testid=editor-import-docx-input type=file style=display:none><input accept="image/png, image/jpeg, image/gif"data-testid=editor-insert-image-input type=file style=display:none></div></div></div><div class=oasis-editor-statusbar data-testid=editor-statusbar><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-word-count></span><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-character-count></span><span class=oasis-editor-statusbar-item></span><div class=oasis-editor-statusbar-zoom data-testid=editor-statusbar-zoom-control><button type=button class=oasis-editor-zoom-button>−</button><input class=oasis-editor-zoom-slider type=range><button type=button class=oasis-editor-zoom-button>+</button><span class="oasis-editor-statusbar-item oasis-editor-zoom-value"data-testid=editor-statusbar-zoom>%`), _tmpl$2$g = /* @__PURE__ */ template(`<div class=oasis-editor-import-overlay data-testid=editor-import-overlay role=status aria-live=polite><div class=oasis-editor-import-card><div class=oasis-editor-import-title></div><div class=oasis-editor-import-phase data-testid=editor-import-phase></div><div class=oasis-editor-import-progress-track><div class=oasis-editor-import-progress-bar data-testid=editor-import-progress-bar></div></div><div class=oasis-editor-import-progress-label>`), _tmpl$3$a = /* @__PURE__ */ template(`<span class=oasis-editor-import-done-icon>`), _tmpl$4$8 = /* @__PURE__ */ template(`<span class=oasis-editor-import-error-icon>`), _tmpl$5$7 = /* @__PURE__ */ template(`<span>`);
|
|
36508
36523
|
function OasisEditorEditor(props) {
|
|
36509
36524
|
const layout = () => props.layout ?? {};
|
|
36510
36525
|
const overlays = () => props.overlays;
|
|
@@ -36539,11 +36554,23 @@ function OasisEditorEditor(props) {
|
|
|
36539
36554
|
const documentForStats = createMemo(() => props.state().document);
|
|
36540
36555
|
const characterCount = createMemo(() => getDocumentCharacterCount(documentForStats()));
|
|
36541
36556
|
const wordCount = createMemo(() => getDocumentWordCount(documentForStats()));
|
|
36542
|
-
const [
|
|
36543
|
-
const
|
|
36544
|
-
|
|
36557
|
+
const [localZoomPercent, setLocalZoomPercent] = createSignal(100);
|
|
36558
|
+
const zoomPercent = () => {
|
|
36559
|
+
var _a, _b;
|
|
36560
|
+
return ((_b = (_a = layout()).zoomPercent) == null ? void 0 : _b.call(_a)) ?? localZoomPercent();
|
|
36561
|
+
};
|
|
36562
|
+
const setZoomPercent = (value) => {
|
|
36563
|
+
const clamped = clampZoom(value);
|
|
36564
|
+
const lift = layout().setZoomPercent;
|
|
36565
|
+
if (lift) lift(clamped);
|
|
36566
|
+
else setLocalZoomPercent(clamped);
|
|
36567
|
+
};
|
|
36568
|
+
const adjustZoom = (delta) => setZoomPercent(zoomPercent() + delta);
|
|
36569
|
+
const fallbackZoomFactor = createMemo(() => clampZoom(zoomPercent()) / 100);
|
|
36570
|
+
const zoomFactor = () => {
|
|
36571
|
+
var _a, _b;
|
|
36572
|
+
return ((_b = (_a = layout()).zoomFactor) == null ? void 0 : _b.call(_a)) ?? fallbackZoomFactor();
|
|
36545
36573
|
};
|
|
36546
|
-
const zoomFactor = createMemo(() => clampZoom(zoomPercent()) / 100);
|
|
36547
36574
|
const [measuredContentHeight, setMeasuredContentHeight] = createSignal(0);
|
|
36548
36575
|
const [viewportSize, setViewportSize] = createSignal({
|
|
36549
36576
|
width: 0,
|
|
@@ -36925,6 +36952,9 @@ function OasisEditorEditor(props) {
|
|
|
36925
36952
|
insert(_el$1, () => t("status.page", [currentPage(), totalPages()]));
|
|
36926
36953
|
_el$11.$$click = () => adjustZoom(-ZOOM_STEP);
|
|
36927
36954
|
_el$12.$$input = (event) => setZoomPercent(clampZoom(event.currentTarget.valueAsNumber));
|
|
36955
|
+
setAttribute(_el$12, "min", ZOOM_MIN);
|
|
36956
|
+
setAttribute(_el$12, "max", ZOOM_MAX);
|
|
36957
|
+
setAttribute(_el$12, "step", ZOOM_STEP);
|
|
36928
36958
|
_el$13.$$click = () => adjustZoom(ZOOM_STEP);
|
|
36929
36959
|
insert(_el$14, zoomPercent, _el$15);
|
|
36930
36960
|
insert(_el$8, createComponent(Show, {
|
|
@@ -40150,7 +40180,7 @@ export {
|
|
|
40150
40180
|
probeLocalFontFamilies as ay,
|
|
40151
40181
|
createInitialEditorState as az,
|
|
40152
40182
|
createEditorRun as b,
|
|
40153
|
-
|
|
40183
|
+
Popover as b$,
|
|
40154
40184
|
Show as b0,
|
|
40155
40185
|
createRenderEffect as b1,
|
|
40156
40186
|
style as b2,
|
|
@@ -40161,33 +40191,33 @@ export {
|
|
|
40161
40191
|
insert as b7,
|
|
40162
40192
|
use as b8,
|
|
40163
40193
|
addEventListener as b9,
|
|
40164
|
-
|
|
40165
|
-
|
|
40166
|
-
|
|
40167
|
-
|
|
40168
|
-
|
|
40169
|
-
|
|
40170
|
-
|
|
40171
|
-
|
|
40172
|
-
|
|
40173
|
-
|
|
40174
|
-
|
|
40175
|
-
|
|
40176
|
-
|
|
40177
|
-
|
|
40178
|
-
|
|
40179
|
-
|
|
40180
|
-
|
|
40181
|
-
|
|
40182
|
-
|
|
40183
|
-
|
|
40184
|
-
|
|
40185
|
-
|
|
40186
|
-
|
|
40187
|
-
|
|
40188
|
-
|
|
40189
|
-
|
|
40190
|
-
|
|
40194
|
+
startLongTaskObserver as bA,
|
|
40195
|
+
installGlobalReport as bB,
|
|
40196
|
+
applyStoredPreciseFontPreference as bC,
|
|
40197
|
+
getWelcomeSeen as bD,
|
|
40198
|
+
isLocalFontAccessSupported as bE,
|
|
40199
|
+
EDITOR_SCROLL_PADDING_PX as bF,
|
|
40200
|
+
Toolbar as bG,
|
|
40201
|
+
OasisEditorLoading as bH,
|
|
40202
|
+
createEditorLogger as bI,
|
|
40203
|
+
getCachedCanvasImage as bJ,
|
|
40204
|
+
registerDomStatsSurface as bK,
|
|
40205
|
+
Button as bL,
|
|
40206
|
+
Checkbox as bM,
|
|
40207
|
+
ColorPicker as bN,
|
|
40208
|
+
CommandRegistry as bO,
|
|
40209
|
+
DEFAULT_PALETTE as bP,
|
|
40210
|
+
DialogFooter as bQ,
|
|
40211
|
+
FloatingActionButton as bR,
|
|
40212
|
+
GridPicker as bS,
|
|
40213
|
+
IconButton as bT,
|
|
40214
|
+
Menu as bU,
|
|
40215
|
+
OASIS_BUILTIN_COMMANDS as bV,
|
|
40216
|
+
OASIS_MENU_ITEMS as bW,
|
|
40217
|
+
OASIS_TOOLBAR_ITEMS as bX,
|
|
40218
|
+
OasisEditorAppLazy as bY,
|
|
40219
|
+
OasisEditorContainer as bZ,
|
|
40220
|
+
PluginCollection as b_,
|
|
40191
40221
|
Dialog as ba,
|
|
40192
40222
|
delegateEvents as bb,
|
|
40193
40223
|
className as bc,
|
|
@@ -40213,24 +40243,25 @@ export {
|
|
|
40213
40243
|
enablePreciseFontMode as bw,
|
|
40214
40244
|
createOasisEditorClient as bx,
|
|
40215
40245
|
setLocale as by,
|
|
40216
|
-
|
|
40246
|
+
createEditorZoom as bz,
|
|
40217
40247
|
createEditorParagraphFromRuns as c,
|
|
40218
|
-
|
|
40219
|
-
|
|
40220
|
-
|
|
40221
|
-
|
|
40222
|
-
|
|
40223
|
-
|
|
40224
|
-
|
|
40225
|
-
|
|
40226
|
-
|
|
40227
|
-
|
|
40228
|
-
|
|
40229
|
-
|
|
40230
|
-
|
|
40231
|
-
|
|
40232
|
-
|
|
40233
|
-
|
|
40248
|
+
RIBBON_TABS as c0,
|
|
40249
|
+
RIBBON_TAB_DEFINITIONS as c1,
|
|
40250
|
+
Select as c2,
|
|
40251
|
+
SelectField as c3,
|
|
40252
|
+
Separator as c4,
|
|
40253
|
+
SidePanel as c5,
|
|
40254
|
+
SidePanelBody as c6,
|
|
40255
|
+
SidePanelFooter as c7,
|
|
40256
|
+
SidePanelHeader as c8,
|
|
40257
|
+
SplitButton as c9,
|
|
40258
|
+
TextField as ca,
|
|
40259
|
+
Button$1 as cb,
|
|
40260
|
+
createEditorCommandBus as cc,
|
|
40261
|
+
createOasisEditor as cd,
|
|
40262
|
+
createOasisEditorContainer as ce,
|
|
40263
|
+
mount as cf,
|
|
40264
|
+
registerToolbarRenderer as cg,
|
|
40234
40265
|
getDocumentSections as d,
|
|
40235
40266
|
createEditorStyledRun as e,
|
|
40236
40267
|
getParagraphText as f,
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { aV,
|
|
1
|
+
import { aV, bL, bM, bN, bO, bP, ba, bQ, aW, aR, bR, bS, bT, aU, bU, aP, bV, bW, bX, bY, bZ, bH, b_, b$, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, bf, ca, bG, cb, bN as bN2, bS as bS2, bU as bU2, c2 as c22, c4 as c42, c9 as c92, aT, aN, cc, cd, ce, aQ, cf, cg, aS } from "./index-Df7Ob0Ek.js";
|
|
2
2
|
export {
|
|
3
3
|
aV as BalloonShell,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
bL as Button,
|
|
5
|
+
bM as Checkbox,
|
|
6
|
+
bN as ColorPicker,
|
|
7
|
+
bO as CommandRegistry,
|
|
8
|
+
bP as DEFAULT_PALETTE,
|
|
9
9
|
ba as Dialog,
|
|
10
|
-
|
|
10
|
+
bQ as DialogFooter,
|
|
11
11
|
aW as DocumentShell,
|
|
12
12
|
aR as Editor,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
bR as FloatingActionButton,
|
|
14
|
+
bS as GridPicker,
|
|
15
|
+
bT as IconButton,
|
|
16
16
|
aU as InlineShell,
|
|
17
|
-
|
|
17
|
+
bU as Menu,
|
|
18
18
|
aP as MenuRegistry,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
bV as OASIS_BUILTIN_COMMANDS,
|
|
20
|
+
bW as OASIS_MENU_ITEMS,
|
|
21
|
+
bX as OASIS_TOOLBAR_ITEMS,
|
|
22
|
+
bY as OasisEditorAppLazy,
|
|
23
|
+
bZ as OasisEditorContainer,
|
|
24
|
+
bH as OasisEditorLoading,
|
|
25
|
+
b_ as PluginCollection,
|
|
26
|
+
b$ as Popover,
|
|
27
|
+
c0 as RIBBON_TABS,
|
|
28
|
+
c1 as RIBBON_TAB_DEFINITIONS,
|
|
29
|
+
c2 as Select,
|
|
30
|
+
c3 as SelectField,
|
|
31
|
+
c4 as Separator,
|
|
32
|
+
c5 as SidePanel,
|
|
33
|
+
c6 as SidePanelBody,
|
|
34
|
+
c7 as SidePanelFooter,
|
|
35
|
+
c8 as SidePanelHeader,
|
|
36
|
+
c9 as SplitButton,
|
|
37
37
|
bf as Tabs,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
ca as TextField,
|
|
39
|
+
bG as Toolbar,
|
|
40
|
+
cb as ToolbarButton,
|
|
41
|
+
bN2 as ToolbarColorPicker,
|
|
42
|
+
bS2 as ToolbarGridPicker,
|
|
43
|
+
bU2 as ToolbarMenu,
|
|
44
|
+
c22 as ToolbarSelect,
|
|
45
|
+
c42 as ToolbarSeparator,
|
|
46
|
+
c92 as ToolbarSplitButton,
|
|
47
47
|
aT as commandRefName,
|
|
48
48
|
aN as createDefaultToolbarPreset,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
cc as createEditorCommandBus,
|
|
50
|
+
cd as createOasisEditor,
|
|
51
|
+
ce as createOasisEditorContainer,
|
|
52
52
|
aQ as createToolbarRegistry,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
cf as mount,
|
|
54
|
+
cg as registerToolbarRenderer,
|
|
55
55
|
aS as resolveCommandRef
|
|
56
56
|
};
|