@ones-editor/editor 1.0.1 → 1.0.2-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.
- package/@ones-editor/code-block/src/index.d.ts +2 -2
- package/@ones-editor/context-menu/index.d.ts +3 -0
- package/@ones-editor/context-menu/package.json +8 -0
- package/@ones-editor/context-menu/src/helper/actions.d.ts +4 -0
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +23 -0
- package/@ones-editor/context-menu/src/helper/utils.d.ts +4 -0
- package/@ones-editor/context-menu/src/locale/en-us.d.ts +14 -0
- package/@ones-editor/context-menu/src/locale/index.d.ts +1 -0
- package/@ones-editor/context-menu/src/locale/ja-jp.d.ts +14 -0
- package/@ones-editor/context-menu/src/locale/zh-cn.d.ts +14 -0
- package/@ones-editor/context-menu/src/menu/index.d.ts +21 -0
- package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +6 -1
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -22
- package/@ones-editor/core/src/core/composition/index.d.ts +1 -1
- package/@ones-editor/core/src/core/doc/doc.d.ts +7 -6
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +0 -1
- package/@ones-editor/core/src/core/index.d.ts +1 -0
- package/@ones-editor/core/src/core/input-handler/actions.d.ts +1 -0
- package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +3 -3
- package/@ones-editor/core/src/core/types.d.ts +27 -0
- package/@ones-editor/core/src/local-doc/index.d.ts +0 -1
- package/@ones-editor/graph-embed/src/config/index.d.ts +1 -1
- package/@ones-editor/graph-embed/src/helper/graph-block-commands.d.ts +1 -1
- package/@ones-editor/image-embed/src/shortcuts/index.d.ts +2 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +0 -4
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +0 -1
- package/@ones-editor/sharedb-doc/src/index.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/versions/index.d.ts +2 -0
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +29 -0
- package/@ones-editor/sharedb-doc/src/versions/simple-client.d.ts +25 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +1 -0
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +1 -0
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +3 -4
- package/@ones-editor/versions/src/utils/index.d.ts +2 -2
- package/@ones-editor/versions/src/version-dialog/index.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +182 -181
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBlock, CodeLineBlock, CodeTextDecorator } from './code-block';
|
|
1
|
+
import { CodeBlock, CodeLineBlock, CodeTextDecorator, CopyCodeInputHandler } from './code-block';
|
|
2
2
|
import './locale';
|
|
3
3
|
export * from './code-block/types';
|
|
4
|
-
export { CodeBlock, CodeLineBlock, CodeTextDecorator };
|
|
4
|
+
export { CodeBlock, CodeLineBlock, CodeTextDecorator, CopyCodeInputHandler };
|
|
5
5
|
export { isCodeBlock } from './code-block/code-block-dom';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OnesEditor, EditorInputHandlers } from '../../../../@ones-editor/core';
|
|
2
|
+
export declare function handleCopyAction(editor: OnesEditor, inputHandlers: EditorInputHandlers | null, id: 'copy' | 'copy-markdown'): Promise<void>;
|
|
3
|
+
export declare function handleCutAction(editor: OnesEditor, inputHandlers: EditorInputHandlers | null): Promise<void>;
|
|
4
|
+
export declare function handlePasteAction(editor: OnesEditor, inputHandlers: EditorInputHandlers | null): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { OnesEditor, CommandItem } from '../../../../@ones-editor/core';
|
|
2
|
+
export default class ContextMenuCommandItems {
|
|
3
|
+
private editor;
|
|
4
|
+
private t;
|
|
5
|
+
private supportClipboard;
|
|
6
|
+
private isSecureContext;
|
|
7
|
+
private externalActionHandleMap;
|
|
8
|
+
constructor(editor: OnesEditor);
|
|
9
|
+
clipboardSupport(): void;
|
|
10
|
+
get isRangeCollapsed(): boolean;
|
|
11
|
+
get imageTypeCommandItems(): CommandItem[];
|
|
12
|
+
get copyTypeCommandItems(): CommandItem[];
|
|
13
|
+
get cutCommandItem(): CommandItem;
|
|
14
|
+
get stepItem(): CommandItem;
|
|
15
|
+
get selectionCommandItems(): CommandItem[];
|
|
16
|
+
destroy(): void;
|
|
17
|
+
handleActionByExternal: (item: CommandItem) => unknown;
|
|
18
|
+
getPasteCommandItem: () => Promise<CommandItem>;
|
|
19
|
+
getCommandItems: () => Promise<CommandItem[]>;
|
|
20
|
+
private getExternalContextMenuOptions;
|
|
21
|
+
private secureEnvTips;
|
|
22
|
+
private isFocusImageBlock;
|
|
23
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ImageObject } from '../../../../@ones-editor/image-embed';
|
|
2
|
+
export declare function blobToString(blob: Blob): Promise<string>;
|
|
3
|
+
export declare function isClipboardEmpty(): Promise<boolean>;
|
|
4
|
+
export declare function saveAs(resourceUrl: string, imageObject: ImageObject): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
contextMenu: {
|
|
3
|
+
copyMarkdown: string;
|
|
4
|
+
paste: string;
|
|
5
|
+
copyImage: string;
|
|
6
|
+
copyImageUrl: string;
|
|
7
|
+
imageSaveAs: string;
|
|
8
|
+
newTabOpenImage: string;
|
|
9
|
+
selectBlock: string;
|
|
10
|
+
selectAll: string;
|
|
11
|
+
uneditableBlockSelected: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
contextMenu: {
|
|
3
|
+
copyMarkdown: string;
|
|
4
|
+
paste: string;
|
|
5
|
+
copyImage: string;
|
|
6
|
+
copyImageUrl: string;
|
|
7
|
+
imageSaveAs: string;
|
|
8
|
+
newTabOpenImage: string;
|
|
9
|
+
selectBlock: string;
|
|
10
|
+
selectAll: string;
|
|
11
|
+
uneditableBlockSelected: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
contextMenu: {
|
|
3
|
+
copyMarkdown: string;
|
|
4
|
+
paste: string;
|
|
5
|
+
copyImage: string;
|
|
6
|
+
copyImageUrl: string;
|
|
7
|
+
imageSaveAs: string;
|
|
8
|
+
newTabOpenImage: string;
|
|
9
|
+
selectBlock: string;
|
|
10
|
+
selectAll: string;
|
|
11
|
+
uneditableBlockSelected: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EditorInputHandlers } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { OnesEditor, OnesEditorContextMenuInstance } from '../../../../@ones-editor/core';
|
|
3
|
+
import './context-menu.scss';
|
|
4
|
+
declare class OnesEditorContextMenu implements OnesEditorContextMenuInstance {
|
|
5
|
+
private editor;
|
|
6
|
+
private contextMenu;
|
|
7
|
+
private contextMenuCommandItems;
|
|
8
|
+
contextMenuInputHandlers: EditorInputHandlers | null;
|
|
9
|
+
constructor(editor: OnesEditor);
|
|
10
|
+
destroy(): void;
|
|
11
|
+
show(event: MouseEvent): void;
|
|
12
|
+
private updateEditorCaret;
|
|
13
|
+
private initInputHandlers;
|
|
14
|
+
private handleContextMenu;
|
|
15
|
+
private isInMenu;
|
|
16
|
+
private isInEditor;
|
|
17
|
+
private handleContextMenuShown;
|
|
18
|
+
private handleContextMenuClick;
|
|
19
|
+
private handleImageEmbedAction;
|
|
20
|
+
}
|
|
21
|
+
export default OnesEditorContextMenu;
|
|
@@ -4,5 +4,10 @@ export declare function injectDocToHtmlFragment(htmlFragment: string, doc: DocOb
|
|
|
4
4
|
export declare function addMetaToDoc(editor: OnesEditor, doc: DocObject): void;
|
|
5
5
|
export type BeforeCopyCallback = (editor: OnesEditor, event: ClipboardEvent, doc: DocObject) => DocObject | boolean | undefined;
|
|
6
6
|
export declare function editorCopy(editor: OnesEditor, event: ClipboardEvent, beforeCopy?: BeforeCopyCallback): void;
|
|
7
|
-
|
|
7
|
+
type EditorCopyWithoutEventOptions = {
|
|
8
|
+
copyAsMarkdown?: boolean;
|
|
9
|
+
beforeCopy?: BeforeCopyCallback;
|
|
10
|
+
};
|
|
11
|
+
export declare function editorCopyWithoutEvent(editor: OnesEditor, options?: EditorCopyWithoutEventOptions): void;
|
|
8
12
|
export declare function editorCopyBlock(editor: OnesEditor, block: BlockElement): Promise<boolean>;
|
|
13
|
+
export {};
|
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
import { OnesEditorInput, OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
2
|
-
import {
|
|
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
|
-
}
|
|
2
|
+
import type { EditorInputCallbacks } from '../types';
|
|
24
3
|
export declare class EditorInput implements OnesEditorInput {
|
|
25
4
|
editor: OnesEditor;
|
|
26
5
|
composing: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment } from './clipboard/copy';
|
|
1
|
+
export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment, editorCopyWithoutEvent } from './clipboard/copy';
|
|
2
2
|
export { copyResourcesFromDoc } from './clipboard/resources/copy-resources';
|
|
@@ -190,7 +190,13 @@ export interface InsertBlockOptions {
|
|
|
190
190
|
noFocus?: boolean;
|
|
191
191
|
}
|
|
192
192
|
export type UpdateBlockOptions = InsertBlockOptions;
|
|
193
|
-
export interface
|
|
193
|
+
export interface OnesEditorDocServer {
|
|
194
|
+
getServerMeta?: () => OnesEditorDocServerMeta;
|
|
195
|
+
buildResourceUrl: (resourceId: string, options?: BuildResourceUrlOptions) => string;
|
|
196
|
+
getVersionHelper?: () => OnesEditorDocVersionHelper | undefined;
|
|
197
|
+
getRemoteUsers: () => OnesEditorRemoteUsers;
|
|
198
|
+
}
|
|
199
|
+
export interface OnesEditorDoc extends OnesEditorDocServer {
|
|
194
200
|
registerCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
195
201
|
unregisterCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
196
202
|
toJSON: () => DocObject;
|
|
@@ -207,17 +213,12 @@ export interface OnesEditorDoc {
|
|
|
207
213
|
}[]) => void;
|
|
208
214
|
localDeleteChildContainers: (containerIds: string[]) => void;
|
|
209
215
|
addResources: (resourceIds: string[]) => Promise<string[]>;
|
|
210
|
-
patchSyncResources: (resourceIds: string[]) => Promise<string[]>;
|
|
211
216
|
uploadResource: (file: File, options?: UploadResourceOptions) => Promise<UploadResourceResult>;
|
|
212
|
-
buildResourceUrl: (resourceId: string, options?: BuildResourceUrlOptions) => string;
|
|
213
217
|
request: <T = unknown>(url: string, options?: unknown) => Promise<T>;
|
|
214
218
|
broadcastMessage: (data: unknown) => void;
|
|
215
219
|
destroy: () => void;
|
|
216
220
|
getUser: () => OnesEditorUser;
|
|
217
|
-
getRemoteUsers: () => OnesEditorRemoteUsers;
|
|
218
221
|
recognizeLink?: (link: string) => Promise<RecognizeLinkResult>;
|
|
219
|
-
getVersionHelper?: () => OnesEditorDocVersionHelper | undefined;
|
|
220
|
-
getServerMeta?: () => OnesEditorDocServerMeta;
|
|
221
222
|
beginBatchUpdate: () => number;
|
|
222
223
|
endBatchUpdate: () => number;
|
|
223
224
|
}
|
|
@@ -36,7 +36,6 @@ export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> im
|
|
|
36
36
|
onError(error: Error): void;
|
|
37
37
|
uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
|
|
38
38
|
addResources(resourceIds: string[]): Promise<string[]>;
|
|
39
|
-
patchSyncResources(resourceIds: string[]): Promise<string[]>;
|
|
40
39
|
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
41
40
|
request<T = unknown>(url: string, options?: unknown): Promise<T>;
|
|
42
41
|
broadcastMessage(data: unknown): void;
|
|
@@ -4,3 +4,4 @@ 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 {
|
|
2
|
-
import { OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
1
|
+
import { OnesEditor, OnesEditorDocs, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
3
2
|
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,7 +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
|
-
|
|
29
|
+
pasteDocs(docs: OnesEditorDocs, event: ClipboardEvent | null, files: File[]): Promise<void>;
|
|
30
30
|
destroy(): void;
|
|
31
31
|
forEach(cb: (handler: OnesEditorInputHandler) => void): void;
|
|
32
32
|
}
|
|
@@ -389,6 +389,7 @@ export interface OnesEditorOptionalOptions {
|
|
|
389
389
|
colors?: string[];
|
|
390
390
|
scrollContainer?: HTMLElement;
|
|
391
391
|
enableComments?: boolean;
|
|
392
|
+
enableContextMenu?: boolean;
|
|
392
393
|
settingsProvider?: OnesEditorSettingsProvider;
|
|
393
394
|
}
|
|
394
395
|
export interface OnesEditorOptions {
|
|
@@ -397,8 +398,12 @@ export interface OnesEditorOptions {
|
|
|
397
398
|
[index: string]: unknown;
|
|
398
399
|
};
|
|
399
400
|
enableComments?: boolean;
|
|
401
|
+
enableContextMenu?: boolean;
|
|
400
402
|
scrollContainer?: HTMLElement;
|
|
401
403
|
}
|
|
404
|
+
export interface OnesEditorContextMenuInstance {
|
|
405
|
+
show: (event: MouseEvent) => void;
|
|
406
|
+
}
|
|
402
407
|
export interface OnesEditorComponents {
|
|
403
408
|
blocks?: Block[];
|
|
404
409
|
boxes?: Box[];
|
|
@@ -565,10 +570,32 @@ export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBl
|
|
|
565
570
|
export type PasteOptions = {
|
|
566
571
|
toPlainText?: boolean;
|
|
567
572
|
};
|
|
573
|
+
export interface EditorInputCallbacks {
|
|
574
|
+
onInsertText: (event: Event, text: string) => void;
|
|
575
|
+
onCompositionStart: (event: Event) => void;
|
|
576
|
+
onUpdateCompositionText: (event: Event, text: string, end: boolean) => void;
|
|
577
|
+
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
578
|
+
onChanged: (action: OnesEditorUndoAction) => void;
|
|
579
|
+
onRemoteChanged: (type: RemoteChangeType) => void;
|
|
580
|
+
onFocus: () => void;
|
|
581
|
+
onBlur: () => void;
|
|
582
|
+
onPaste: (event: ClipboardEvent) => void;
|
|
583
|
+
onPasteText: (text: string, options?: PasteOptions) => void;
|
|
584
|
+
onCopy: (event: ClipboardEvent) => void;
|
|
585
|
+
onCut: (event: ClipboardEvent) => void;
|
|
586
|
+
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
587
|
+
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
588
|
+
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
589
|
+
defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
590
|
+
destroy: () => void;
|
|
591
|
+
pasteDoc: (doc: DocObject) => Promise<void>;
|
|
592
|
+
forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
|
|
593
|
+
}
|
|
568
594
|
export interface OnesEditorInput {
|
|
569
595
|
readonly inputElement: HTMLInputElement;
|
|
570
596
|
destroy: () => void;
|
|
571
597
|
focus: () => void;
|
|
598
|
+
callbacks: EditorInputCallbacks;
|
|
572
599
|
handleDocumentSelectionChange: () => void;
|
|
573
600
|
handleCompositionstart: (event: CompositionEvent) => void;
|
|
574
601
|
handleCompositionend: (event: CompositionEvent) => void;
|
|
@@ -24,7 +24,6 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
|
|
|
24
24
|
localDeleteChildContainers(containerIds: string[]): void;
|
|
25
25
|
uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
|
|
26
26
|
addResources(resourceIds: string[]): Promise<string[]>;
|
|
27
|
-
patchSyncResources(resourceIds: string[]): Promise<string[]>;
|
|
28
27
|
buildResourceUrl(src: string): string;
|
|
29
28
|
request<T>(url: string, opt?: any): Promise<T>;
|
|
30
29
|
broadcastMessage(data: unknown): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const MERMAID_SCRIPTS = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js";
|
|
1
|
+
export declare const MERMAID_SCRIPTS = "https://cdn.jsdelivr.net/npm/mermaid@9.0.1/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";
|
|
@@ -15,7 +15,7 @@ declare class GraphBlockCommands extends StandardEmbedBlockCommands<PresetComman
|
|
|
15
15
|
executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
|
|
16
16
|
}
|
|
17
17
|
export declare function getGraphEmbedBlockProperties(editor: OnesEditor, block: BlockElement, type: 'mermaid' | 'flowchart' | 'plantuml', properties?: GraphEmbedBlockProperties): {
|
|
18
|
-
blockCommands: {
|
|
18
|
+
blockCommands: Record<string, import("@ones-editor/core").BlockCommands> | {
|
|
19
19
|
'hovering-toolbar': GraphBlockCommands;
|
|
20
20
|
};
|
|
21
21
|
abstract: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OnesEditor, ShortcutRecords } from '../../../../@ones-editor/core';
|
|
2
|
+
import { copyImage } from './copy-image';
|
|
2
3
|
declare function deleteImage(editor: OnesEditor): true | undefined;
|
|
3
4
|
declare const ImageShortcuts: ShortcutRecords;
|
|
4
|
-
export { ImageShortcuts, deleteImage, };
|
|
5
|
+
export { ImageShortcuts, deleteImage, copyImage, };
|
|
@@ -30,11 +30,7 @@ export default class ShareDBClient {
|
|
|
30
30
|
getFileUrlByHash(uploadFileUrl: string, hash: string, name: string, size: number, headers: {
|
|
31
31
|
[index: string]: string;
|
|
32
32
|
}): Promise<any>;
|
|
33
|
-
patchSyncResourceByHash(uploadFileUrl: string, hash: string[], headers: {
|
|
34
|
-
[index: string]: string;
|
|
35
|
-
}): Promise<any[]>;
|
|
36
33
|
getFileUrlsByHashes(resourceHashes: string[]): Promise<any[]>;
|
|
37
|
-
patchSyncResourceByHashes(resourceHashes: string[]): Promise<any[]>;
|
|
38
34
|
uploadFile(url: string, file: File, headers: {
|
|
39
35
|
[index: string]: string;
|
|
40
36
|
}, onProgress: OnProgress, options?: {
|
|
@@ -76,7 +76,6 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
76
76
|
onUpdateComment(commentId: string, local: boolean): void;
|
|
77
77
|
onCustomMessage(msg: unknown): void;
|
|
78
78
|
addResources(resourceIds: string[]): Promise<string[]>;
|
|
79
|
-
patchSyncResources(resourceIds: string[]): Promise<any[]>;
|
|
80
79
|
uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
|
|
81
80
|
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
82
81
|
request<T = unknown>(url: string, options?: unknown): Promise<T>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BuildResourceUrlOptions, DocObject, DocVersion, EventCallbacks, OnesEditorDocHistoryData, OnesEditorDocServer, OnesEditorDocServerMeta, OnesEditorDocVersionExtra, OnesEditorDocVersionHelper, OnesEditorHistoryDataParseHandler, RemoteUsers } from '../../../../@ones-editor/core';
|
|
2
|
+
import { ShareDBDocCallbacks, ShareDBDocOptions } from '../types';
|
|
3
|
+
import ShareDBSimpleClient from './simple-client';
|
|
4
|
+
export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> implements OnesEditorDocServer, OnesEditorDocVersionHelper {
|
|
5
|
+
private options;
|
|
6
|
+
remoteUsers: RemoteUsers;
|
|
7
|
+
client: ShareDBSimpleClient;
|
|
8
|
+
constructor(options: ShareDBDocOptions);
|
|
9
|
+
destroy(): void;
|
|
10
|
+
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
11
|
+
getRemoteUsers(): RemoteUsers;
|
|
12
|
+
getVersionHelper(): OnesEditorDocVersionHelper;
|
|
13
|
+
getVersions(): Promise<DocVersion[]>;
|
|
14
|
+
getVersion(ver: number): Promise<DocObject>;
|
|
15
|
+
getLatestVersion(): Promise<DocObject>;
|
|
16
|
+
getHistoryData(version: number, from?: number | undefined): Promise<{
|
|
17
|
+
doc: DocObject;
|
|
18
|
+
historyData: OnesEditorDocHistoryData[];
|
|
19
|
+
}>;
|
|
20
|
+
getVersionData(version: number, from?: number): Promise<{
|
|
21
|
+
doc: DocObject;
|
|
22
|
+
versionData: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
updateVersionExtra(version: number, tagId: string, extra: OnesEditorDocVersionExtra): Promise<void>;
|
|
25
|
+
revertVersion(ver: number): Promise<void>;
|
|
26
|
+
createVersion(tag: string, publish: boolean): Promise<DocVersion>;
|
|
27
|
+
parseHistoryData(historyData: OnesEditorDocHistoryData, handler: OnesEditorHistoryDataParseHandler): void;
|
|
28
|
+
getServerMeta(): OnesEditorDocServerMeta;
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BuildResourceUrlOptions, DocVersion, OnesEditorDocVersionExtra } from '../../../../@ones-editor/core';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
import { AuthMessage, EditorDoc, EditorOp } from '../types';
|
|
4
|
+
export default class ShareDBSimpleClient {
|
|
5
|
+
private serverUrl;
|
|
6
|
+
auth: AuthMessage;
|
|
7
|
+
clientId: string;
|
|
8
|
+
constructor(auth: AuthMessage, serverUrl: string);
|
|
9
|
+
editorServer(): string;
|
|
10
|
+
apiServer(): string;
|
|
11
|
+
getBaseURL(): string;
|
|
12
|
+
getBase64BaseURL(): string;
|
|
13
|
+
request<T = unknown>(url: string, opt?: any): Promise<AxiosResponse<any, T>>;
|
|
14
|
+
getVersions(): Promise<DocVersion[]>;
|
|
15
|
+
getVersion(ver: number): Promise<EditorDoc>;
|
|
16
|
+
getLatestVersion(): Promise<EditorDoc>;
|
|
17
|
+
getVersionOps(version: number, from?: number): Promise<{
|
|
18
|
+
doc: EditorDoc;
|
|
19
|
+
ops: EditorOp[];
|
|
20
|
+
}>;
|
|
21
|
+
updateVersionExtra(version: number, tagId: string, extra: OnesEditorDocVersionExtra): Promise<void>;
|
|
22
|
+
revertVersion(ver: number): Promise<void>;
|
|
23
|
+
createVersion(tag: string, publish: boolean): Promise<any>;
|
|
24
|
+
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
25
|
+
}
|