@ones-editor/editor 2.0.7-beta.0 → 2.0.7

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 (26) hide show
  1. package/@ones-editor/context-menu/src/helper/utils.d.ts +1 -0
  2. package/@ones-editor/core/src/core/composition/editor-input.d.ts +2 -2
  3. package/@ones-editor/core/src/core/doc/doc.d.ts +2 -2
  4. package/@ones-editor/core/src/core/editor/actions/update-block-data.d.ts +2 -2
  5. package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +2 -2
  6. package/@ones-editor/core/src/core/types.d.ts +2 -2
  7. package/@ones-editor/core/src/core/undo-manager/undo-manager.d.ts +2 -0
  8. package/@ones-editor/core/src/utils/clipboard.d.ts +6 -4
  9. package/@ones-editor/drawio-embed/src/lang/en-us.d.ts +1 -0
  10. package/@ones-editor/drawio-embed/src/lang/ja-jp.d.ts +1 -0
  11. package/@ones-editor/drawio-embed/src/lang/zh-cn.d.ts +1 -0
  12. package/@ones-editor/misc/src/re-auth/index.d.ts +7 -2
  13. package/@ones-editor/misc/src/re-auth/locale/en-us.d.ts +1 -0
  14. package/@ones-editor/misc/src/re-auth/locale/ja-jp.d.ts +1 -0
  15. package/@ones-editor/misc/src/re-auth/locale/zh-cn.d.ts +1 -0
  16. package/@ones-editor/misc/src/re-auth/ui/toolbar.d.ts +2 -0
  17. package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +2 -0
  18. package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +1 -1
  19. package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +1 -1
  20. package/@ones-editor/table-block/src/table-block/border-bar/table-border-bar-handler.d.ts +1 -0
  21. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  22. package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +2 -0
  23. package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +2 -2
  24. package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -0
  25. package/dist/index.js +202 -202
  26. package/package.json +2 -2
@@ -2,4 +2,5 @@ export declare function blobToString(blob: Blob): Promise<string>;
2
2
  export declare function isClipboardEmpty(): Promise<boolean>;
3
3
  export declare function saveAs(resourceUrl: string, resourceId: string): void;
4
4
  export declare function blob2String(blob: Blob): Promise<string>;
5
+ export declare function getRandomFileName(mimeType: string, length?: number): string;
5
6
  export declare function getClipboardData(): Promise<DataTransfer>;
@@ -27,11 +27,11 @@ export declare class EditorInput implements OnesEditorInput {
27
27
  callbacks: EditorInputCallbacks;
28
28
  inputElement: HTMLInputElement;
29
29
  constructor(editor: OnesEditor, callbacks: EditorInputCallbacks);
30
- private isInCommandbar;
30
+ private isInCommandBar;
31
31
  destroy(): void;
32
32
  getInput(): HTMLInputElement;
33
33
  focus(): void;
34
- isInDisableScrollMask(target: HTMLElement): boolean;
34
+ isInDisableScrollMask(target: Node): boolean;
35
35
  handleWindowBlur: () => void;
36
36
  handleWindowFocus: () => void;
37
37
  handleDocumentClick: (event: MouseEvent) => void;
@@ -227,7 +227,7 @@ export interface OnesEditorDoc extends OnesEditorDocServer {
227
227
  findContainerBlocks: (containerId: string) => DocBlock[] | null;
228
228
  getBlockData: (containerId: string, blockIndex: number) => DocBlock;
229
229
  localUpdateBlockText: (containerId: string, blockIndex: number, actions: DocBlockTextActions, options?: UpdateBlockOptions) => DocBlockText;
230
- localUpdateBlockData: (containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange) => DocBlock;
230
+ localUpdateBlockData: (containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange, options?: UpdateBlockOptions) => DocBlock;
231
231
  localInsertBlock: (containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange, options?: InsertBlockOptions) => DocBlock;
232
232
  localDeleteBlock: (containerId: string, blockIndex: number, newRange: OnesEditorDocRange) => DocBlock;
233
233
  localInsertChildContainers: (containers: {
@@ -244,7 +244,7 @@ export interface OnesEditorDoc extends OnesEditorDocServer {
244
244
  recognizeLink?: (link: string) => Promise<RecognizeLinkResult>;
245
245
  beginBatchUpdate: () => number;
246
246
  endBatchUpdate: () => number;
247
- triggerReAuth?: () => void;
247
+ triggerReAuth?: (auto?: boolean) => void;
248
248
  }
249
249
  export interface OnesEditorDocHistoryData {
250
250
  user: {
@@ -1,4 +1,4 @@
1
- import { DocBlock, DocBlockAttributes, DocEmbedData, OnesEditorDocRange } from '../../doc';
1
+ import { DocBlock, DocBlockAttributes, DocEmbedData, OnesEditorDocRange, UpdateBlockOptions } from '../../doc';
2
2
  import { BlockElement, OnesEditor, SelectionRange } from '../../types';
3
- export declare function editorUpdateBlockData(editor: OnesEditor, block: BlockElement, data: DocBlockAttributes, newRange: OnesEditorDocRange): DocBlock;
3
+ export declare function editorUpdateBlockData(editor: OnesEditor, block: BlockElement, data: DocBlockAttributes, newRange: OnesEditorDocRange, options?: UpdateBlockOptions): DocBlock;
4
4
  export declare function editorUpdateEmbedData(editor: OnesEditor, block: BlockElement, data: DocEmbedData, newRange?: SelectionRange): DocBlock;
@@ -16,7 +16,7 @@ export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> im
16
16
  getBlockData(containerId: string, blockIndex: number): DocBlock;
17
17
  verifyBlockWritable(containerId: string, blockIndex: number): void;
18
18
  localUpdateBlockText(containerId: string, blockIndex: number, actions: DocBlockTextActions, options?: UpdateBlockOptions): DocBlockText;
19
- localUpdateBlockData(containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange): DocBlock;
19
+ localUpdateBlockData(containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange, options?: UpdateBlockOptions): DocBlock;
20
20
  localInsertBlock(containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange, options?: InsertBlockOptions): DocBlock;
21
21
  localDeleteBlock(containerId: string, blockIndex: number, newRange: OnesEditorDocRange): DocBlock;
22
22
  localDeleteChildContainers(containerIds: string[]): void;
@@ -42,7 +42,7 @@ export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> im
42
42
  broadcastMessage(data: unknown): void;
43
43
  getUser(): import("../doc").OnesEditorUser;
44
44
  getRemoteUsers(): import("../doc").OnesEditorRemoteUsers;
45
- triggerReAuth(): void | undefined;
45
+ triggerReAuth(auto?: boolean): void;
46
46
  destroy(): void;
47
47
  getServerMeta(): OnesEditorDocServerMeta;
48
48
  reset(doc: OnesEditorDoc): void;
@@ -1,5 +1,5 @@
1
1
  import { TypedEmitter } from 'tiny-typed-emitter';
2
- import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange } from './doc';
2
+ import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange, UpdateBlockOptions } from './doc';
3
3
  export type ContainerElement = HTMLDivElement & {
4
4
  __neverUse: 'ContainerElement';
5
5
  };
@@ -550,7 +550,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
550
550
  insertDocAt: (container: ContainerElement, blockIndex: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => BlockElement[];
551
551
  pasteDoc: (doc: DocObject) => Promise<void>;
552
552
  deleteChildContainers: (containerIds: string[]) => void;
553
- updateBlockData: (block: BlockElement, data: DocBlockAttributes, newRange?: SelectionRange) => DocBlock;
553
+ updateBlockData: (block: BlockElement, data: DocBlockAttributes, newRange?: SelectionRange, options?: UpdateBlockOptions) => DocBlock;
554
554
  updateEmbedData: (block: BlockElement, data: DocEmbedData, newRange?: SelectionRange) => DocBlock;
555
555
  updateBoxData: (boxData: DocBox, options?: InsertTextOptions) => void;
556
556
  updateCompositionText: (text: string, end: boolean) => void;
@@ -16,6 +16,8 @@ declare class UndoManager implements OnesEditorUndoManager, EditorDocLocalAction
16
16
  private endGroup;
17
17
  hasGroup(): boolean;
18
18
  runInGroup<T>(action: () => T): T;
19
+ private verifyPos;
20
+ private checkRange;
19
21
  undo(): boolean;
20
22
  redo(): boolean;
21
23
  canUndo(): boolean;
@@ -1,8 +1,10 @@
1
+ type ClipboardItemData = {
2
+ type: string;
3
+ data: string | Blob;
4
+ };
1
5
  export declare function setClipboardDataByEvent(items: {
2
6
  type: string;
3
7
  data: string;
4
8
  }[], event: ClipboardEvent): Promise<boolean>;
5
- export declare function setClipboardData(items: {
6
- type: string;
7
- data: string | Blob;
8
- }[]): Promise<boolean>;
9
+ export declare function setClipboardData(items: ClipboardItemData[]): Promise<boolean>;
10
+ export {};
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  errorTips: string;
8
8
  errorSubTips: string;
9
9
  retry: string;
10
+ save: string;
10
11
  };
11
12
  };
12
13
  export default _default;
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  errorTips: string;
8
8
  errorSubTips: string;
9
9
  retry: string;
10
+ save: string;
10
11
  };
11
12
  };
12
13
  export default _default;
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  errorTips: string;
8
8
  errorSubTips: string;
9
9
  retry: string;
10
+ save: string;
10
11
  };
11
12
  };
12
13
  export default _default;
@@ -1,14 +1,19 @@
1
1
  import { TypedEmitter } from 'tiny-typed-emitter';
2
- import type { OnesEditor, OnesEditorCustom, OnesEditorDocCallbacks } from '../../../../@ones-editor/core';
2
+ import { OnesEditor, OnesEditorCustom, OnesEditorDocCallbacks } from '../../../../@ones-editor/core';
3
3
  import ReAuthToolbar from './ui/toolbar';
4
4
  import './locale';
5
5
  type EventCallback = (() => void) | undefined;
6
6
  declare const DOC_RE_AUTH_KEYS = "doc-re-auth-event";
7
- declare class DocReAuthCallbacks extends TypedEmitter implements OnesEditorCustom, OnesEditorDocCallbacks {
7
+ type ReAuthEvent = {
8
+ tokenExpired: () => void;
9
+ };
10
+ declare class DocReAuthCallbacks extends TypedEmitter<ReAuthEvent> implements OnesEditorCustom, OnesEditorDocCallbacks {
8
11
  private editor;
9
12
  private authErrorCallback;
10
13
  private authRecoverCallback;
14
+ reAuthToolbar: ReAuthToolbar;
11
15
  constructor(editor: OnesEditor);
16
+ handleReAuth: () => void;
12
17
  addAuthListen(event: 'authError' | 'authRecover', callback: EventCallback): void;
13
18
  removeListeners(): void;
14
19
  destroy: () => void;
@@ -1,6 +1,7 @@
1
1
  declare const _default: {
2
2
  authError: {
3
3
  tips: string;
4
+ successTips: string;
4
5
  };
5
6
  };
6
7
  export default _default;
@@ -1,6 +1,7 @@
1
1
  declare const _default: {
2
2
  authError: {
3
3
  tips: string;
4
+ successTips: string;
4
5
  };
5
6
  };
6
7
  export default _default;
@@ -1,6 +1,7 @@
1
1
  declare const _default: {
2
2
  authError: {
3
3
  tips: string;
4
+ successTips: string;
4
5
  };
5
6
  };
6
7
  export default _default;
@@ -4,7 +4,9 @@ export default class ReAuthToolbar {
4
4
  private editor;
5
5
  private isShown;
6
6
  private currentBlock;
7
+ private fixedToolbar;
7
8
  constructor(editor: OnesEditor);
8
9
  render(block: BlockElement, onExit?: () => void): void;
10
+ succeedRender: () => void;
9
11
  destroy(): void;
10
12
  }
@@ -28,6 +28,8 @@ export declare class AuthConnection {
28
28
  logout(): Promise<void>;
29
29
  init(auth: AuthMessage): Promise<void>;
30
30
  reConnect(token: string): Promise<void>;
31
+ _autoReAuth(): Promise<void>;
32
+ autoReAuth(): Promise<void>;
31
33
  handleAuthError(): Promise<void>;
32
34
  reAuth: () => Promise<void>;
33
35
  private emitPermissionError;
@@ -54,5 +54,5 @@ export default class ShareDBClient {
54
54
  recognizeLink(url: string): Promise<LinkDetails>;
55
55
  private getResourceId;
56
56
  buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
57
- reAuth(): void;
57
+ reAuth(auto?: boolean): void;
58
58
  }
@@ -107,5 +107,5 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
107
107
  recognizeLink(url: string): Promise<import("../types").LinkDetails>;
108
108
  parseHistoryData(historyData: OnesEditorDocHistoryData, handler: OnesEditorHistoryDataParseHandler): void;
109
109
  getServerMeta(): OnesEditorDocServerMeta;
110
- triggerReAuth(): void;
110
+ triggerReAuth(auto?: boolean): void;
111
111
  }
@@ -10,6 +10,7 @@ export declare class TableBlockBorderHandler {
10
10
  show(tableBlock: BlockElement): void;
11
11
  update(): void;
12
12
  closeToolbar(): void;
13
+ isInBlock: (block: BlockElement, event: MouseEvent) => boolean;
13
14
  hide(): void;
14
15
  }
15
16
  export declare function handleTableBorderBar(editor: OnesEditor, type: 'create' | 'update'): void;