@ones-editor/editor 2.9.7 → 2.9.8-beta.10

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/@ones-editor/cke-html/package.json +7 -0
  2. package/@ones-editor/cke-html/src/html/cke-html.d.ts +4 -0
  3. package/@ones-editor/cke-html/src/html/combine-html.d.ts +2 -0
  4. package/@ones-editor/cke-html/src/html/comment.d.ts +6 -0
  5. package/@ones-editor/cke-html/src/html/converter.d.ts +7 -0
  6. package/@ones-editor/cke-html/src/html/data-helper/link-data.d.ts +0 -0
  7. package/@ones-editor/cke-html/src/html/image.d.ts +4 -0
  8. package/@ones-editor/cke-html/src/html/link.d.ts +2 -0
  9. package/@ones-editor/cke-html/src/html/markdown.d.ts +2 -0
  10. package/@ones-editor/cke-html/src/html/mention.d.ts +4 -0
  11. package/@ones-editor/cke-html/src/index.d.ts +2 -0
  12. package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -0
  13. package/@ones-editor/core/src/core/doc/doc.d.ts +3 -1
  14. package/@ones-editor/core/src/core/input-handler/remove-unknown-components.d.ts +3 -0
  15. package/@ones-editor/core/src/core/types.d.ts +1 -0
  16. package/@ones-editor/core/src/users/remote-users.d.ts +1 -1
  17. package/@ones-editor/main-toolbar/src/index.d.ts +8 -1
  18. package/@ones-editor/main-toolbar/src/items/file.d.ts +8 -0
  19. package/@ones-editor/main-toolbar/src/items/index.d.ts +4 -2
  20. package/@ones-editor/main-toolbar/src/items/mention.d.ts +8 -0
  21. package/@ones-editor/main-toolbar/src/locale/en-us.d.ts +3 -0
  22. package/@ones-editor/main-toolbar/src/locale/ja-jp.d.ts +3 -0
  23. package/@ones-editor/main-toolbar/src/locale/zh-cn.d.ts +3 -0
  24. package/@ones-editor/main-toolbar/src/locale/zh-hant-hk.d.ts +3 -0
  25. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  26. package/@ones-editor/ui-base/src/command-bar/types.d.ts +13 -7
  27. package/@ones-editor/ui-base/src/icons/index.d.ts +3 -1
  28. package/dist/index.d.ts +2 -1
  29. package/dist/index.js +711 -164
  30. package/dist/types.d.ts +1 -0
  31. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@ones-editor/cke-html",
3
+ "version": "1.0.0",
4
+ "main": "./src/index.ts",
5
+ "license": "MIT",
6
+ "types": "src/index.d.ts"
7
+ }
@@ -0,0 +1,4 @@
1
+ import type { DocObject, OnesEditor } from '../../../../@ones-editor/core';
2
+ export declare function ckeHtml2Doc(html: string): DocObject;
3
+ export declare function injectDocToCkeHtmlFragment(htmlFragment: string, doc: DocObject, text?: string): string;
4
+ export declare function editorToCKEHtml(editor: OnesEditor): string;
@@ -0,0 +1,2 @@
1
+ export declare function combineCkeHtml(html1: string, html2: string): string;
2
+ export declare function combineRichTextValue(value1: string, value2: string): string;
@@ -0,0 +1,6 @@
1
+ import type { DocObject, DocComment } from '../../../../@ones-editor/core';
2
+ import type { CkeHtmlConverter } from './converter';
3
+ export declare const CkeCommentConverter: CkeHtmlConverter;
4
+ export declare function processCkeCommentsLink(doc: DocObject): void;
5
+ export declare function convertAnnotateToComment(annotate: any): DocComment;
6
+ export declare function convertAnnotatesToComments(annotates: any[]): Record<string, DocComment>;
@@ -0,0 +1,7 @@
1
+ export interface CkeHtmlConverter {
2
+ filter: (node: Node) => boolean;
3
+ replacement: (content: any, node: HTMLElement) => string;
4
+ }
5
+ export declare function registerCKEHtmlConvert(name: string, converter: CkeHtmlConverter): void;
6
+ export declare function getTurndownRootElement(node: Node): Node;
7
+ export declare function patchForEmptyBlock(key: string, node: Node, className: string): void;
@@ -0,0 +1,4 @@
1
+ import type { OnesEditor } from '../../../../@ones-editor/core';
2
+ import type { CkeHtmlConverter } from './converter';
3
+ export declare const CkeImageConverter: CkeHtmlConverter;
4
+ export declare function patchImageConverter(editor: OnesEditor): void;
@@ -0,0 +1,2 @@
1
+ import type { DocObject } from '../../../../@ones-editor/core';
2
+ export declare function processLinks(doc: DocObject): void;
@@ -0,0 +1,2 @@
1
+ import type { CkeHtmlConverter } from './converter';
2
+ export declare const CkeMarkdownConverter: CkeHtmlConverter;
@@ -0,0 +1,4 @@
1
+ import { type OnesEditor } from '../../../../@ones-editor/core';
2
+ import { type CkeHtmlConverter } from './converter';
3
+ export declare const CkeMentionConverter: CkeHtmlConverter;
4
+ export declare function patchMentionConverter(editor: OnesEditor): void;
@@ -0,0 +1,2 @@
1
+ export * from './html/cke-html';
2
+ export * from './html/combine-html';
@@ -28,6 +28,7 @@ export declare class EditorInput implements OnesEditorInput {
28
28
  composingTimer: NodeJS.Timeout | undefined;
29
29
  callbacks: EditorInputCallbacks;
30
30
  inputElement: HTMLTextAreaElement;
31
+ private focused;
31
32
  constructor(editor: OnesEditor, callbacks: EditorInputCallbacks);
32
33
  private isInCommandBar;
33
34
  destroy(): void;
@@ -139,8 +139,10 @@ export interface OnesEditorDocCallbacks {
139
139
  onStatusChanged?: (status: OnesEditorDocStatus) => void;
140
140
  onError?: (error: Error) => void;
141
141
  }
142
+ export type OnesEditorResourceType = 'image' | 'media' | 'file' | 'graph' | 'paste' | 'unknown';
142
143
  export interface UploadResourceOptions {
143
144
  onProgress?: (progress: number) => void;
145
+ resourceType?: OnesEditorResourceType;
144
146
  }
145
147
  export interface UploadResourceResult {
146
148
  resourceId: string;
@@ -175,7 +177,7 @@ export interface OnesEditorRemoteUsers extends TypedEmitter<RemoteUsersEvents> {
175
177
  findUser: (userId: string) => OnesEditorUser | null;
176
178
  removeUser: (clientId: string) => void;
177
179
  updateUsers: (users: OnesEditorUser[]) => void;
178
- getSimpleCursors: (blockId: string) => Map<number, OnesEditorClientSelection[]>;
180
+ getSimpleCursors: (blockId: string, excludeUserId?: string) => Map<number, OnesEditorClientSelection[]>;
179
181
  getCursors: (blockId: string) => OnesEditorClientSelection[];
180
182
  onUpdateBlockText: (blockData: DocBlock, actions: DocBlockTextActions, local: boolean) => void;
181
183
  getFixedUserColor: (userId: string, type: 'flag' | 'selection') => string;
@@ -0,0 +1,3 @@
1
+ import { DocObject } from "../doc";
2
+ import { OnesEditor } from "../types";
3
+ export declare function removeUnknownComponents(editor: OnesEditor, doc: DocObject): void;
@@ -551,6 +551,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
551
551
  readonly settingsProvider: OnesEditorSettingsProvider;
552
552
  version: string;
553
553
  readonly: boolean;
554
+ destroyed: boolean;
554
555
  addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator<T>) => T;
555
556
  getCustom: <T extends OnesEditorCustom>(name: string) => T;
556
557
  replaceCustom: <T extends OnesEditorCustom>(name: string, newCustom: T) => T;
@@ -12,7 +12,7 @@ declare class RemoteUsers extends TypedEmitter<RemoteUsersEvents> implements One
12
12
  findUser(userId: string): OnesEditorUser | null;
13
13
  removeUser(clientId: string): void;
14
14
  updateUsers(users: OnesEditorUser[]): void;
15
- getSimpleCursors(blockId: string): Map<number, OnesEditorClientSelection[]>;
15
+ getSimpleCursors(blockId: string, excludeUserId?: string): Map<number, OnesEditorClientSelection[]>;
16
16
  getCursors(blockId: string): OnesEditorClientSelection[];
17
17
  onUpdateBlockText(blockData: DocBlock, actions: DocBlockTextActions, local: boolean): void;
18
18
  getFixedUserColor(userId: string, type: 'flag' | 'selection'): string;
@@ -5,10 +5,17 @@ import './locale';
5
5
  import './style.scss';
6
6
  export * from './types';
7
7
  export * from './items';
8
+ export interface MainToolbarOptions {
9
+ enableFullScreen?: boolean;
10
+ onFullScreenClick?: (editor: OnesEditor, item: CommandItem) => void;
11
+ }
8
12
  export declare class MainToolbar implements OnesEditorCustom {
9
13
  private editor;
14
+ private options;
10
15
  toolbar: FixedToolbar;
11
- constructor(editor: OnesEditor, parent: HTMLElement);
16
+ toolbarFullScreen?: FixedToolbar;
17
+ root: HTMLElement;
18
+ constructor(editor: OnesEditor, parent: HTMLElement, options?: MainToolbarOptions);
12
19
  destroy(): void;
13
20
  setItems(items: ToolbarItem[]): void;
14
21
  getItems(): ToolbarItem[];
@@ -0,0 +1,8 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ import { ToolbarItem } from '../types';
3
+ export declare class InsertFileItem implements ToolbarItem {
4
+ id: string;
5
+ name: string;
6
+ icon: string;
7
+ onClick(editor: OnesEditor, item: ToolbarItem): Promise<void>;
8
+ }
@@ -13,5 +13,7 @@ import { FindReplaceItem } from './find';
13
13
  import { CommentItem } from './comment';
14
14
  import { ColorItem } from './text-color';
15
15
  import { MoreItem } from './more-item';
16
- export declare function getToolbarDefaultItems(editor: OnesEditor): (FontBoldItem | FontItalicItem | FontUnderlineItem | FontStrikethroughItem | InlineCodeItem | SuperscriptItem | SubscriptItem | InsertImageItem | InsertLinkItem | OrderedListItem | UnorderedListItem | CheckListItem | ParagraphItem | QuoteItem | SeparatorItem | AlignLeftItem | AlignCenterItem | AlignRightItem | UndoItem | RedoItem | InsertItem | FindReplaceItem | CommentItem | ColorItem | MoreItem)[];
17
- export { UndoItem, RedoItem, FontBoldItem, FontItalicItem, FontUnderlineItem, FontStrikethroughItem, ColorItem, InlineCodeItem, SuperscriptItem, SubscriptItem, AlignLeftItem, AlignCenterItem, AlignRightItem, ParagraphItem, SeparatorItem, OrderedListItem, UnorderedListItem, CheckListItem, InsertImageItem, InsertLinkItem, QuoteItem, InsertItem, FindReplaceItem, CommentItem, MoreItem, };
16
+ import { InsertFileItem } from './file';
17
+ import { InsertMentionItem } from './mention';
18
+ export declare function getToolbarDefaultItems(editor: OnesEditor): (FontBoldItem | FontItalicItem | FontUnderlineItem | FontStrikethroughItem | InlineCodeItem | SuperscriptItem | SubscriptItem | InsertLinkItem | OrderedListItem | UnorderedListItem | CheckListItem | ParagraphItem | QuoteItem | SeparatorItem | AlignLeftItem | AlignCenterItem | AlignRightItem | UndoItem | RedoItem | InsertItem | FindReplaceItem | ColorItem)[];
19
+ export { UndoItem, RedoItem, FontBoldItem, FontItalicItem, FontUnderlineItem, FontStrikethroughItem, ColorItem, InlineCodeItem, SuperscriptItem, SubscriptItem, AlignLeftItem, AlignCenterItem, AlignRightItem, ParagraphItem, SeparatorItem, OrderedListItem, UnorderedListItem, CheckListItem, InsertImageItem, InsertFileItem, InsertLinkItem, QuoteItem, InsertItem, FindReplaceItem, CommentItem, MoreItem, InsertMentionItem, };
@@ -0,0 +1,8 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ import { ToolbarItem } from '../types';
3
+ export declare class InsertMentionItem implements ToolbarItem {
4
+ id: string;
5
+ name: string;
6
+ icon: string;
7
+ onClick(editor: OnesEditor, item: ToolbarItem): void;
8
+ }
@@ -10,6 +10,9 @@ declare const _default: {
10
10
  checkList: string;
11
11
  orderedList: string;
12
12
  unorderedList: string;
13
+ fullscreen: string;
14
+ file: string;
15
+ mention: string;
13
16
  };
14
17
  };
15
18
  export default _default;
@@ -10,6 +10,9 @@ declare const _default: {
10
10
  checkList: string;
11
11
  orderedList: string;
12
12
  unorderedList: string;
13
+ fullscreen: string;
14
+ file: string;
15
+ mention: string;
13
16
  };
14
17
  };
15
18
  export default _default;
@@ -10,6 +10,9 @@ declare const _default: {
10
10
  checkList: string;
11
11
  orderedList: string;
12
12
  unorderedList: string;
13
+ fullscreen: string;
14
+ file: string;
15
+ mention: string;
13
16
  };
14
17
  };
15
18
  export default _default;
@@ -10,6 +10,9 @@ declare const _default: {
10
10
  checkList: string;
11
11
  orderedList: string;
12
12
  unorderedList: string;
13
+ fullscreen: string;
14
+ file: string;
15
+ mention: string;
13
16
  };
14
17
  };
15
18
  export default _default;