oasis-editor 0.0.133 → 0.0.134
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-DmXn9H33.js → OasisEditorApp-B2f15Gpe.js} +485 -7
- package/dist/app/controllers/EditorCommandsController.d.ts +3 -0
- package/dist/app/controllers/createCropSession.d.ts +26 -0
- package/dist/app/controllers/useEditorImageOperations.d.ts +7 -0
- package/dist/core/commands/builtinCommands.d.ts +1 -1
- package/dist/core/commands/image.d.ts +37 -1
- package/dist/core/commands/publicCommandTypes.d.ts +5 -0
- package/dist/core/pluginUiTypes.d.ts +1 -1
- package/dist/core/transactionMergeKeys.d.ts +2 -0
- package/dist/export/pdf/writer/PdfContentStream.d.ts +8 -0
- package/dist/export/pdf/writer/pdfTypes.d.ts +10 -0
- package/dist/i18n/locales/en.d.ts +13 -0
- package/dist/i18n/locales/pt-BR.d.ts +13 -0
- package/dist/{index-BOj4-NlJ.js → index-ogn0S9F3.js} +527 -308
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +49 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/plugins/internal/essentialsCapabilities.d.ts +15 -0
- package/dist/ui/OasisEditorEditorProps.d.ts +5 -0
- package/dist/ui/app/buildEditorViewProps.d.ts +2 -0
- package/dist/ui/app/createAppCommandsController.d.ts +6 -0
- package/dist/ui/app/createEditorCommandRuntime.d.ts +3 -0
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +7 -0
- package/dist/ui/app/essentials/types.d.ts +5 -0
- package/dist/ui/components/Toolbar/controls/ImageSizeControls.d.ts +16 -0
- package/dist/ui/cropGeometry.d.ts +23 -0
- package/package.json +1 -1
|
@@ -90,6 +90,21 @@ export interface EssentialsImageCapability {
|
|
|
90
90
|
promptAlt: () => void;
|
|
91
91
|
promptCaption: () => void;
|
|
92
92
|
isSelected: () => boolean;
|
|
93
|
+
/** Displayed size of the selected image in centimetres, or `null`. */
|
|
94
|
+
getSizeCm: () => {
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
} | null;
|
|
98
|
+
/** Set the displayed width (cm), scaling height to keep the aspect ratio. */
|
|
99
|
+
setWidthCm: (cm: number) => void;
|
|
100
|
+
/** Set the displayed height (cm), scaling width to keep the aspect ratio. */
|
|
101
|
+
setHeightCm: (cm: number) => void;
|
|
102
|
+
/** Whether interactive crop mode is currently active. */
|
|
103
|
+
isCropActive: () => boolean;
|
|
104
|
+
/** Toggle interactive crop mode for the selected image. */
|
|
105
|
+
toggleCrop: () => void;
|
|
106
|
+
/** Apply an aspect-ratio crop preset (e.g. "16:9", "1:1", "reset"). */
|
|
107
|
+
applyCropAspect: (preset: string) => void;
|
|
93
108
|
}
|
|
94
109
|
export interface EssentialsBrowserCapability {
|
|
95
110
|
print: () => void;
|
|
@@ -31,6 +31,8 @@ export interface OasisEditorEditorOverlayProps {
|
|
|
31
31
|
focused: Accessor<boolean>;
|
|
32
32
|
showCaret: Accessor<boolean>;
|
|
33
33
|
importProgress?: Accessor<ImportProgress | null>;
|
|
34
|
+
/** Whether interactive image crop mode is active (shows crop handles). */
|
|
35
|
+
imageCropMode?: Accessor<boolean>;
|
|
34
36
|
toolbarHost?: () => ToolbarHost;
|
|
35
37
|
persistenceStatus?: () => string;
|
|
36
38
|
showFloatingTableToolbar?: Accessor<boolean>;
|
|
@@ -66,6 +68,9 @@ export interface OasisEditorEditorSurfaceHandlers {
|
|
|
66
68
|
onImageRotateHandleMouseDown: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
|
|
67
69
|
currentTarget: HTMLElement;
|
|
68
70
|
}) => void;
|
|
71
|
+
onImageCropHandleMouseDown?: (paragraphId: string, paragraphOffset: number, direction: ResizeHandleDirection, event: MouseEvent & {
|
|
72
|
+
currentTarget: HTMLElement;
|
|
73
|
+
}) => void;
|
|
69
74
|
onTextBoxRotateHandleMouseDown: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
|
|
70
75
|
currentTarget: HTMLElement;
|
|
71
76
|
}) => void;
|
|
@@ -35,6 +35,7 @@ export interface EditorViewOverlayInput {
|
|
|
35
35
|
focused: Accessor<boolean>;
|
|
36
36
|
showCaret: Accessor<boolean>;
|
|
37
37
|
importProgress: Accessor<ImportProgress | null>;
|
|
38
|
+
imageCropMode: Accessor<boolean>;
|
|
38
39
|
}
|
|
39
40
|
/** Owner of the editor element refs. */
|
|
40
41
|
export interface EditorViewRefsInput {
|
|
@@ -58,6 +59,7 @@ export interface EditorViewSurfaceInput {
|
|
|
58
59
|
handleImageResizeHandleMouseDown: OasisEditorEditorSurfaceHandlers["onImageResizeHandleMouseDown"];
|
|
59
60
|
handleTextBoxResizeHandleMouseDown: OasisEditorEditorSurfaceHandlers["onTextBoxResizeHandleMouseDown"];
|
|
60
61
|
handleImageRotateHandleMouseDown: OasisEditorEditorSurfaceHandlers["onImageRotateHandleMouseDown"];
|
|
62
|
+
handleImageCropHandleMouseDown: NonNullable<OasisEditorEditorSurfaceHandlers["onImageCropHandleMouseDown"]>;
|
|
61
63
|
handleTextBoxRotateHandleMouseDown: OasisEditorEditorSurfaceHandlers["onTextBoxRotateHandleMouseDown"];
|
|
62
64
|
handleEditorContextMenu: (event: MouseEvent) => void;
|
|
63
65
|
}
|
|
@@ -69,6 +69,9 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
|
|
|
69
69
|
promptForImageAlt: () => void;
|
|
70
70
|
applyImageCaptionCommand: (caption: string) => void;
|
|
71
71
|
promptForImageCaption: () => void;
|
|
72
|
+
applyImageWidthCmCommand: (cm: number) => void;
|
|
73
|
+
applyImageHeightCmCommand: (cm: number) => void;
|
|
74
|
+
applyImageCropAspectCommand: (preset: string) => void;
|
|
72
75
|
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
73
76
|
handleListEnter: () => boolean;
|
|
74
77
|
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
@@ -103,6 +106,9 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
|
|
|
103
106
|
promptForImageAlt: () => void;
|
|
104
107
|
applyImageCaptionCommand: (caption: string) => void;
|
|
105
108
|
promptForImageCaption: () => void;
|
|
109
|
+
applyImageWidthCmCommand: (cm: number) => void;
|
|
110
|
+
applyImageHeightCmCommand: (cm: number) => void;
|
|
111
|
+
applyImageCropAspectCommand: (preset: string) => void;
|
|
106
112
|
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
107
113
|
handleListEnter: () => boolean;
|
|
108
114
|
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
@@ -84,6 +84,9 @@ declare function createEditorCommandRuntimeImpl(deps: EditorCommandRuntimeDeps):
|
|
|
84
84
|
promptForImageAlt: () => void;
|
|
85
85
|
applyImageCaptionCommand: (caption: string) => void;
|
|
86
86
|
promptForImageCaption: () => void;
|
|
87
|
+
applyImageWidthCmCommand: (cm: number) => void;
|
|
88
|
+
applyImageHeightCmCommand: (cm: number) => void;
|
|
89
|
+
applyImageCropAspectCommand: (preset: string) => void;
|
|
87
90
|
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
88
91
|
handleListEnter: () => boolean;
|
|
89
92
|
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
@@ -89,6 +89,9 @@ declare function createEditorInteractionRuntimeImpl(deps: EditorInteractionRunti
|
|
|
89
89
|
};
|
|
90
90
|
imageOps: {
|
|
91
91
|
dragging: import('solid-js').Accessor<boolean>;
|
|
92
|
+
cropMode: import('solid-js').Accessor<boolean>;
|
|
93
|
+
setCropMode: import('solid-js').Setter<boolean>;
|
|
94
|
+
toggleCropMode: () => void;
|
|
92
95
|
draggedImageInfo: import('solid-js').Accessor<import('../../app/controllers/useEditorImageOperations.js').ActiveImageDrag | null>;
|
|
93
96
|
mousePos: import('solid-js').Accessor<{
|
|
94
97
|
x: number;
|
|
@@ -107,6 +110,7 @@ declare function createEditorInteractionRuntimeImpl(deps: EditorInteractionRunti
|
|
|
107
110
|
stopImageDrag: () => void;
|
|
108
111
|
stopImageResize: () => void;
|
|
109
112
|
stopImageRotate: () => void;
|
|
113
|
+
stopImageCrop: () => void;
|
|
110
114
|
handleImageMouseDown: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
|
|
111
115
|
currentTarget: HTMLElement;
|
|
112
116
|
}) => void;
|
|
@@ -116,6 +120,9 @@ declare function createEditorInteractionRuntimeImpl(deps: EditorInteractionRunti
|
|
|
116
120
|
handleImageRotateHandleMouseDown: (paragraphId: string, paragraphOffset: number, event: MouseEvent & {
|
|
117
121
|
currentTarget: HTMLElement;
|
|
118
122
|
}) => void;
|
|
123
|
+
handleImageCropHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: import('../resizeGeometry.js').ResizeHandleDirection, event: MouseEvent & {
|
|
124
|
+
currentTarget: HTMLElement;
|
|
125
|
+
}) => void;
|
|
119
126
|
};
|
|
120
127
|
textBoxOps: {
|
|
121
128
|
handleTextBoxResizeHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: import('../resizeGeometry.js').ResizeHandleDirection, event: MouseEvent & {
|
|
@@ -29,6 +29,11 @@ export interface CreateEditorEssentialsPluginOptions {
|
|
|
29
29
|
importInputRef: () => HTMLInputElement | undefined;
|
|
30
30
|
imageInputRef: () => HTMLInputElement | undefined;
|
|
31
31
|
selectedImageRun: () => SelectedImageRun | null;
|
|
32
|
+
/** Interactive image crop-mode signal (owned by the image operations). */
|
|
33
|
+
imageCropMode: {
|
|
34
|
+
isActive: () => boolean;
|
|
35
|
+
toggle: () => void;
|
|
36
|
+
};
|
|
32
37
|
selectionBoxes: () => Array<unknown>;
|
|
33
38
|
focusInput: () => void;
|
|
34
39
|
applyState: (nextState: EditorState) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { ToolbarActionApi } from '../schema/items.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A labelled centimetre field for the image Size group (height or width). Reads
|
|
6
|
+
* the current size from the `imageHeightCm`/`imageWidthCm` command and writes it
|
|
7
|
+
* back on change; the core keeps the aspect ratio locked.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ImageSizeField(props: {
|
|
10
|
+
api: ToolbarActionApi;
|
|
11
|
+
dimension: "height" | "width";
|
|
12
|
+
}): JSX.Element;
|
|
13
|
+
/** The Cortar chevron menu: toggle crop mode + aspect-ratio presets. */
|
|
14
|
+
export declare function ImageCropMenu(props: {
|
|
15
|
+
api: ToolbarActionApi;
|
|
16
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ResizeHandleDirection } from './resizeGeometry.js';
|
|
2
|
+
import { EditorImageCrop } from '../core/model.js';
|
|
3
|
+
|
|
4
|
+
export interface CropSessionGeometry {
|
|
5
|
+
handleDirection: ResizeHandleDirection;
|
|
6
|
+
/** Displayed box size (px) captured when the handle was grabbed. */
|
|
7
|
+
startWidth: number;
|
|
8
|
+
startHeight: number;
|
|
9
|
+
/** Crop fractions captured when the handle was grabbed. */
|
|
10
|
+
startCrop: EditorImageCrop;
|
|
11
|
+
}
|
|
12
|
+
export interface CropResult {
|
|
13
|
+
crop: EditorImageCrop;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the next crop + displayed size for a crop-handle drag. `deltaX`/
|
|
19
|
+
* `deltaY` are pointer deltas in document px (already divided by zoom). Growing
|
|
20
|
+
* a side is bounded by that side's original crop (you cannot un-crop past the
|
|
21
|
+
* source image).
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveCroppedImage(geometry: CropSessionGeometry, deltaX: number, deltaY: number): CropResult;
|