@ones-editor/editor 1.0.2-beta.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 +1 -1
- package/@ones-editor/context-menu/src/helper/actions.d.ts +4 -2
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +6 -1
- package/@ones-editor/context-menu/src/helper/utils.d.ts +4 -0
- package/@ones-editor/context-menu/src/menu/index.d.ts +8 -4
- package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +6 -3
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -22
- package/@ones-editor/core/src/core/doc/doc.d.ts +7 -5
- 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 +1 -1
- package/@ones-editor/core/src/core/types.d.ts +22 -6
- 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/mathjax/src/mathjax/convert.d.ts +9 -0
- package/@ones-editor/mathjax/src/mathjax-box/mathjax-editor.d.ts +3 -3
- 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/ui-base/src/color-button/text-color-item.d.ts +1 -1
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +3 -3
- package/@ones-editor/versions/src/utils/index.d.ts +2 -2
- package/@ones-editor/versions/src/version-dialog/index.d.ts +3 -3
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +170 -169
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/@ones-editor/context-menu/src/helper/save-as.d.ts +0 -2
- package/@ones-editor/context-menu/src/helper/selection.d.ts +0 -0
- package/@ones-editor/context-menu/src/index.d.ts +0 -3
|
@@ -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';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
export declare function
|
|
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>;
|
|
@@ -2,17 +2,22 @@ import type { OnesEditor, CommandItem } from '../../../../@ones-editor/core';
|
|
|
2
2
|
export default class ContextMenuCommandItems {
|
|
3
3
|
private editor;
|
|
4
4
|
private t;
|
|
5
|
+
private supportClipboard;
|
|
5
6
|
private isSecureContext;
|
|
7
|
+
private externalActionHandleMap;
|
|
6
8
|
constructor(editor: OnesEditor);
|
|
9
|
+
clipboardSupport(): void;
|
|
7
10
|
get isRangeCollapsed(): boolean;
|
|
8
11
|
get imageTypeCommandItems(): CommandItem[];
|
|
9
12
|
get copyTypeCommandItems(): CommandItem[];
|
|
10
13
|
get cutCommandItem(): CommandItem;
|
|
11
14
|
get stepItem(): CommandItem;
|
|
12
15
|
get selectionCommandItems(): CommandItem[];
|
|
16
|
+
destroy(): void;
|
|
17
|
+
handleActionByExternal: (item: CommandItem) => unknown;
|
|
13
18
|
getPasteCommandItem: () => Promise<CommandItem>;
|
|
14
19
|
getCommandItems: () => Promise<CommandItem[]>;
|
|
20
|
+
private getExternalContextMenuOptions;
|
|
15
21
|
private secureEnvTips;
|
|
16
|
-
private isClipboardEmpty;
|
|
17
22
|
private isFocusImageBlock;
|
|
18
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;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import { EditorInputHandlers } from '../../../../@ones-editor/core';
|
|
1
2
|
import type { OnesEditor, OnesEditorContextMenuInstance } from '../../../../@ones-editor/core';
|
|
2
3
|
import './context-menu.scss';
|
|
3
|
-
declare class
|
|
4
|
+
declare class OnesEditorContextMenu implements OnesEditorContextMenuInstance {
|
|
4
5
|
private editor;
|
|
5
6
|
private contextMenu;
|
|
6
7
|
private contextMenuCommandItems;
|
|
8
|
+
contextMenuInputHandlers: EditorInputHandlers | null;
|
|
7
9
|
constructor(editor: OnesEditor);
|
|
10
|
+
destroy(): void;
|
|
8
11
|
show(event: MouseEvent): void;
|
|
9
|
-
|
|
12
|
+
private updateEditorCaret;
|
|
13
|
+
private initInputHandlers;
|
|
10
14
|
private handleContextMenu;
|
|
11
15
|
private isInMenu;
|
|
12
16
|
private isInEditor;
|
|
13
17
|
private handleContextMenuShown;
|
|
14
18
|
private handleContextMenuClick;
|
|
15
|
-
private
|
|
19
|
+
private handleImageEmbedAction;
|
|
16
20
|
}
|
|
17
|
-
export default
|
|
21
|
+
export default OnesEditorContextMenu;
|
|
@@ -4,7 +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
|
-
|
|
8
|
-
copyAsMarkdown
|
|
9
|
-
|
|
7
|
+
type EditorCopyWithoutEventOptions = {
|
|
8
|
+
copyAsMarkdown?: boolean;
|
|
9
|
+
beforeCopy?: BeforeCopyCallback;
|
|
10
|
+
};
|
|
11
|
+
export declare function editorCopyWithoutEvent(editor: OnesEditor, options?: EditorCopyWithoutEventOptions): void;
|
|
10
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;
|
|
@@ -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;
|
|
@@ -208,15 +214,11 @@ export interface OnesEditorDoc {
|
|
|
208
214
|
localDeleteChildContainers: (containerIds: string[]) => void;
|
|
209
215
|
addResources: (resourceIds: string[]) => Promise<string[]>;
|
|
210
216
|
uploadResource: (file: File, options?: UploadResourceOptions) => Promise<UploadResourceResult>;
|
|
211
|
-
buildResourceUrl: (resourceId: string, options?: BuildResourceUrlOptions) => string;
|
|
212
217
|
request: <T = unknown>(url: string, options?: unknown) => Promise<T>;
|
|
213
218
|
broadcastMessage: (data: unknown) => void;
|
|
214
219
|
destroy: () => void;
|
|
215
220
|
getUser: () => OnesEditorUser;
|
|
216
|
-
getRemoteUsers: () => OnesEditorRemoteUsers;
|
|
217
221
|
recognizeLink?: (link: string) => Promise<RecognizeLinkResult>;
|
|
218
|
-
getVersionHelper?: () => OnesEditorDocVersionHelper | undefined;
|
|
219
|
-
getServerMeta?: () => OnesEditorDocServerMeta;
|
|
220
222
|
beginBatchUpdate: () => number;
|
|
221
223
|
endBatchUpdate: () => number;
|
|
222
224
|
}
|
|
@@ -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 { EditorInputCallbacks } from '../composition/editor-input';
|
|
2
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[];
|
|
@@ -404,9 +404,6 @@ export interface OnesEditorOptions {
|
|
|
404
404
|
export interface OnesEditorContextMenuInstance {
|
|
405
405
|
show: (event: MouseEvent) => void;
|
|
406
406
|
}
|
|
407
|
-
interface OnesEditorContextMenu {
|
|
408
|
-
new (editor: OnesEditor): OnesEditorContextMenuInstance;
|
|
409
|
-
}
|
|
410
407
|
export interface OnesEditorComponents {
|
|
411
408
|
blocks?: Block[];
|
|
412
409
|
boxes?: Box[];
|
|
@@ -417,7 +414,6 @@ export interface OnesEditorComponents {
|
|
|
417
414
|
commandProviders?: OnesEditorCommandProvider[];
|
|
418
415
|
textRenders?: OnesEditorBlockRenderer[];
|
|
419
416
|
blockHooks?: OnesEditorBlockHook[];
|
|
420
|
-
contextMenu?: OnesEditorContextMenu;
|
|
421
417
|
options?: {
|
|
422
418
|
[index: string]: unknown;
|
|
423
419
|
};
|
|
@@ -481,7 +477,6 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
481
477
|
readonly options: OnesEditorOptions;
|
|
482
478
|
readonly domEvents: OnesEditorDomEvents;
|
|
483
479
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
484
|
-
readonly contextMenu: OnesEditorContextMenuInstance | null;
|
|
485
480
|
readonly: boolean;
|
|
486
481
|
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
|
|
487
482
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
@@ -575,10 +570,32 @@ export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBl
|
|
|
575
570
|
export type PasteOptions = {
|
|
576
571
|
toPlainText?: boolean;
|
|
577
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
|
+
}
|
|
578
594
|
export interface OnesEditorInput {
|
|
579
595
|
readonly inputElement: HTMLInputElement;
|
|
580
596
|
destroy: () => void;
|
|
581
597
|
focus: () => void;
|
|
598
|
+
callbacks: EditorInputCallbacks;
|
|
582
599
|
handleDocumentSelectionChange: () => void;
|
|
583
600
|
handleCompositionstart: (event: CompositionEvent) => void;
|
|
584
601
|
handleCompositionend: (event: CompositionEvent) => void;
|
|
@@ -692,4 +709,3 @@ export interface OnesEditorBlockHook {
|
|
|
692
709
|
writable?: (editor: OnesEditor, blockElement: BlockElement | BlockElement[]) => boolean | undefined;
|
|
693
710
|
commands?: (editor: OnesEditor, blockElement: BlockElement) => BlockCommands;
|
|
694
711
|
}
|
|
695
|
-
export {};
|
|
@@ -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,9 +1,18 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
type ReturnType<T> = T extends (...args: any) => infer R ? R : never;
|
|
2
3
|
export interface MathjaxOptions {
|
|
3
4
|
cdn?: {
|
|
4
5
|
mathjax?: string;
|
|
5
6
|
};
|
|
6
7
|
}
|
|
7
8
|
export declare function mathjax2Svg(editor: OnesEditor, tex: string): Promise<string>;
|
|
9
|
+
export declare function analyzeMathjaxSvgWidth(svg: string): {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
8
13
|
export declare function mathjax2DataUrl(editor: OnesEditor, tex: string): Promise<string>;
|
|
9
14
|
export declare function convertAndUploadMathjax(editor: OnesEditor, tex: string): Promise<string>;
|
|
15
|
+
export declare function convertAndUploadMathjaxForEmbed(editor: OnesEditor, tex: string): Promise<{
|
|
16
|
+
resourceId: string;
|
|
17
|
+
} & ReturnType<typeof analyzeMathjaxSvgWidth>>;
|
|
18
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
|
-
import { AbstractCommandBar, Popup } from '../../../../@ones-editor/ui-base';
|
|
2
|
+
import { AbstractCommandBar, Popup, ManualShowCommandBarOptions } from '../../../../@ones-editor/ui-base';
|
|
3
3
|
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
4
4
|
export type OnEditChange = (tex: string, end: boolean) => void;
|
|
5
5
|
export default class MathjaxEditor {
|
|
@@ -7,7 +7,7 @@ export default class MathjaxEditor {
|
|
|
7
7
|
onChange: OnEditChange | null;
|
|
8
8
|
tex: string;
|
|
9
9
|
private observer;
|
|
10
|
-
editMathjax(elem: HTMLElement, tex: string, onChange: OnEditChange): void;
|
|
10
|
+
editMathjax(elem: HTMLElement, tex: string, onChange: OnEditChange, options?: ManualShowCommandBarOptions): void;
|
|
11
11
|
handleClose: (commandBar: AbstractCommandBar) => void;
|
|
12
12
|
handleKeyup: (event: KeyboardEvent) => void;
|
|
13
13
|
handleChange: import("lodash").DebouncedFunc<(text: string) => void>;
|
|
@@ -16,4 +16,4 @@ export default class MathjaxEditor {
|
|
|
16
16
|
getTextarea(): HTMLTextAreaElement;
|
|
17
17
|
destroy(): void;
|
|
18
18
|
}
|
|
19
|
-
export declare function editMathjax(editor: OnesEditor, elem: HTMLElement, tex: string, onChange: OnEditChange): void;
|
|
19
|
+
export declare function editMathjax(editor: OnesEditor, elem: HTMLElement, tex: string, onChange: OnEditChange, options?: ManualShowCommandBarOptions): void;
|
|
@@ -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
|
+
}
|