oasis-editor 0.0.200 → 0.0.202

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.
@@ -33,6 +33,11 @@ export interface EssentialsFormattingCapability {
33
33
  insertEquation: (expression: EditorMathExpression) => boolean;
34
34
  updateEquation: (runId: string, expression: EditorMathExpression) => boolean;
35
35
  pastePlainText: () => boolean;
36
+ formatPainterOnce: () => boolean;
37
+ formatPainterContinuous: () => boolean;
38
+ cancelFormatPainter: () => boolean;
39
+ formatPainterMode: () => "once" | "continuous" | null;
40
+ canCaptureFormatPainter: () => boolean;
36
41
  bold: () => boolean;
37
42
  italic: () => boolean;
38
43
  underline: () => boolean;
@@ -148,7 +153,14 @@ export interface EssentialsImageCapability {
148
153
  setBorder: (patch: ImageBorderPatch) => void;
149
154
  }
150
155
  export interface EssentialsBrowserCapability {
156
+ cut: () => void;
157
+ canCut: () => boolean;
158
+ paste: () => void;
159
+ pasteAsPlainText: () => void;
160
+ pasteMergeFormatting: () => void;
161
+ canPaste: () => boolean;
151
162
  copy: () => void;
163
+ hasSelection: () => boolean;
152
164
  }
153
165
  export interface EssentialsParagraphCapability {
154
166
  togglePageBreakBefore: () => void;
@@ -104,6 +104,10 @@ export interface OasisEditorEditorInputHandlers {
104
104
  onKeyDown: (event: KeyboardEvent & {
105
105
  currentTarget: HTMLTextAreaElement;
106
106
  }) => void;
107
+ /** Applied after keyboard selection is finalized, not while Shift is held. */
108
+ onKeyUp?: (event: KeyboardEvent & {
109
+ currentTarget: HTMLTextAreaElement;
110
+ }) => void;
107
111
  onPaste: (event: ClipboardEvent & {
108
112
  currentTarget: HTMLTextAreaElement;
109
113
  }) => void;
@@ -72,6 +72,7 @@ export interface EditorViewInputInput {
72
72
  handleCut: OasisEditorEditorInputHandlers["onCut"];
73
73
  handlePaste: OasisEditorEditorInputHandlers["onPaste"];
74
74
  handleKeyDown: OasisEditorEditorInputHandlers["onKeyDown"];
75
+ handleKeyUp?: OasisEditorEditorInputHandlers["onKeyUp"];
75
76
  }
76
77
  /**
77
78
  * Inputs needed to assemble the editor's view-prop bundles, grouped by the
@@ -0,0 +1,20 @@
1
+ import { EditorState } from '../../core/model.js';
2
+ export type ClipboardPasteMode = "rich" | "text" | "merge";
3
+ export interface ClipboardPasteDeps {
4
+ state: () => EditorState;
5
+ isReadOnly: () => boolean;
6
+ applyTransactionalState: (producer: (current: EditorState) => EditorState) => void;
7
+ applyTableAwareParagraphEdit: (state: EditorState, edit: (state: EditorState) => EditorState) => EditorState;
8
+ clearPreferredColumn: () => void;
9
+ resetTransactionGrouping: () => void;
10
+ focusInput: () => void;
11
+ onError?: (error: unknown) => void;
12
+ }
13
+ /** A permissions prompt may still deny access at runtime. */
14
+ export declare function canReadSystemClipboard(): boolean;
15
+ /**
16
+ * Insert clipboard content at the selection captured before the asynchronous
17
+ * read. Abort if the document has changed during the permission prompt instead
18
+ * of applying stale offsets. Native paste events still handle image-only paste.
19
+ */
20
+ export declare function pasteFromSystemClipboard(deps: ClipboardPasteDeps, mode: ClipboardPasteMode): Promise<boolean>;
@@ -0,0 +1,11 @@
1
+ import { EditorState } from '../../core/model.js';
2
+ import { ClipboardPasteDeps } from './clipboardPaste.js';
3
+ /** Clipboard writes must be initiated from the user's gesture. */
4
+ export declare function canWriteSystemClipboard(): boolean;
5
+ /**
6
+ * A rejected write always returns false. In particular, Cut must not delete
7
+ * text because an asynchronous Clipboard API call was merely attempted.
8
+ */
9
+ export declare function writeEditorSelectionToClipboard(snapshot: EditorState): Promise<boolean>;
10
+ /** Atomic undoable deletion, only after successful clipboard write. */
11
+ export declare function cutEditorSelection(deps: ClipboardPasteDeps): Promise<boolean>;
@@ -0,0 +1,25 @@
1
+ import { EditorState } from '../../core/model.js';
2
+ export type FormatPainterMode = "once" | "continuous" | null;
3
+ export interface EditorFormatPainterDeps {
4
+ state: () => EditorState;
5
+ isReadOnly: () => boolean;
6
+ applyTransactionalState: (transform: (state: EditorState) => EditorState) => void;
7
+ applyTableAwareParagraphEdit: (state: EditorState, transform: (state: EditorState) => EditorState) => EditorState;
8
+ clearPreferredColumn: () => void;
9
+ resetTransactionGrouping: () => void;
10
+ focusInput: () => void;
11
+ }
12
+ /**
13
+ * Instance-local UI state. Source formatting is captured when armed.
14
+ * Pointer selection is committed only after pointerup (never during drag),
15
+ * and keyboard selection only on keyup.
16
+ */
17
+ export declare function createEditorFormatPainter(deps: EditorFormatPainterDeps): {
18
+ mode: import('solid-js').Accessor<FormatPainterMode>;
19
+ canCapture: () => boolean;
20
+ armOnce: () => boolean;
21
+ armContinuous: () => boolean;
22
+ cancel: () => void;
23
+ applyToSelection: (origin: "pointer" | "keyboard") => boolean;
24
+ };
25
+ export type EditorFormatPainter = ReturnType<typeof createEditorFormatPainter>;
@@ -146,6 +146,14 @@ declare function createEditorInteractionRuntimeImpl(deps: EditorInteractionRunti
146
146
  applyToolbarValueStyleCommand: <K extends "link" | "styleId" | "underlineStyle" | "textEffect" | "fontFamily" | "fontSize" | "color" | "highlight" | "shading" | "language">(key: K, value: import('../../core/model.js').EditorTextStyle[K] | null) => void;
147
147
  applyToolbarBooleanStyleCommand: (key: import('../toolbarStyleState.js').BooleanStyleKey) => void;
148
148
  };
149
+ formatPainter: {
150
+ mode: import('solid-js').Accessor<import('./createEditorFormatPainter.js').FormatPainterMode>;
151
+ canCapture: () => boolean;
152
+ armOnce: () => boolean;
153
+ armContinuous: () => boolean;
154
+ cancel: () => void;
155
+ applyToSelection: (origin: "pointer" | "keyboard") => boolean;
156
+ };
149
157
  onEditorPointerDown: (event: PointerEvent) => void;
150
158
  tableResize: import('../../app/controllers/useEditorTableResize.js').TableResizeOps;
151
159
  tableCornerResize: import('../../app/controllers/useEditorTableCornerResize.js').TableCornerResizeOps;
@@ -1,2 +1,8 @@
1
1
  import { EssentialsBrowserCapability } from '../../../plugins/internal/essentialsCapabilities.js';
2
- export declare function buildEssentialsBrowser(): EssentialsBrowserCapability;
2
+ import { CreateEditorEssentialsPluginOptions } from './types.js';
3
+ /**
4
+ * Copies the editor's *model selection*, not the DOM selection of the button
5
+ * that currently holds focus. Keyboard copy through the editor input continues
6
+ * to use useEditorClipboard, preserving its existing rich-clipboard behavior.
7
+ */
8
+ export declare function buildEssentialsBrowser(options: Pick<CreateEditorEssentialsPluginOptions, "state" | "isReadOnly" | "applyTransactionalState" | "tableOps" | "clearPreferredColumn" | "resetTransactionGrouping" | "focusInput">): EssentialsBrowserCapability;
@@ -4,6 +4,7 @@ import { SelectedImageRun } from '../../../core/commands/image.js';
4
4
  import { createEditorCommandsController } from '../../../app/controllers/EditorCommandsController.js';
5
5
  import { createEditorHistoryActions } from '../../../app/controllers/useEditorHistoryActions.js';
6
6
  import { createEditorStyleController } from '../../../app/controllers/useEditorStyle.js';
7
+ import { EditorFormatPainter } from '../createEditorFormatPainter.js';
7
8
  import { createEditorTableOperations } from '../../../app/controllers/useEditorTableOperations.js';
8
9
  import { EssentialsDesignCapability } from '../../../plugins/internal/essentialsCapabilities.js';
9
10
  export interface CreateEditorEssentialsPluginOptions {
@@ -22,6 +23,7 @@ export interface CreateEditorEssentialsPluginOptions {
22
23
  };
23
24
  historyActions: ReturnType<typeof createEditorHistoryActions>;
24
25
  styleController: ReturnType<typeof createEditorStyleController>;
26
+ formatPainter: EditorFormatPainter;
25
27
  tableOps: ReturnType<typeof createEditorTableOperations>;
26
28
  docIO: {
27
29
  handleExportDocx: () => Promise<Blob>;
@@ -41,6 +43,8 @@ export interface CreateEditorEssentialsPluginOptions {
41
43
  };
42
44
  selectionBoxes: () => Array<unknown>;
43
45
  focusInput: () => void;
46
+ clearPreferredColumn: () => void;
47
+ resetTransactionGrouping: () => void;
44
48
  applyState: (nextState: EditorState) => void;
45
49
  applyTransactionalState: (producer: (current: EditorState) => EditorState, options?: {
46
50
  mergeKey?: MergeKey;
@@ -12,6 +12,7 @@ import { createEditorRevisionController } from '../../app/controllers/useEditorR
12
12
  import { createEditorTableOperations } from '../../app/controllers/useEditorTableOperations.js';
13
13
  import { createEditorImageOperations } from '../../app/controllers/useEditorImageOperations.js';
14
14
  import { createEditorStyleController } from '../../app/controllers/useEditorStyle.js';
15
+ import { EditorFormatPainter } from './createEditorFormatPainter.js';
15
16
  type TableDragParams = Parameters<typeof createEditorTableDrag>[0];
16
17
  type TextDragParams = Parameters<typeof createEditorTextDrag>[0];
17
18
  type NavigationParams = Parameters<typeof createEditorNavigation>[0];
@@ -47,6 +48,7 @@ export interface EditorInteractionWiringContext {
47
48
  tableOps: ReturnType<typeof createEditorTableOperations>;
48
49
  imageOps: ReturnType<typeof createEditorImageOperations>;
49
50
  styleController: ReturnType<typeof createEditorStyleController>;
51
+ formatPainter: EditorFormatPainter;
50
52
  getForcePlainTextPaste: () => boolean;
51
53
  setForcePlainTextPaste: (value: boolean) => void;
52
54
  insertImageFromFile: ClipboardParams["insertImageFromFile"];
@@ -12,10 +12,12 @@ export interface SplitButtonProps {
12
12
  mainTestId?: string;
13
13
  mainAriaLabel?: string;
14
14
  mainPressed?: boolean;
15
+ mainDisabled?: boolean;
15
16
  onMain: () => void;
16
17
  /** Chevron (right) button. */
17
18
  menuTestId?: string;
18
19
  menuAriaLabel?: string;
20
+ menuDisabled?: boolean;
19
21
  /** Popover panel. */
20
22
  panelClass?: string;
21
23
  panelRole?: PanelRole;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.200",
3
+ "version": "0.0.202",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {