@ones-editor/editor 1.1.2 → 1.1.3-bate.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.
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +22 -1
- package/@ones-editor/core/src/core/composition/index.d.ts +1 -1
- package/@ones-editor/core/src/core/doc/doc.d.ts +2 -0
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +1 -0
- package/@ones-editor/core/src/core/input-handler/actions.d.ts +0 -1
- package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +3 -4
- package/@ones-editor/core/src/core/keyboard/default-shortcuts.d.ts +1 -2
- package/@ones-editor/core/src/core/types.d.ts +0 -24
- package/@ones-editor/core/src/utils/dom-scroll.d.ts +1 -1
- package/@ones-editor/core/src/utils/index.d.ts +0 -1
- package/@ones-editor/drawio-embed/src/helper/iframe-embed-doc-event.d.ts +23 -0
- package/@ones-editor/drawio-embed/src/helper/index.d.ts +1 -1
- package/@ones-editor/drawio-embed/src/index.d.ts +1 -0
- package/@ones-editor/drawio-embed/src/lang/en-us.d.ts +3 -0
- package/@ones-editor/drawio-embed/src/lang/ja-jp.d.ts +3 -0
- package/@ones-editor/drawio-embed/src/lang/zh-cn.d.ts +3 -0
- package/@ones-editor/graph-embed/src/config/index.d.ts +1 -1
- package/@ones-editor/image-embed/src/shortcuts/index.d.ts +1 -2
- package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +4 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +2 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +2 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +0 -1
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +0 -1
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +1 -1
- package/dist/index.js +200 -204
- package/dist/types.d.ts +0 -2
- package/package.json +1 -1
- package/@ones-editor/context-menu/index.d.ts +0 -3
- package/@ones-editor/context-menu/package.json +0 -8
- package/@ones-editor/context-menu/src/helper/actions.d.ts +0 -5
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +0 -26
- package/@ones-editor/context-menu/src/helper/utils.d.ts +0 -3
- package/@ones-editor/context-menu/src/locale/en-us.d.ts +0 -14
- package/@ones-editor/context-menu/src/locale/index.d.ts +0 -1
- package/@ones-editor/context-menu/src/locale/ja-jp.d.ts +0 -14
- package/@ones-editor/context-menu/src/locale/zh-cn.d.ts +0 -14
- package/@ones-editor/context-menu/src/menu/index.d.ts +0 -17
- package/@ones-editor/core/src/utils/blob-to-string.d.ts +0 -1
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { OnesEditorInput, OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
2
|
-
import
|
|
2
|
+
import { DocObject } from '../doc';
|
|
3
|
+
export interface EditorInputCallbacks {
|
|
4
|
+
onInsertText: (event: Event, text: string) => void;
|
|
5
|
+
onCompositionStart: (event: Event) => void;
|
|
6
|
+
onUpdateCompositionText: (event: Event, text: string, end: boolean) => void;
|
|
7
|
+
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
8
|
+
onChanged: (action: OnesEditorUndoAction) => void;
|
|
9
|
+
onRemoteChanged: (type: RemoteChangeType) => void;
|
|
10
|
+
onFocus: () => void;
|
|
11
|
+
onBlur: () => void;
|
|
12
|
+
onPaste: (event: ClipboardEvent) => void;
|
|
13
|
+
onPasteText: (text: string, options?: PasteOptions) => void;
|
|
14
|
+
onCopy: (event: ClipboardEvent) => void;
|
|
15
|
+
onCut: (event: ClipboardEvent) => void;
|
|
16
|
+
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
17
|
+
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
18
|
+
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
19
|
+
defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
20
|
+
destroy: () => void;
|
|
21
|
+
pasteDoc: (doc: DocObject) => Promise<void>;
|
|
22
|
+
forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
|
|
23
|
+
}
|
|
3
24
|
export declare class EditorInput implements OnesEditorInput {
|
|
4
25
|
editor: OnesEditor;
|
|
5
26
|
composing: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment
|
|
1
|
+
export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment } from './clipboard/copy';
|
|
2
2
|
export { copyResourcesFromDoc } from './clipboard/resources/copy-resources';
|
|
@@ -109,6 +109,7 @@ export interface OnesEditorDocCallbacks {
|
|
|
109
109
|
onCustomMessage?: (msg: unknown) => void;
|
|
110
110
|
onStatusChanged?: (status: OnesEditorDocStatus) => void;
|
|
111
111
|
onError?: (error: Error) => void;
|
|
112
|
+
onAuthRecover?: () => void;
|
|
112
113
|
}
|
|
113
114
|
export interface UploadResourceOptions {
|
|
114
115
|
onProgress?: (progress: number) => void;
|
|
@@ -221,6 +222,7 @@ export interface OnesEditorDoc extends OnesEditorDocServer {
|
|
|
221
222
|
recognizeLink?: (link: string) => Promise<RecognizeLinkResult>;
|
|
222
223
|
beginBatchUpdate: () => number;
|
|
223
224
|
endBatchUpdate: () => number;
|
|
225
|
+
triggerReAuth?: () => void;
|
|
224
226
|
}
|
|
225
227
|
export interface OnesEditorDocHistoryData {
|
|
226
228
|
user: {
|
|
@@ -41,6 +41,7 @@ export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> im
|
|
|
41
41
|
broadcastMessage(data: unknown): void;
|
|
42
42
|
getUser(): import("../doc").OnesEditorUser;
|
|
43
43
|
getRemoteUsers(): import("../doc").OnesEditorRemoteUsers;
|
|
44
|
+
triggerReAuth(): void | undefined;
|
|
44
45
|
destroy(): void;
|
|
45
46
|
getServerMeta(): OnesEditorDocServerMeta;
|
|
46
47
|
reset(doc: OnesEditorDoc): void;
|
|
@@ -4,4 +4,3 @@ export declare function editorHandleDelete(editor: OnesEditor, event: Event): bo
|
|
|
4
4
|
export declare function editorHandleBackspace(editor: OnesEditor, event: Event): boolean;
|
|
5
5
|
export declare function editorHandleInsertBr(editor: OnesEditor, event: Event): boolean;
|
|
6
6
|
export declare function editorHandlePastePlainText(editor: OnesEditor): boolean;
|
|
7
|
-
export declare function editorHandleCopyMarkdown(editor: OnesEditor): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EditorInputCallbacks } from '../composition/editor-input';
|
|
2
|
+
import { OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
2
3
|
import { DocObject } from '../doc';
|
|
3
|
-
import type { EditorInputCallbacks } from '../types';
|
|
4
4
|
export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
5
5
|
editor: OnesEditor;
|
|
6
6
|
handlers: OnesEditorInputHandler[];
|
|
@@ -26,8 +26,7 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
|
26
26
|
defaultInsertText(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string): void;
|
|
27
27
|
defaultHandleKeydown(editor: OnesEditor, event: KeyboardEvent): boolean;
|
|
28
28
|
pasteDoc(doc: DocObject): Promise<void>;
|
|
29
|
-
pasteDocs
|
|
29
|
+
private pasteDocs;
|
|
30
30
|
destroy(): void;
|
|
31
31
|
forEach(cb: (handler: OnesEditorInputHandler) => void): void;
|
|
32
|
-
private getClipboardData;
|
|
33
32
|
}
|
|
@@ -391,7 +391,6 @@ export interface OnesEditorOptionalOptions {
|
|
|
391
391
|
colors?: string[];
|
|
392
392
|
scrollContainer?: HTMLElement;
|
|
393
393
|
enableComments?: boolean;
|
|
394
|
-
enableContextMenu?: boolean;
|
|
395
394
|
settingsProvider?: OnesEditorSettingsProvider;
|
|
396
395
|
}
|
|
397
396
|
export interface OnesEditorOptions {
|
|
@@ -400,7 +399,6 @@ export interface OnesEditorOptions {
|
|
|
400
399
|
[index: string]: unknown;
|
|
401
400
|
};
|
|
402
401
|
enableComments?: boolean;
|
|
403
|
-
enableContextMenu?: boolean;
|
|
404
402
|
scrollContainer?: HTMLElement;
|
|
405
403
|
}
|
|
406
404
|
export interface OnesEditorComponents {
|
|
@@ -569,32 +567,10 @@ export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBl
|
|
|
569
567
|
export type PasteOptions = {
|
|
570
568
|
toPlainText?: boolean;
|
|
571
569
|
};
|
|
572
|
-
export interface EditorInputCallbacks {
|
|
573
|
-
onInsertText: (event: Event, text: string) => void;
|
|
574
|
-
onCompositionStart: (event: Event) => void;
|
|
575
|
-
onUpdateCompositionText: (event: Event, text: string, end: boolean) => void;
|
|
576
|
-
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
577
|
-
onChanged: (action: OnesEditorUndoAction) => void;
|
|
578
|
-
onRemoteChanged: (type: RemoteChangeType) => void;
|
|
579
|
-
onFocus: () => void;
|
|
580
|
-
onBlur: () => void;
|
|
581
|
-
onPaste: (event: ClipboardEvent) => void;
|
|
582
|
-
onPasteText: (text: string, options?: PasteOptions) => void;
|
|
583
|
-
onCopy: (event: ClipboardEvent) => void;
|
|
584
|
-
onCut: (event: ClipboardEvent) => void;
|
|
585
|
-
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
586
|
-
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
587
|
-
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
588
|
-
defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
589
|
-
destroy: () => void;
|
|
590
|
-
pasteDoc: (doc: DocObject) => Promise<void>;
|
|
591
|
-
forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
|
|
592
|
-
}
|
|
593
570
|
export interface OnesEditorInput {
|
|
594
571
|
readonly inputElement: HTMLInputElement;
|
|
595
572
|
destroy: () => void;
|
|
596
573
|
focus: () => void;
|
|
597
|
-
callbacks: EditorInputCallbacks;
|
|
598
574
|
handleDocumentSelectionChange: () => void;
|
|
599
575
|
handleCompositionstart: (event: CompositionEvent) => void;
|
|
600
576
|
handleCompositionend: (event: CompositionEvent) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function getScrollContainer(element: HTMLElement, options?: {
|
|
2
2
|
horizontal?: boolean;
|
|
3
3
|
}): HTMLElement;
|
|
4
|
-
export declare function disablePageScroll(id: string):
|
|
4
|
+
export declare function disablePageScroll(id: string): HTMLDivElement | null;
|
|
5
5
|
export declare function enablePageScroll(id: string): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
+
import type { BlockElement, OnesEditor, OnesEditorCustom, OnesEditorDocCallbacks } from '../../../../@ones-editor/core';
|
|
3
|
+
type ErrorRender = ((block: BlockElement, iframe: HTMLIFrameElement) => void) | undefined;
|
|
4
|
+
export declare class IframeKindEmbedDocCallbacks extends TypedEmitter implements OnesEditorCustom, OnesEditorDocCallbacks {
|
|
5
|
+
private editor;
|
|
6
|
+
private currentBlock;
|
|
7
|
+
private currentIframe;
|
|
8
|
+
private onReAuthErrorWhenIframeEditing;
|
|
9
|
+
private onIframeExitEdit;
|
|
10
|
+
constructor(editor: OnesEditor);
|
|
11
|
+
destroy: () => void;
|
|
12
|
+
onError: (error: Error) => void;
|
|
13
|
+
onAuthRecover: () => void;
|
|
14
|
+
unregisterCallbacks: () => void;
|
|
15
|
+
register: (block: BlockElement, iframe: HTMLIFrameElement, options: {
|
|
16
|
+
onError?: ErrorRender;
|
|
17
|
+
onExit?: () => void;
|
|
18
|
+
}) => void;
|
|
19
|
+
unRegister: () => void;
|
|
20
|
+
onConnectReAuthError: () => void;
|
|
21
|
+
private exit;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -7,7 +7,7 @@ export declare function getDrawioIframeUrl(editor: OnesEditor): string;
|
|
|
7
7
|
export declare function resizeObserver(el: HTMLElement): {
|
|
8
8
|
disconnect: () => void;
|
|
9
9
|
};
|
|
10
|
-
export declare function initializeDrawioIframe(editor: OnesEditor): Promise<{
|
|
10
|
+
export declare function initializeDrawioIframe(editor: OnesEditor, block: BlockElement): Promise<{
|
|
11
11
|
drawioIframe: HTMLIFrameElement;
|
|
12
12
|
exit: () => void;
|
|
13
13
|
}>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const MERMAID_SCRIPTS = "https://cdn.jsdelivr.net/npm/mermaid
|
|
1
|
+
export declare const MERMAID_SCRIPTS = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js";
|
|
2
2
|
export declare const FLOWCHART_SCRIPTS: string[];
|
|
3
3
|
export declare const PLANTUML_PRE = "https://www.plantuml.com/plantuml/svg";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OnesEditor, ShortcutRecords } from '../../../../@ones-editor/core';
|
|
2
|
-
import { copyImage } from './copy-image';
|
|
3
2
|
declare function deleteImage(editor: OnesEditor): true | undefined;
|
|
4
3
|
declare const ImageShortcuts: ShortcutRecords;
|
|
5
|
-
export { ImageShortcuts, deleteImage,
|
|
4
|
+
export { ImageShortcuts, deleteImage, };
|
|
@@ -24,6 +24,9 @@ export declare class AuthConnection {
|
|
|
24
24
|
logout(): Promise<void>;
|
|
25
25
|
init(auth: AuthMessage): Promise<void>;
|
|
26
26
|
handleAuthError(): Promise<void>;
|
|
27
|
+
reAuth: () => Promise<void>;
|
|
28
|
+
private emitPermissionError;
|
|
29
|
+
private emitAuthRecover;
|
|
27
30
|
private emitAuthError;
|
|
28
31
|
private emitRequestReloadError;
|
|
29
32
|
private emitWriteConflictError;
|
|
@@ -32,6 +35,7 @@ export declare class AuthConnection {
|
|
|
32
35
|
get(collectionName: string, documentID: string): Doc;
|
|
33
36
|
addEventListener(event: 'open' | 'close' | 'error', callback: (e: Event | Error) => void): void;
|
|
34
37
|
onAuthError(callback: (error: Error) => void): void;
|
|
38
|
+
onAuthRecover(callback: () => void): void;
|
|
35
39
|
onWriteConflictError(callback: (error: Error) => void): void;
|
|
36
40
|
onMaxUsersError(callback: () => void): void;
|
|
37
41
|
onRequestReloadError(callback: (error: Error) => void): void;
|
|
@@ -15,6 +15,7 @@ export default class ShareDBClient {
|
|
|
15
15
|
close(logout: boolean): void;
|
|
16
16
|
on(event: 'open' | 'close' | 'error', callback: (event: Event | Error) => void): void;
|
|
17
17
|
onAuthError(callback: (error: Error) => void): void;
|
|
18
|
+
onAuthRecover(callback: () => void): void;
|
|
18
19
|
onWriteConflictError(callback: (error: Error) => void): void;
|
|
19
20
|
onMaxUsersError(callback: () => void): void;
|
|
20
21
|
onRequestReloadError(callback: (error: Error) => void): void;
|
|
@@ -52,4 +53,5 @@ export default class ShareDBClient {
|
|
|
52
53
|
createVersion(tag: string, publish: boolean): Promise<any>;
|
|
53
54
|
recognizeLink(url: string): Promise<LinkDetails>;
|
|
54
55
|
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
56
|
+
reAuth(): void;
|
|
55
57
|
}
|
|
@@ -75,6 +75,7 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
75
75
|
onCreateComment(commentId: string, local: boolean): void;
|
|
76
76
|
onUpdateComment(commentId: string, local: boolean): void;
|
|
77
77
|
onCustomMessage(msg: unknown): void;
|
|
78
|
+
onAuthRecover(): void;
|
|
78
79
|
addResources(resourceIds: string[]): Promise<string[]>;
|
|
79
80
|
uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
|
|
80
81
|
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
@@ -106,4 +107,5 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
106
107
|
recognizeLink(url: string): Promise<import("../types").LinkDetails>;
|
|
107
108
|
parseHistoryData(historyData: OnesEditorDocHistoryData, handler: OnesEditorHistoryDataParseHandler): void;
|
|
108
109
|
getServerMeta(): OnesEditorDocServerMeta;
|
|
110
|
+
triggerReAuth(): void;
|
|
109
111
|
}
|