@ones-editor/editor 2.2.14-beta.2 → 2.2.14-beta.20

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 (28) hide show
  1. package/@ones-editor/comments/src/types.d.ts +5 -0
  2. package/@ones-editor/core/src/core/types.d.ts +2 -3
  3. package/@ones-editor/drawio-embed/src/dom/toast.d.ts +2 -0
  4. package/@ones-editor/drawio-embed/src/helper/paste-handler.d.ts +8 -0
  5. package/@ones-editor/drawio-embed/src/index.d.ts +2 -1
  6. package/@ones-editor/embed-block-helper/src/block-resizer/index.d.ts +6 -1
  7. package/@ones-editor/exclusive-block/src/index.d.ts +2 -0
  8. package/@ones-editor/graph-embed/src/command.d.ts +5 -2
  9. package/@ones-editor/graph-embed/src/helper/graph-base.d.ts +6 -2
  10. package/@ones-editor/graph-embed/src/helper/graph-dom/code-editor.d.ts +3 -1
  11. package/@ones-editor/graph-embed/src/helper/graph-exclusive-handler.d.ts +13 -0
  12. package/@ones-editor/graph-embed/src/helper/utils.d.ts +4 -0
  13. package/@ones-editor/graph-embed/src/mermaid/mermaid.d.ts +1 -0
  14. package/@ones-editor/graph-embed/src/types.d.ts +3 -0
  15. package/@ones-editor/image-embed/src/types.d.ts +0 -1
  16. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  17. package/@ones-editor/ui/src/providers/insert-menu.d.ts +2 -2
  18. package/@ones-editor/ui/src/providers/utils/add-section.d.ts +9 -0
  19. package/@ones-editor/ui/src/providers/utils/index.d.ts +2 -0
  20. package/@ones-editor/ui/src/quick-menu/quick-command-providers.d.ts +3 -3
  21. package/@ones-editor/ui/src/quick-menu/types.d.ts +2 -2
  22. package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +1 -0
  23. package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +1 -1
  24. package/@ones-editor/ui-base/src/toast/index.d.ts +3 -1
  25. package/dist/custom/image-preview-handler.d.ts +11 -0
  26. package/dist/index.js +2051 -1579
  27. package/dist/types.d.ts +1 -0
  28. package/package.json +1 -1
@@ -1,4 +1,7 @@
1
1
  import { DocObject, LocalDoc, OnesEditor, OnesEditorComment } from '../../../@ones-editor/core';
2
+ type EditorEvents = {
3
+ onPreviewImage?: (editor: OnesEditor, img: HTMLImageElement) => void;
4
+ };
2
5
  export type CommentData = {
3
6
  [p in string]: unknown;
4
7
  };
@@ -18,6 +21,7 @@ export interface OnesEditorCommentOptions {
18
21
  onUpdateLayout?: (editor: OnesEditor, data: CommentData) => void;
19
22
  onCommentCountChange?: (count: number) => void;
20
23
  onCommentEditorClick?: (editor: OnesEditor, event: MouseEvent) => void;
24
+ events?: EditorEvents;
21
25
  componentsOptions?: {
22
26
  [index: string]: unknown;
23
27
  };
@@ -59,3 +63,4 @@ export interface MiniCommentGroup {
59
63
  commentIds: CommentIds;
60
64
  }
61
65
  export type MiniCommentGroups = MiniCommentGroup[];
66
+ export {};
@@ -93,7 +93,6 @@ export interface EmbedOptions {
93
93
  }
94
94
  export interface Embed {
95
95
  embedType: string;
96
- adjustableMinHeight?: number;
97
96
  createEmbedContent: (editor: OnesEditor, content: BlockContentElement, block: DocEmbedBlock, path: BlockPath, container: ContainerElement, blockElement: BlockElement) => void;
98
97
  convertTo?: (editor: OnesEditor, blockData: DocEmbedBlock, doc: DocObject, type: 'text' | 'html' | 'markdown') => string;
99
98
  getBlockProperties?: (editor: OnesEditor, block: BlockElement) => BlockProperties;
@@ -729,7 +728,7 @@ export interface OnesEditorCommandProvider {
729
728
  id: string;
730
729
  groupIndex?: number;
731
730
  getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange, params?: CommandParams) => CommandItem[];
732
- getInsertCommands?: (editor: OnesEditor, containerId: string) => CommandItem[];
731
+ getInsertCommands?: (editor: OnesEditor, containerId: string, params?: CommandParams) => CommandItem[];
733
732
  executeInsertCommand?: (editor: OnesEditor, containerId: string, blockIndex: number, item: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
734
733
  executeRangeCommand?: (editor: OnesEditor, range: SelectionRange, command: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
735
734
  executeCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
@@ -751,7 +750,7 @@ export interface OnesEditorCommandProviders {
751
750
  registerCommandProvider: (provider: OnesEditorCommandProvider) => void;
752
751
  getCommandProviders: () => OnesEditorCommandProvider[];
753
752
  getCommandProvider: (id: string) => OnesEditorCommandProvider;
754
- getCommands: (range: SelectionRange) => CommandItemWithSource[];
753
+ getCommands: (range: SelectionRange, params?: CommandParams) => CommandItemWithSource[];
755
754
  executeCommand: (range: SelectionRange, item: CommandItemWithSource, params: CommandParams) => {
756
755
  [index: string]: CommandResult;
757
756
  };
@@ -0,0 +1,2 @@
1
+ import './toast.scss';
2
+ export declare const showWarnToast: (exit: () => void) => () => void;
@@ -0,0 +1,8 @@
1
+ import { DocObject, OnesEditor, OnesEditorCustom, OnesEditorInputHandler } from '../../../../@ones-editor/core';
2
+ export declare class DrawioPasteHandler implements OnesEditorInputHandler, OnesEditorCustom {
3
+ private editor;
4
+ constructor(editor: OnesEditor);
5
+ isSameOrigin(editor: OnesEditor, doc: DocObject, src: string): boolean;
6
+ handleBeforePasteDoc: (editor: OnesEditor, doc: DocObject) => Promise<boolean>;
7
+ destroy(): void;
8
+ }
@@ -1,5 +1,6 @@
1
1
  import DrawioEmbed from './drawio-embed';
2
+ import { DrawioPasteHandler } from './helper/paste-handler';
2
3
  import './style.scss';
3
- export { DrawioEmbed, };
4
+ export { DrawioEmbed, DrawioPasteHandler, };
4
5
  export * from '../types';
5
6
  export * from './utils/download-object';
@@ -1,5 +1,9 @@
1
1
  import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
2
2
  import { BlockResizer } from '../../../../@ones-editor/block-resizer';
3
+ interface EmbedBlockResizerOptions {
4
+ maxHeight?: number;
5
+ minHeight?: number;
6
+ }
3
7
  export declare class EmbedBlockResizer {
4
8
  private editor;
5
9
  private resizing;
@@ -13,5 +17,6 @@ export declare class EmbedBlockResizer {
13
17
  tryEnableResizer(block: BlockElement): void;
14
18
  disableResizer(): void;
15
19
  static get(editor: OnesEditor): EmbedBlockResizer;
16
- static register(editor: OnesEditor, block: BlockElement): EmbedBlockResizer;
20
+ static register(editor: OnesEditor, block: BlockElement, options?: EmbedBlockResizerOptions): EmbedBlockResizer;
17
21
  }
22
+ export {};
@@ -2,6 +2,8 @@ import { OnesEditorExclusiveBlock } from './exclusive-block';
2
2
  import BlockExclusiveHook from './exclusive-block-hook';
3
3
  import './exclusive-block-styles.scss';
4
4
  import './locale';
5
+ import { ExclusiveBlockMessage } from './types';
6
+ export type { ExclusiveBlockMessage };
5
7
  export { isExclusiveBlock } from './exclusive-dom';
6
8
  export { exclusiveBlock, unexclusiveBlock } from './exclusive-block';
7
9
  export { BlockExclusiveHook, OnesEditorExclusiveBlock };
@@ -1,6 +1,9 @@
1
- import { AddMenuCommand, QuickMenuCommandBetween, QuickMenuCommandInline, QuickMenuCommandProvider } from '../../../@ones-editor/ui';
1
+ import { AddMenuCommand, QuickMenuCommandBetween, QuickMenuCommandInline, QuickMenuCommandParams, QuickMenuCommandProvider } from '../../../@ones-editor/ui';
2
2
  import { CommandItem, OnesEditor } from '../../../@ones-editor/core';
3
3
  export declare class GraphCommandProvider implements QuickMenuCommandProvider {
4
- getCommands: (editor: OnesEditor) => CommandItem[];
4
+ id: string;
5
+ name: string;
6
+ getCommands: (editor: OnesEditor, params?: QuickMenuCommandParams) => CommandItem[];
7
+ checkCommandId: (id: string) => boolean;
5
8
  executeCommand: (editor: OnesEditor, item: CommandItem, params: QuickMenuCommandInline | QuickMenuCommandBetween | AddMenuCommand) => Promise<null>;
6
9
  }
@@ -14,15 +14,19 @@ export default abstract class GraphBase {
14
14
  private drawHandler?;
15
15
  private get block();
16
16
  constructor(editor: OnesEditor);
17
+ private handleExclusiveBlock;
17
18
  private handleReadonlyChanged;
18
19
  destroy(): void;
19
20
  private updateLayoutData;
20
- private handleEditChange;
21
+ private handleInputChange;
21
22
  private handleFlexChange;
22
23
  private getRealView;
23
24
  private hasChanged;
24
25
  private handleBlockFocus;
25
- createEmbedContent(content: BlockContentElement, blockData: DocEmbedBlock): void;
26
+ private handleClick;
27
+ private handleSelectionChanged;
28
+ private handleInputFocusChange;
29
+ createEmbedContent(blockContent: BlockContentElement, blockData: DocEmbedBlock): void;
26
30
  private updateHeight;
27
31
  private updateLayout;
28
32
  private updateDraw;
@@ -1,2 +1,4 @@
1
+ import { BlockElement } from '../../../../../@ones-editor/core';
1
2
  export type OnChange = (codeValue: string) => void;
2
- export declare const createCodeEditor: (parent: HTMLElement, codeValue: string, onChange: OnChange) => void;
3
+ export declare const createCodeEditor: (parent: HTMLElement, codeValue: string, onChange: OnChange, onActiveChange: (focused: boolean) => void) => void;
4
+ export declare const getCodeEditor: (block: BlockElement) => HTMLTextAreaElement;
@@ -0,0 +1,13 @@
1
+ import { OnesEditor, OnesEditorCustom, OnesEditorDocCallbacks } from '../../../../@ones-editor/core';
2
+ import { TypedEmitter } from 'tiny-typed-emitter';
3
+ type OnExclusiveBlock = (blockId: string, exclusive: boolean) => void;
4
+ export declare class GraphExclusiveHandler extends TypedEmitter<{
5
+ onExclusiveBlock: OnExclusiveBlock;
6
+ }> implements OnesEditorCustom, OnesEditorDocCallbacks {
7
+ private editor;
8
+ constructor(editor: OnesEditor);
9
+ destroy(): void;
10
+ onCustomMessage: (msg: unknown) => void;
11
+ static get(editor: OnesEditor): GraphExclusiveHandler;
12
+ }
13
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface PromiseHelper {
2
+ isDelayComplete: boolean;
3
+ }
4
+ export declare const enhanceAsync: <T extends any[], R>(asyncFunction: (promiseHelper: PromiseHelper, ...args: T) => Promise<R>) => (this: any, ...args: T) => Promise<R>;
@@ -5,6 +5,7 @@ export declare class MermaidInstance extends GraphBase {
5
5
  static graphType: GraphType;
6
6
  protected graphType: GraphType;
7
7
  static get(editor: OnesEditor, id: string): MermaidInstance;
8
+ static destroyCustom(editor: OnesEditor, id: string): void;
8
9
  code2ObjectUrl(code: string): Promise<string>;
9
10
  code2ResourceId(code: string): Promise<string>;
10
11
  static createEmptyEmbedData: () => {
@@ -3,16 +3,19 @@ import { StandardEmbedBlockProperties } from '../../../@ones-editor/embed-block-
3
3
  export type MermaidEmbedOptions = {
4
4
  cdn?: {
5
5
  mermaid?: string;
6
+ helpLink?: string;
6
7
  };
7
8
  };
8
9
  export type FlowCharEmbedOptions = {
9
10
  cdn?: {
10
11
  flowchart?: string[];
12
+ helpLink?: string;
11
13
  };
12
14
  };
13
15
  export type PlantumlEmbedOptions = {
14
16
  cdn?: {
15
17
  plantuml?: string;
18
+ helpLink?: string;
16
19
  };
17
20
  };
18
21
  export interface GraphCommandItem extends CommandItem {
@@ -6,7 +6,6 @@ export interface ImageOptions {
6
6
  callbacks?: {
7
7
  onError?: (editor: OnesEditor, error: Error) => void;
8
8
  };
9
- onPreview?: (editor: OnesEditor, event: MouseEvent) => void;
10
9
  }
11
10
  export interface ImageEmbedData extends DocEmbedData {
12
11
  src: string | string[];