@ones-editor/editor 2.3.1 → 2.3.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.
@@ -0,0 +1,21 @@
1
+ import { OnesEditor, OnesEditorCustom } from '../../../../@ones-editor/core';
2
+ import { EmojiPalette } from '../../../../@ones-editor/ui-base';
3
+ export interface EmojiPopupCallbacks {
4
+ onSelectEmoji: (emoji: string, closePopup: VoidFunction) => void;
5
+ onClose: VoidFunction;
6
+ }
7
+ export declare class EmojiPopup implements OnesEditorCustom {
8
+ private editor;
9
+ private popup;
10
+ private popupContent;
11
+ emojiPalette: EmojiPalette;
12
+ private latestPopupCallbacks;
13
+ constructor(editor: OnesEditor);
14
+ private closePopup;
15
+ private handleEmojiSelect;
16
+ private handlePopupClose;
17
+ private populateEmojiPopupContent;
18
+ setCallbacks(callbacks: EmojiPopupCallbacks): void;
19
+ show(rect: DOMRect): void;
20
+ destroy(): void;
21
+ }
@@ -0,0 +1,8 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ import { EmojiPopupCallbacks } from './emoji-popup';
3
+ export interface ShowEmojiPopupOptions extends EmojiPopupCallbacks {
4
+ currentEmoji?: string;
5
+ anchor: HTMLElement;
6
+ }
7
+ declare function showEmojiPopup(editor: OnesEditor, options: ShowEmojiPopupOptions): void;
8
+ export { showEmojiPopup, };
@@ -36,6 +36,7 @@ import { ReadonlyToolbar } from './readonly-toolbar';
36
36
  import { ReadonlyToolbarCommandProvider, ReadonlyCommandOptions } from './readonly-toolbar/types';
37
37
  import { AddCommentToOldDocCommandProvider } from './readonly-toolbar/add-comment-to-old-doc';
38
38
  import ClipboardProvider from './providers/clipboard-provider';
39
+ export { showEmojiPopup } from './emoji-popup';
39
40
  export * from './providers/utils/clipboard';
40
41
  export * from './providers/utils';
41
42
  export * from './box-helper/standard-box-commands';
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  inlineBox: {
14
14
  math: string;
15
15
  link: string;
16
+ emoji: string;
16
17
  };
17
18
  };
18
19
  link: {
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  inlineBox: {
14
14
  math: string;
15
15
  link: string;
16
+ emoji: string;
16
17
  };
17
18
  };
18
19
  link: {
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  inlineBox: {
14
14
  math: string;
15
15
  link: string;
16
+ emoji: string;
16
17
  };
17
18
  };
18
19
  link: {
@@ -0,0 +1,12 @@
1
+ import { BlockElement, CommandItem, CommandParams, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../@ones-editor/core';
2
+ export declare class EmojiProvider implements OnesEditorCommandProvider {
3
+ private editor;
4
+ id: string;
5
+ constructor(editor: OnesEditor);
6
+ create(): CommandItem[];
7
+ isDisabled: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => boolean;
8
+ getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange, params?: CommandParams) => CommandItem[];
9
+ getInsertCommands: () => CommandItem[];
10
+ executeCommand: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem) => boolean;
11
+ executeInsertCommand(editor: OnesEditor, containerId: string, blockIndex: number, item: CommandItem): boolean;
12
+ }
@@ -11,9 +11,8 @@ export declare class EmojiItem implements CommandItem, OnesEditorCustom {
11
11
  childrenPlacement: "bottom-start";
12
12
  childrenMenuId: string;
13
13
  closeable: Closeable;
14
- constructor();
14
+ constructor(editor: OnesEditor);
15
15
  beforePopup(): void;
16
16
  setCloseable(closeable: Closeable): void;
17
17
  destroy(): void;
18
- static get(editor: OnesEditor): EmojiItem;
19
18
  }
@@ -0,0 +1,3 @@
1
+ import './index.scss';
2
+ import { EmojiPaletteOptions } from './types';
3
+ export declare function defaultPaletteRenderer(parent: HTMLDivElement, options: EmojiPaletteOptions): () => void;
@@ -1,23 +1,20 @@
1
- import { CommandItem } from '../../../../@ones-editor/core';
1
+ import { CommandItem, OnesEditor } from '../../../../@ones-editor/core';
2
2
  import { TypedEmitter } from 'tiny-typed-emitter';
3
3
  import './index.scss';
4
- export interface EmojiPaletteEvents {
4
+ export type { OnesEditorEmojiPaletteOptions, EmojiSelectedHandler } from './types';
5
+ interface EmojiPaletteEvents {
5
6
  onSelectEmoji: (emoji: string) => void;
6
7
  }
7
8
  export declare class EmojiPalette extends TypedEmitter<EmojiPaletteEvents> implements CommandItem {
9
+ private editor;
8
10
  id: string;
9
11
  name: string;
10
12
  element: HTMLDivElement;
11
- private emojiData;
12
- private emojiSearch;
13
- private emojiContent;
14
- private emojiNavigation;
15
- constructor();
16
- private initEmojiData;
17
- private handleSearch;
18
- private handleEmojiSelect;
19
- private handleSelectCategory;
20
- private handleCategoryReach;
21
- updateComponents(): void;
13
+ private currentEmoji;
14
+ private unmountPalette;
15
+ constructor(editor: OnesEditor);
16
+ private renderPalette;
17
+ render(): Promise<void>;
18
+ setCurrentEmoji(emoji: string): void;
22
19
  destroy(): void;
23
20
  }
@@ -0,0 +1,10 @@
1
+ export type EmojiSelectedHandler = (emoji: string) => void;
2
+ export type EmojiPaletteOptions = {
3
+ emoji: string;
4
+ onSelectEmoji: EmojiSelectedHandler;
5
+ };
6
+ export type UnmountPalette = () => void;
7
+ export type EmojiPaletteRenderer = (parent: HTMLDivElement, options: EmojiPaletteOptions) => UnmountPalette;
8
+ export type OnesEditorEmojiPaletteOptions = {
9
+ emojiPaletteRenderer: EmojiPaletteRenderer;
10
+ };
@@ -18,4 +18,6 @@ export * from './emoji-item';
18
18
  export * from './mobile-command-bar/mobile-bottom-menu';
19
19
  export * from './text-button';
20
20
  export { scrollBarIntoView } from './mobile-command-bar/scroll-into-view';
21
+ export { EmojiPalette } from './emoji-palette';
22
+ export type { OnesEditorEmojiPaletteOptions, EmojiSelectedHandler } from './emoji-palette';
21
23
  export { tippy, };
package/dist/index.d.ts CHANGED
@@ -83,6 +83,7 @@ export declare function getDefaultOnesEditorOptions(options: CreateOnesEditorOpt
83
83
  link?: import("@ones-editor/ui/src/link-popup").LinkOptions | undefined;
84
84
  columns?: import("@ones-editor/layout-block/src/types").EditorConfigLayoutOptions | undefined;
85
85
  mobile?: import("@ones-editor/core").MobileClient | undefined;
86
+ emojiPalette?: import("@ones-editor/ui-base").OnesEditorEmojiPaletteOptions | undefined;
86
87
  };
87
88
  };
88
89
  shortcuts: import("@ones-editor/core").ShortcutRecords[];