oasis-editor 0.0.25 → 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.
- package/dist/{OasisEditorApp-y3iUL8-k.js → OasisEditorApp-DiKFbvcS.js} +44 -14
- package/dist/app/controllers/createResizeSession.d.ts +2 -0
- package/dist/app/controllers/useEditorImageOperations.d.ts +2 -0
- package/dist/app/controllers/useEditorRevision.d.ts +2 -0
- package/dist/app/controllers/useEditorTableResize.d.ts +2 -0
- package/dist/app/controllers/useEditorTextBoxOperations.d.ts +2 -0
- package/dist/{index-Df7Ob0Ek.js → index-nYpJ3a_R.js} +28 -7
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +3 -3
- package/dist/ui/canvas/CanvasDebug.d.ts +15 -0
- package/dist/ui/components/Ruler/HorizontalRuler.d.ts +7 -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 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-
|
|
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) {
|
|
@@ -7255,12 +7255,14 @@ function createResizeSession(adapter, deps) {
|
|
|
7255
7255
|
}
|
|
7256
7256
|
});
|
|
7257
7257
|
const handleMouseMove = (event) => {
|
|
7258
|
+
var _a;
|
|
7258
7259
|
const resize = active;
|
|
7259
7260
|
if (!resize) {
|
|
7260
7261
|
return;
|
|
7261
7262
|
}
|
|
7262
|
-
const
|
|
7263
|
-
const
|
|
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;
|
|
7264
7266
|
const maxWidth = adapter.getMaxWidth(deps.state, resize.paragraphId);
|
|
7265
7267
|
const { width, height } = resolveResizedDimensions(
|
|
7266
7268
|
resize,
|
|
@@ -7504,7 +7506,8 @@ function createEditorImageOperations(deps) {
|
|
|
7504
7506
|
updateHistoryState: deps.updateHistoryState,
|
|
7505
7507
|
cloneState: deps.cloneState,
|
|
7506
7508
|
focusInput: deps.focusInput,
|
|
7507
|
-
logger: deps.logger
|
|
7509
|
+
logger: deps.logger,
|
|
7510
|
+
zoomFactor: deps.zoomFactor
|
|
7508
7511
|
}
|
|
7509
7512
|
);
|
|
7510
7513
|
const imageRotateSession = createRotateSession(
|
|
@@ -7705,7 +7708,8 @@ function createEditorTextBoxOperations(deps) {
|
|
|
7705
7708
|
updateHistoryState: deps.updateHistoryState,
|
|
7706
7709
|
cloneState: deps.cloneState,
|
|
7707
7710
|
focusInput: deps.focusInput,
|
|
7708
|
-
logger: deps.logger
|
|
7711
|
+
logger: deps.logger,
|
|
7712
|
+
zoomFactor: deps.zoomFactor
|
|
7709
7713
|
}
|
|
7710
7714
|
);
|
|
7711
7715
|
const rotateSession = createRotateSession(
|
|
@@ -39181,7 +39185,8 @@ function cloneLayoutSnapshot(snapshot) {
|
|
|
39181
39185
|
top: paragraph.tableCell.top,
|
|
39182
39186
|
width: paragraph.tableCell.width,
|
|
39183
39187
|
height: paragraph.tableCell.height
|
|
39184
|
-
} : void 0
|
|
39188
|
+
} : void 0,
|
|
39189
|
+
verticalMode: paragraph.verticalMode
|
|
39185
39190
|
})),
|
|
39186
39191
|
inlineImages: snapshot.inlineImages.map((image) => ({
|
|
39187
39192
|
paragraphId: image.paragraphId,
|
|
@@ -39195,6 +39200,21 @@ function cloneLayoutSnapshot(snapshot) {
|
|
|
39195
39200
|
width: image.width,
|
|
39196
39201
|
height: image.height
|
|
39197
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
|
+
),
|
|
39198
39218
|
unsupportedRegions: snapshot.unsupportedRegions.map((region) => ({
|
|
39199
39219
|
...region
|
|
39200
39220
|
}))
|
|
@@ -39224,6 +39244,9 @@ function buildApi() {
|
|
|
39224
39244
|
inlineImages: lastLayoutSnapshot.inlineImages.map((image) => ({
|
|
39225
39245
|
...image
|
|
39226
39246
|
})),
|
|
39247
|
+
inlineTextBoxes: lastLayoutSnapshot.inlineTextBoxes.map((box) => ({
|
|
39248
|
+
...box
|
|
39249
|
+
})),
|
|
39227
39250
|
unsupportedRegions: lastLayoutSnapshot.unsupportedRegions.map(
|
|
39228
39251
|
(region) => ({
|
|
39229
39252
|
...region
|
|
@@ -44772,9 +44795,11 @@ function createEditorTableResize(deps) {
|
|
|
44772
44795
|
setActiveCursorClass(currentResizing.type === "column");
|
|
44773
44796
|
};
|
|
44774
44797
|
const handleWindowMouseUp = (event) => {
|
|
44798
|
+
var _a;
|
|
44775
44799
|
const currentResizing = resizing();
|
|
44776
44800
|
if (!currentResizing) return;
|
|
44777
|
-
const
|
|
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;
|
|
44778
44803
|
if (Math.abs(delta) >= DRAG_THRESHOLD_PX) {
|
|
44779
44804
|
deps.applyTransactionalState((current) => {
|
|
44780
44805
|
if (currentResizing.type === "row") {
|
|
@@ -45871,7 +45896,7 @@ function createEditorNavigation(deps) {
|
|
|
45871
45896
|
function createEditorRevisionController(deps) {
|
|
45872
45897
|
const [hoveredRevision, setHoveredRevision] = createSignal(null);
|
|
45873
45898
|
const handleRevisionMouseEnter = (revisionId, event) => {
|
|
45874
|
-
var _a, _b;
|
|
45899
|
+
var _a, _b, _c;
|
|
45875
45900
|
const paragraphs = getParagraphs(deps.state());
|
|
45876
45901
|
let foundRevision;
|
|
45877
45902
|
for (const p of paragraphs) {
|
|
@@ -45887,13 +45912,14 @@ function createEditorRevisionController(deps) {
|
|
|
45887
45912
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
45888
45913
|
const surfaceRect = (_b = deps.surfaceRef()) == null ? void 0 : _b.getBoundingClientRect();
|
|
45889
45914
|
if (!surfaceRect) return;
|
|
45915
|
+
const z = ((_c = deps.zoomFactor) == null ? void 0 : _c.call(deps)) ?? 1;
|
|
45890
45916
|
setHoveredRevision({
|
|
45891
45917
|
revisionId: foundRevision.id,
|
|
45892
45918
|
author: foundRevision.author,
|
|
45893
45919
|
date: foundRevision.date,
|
|
45894
45920
|
type: foundRevision.type,
|
|
45895
|
-
left: rect.left - surfaceRect.left,
|
|
45896
|
-
top: rect.top - surfaceRect.top
|
|
45921
|
+
left: (rect.left - surfaceRect.left) / z,
|
|
45922
|
+
top: (rect.top - surfaceRect.top) / z
|
|
45897
45923
|
});
|
|
45898
45924
|
};
|
|
45899
45925
|
const handleRevisionMouseLeave = () => {
|
|
@@ -45911,7 +45937,8 @@ function useEditorInteractionWiring(ctx) {
|
|
|
45911
45937
|
state,
|
|
45912
45938
|
applyTransactionalState: ctx.applyTransactionalState,
|
|
45913
45939
|
surfaceRef: ctx.surfaceRef,
|
|
45914
|
-
viewportRef: ctx.viewportRef
|
|
45940
|
+
viewportRef: ctx.viewportRef,
|
|
45941
|
+
zoomFactor: ctx.zoomFactor
|
|
45915
45942
|
});
|
|
45916
45943
|
const tableDrag = createEditorTableDrag({
|
|
45917
45944
|
state,
|
|
@@ -45921,7 +45948,8 @@ function useEditorInteractionWiring(ctx) {
|
|
|
45921
45948
|
});
|
|
45922
45949
|
const revisionController = createEditorRevisionController({
|
|
45923
45950
|
state,
|
|
45924
|
-
surfaceRef: () => ctx.surfaceRef() ?? null
|
|
45951
|
+
surfaceRef: () => ctx.surfaceRef() ?? null,
|
|
45952
|
+
zoomFactor: ctx.zoomFactor
|
|
45925
45953
|
});
|
|
45926
45954
|
const textDrag = createEditorTextDrag({
|
|
45927
45955
|
state,
|
|
@@ -46636,7 +46664,8 @@ function OasisEditorApp(props = {}) {
|
|
|
46636
46664
|
focusInput,
|
|
46637
46665
|
focusInputAfterPointerSelection,
|
|
46638
46666
|
cloneState,
|
|
46639
|
-
logger
|
|
46667
|
+
logger,
|
|
46668
|
+
zoomFactor: zoom.zoomFactor
|
|
46640
46669
|
});
|
|
46641
46670
|
const textBoxOps = createEditorTextBoxOperations({
|
|
46642
46671
|
state,
|
|
@@ -46645,7 +46674,8 @@ function OasisEditorApp(props = {}) {
|
|
|
46645
46674
|
updateHistoryState,
|
|
46646
46675
|
focusInput,
|
|
46647
46676
|
cloneState,
|
|
46648
|
-
logger
|
|
46677
|
+
logger,
|
|
46678
|
+
zoomFactor: zoom.zoomFactor
|
|
46649
46679
|
});
|
|
46650
46680
|
const styleController = createEditorStyleController({
|
|
46651
46681
|
state: () => state,
|
|
@@ -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>;
|
|
@@ -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 & {
|
|
@@ -2438,7 +2438,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2438
2438
|
onCleanup(() => {
|
|
2439
2439
|
cancelled = true;
|
|
2440
2440
|
});
|
|
2441
|
-
import("./OasisEditorApp-
|
|
2441
|
+
import("./OasisEditorApp-DiKFbvcS.js").then((m) => {
|
|
2442
2442
|
cancelled = true;
|
|
2443
2443
|
setProgress(1);
|
|
2444
2444
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -21810,11 +21810,13 @@ function HorizontalRuler(props) {
|
|
|
21810
21810
|
return typeof navigator !== "undefined" && ((_a = navigator.language) == null ? void 0 : _a.toLowerCase().startsWith("en")) ? "in" : "cm";
|
|
21811
21811
|
};
|
|
21812
21812
|
const ticks = createMemo(() => computeRulerTicks(pageSettings().width, baseGeometry().contentLeft, unit()));
|
|
21813
|
-
const
|
|
21813
|
+
const z = () => props.zoomFactor();
|
|
21814
|
+
const sx = (value) => value * z();
|
|
21815
|
+
const trackWidth = createMemo(() => pageLeft() * 2 + sx(pageSettings().width));
|
|
21814
21816
|
const pageXFromClient = (clientX) => {
|
|
21815
21817
|
const rect = pageRef == null ? void 0 : pageRef.getBoundingClientRect();
|
|
21816
21818
|
if (!rect) return 0;
|
|
21817
|
-
return clamp$1(clientX - rect.left, 0, pageSettings().width);
|
|
21819
|
+
return clamp$1((clientX - rect.left) / z(), 0, pageSettings().width);
|
|
21818
21820
|
};
|
|
21819
21821
|
const beginDrag = (type, event) => {
|
|
21820
21822
|
var _a;
|
|
@@ -21921,7 +21923,7 @@ function HorizontalRuler(props) {
|
|
|
21921
21923
|
children: (tick) => [(() => {
|
|
21922
21924
|
var _el$11 = _tmpl$2$l();
|
|
21923
21925
|
createRenderEffect((_p$) => {
|
|
21924
|
-
var _v$27 = `oasis-editor-horizontal-ruler-tick oasis-editor-horizontal-ruler-tick-${tick.kind}`, _v$28 = `${tick.x}px`;
|
|
21926
|
+
var _v$27 = `oasis-editor-horizontal-ruler-tick oasis-editor-horizontal-ruler-tick-${tick.kind}`, _v$28 = `${sx(tick.x)}px`;
|
|
21925
21927
|
_v$27 !== _p$.e && className(_el$11, _p$.e = _v$27);
|
|
21926
21928
|
_v$28 !== _p$.t && setStyleProperty(_el$11, "left", _p$.t = _v$28);
|
|
21927
21929
|
return _p$;
|
|
@@ -21933,7 +21935,7 @@ function HorizontalRuler(props) {
|
|
|
21933
21935
|
})(), memo(() => memo(() => !!tick.label)() && (() => {
|
|
21934
21936
|
var _el$12 = _tmpl$3$e();
|
|
21935
21937
|
insert(_el$12, () => tick.label);
|
|
21936
|
-
createRenderEffect((_$p) => setStyleProperty(_el$12, "left", `${tick.x}px`));
|
|
21938
|
+
createRenderEffect((_$p) => setStyleProperty(_el$12, "left", `${sx(tick.x)}px`));
|
|
21937
21939
|
return _el$12;
|
|
21938
21940
|
})())]
|
|
21939
21941
|
}), _el$7);
|
|
@@ -21944,7 +21946,7 @@ function HorizontalRuler(props) {
|
|
|
21944
21946
|
_el$1.$$pointerdown = (event) => beginDrag("leftIndent", event);
|
|
21945
21947
|
_el$10.$$pointerdown = (event) => beginDrag("rightIndent", event);
|
|
21946
21948
|
createRenderEffect((_p$) => {
|
|
21947
|
-
var _v$ = t("ruler.horizontal"), _v$2 = `${trackWidth()}px`, _v$3 = `translateX(${-scrollLeft()}px)`, _v$4 = `${pageLeft()}px`, _v$5 = `${pageSettings().width}px`, _v$6 = `${geometry().contentLeft}px`, _v$7 = `${geometry().contentRight}px`, _v$8 = `${Math.max(0, pageSettings().width - geometry().contentRight)}px`, _v$9 = `${geometry().contentLeft}px`, _v$0 = `${Math.max(0, geometry().contentRight - geometry().contentLeft)}px`, _v$1 = `${geometry().contentLeft}px`, _v$10 = t("ruler.leftMargin"), _v$11 = t("ruler.leftMargin"), _v$12 = `${geometry().contentRight}px`, _v$13 = t("ruler.rightMargin"), _v$14 = t("ruler.rightMargin"), _v$15 = `${geometry().firstLineX}px`, _v$16 = t("ruler.firstLineIndent"), _v$17 = t("ruler.firstLineIndent"), _v$18 = `${geometry().leftIndentX}px`, _v$19 = t("ruler.hangingIndent"), _v$20 = t("ruler.hangingIndent"), _v$21 = `${geometry().leftIndentX}px`, _v$22 = t("ruler.leftIndent"), _v$23 = t("ruler.leftIndent"), _v$24 = `${geometry().rightIndentX}px`, _v$25 = t("ruler.rightIndent"), _v$26 = t("ruler.rightIndent");
|
|
21949
|
+
var _v$ = t("ruler.horizontal"), _v$2 = `${trackWidth()}px`, _v$3 = `translateX(${-scrollLeft()}px)`, _v$4 = `${pageLeft()}px`, _v$5 = `${sx(pageSettings().width)}px`, _v$6 = `${sx(geometry().contentLeft)}px`, _v$7 = `${sx(geometry().contentRight)}px`, _v$8 = `${sx(Math.max(0, pageSettings().width - geometry().contentRight))}px`, _v$9 = `${sx(geometry().contentLeft)}px`, _v$0 = `${sx(Math.max(0, geometry().contentRight - geometry().contentLeft))}px`, _v$1 = `${sx(geometry().contentLeft)}px`, _v$10 = t("ruler.leftMargin"), _v$11 = t("ruler.leftMargin"), _v$12 = `${sx(geometry().contentRight)}px`, _v$13 = t("ruler.rightMargin"), _v$14 = t("ruler.rightMargin"), _v$15 = `${sx(geometry().firstLineX)}px`, _v$16 = t("ruler.firstLineIndent"), _v$17 = t("ruler.firstLineIndent"), _v$18 = `${sx(geometry().leftIndentX)}px`, _v$19 = t("ruler.hangingIndent"), _v$20 = t("ruler.hangingIndent"), _v$21 = `${sx(geometry().leftIndentX)}px`, _v$22 = t("ruler.leftIndent"), _v$23 = t("ruler.leftIndent"), _v$24 = `${sx(geometry().rightIndentX)}px`, _v$25 = t("ruler.rightIndent"), _v$26 = t("ruler.rightIndent");
|
|
21948
21950
|
_v$ !== _p$.e && setAttribute(_el$, "aria-label", _p$.e = _v$);
|
|
21949
21951
|
_v$2 !== _p$.t && setStyleProperty(_el$2, "width", _p$.t = _v$2);
|
|
21950
21952
|
_v$3 !== _p$.a && setStyleProperty(_el$2, "transform", _p$.a = _v$3);
|
|
@@ -36580,6 +36582,24 @@ function OasisEditorEditor(props) {
|
|
|
36580
36582
|
const zoomSizerWidth = createMemo(() => Math.max(unscaledContentWidth() * zoomFactor(), viewportSize().width));
|
|
36581
36583
|
const zoomSizerHeight = createMemo(() => Math.max(measuredContentHeight() * zoomFactor(), viewportSize().height));
|
|
36582
36584
|
const zoomLayerLeft = createMemo(() => Math.max(0, (zoomSizerWidth() - unscaledContentWidth() * zoomFactor()) / 2));
|
|
36585
|
+
let prevZoomFactor = zoomFactor();
|
|
36586
|
+
createEffect(() => {
|
|
36587
|
+
const next = zoomFactor();
|
|
36588
|
+
const prev = prevZoomFactor;
|
|
36589
|
+
prevZoomFactor = next;
|
|
36590
|
+
if (next === prev || prev <= 0) return;
|
|
36591
|
+
const el = viewportElement;
|
|
36592
|
+
if (!el) return;
|
|
36593
|
+
const ratio = next / prev;
|
|
36594
|
+
const halfW = el.clientWidth / 2;
|
|
36595
|
+
const halfH = el.clientHeight / 2;
|
|
36596
|
+
const targetLeft = (el.scrollLeft + halfW) * ratio - halfW;
|
|
36597
|
+
const targetTop = (el.scrollTop + halfH) * ratio - halfH;
|
|
36598
|
+
requestAnimationFrame(() => {
|
|
36599
|
+
el.scrollLeft = targetLeft;
|
|
36600
|
+
el.scrollTop = targetTop;
|
|
36601
|
+
});
|
|
36602
|
+
});
|
|
36583
36603
|
const statusDocumentLayout = createMemo(() => {
|
|
36584
36604
|
var _a, _b, _c, _d;
|
|
36585
36605
|
return projectDocumentLayout(documentForStats(), void 0, (_b = (_a = layout()).measuredBlockHeights) == null ? void 0 : _b.call(_a), (_d = (_c = layout()).measuredParagraphLayouts) == null ? void 0 : _d.call(_c));
|
|
@@ -36647,7 +36667,8 @@ function OasisEditorEditor(props) {
|
|
|
36647
36667
|
return overlays().toolbarHost;
|
|
36648
36668
|
},
|
|
36649
36669
|
viewportRef,
|
|
36650
|
-
readOnly: () => Boolean(layout().readOnly)
|
|
36670
|
+
readOnly: () => Boolean(layout().readOnly),
|
|
36671
|
+
zoomFactor
|
|
36651
36672
|
});
|
|
36652
36673
|
}
|
|
36653
36674
|
}), _el$2);
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-nYpJ3a_R.js";
|
|
2
2
|
export {
|
|
3
3
|
aV as BalloonShell,
|
|
4
4
|
bL as Button,
|