@ones-editor/editor 1.1.9 → 1.1.10-beta.2

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.
@@ -1,3 +1,3 @@
1
- import { BlockElement, CommandItem, OnesEditor } from '../../types';
1
+ import { BlockCommandItemWithSource, BlockElement, CommandItem, OnesEditor } from '../../types';
2
2
  export declare function executeEmbedBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item: CommandItem): unknown;
3
- export declare function executeBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item: CommandItem): unknown;
3
+ export declare function executeBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item: BlockCommandItemWithSource): unknown;
@@ -1,5 +1,5 @@
1
1
  import { BlockCommandItemWithSource, CommandParams, CommandResult, SelectionRange } from '../../types';
2
- export declare function getRangeCommands(range: SelectionRange): BlockCommandItemWithSource[];
2
+ export declare function getRangeCommands(range: SelectionRange, source: string): BlockCommandItemWithSource[];
3
3
  export declare function executeRangeCommand(range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams): {
4
4
  [index: string]: CommandResult;
5
5
  };
@@ -7,7 +7,7 @@ export default class EditorCommandProviders implements OnesEditorCommandProvider
7
7
  registerCommandProvider(provider: OnesEditorCommandProvider): void;
8
8
  getCommandProviders(): OnesEditorCommandProvider[];
9
9
  getCommandProvider(id: string): OnesEditorCommandProvider;
10
- getCommands(range: SelectionRange): BlockCommandItemWithSource[];
10
+ getCommands(range: SelectionRange, source: string): BlockCommandItemWithSource[];
11
11
  executeCommand(range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams): {
12
12
  [index: string]: import("../types").CommandResult;
13
13
  };
@@ -78,7 +78,7 @@ export interface InsertEmptyBlockOptions {
78
78
  containerId: string;
79
79
  blockIndex: number;
80
80
  data?: Record<string, unknown>;
81
- from?: 'block-menu' | 'quick-menu';
81
+ from?: 'block-menu' | 'quick-menu' | 'add-block-menu';
82
82
  }
83
83
  export interface EmbedOptions {
84
84
  name: string;
@@ -382,6 +382,9 @@ export interface OnesEditorEvents {
382
382
  'blur': (editor: OnesEditor) => void;
383
383
  'focus': (editor: OnesEditor) => void;
384
384
  'containerRemount': (editor: OnesEditor, containerId: string) => void;
385
+ 'beforeExecCommand': (editor: OnesEditor, command: CommandItem, option: {
386
+ source: string;
387
+ }) => void;
385
388
  }
386
389
  export interface OnesEditorSettingsProvider {
387
390
  getItem: (key: string) => string | null;
@@ -670,7 +673,7 @@ export interface OnesEditorCommandProviders {
670
673
  registerCommandProvider: (provider: OnesEditorCommandProvider) => void;
671
674
  getCommandProviders: () => OnesEditorCommandProvider[];
672
675
  getCommandProvider: (id: string) => OnesEditorCommandProvider;
673
- getCommands: (range: SelectionRange) => BlockCommandItemWithSource[];
676
+ getCommands: (range: SelectionRange, source: string) => BlockCommandItemWithSource[];
674
677
  executeCommand: (range: SelectionRange, item: BlockCommandItemWithSource, params: CommandParams) => {
675
678
  [index: string]: CommandResult;
676
679
  };
@@ -8,7 +8,7 @@ export declare function getImageDim(obj: ImageObject, buffer: ArrayBuffer): Prom
8
8
  width: number;
9
9
  height: number;
10
10
  buffer: ArrayBuffer;
11
- }>;
11
+ } | undefined>;
12
12
  export declare function reCalculateImageDims(dims: (ImageDimWithBuffer | undefined)[], maxWidth: number): {
13
13
  width: number;
14
14
  height: number;
@@ -64,7 +64,7 @@ export type BlockObject = {
64
64
  border: boolean;
65
65
  };
66
66
  export type CodeObject = BlockObject[][];
67
- export type ReadImageFunc = (appId: string, docId: string, image: string) => Promise<ArrayBuffer | undefined>;
67
+ export type ReadImageFunc = (appId: string, docId: string, image: string) => Promise<[ArrayBuffer | undefined, string]>;
68
68
  export type GetDocByBlockFunc = (appId: string, docId: string, block: DocBlock) => Promise<DocObject | undefined>;
69
69
  export type GetTextsByBoxFunc = (box: DocBlockTextOp) => Promise<DocBlockText | undefined>;
70
70
  export type MD5Func = (s: string) => string;