oasis-editor 0.0.230 → 0.0.232

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.
Files changed (31) hide show
  1. package/dist/OasisEditorApp-QuRS1JVm.js +1 -0
  2. package/dist/app/controllers/EditorCommandsController.d.ts +2 -1
  3. package/dist/app/controllers/useEditorClipboard.d.ts +3 -0
  4. package/dist/app/controllers/useEditorStyle.d.ts +2 -1
  5. package/dist/core/commands/builtinCommands.d.ts +1 -1
  6. package/dist/core/commands/publicCommandTypes.d.ts +2 -1
  7. package/dist/core/commands/textFormatting.d.ts +3 -1
  8. package/dist/defaultToolbar-BLpx6Q1W.js +1 -0
  9. package/dist/i18n/locales/en.d.ts +7 -0
  10. package/dist/i18n/locales/pt-BR.d.ts +7 -0
  11. package/dist/oasis-editor.css +1 -1
  12. package/dist/oasis-editor.js +1 -1
  13. package/dist/oasis-editor.umd.cjs +1 -1
  14. package/dist/plugins/internal/essentialsCapabilities.d.ts +2 -1
  15. package/dist/ui/app/clipboardPaste.d.ts +2 -0
  16. package/dist/ui/app/clipboardWrite.d.ts +2 -2
  17. package/dist/ui/app/createAppCommandsController.d.ts +2 -0
  18. package/dist/ui/app/createEditorChrome.d.ts +2 -0
  19. package/dist/ui/app/createEditorClipboardActions.d.ts +19 -0
  20. package/dist/ui/app/createEditorCommandRuntime.d.ts +3 -0
  21. package/dist/ui/app/createEditorInteractionRuntime.d.ts +3 -0
  22. package/dist/ui/app/essentials/browser.d.ts +2 -6
  23. package/dist/ui/app/essentials/types.d.ts +2 -0
  24. package/dist/ui/app/useEditorContextMenuClipboard.d.ts +5 -3
  25. package/dist/ui/app/useEditorInteractionWiring.d.ts +2 -0
  26. package/dist/ui/components/ClipboardFeedback.d.ts +6 -0
  27. package/dist/ui/components/Toolbar/controls/UnderlineControl.d.ts +1 -1
  28. package/dist/ui/components/Toolbar/primitives/popoverBranch.d.ts +2 -0
  29. package/package.json +4 -2
  30. package/dist/OasisEditorApp-B7XbE1cT.js +0 -1
  31. package/dist/defaultToolbar-D2zbRedt.js +0 -1
@@ -1,4 +1,4 @@
1
- import { EditorColumnsSettings, EditorDocumentDesign, EditorImageBorder, EditorPageBorder, EditorPageMargins, EditorPageNumbering, EditorPosition, EditorSectionBreakType, EditorWatermark, EditorMathExpression, EditorTabStop } from '../../core/model.js';
1
+ import { EditorColumnsSettings, EditorUnderlineStyle, EditorDocumentDesign, EditorImageBorder, EditorPageBorder, EditorPageMargins, EditorPageNumbering, EditorPosition, EditorSectionBreakType, EditorWatermark, EditorMathExpression, EditorTabStop } from '../../core/model.js';
2
2
  import { SectionPageNumberFormat } from '../../core/commands/pageNumber.js';
3
3
  import { CrossReferenceType } from '../../core/commands/crossReference.js';
4
4
  import { DesignThemeId } from '../../core/commands/design.js';
@@ -151,6 +151,7 @@ export interface EssentialsFormattingCapability {
151
151
  setStyleId: (value: string) => boolean;
152
152
  setCharacterStyleId: (value: string) => boolean;
153
153
  setUnderlineStyle: (value: string | null) => void;
154
+ applyUnderlineStyle: (value: EditorUnderlineStyle | null) => void;
154
155
  setUnderlineColor: (value: string | null) => boolean;
155
156
  setCharacterScale: (value: number | null) => boolean;
156
157
  setCharacterSpacing: (value: number | null) => boolean;
@@ -1,4 +1,5 @@
1
1
  import { EditorState } from '../../core/model.js';
2
+ export type ClipboardIssue = "access-denied" | "empty" | "unsupported" | "document-changed";
2
3
  export type ClipboardPasteMode = "rich" | "text" | "merge";
3
4
  export interface ClipboardPasteDeps {
4
5
  state: () => EditorState;
@@ -9,6 +10,7 @@ export interface ClipboardPasteDeps {
9
10
  resetTransactionGrouping: () => void;
10
11
  focusInput: () => void;
11
12
  onError?: (error: unknown) => void;
13
+ onIssue?: (issue: ClipboardIssue) => void;
12
14
  }
13
15
  /** A permissions prompt may still deny access at runtime. */
14
16
  export declare function canReadSystemClipboard(): boolean;
@@ -1,11 +1,11 @@
1
1
  import { EditorState } from '../../core/model.js';
2
- import { ClipboardPasteDeps } from './clipboardPaste.js';
2
+ import { ClipboardIssue, ClipboardPasteDeps } from './clipboardPaste.js';
3
3
  /** Clipboard writes must be initiated from the user's gesture. */
4
4
  export declare function canWriteSystemClipboard(): boolean;
5
5
  /**
6
6
  * A rejected write always returns false. In particular, Cut must not delete
7
7
  * text because an asynchronous Clipboard API call was merely attempted.
8
8
  */
9
- export declare function writeEditorSelectionToClipboard(snapshot: EditorState): Promise<boolean>;
9
+ export declare function writeEditorSelectionToClipboard(snapshot: EditorState, onIssue?: (issue: ClipboardIssue) => void): Promise<boolean>;
10
10
  /** Atomic undoable deletion, only after successful clipboard write. */
11
11
  export declare function cutEditorSelection(deps: ClipboardPasteDeps): Promise<boolean>;
@@ -44,6 +44,7 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
44
44
  applyBooleanStyleCommand: (key: BooleanStyleKey) => void;
45
45
  applyToggleCharacterBorderCommand: () => void;
46
46
  applyValueStyleCommand: <K extends "styleId" | "fontFamily" | "fontSize" | "color" | "highlight" | "shading" | "language" | "textEffect" | "link" | "underlineStyle">(key: K, value: import('../../core/model.js').EditorTextStyle[K] | null) => void;
47
+ applyUnderlineStyleCommand: (style: import('../../core/model.js').EditorUnderlineStyle | null) => void;
47
48
  applyChangeTextCaseCommand: (mode: import('../../core/commands/textCase').TextCaseMode) => void;
48
49
  applyClearFormattingCommand: () => void;
49
50
  applyParagraphStyleCommand: <K extends import('../toolbarStyleState.js').ParagraphStyleKey>(key: K, value: import('../../core/model.js').EditorParagraphStyle[K] | null) => void;
@@ -93,6 +94,7 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
93
94
  applyBooleanStyleCommand: (style: BooleanStyleKey) => void;
94
95
  applyToggleCharacterBorderCommand: () => void;
95
96
  applyValueStyleCommand: <K extends "styleId" | "fontFamily" | "fontSize" | "color" | "highlight" | "shading" | "language" | "textEffect" | "link" | "underlineStyle">(key: K, value: import('../../core/model.js').EditorTextStyle[K] | null) => void;
97
+ applyUnderlineStyleCommand: (style: import('../../core/model.js').EditorUnderlineStyle | null) => void;
96
98
  applyChangeTextCaseCommand: (mode: import('../../core/commands/textCase').TextCaseMode) => void;
97
99
  applyClearFormattingCommand: () => void;
98
100
  applyParagraphStyleCommand: <K extends import('../toolbarStyleState.js').ParagraphStyleKey>(key: K, value: import('../../core/model.js').EditorParagraphStyle[K] | null) => void;
@@ -1,3 +1,4 @@
1
+ import { EditorClipboardActions } from './createEditorClipboardActions.js';
1
2
  import { MergeKey } from '../../core/transactionMergeKeys.js';
2
3
  import { EditorSelection, EditorState } from '../../core/model.js';
3
4
  import { ToolbarStyleState } from '../toolbarStyleState.js';
@@ -18,6 +19,7 @@ interface ContextMenuState {
18
19
  y: number;
19
20
  }
20
21
  export interface EditorChromeDeps {
22
+ clipboardActions?: EditorClipboardActions;
21
23
  state: () => EditorState;
22
24
  selection: () => EditorSelection;
23
25
  toolbarStyleState: () => ToolbarStyleState;
@@ -0,0 +1,19 @@
1
+ import { ClipboardIssue, ClipboardPasteDeps, ClipboardPasteMode } from './clipboardPaste.js';
2
+ export interface ClipboardNotice {
3
+ action: "copy" | "cut" | "paste";
4
+ issue: ClipboardIssue;
5
+ mode?: ClipboardPasteMode;
6
+ }
7
+ /** One editor's actions, feedback and single-use native-paste fallback. */
8
+ export declare function createEditorClipboardActions(deps: ClipboardPasteDeps): ReturnType<typeof createClipboardActions>;
9
+ export type EditorClipboardActions = ReturnType<typeof createEditorClipboardActions>;
10
+ declare function createClipboardActions(deps: ClipboardPasteDeps): {
11
+ notice: import('solid-js').Accessor<ClipboardNotice | undefined>;
12
+ dismiss: () => void;
13
+ consumePasteMode: () => ClipboardPasteMode | undefined;
14
+ copy: () => Promise<boolean>;
15
+ cut: () => Promise<boolean>;
16
+ paste: (mode?: ClipboardPasteMode) => Promise<boolean>;
17
+ hasSelection: () => boolean;
18
+ };
19
+ export {};
@@ -1,3 +1,4 @@
1
+ import { EditorClipboardActions } from './createEditorClipboardActions.js';
1
2
  import { BooleanStyleKey } from '../toolbarStyleState.js';
2
3
  import { EditorState } from '../../core/model.js';
3
4
  import { EditorLogger } from '../../utils/logger.js';
@@ -17,6 +18,7 @@ interface LinkDialogSetter {
17
18
  }): void;
18
19
  }
19
20
  export interface EditorCommandRuntimeDeps {
21
+ clipboardActions?: EditorClipboardActions;
20
22
  document: DocumentRuntime;
21
23
  interaction: InteractionRuntime;
22
24
  commentComposer: EditorCommentComposer;
@@ -84,6 +86,7 @@ declare function createEditorCommandRuntimeImpl(deps: EditorCommandRuntimeDeps):
84
86
  applyBooleanStyleCommand: (key: BooleanStyleKey) => void;
85
87
  applyToggleCharacterBorderCommand: () => void;
86
88
  applyValueStyleCommand: <K extends "styleId" | "fontFamily" | "fontSize" | "color" | "highlight" | "shading" | "language" | "textEffect" | "link" | "underlineStyle">(key: K, value: import('../../core/model.js').EditorTextStyle[K] | null) => void;
89
+ applyUnderlineStyleCommand: (style: import('../../core/model.js').EditorUnderlineStyle | null) => void;
87
90
  applyChangeTextCaseCommand: (mode: import('../../core/commands/textCase.js').TextCaseMode) => void;
88
91
  applyClearFormattingCommand: () => void;
89
92
  applyParagraphStyleCommand: <K extends import('../toolbarStyleState.js').ParagraphStyleKey>(key: K, value: import('../../core/model.js').EditorParagraphStyle[K] | null) => void;
@@ -1,3 +1,4 @@
1
+ import { EditorClipboardActions } from './createEditorClipboardActions.js';
1
2
  import { EditorPosition, EditorState } from '../../core/model.js';
2
3
  import { EditorLogger } from '../../utils/logger.js';
3
4
  import { createEditorCommandsController } from '../../app/controllers/EditorCommandsController.js';
@@ -6,6 +7,7 @@ import { SelectedObjectRun } from '../../core/commands/selectedObjectRun.js';
6
7
  type DocRuntime = ReturnType<typeof createEditorDocumentRuntime>;
7
8
  type CommandsController = ReturnType<typeof createEditorCommandsController>;
8
9
  export interface EditorInteractionRuntimeDeps {
10
+ clipboardActions?: EditorClipboardActions;
9
11
  state: EditorState;
10
12
  logger: EditorLogger;
11
13
  isReadOnly: () => boolean;
@@ -144,6 +146,7 @@ declare function createEditorInteractionRuntimeImpl(deps: EditorInteractionRunti
144
146
  clearPendingCaretTextStyle: () => void;
145
147
  toolbarStyleState: () => import('../toolbarStyleState.js').ToolbarStyleState;
146
148
  applyToolbarValueStyleCommand: <K extends "link" | "styleId" | "underlineStyle" | "textEffect" | "fontFamily" | "fontSize" | "color" | "highlight" | "shading" | "language">(key: K, value: import('../../core/model.js').EditorTextStyle[K] | null) => void;
149
+ applyToolbarUnderlineStyleCommand: (style: import('../../core/model.js').EditorUnderlineStyle | null) => void;
147
150
  applyToolbarBooleanStyleCommand: (key: import('../toolbarStyleState.js').BooleanStyleKey) => void;
148
151
  };
149
152
  formatPainter: {
@@ -1,8 +1,4 @@
1
1
  import { EssentialsBrowserCapability } from '../../../plugins/internal/essentialsCapabilities.js';
2
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;
3
+ /** Ribbon and context-menu actions share this editor's clipboard feedback. */
4
+ export declare function buildEssentialsBrowser(options: Pick<CreateEditorEssentialsPluginOptions, "state" | "isReadOnly" | "applyTransactionalState" | "tableOps" | "clearPreferredColumn" | "resetTransactionGrouping" | "focusInput" | "clipboardActions">): EssentialsBrowserCapability;
@@ -1,3 +1,4 @@
1
+ import { EditorClipboardActions } from '../createEditorClipboardActions.js';
1
2
  import { MergeKey } from '../../../core/transactionMergeKeys.js';
2
3
  import { EditorState } from '../../../core/model.js';
3
4
  import { SelectedImageRun } from '../../../core/commands/image.js';
@@ -9,6 +10,7 @@ import { EditorCommentComposer } from '../createEditorCommentComposer.js';
9
10
  import { createEditorTableOperations } from '../../../app/controllers/useEditorTableOperations.js';
10
11
  import { EssentialsDesignCapability } from '../../../plugins/internal/essentialsCapabilities.js';
11
12
  export interface CreateEditorEssentialsPluginOptions {
13
+ clipboardActions?: EditorClipboardActions;
12
14
  design?: EssentialsDesignCapability;
13
15
  state: () => EditorState;
14
16
  isReadOnly: () => boolean;
@@ -1,3 +1,4 @@
1
+ import { EditorClipboardActions } from './createEditorClipboardActions.js';
1
2
  import { MergeKey } from '../../core/transactionMergeKeys.js';
2
3
  import { EditorState } from '../../core/model.js';
3
4
  import { TranslateFn } from '../../i18n/index.js';
@@ -9,6 +10,7 @@ interface ContextMenuState {
9
10
  y: number;
10
11
  }
11
12
  export interface EditorContextMenuClipboardDeps {
13
+ clipboardActions?: EditorClipboardActions;
12
14
  state: () => EditorState;
13
15
  isReadOnly: () => boolean;
14
16
  t: TranslateFn;
@@ -53,8 +55,8 @@ declare function createEditorContextMenuClipboardImpl(deps: EditorContextMenuCli
53
55
  buildContextMenuItems: () => ContextMenuItem[];
54
56
  closeContextMenu: () => void;
55
57
  handleEditorContextMenu: (event: MouseEvent) => void;
56
- programmaticCopy: () => Promise<void>;
57
- programmaticCut: () => Promise<void>;
58
- programmaticPaste: () => Promise<void>;
58
+ programmaticCopy: () => Promise<boolean>;
59
+ programmaticCut: () => Promise<boolean>;
60
+ programmaticPaste: () => Promise<boolean>;
59
61
  };
60
62
  export {};
@@ -1,3 +1,4 @@
1
+ import { EditorClipboardActions } from './createEditorClipboardActions.js';
1
2
  import { EditorState } from '../../core/model.js';
2
3
  import { EditorLogger } from '../../utils/logger.js';
3
4
  import { createEditorClipboardController } from '../../app/controllers/useEditorClipboard.js';
@@ -25,6 +26,7 @@ type ClipboardParams = Parameters<typeof createEditorClipboardController>[0];
25
26
  * the pointer/keyboard interaction controllers on top of them.
26
27
  */
27
28
  export interface EditorInteractionWiringContext {
29
+ clipboardActions?: EditorClipboardActions;
28
30
  state: EditorState;
29
31
  applyState: NavigationParams["applyState"];
30
32
  applyTransactionalState: TextDragParams["applyTransactionalState"];
@@ -0,0 +1,6 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ClipboardNotice } from '../app/createEditorClipboardActions.js';
3
+ export declare function ClipboardFeedback(props: {
4
+ notice: () => ClipboardNotice | undefined;
5
+ onDismiss: () => void;
6
+ }): JSX.Element;
@@ -2,7 +2,7 @@ import { JSX } from 'solid-js';
2
2
  import { ToolbarActionApi } from '../schema/items.js';
3
3
  /**
4
4
  * Underline split-button control — toggle plus a style picker, dispatching only
5
- * through the `underline` and `setUnderlineStyle` commands.
5
+ * through the atomic `applyUnderlineStyle` command.
6
6
  */
7
7
  export declare function UnderlineControl(props: {
8
8
  api: ToolbarActionApi;
@@ -3,5 +3,7 @@ export interface PopoverBranch {
3
3
  open: () => boolean;
4
4
  contains: (target: Node) => boolean;
5
5
  children: Set<PopoverBranch>;
6
+ /** A chosen action ends this menu path; opening a child does not. */
7
+ closeAll: () => void;
6
8
  }
7
9
  export declare const PopoverBranchContext: import('solid-js').Context<PopoverBranch | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.230",
3
+ "version": "0.0.232",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -76,7 +76,9 @@
76
76
  "test:ribbon:resize": "node scripts/verify-ribbon-resize.mjs",
77
77
  "test:ribbon:ci": "node scripts/verify-ribbon-ci.mjs",
78
78
  "test:ribbon:contexts": "node scripts/verify-ribbon-contexts.mjs",
79
- "test:ribbon:icons": "node scripts/verify-ribbon-icons.mjs"
79
+ "test:ribbon:icons": "node scripts/verify-ribbon-icons.mjs",
80
+ "test:ribbon:editing": "node scripts/verify-ribbon-editing.mjs",
81
+ "test:ribbon:clipboard": "node scripts/verify-ribbon-clipboard.mjs"
80
82
  },
81
83
  "devDependencies": {
82
84
  "@eslint/js": "^10.0.1",