@ones-editor/editor 1.0.2-beta.7 → 1.0.2-beta.8
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/block-menu/src/block-menu/index.d.ts +0 -1
- package/@ones-editor/code-block/src/index.d.ts +2 -2
- package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +1 -6
- 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 +8 -5
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +1 -0
- package/@ones-editor/core/src/core/index.d.ts +0 -1
- 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 -3
- package/@ones-editor/core/src/core/types.d.ts +0 -43
- package/@ones-editor/core/src/local-doc/index.d.ts +1 -0
- package/@ones-editor/graph-embed/src/helper/graph-base.d.ts +1 -2
- package/@ones-editor/image-embed/src/shortcuts/index.d.ts +1 -2
- 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/doc/sharedb-client.d.ts +4 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +1 -0
- 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 +0 -1
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +0 -1
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +0 -1
- 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 +4 -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 +163 -164
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
- package/@ones-editor/context-menu/package.json +0 -8
- package/@ones-editor/context-menu/src/helper/actions.d.ts +0 -4
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +0 -23
- package/@ones-editor/context-menu/src/helper/utils.d.ts +0 -4
- package/@ones-editor/context-menu/src/index.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 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBlock, CodeLineBlock, CodeTextDecorator
|
|
1
|
+
import { CodeBlock, CodeLineBlock, CodeTextDecorator } from './code-block';
|
|
2
2
|
import './locale';
|
|
3
3
|
export * from './code-block/types';
|
|
4
|
-
export { CodeBlock, CodeLineBlock, CodeTextDecorator
|
|
4
|
+
export { CodeBlock, CodeLineBlock, CodeTextDecorator };
|
|
5
5
|
export { isCodeBlock } from './code-block/code-block-dom';
|
|
@@ -4,10 +4,5 @@ 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?: boolean;
|
|
9
|
-
beforeCopy?: BeforeCopyCallback;
|
|
10
|
-
};
|
|
11
|
-
export declare function editorCopyWithoutEvent(editor: OnesEditor, options?: EditorCopyWithoutEventOptions): void;
|
|
7
|
+
export declare function editorCopyWithoutEvent(editor: OnesEditor): void;
|
|
12
8
|
export declare function editorCopyBlock(editor: OnesEditor, block: BlockElement): Promise<boolean>;
|
|
13
|
-
export {};
|
|
@@ -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';
|
|
@@ -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,16 +213,13 @@ export interface OnesEditorDoc {
|
|
|
207
213
|
}[]) => void;
|
|
208
214
|
localDeleteChildContainers: (containerIds: string[]) => void;
|
|
209
215
|
addResources: (resourceIds: string[]) => Promise<string[]>;
|
|
216
|
+
patchSyncResources: (resourceIds: string[]) => Promise<string[]>;
|
|
210
217
|
uploadResource: (file: File, options?: UploadResourceOptions) => Promise<UploadResourceResult>;
|
|
211
|
-
buildResourceUrl: (resourceId: string, options?: BuildResourceUrlOptions) => string;
|
|
212
218
|
request: <T = unknown>(url: string, options?: unknown) => Promise<T>;
|
|
213
219
|
broadcastMessage: (data: unknown) => void;
|
|
214
220
|
destroy: () => void;
|
|
215
221
|
getUser: () => OnesEditorUser;
|
|
216
|
-
getRemoteUsers: () => OnesEditorRemoteUsers;
|
|
217
222
|
recognizeLink?: (link: string) => Promise<RecognizeLinkResult>;
|
|
218
|
-
getVersionHelper?: () => OnesEditorDocVersionHelper | undefined;
|
|
219
|
-
getServerMeta?: () => OnesEditorDocServerMeta;
|
|
220
223
|
beginBatchUpdate: () => number;
|
|
221
224
|
endBatchUpdate: () => number;
|
|
222
225
|
}
|
|
@@ -36,6 +36,7 @@ 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[]>;
|
|
39
40
|
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
40
41
|
request<T = unknown>(url: string, options?: unknown): Promise<T>;
|
|
41
42
|
broadcastMessage(data: unknown): 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,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
|
-
pasteDocs
|
|
29
|
+
private pasteDocs;
|
|
30
30
|
destroy(): void;
|
|
31
31
|
forEach(cb: (handler: OnesEditorInputHandler) => void): void;
|
|
32
32
|
}
|
|
@@ -82,14 +82,6 @@ export interface EmbedOptions {
|
|
|
82
82
|
insertEmbedCommandItems?: CommandItem[];
|
|
83
83
|
handleInsertEmptyEmbed?: (editor: OnesEditor, options: InsertEmptyBlockOptions) => Promise<BlockElement | null>;
|
|
84
84
|
}
|
|
85
|
-
export interface OnesContextMenuOptions {
|
|
86
|
-
id: string;
|
|
87
|
-
inserts: {
|
|
88
|
-
insertBefore?: string;
|
|
89
|
-
commands: CommandItem[];
|
|
90
|
-
};
|
|
91
|
-
handleContextMenuAction?: (editor: OnesEditor, srcBlock: BlockElement, item: CommandItem) => boolean;
|
|
92
|
-
}
|
|
93
85
|
export interface Embed {
|
|
94
86
|
embedType: string;
|
|
95
87
|
createEmbedContent: (editor: OnesEditor, content: BlockContentElement, block: DocEmbedBlock, path: BlockPath, container: ContainerElement, blockElement: BlockElement) => void;
|
|
@@ -105,7 +97,6 @@ export interface Embed {
|
|
|
105
97
|
data?: DocBlockAttributes;
|
|
106
98
|
}) => ConvertBlockResult | null;
|
|
107
99
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, path: BlockPath) => Promise<DocObject | undefined>;
|
|
108
|
-
getContextMenu?: (editor: OnesEditor, srcBlock: BlockElement, isSecureContext: boolean) => OnesContextMenuOptions;
|
|
109
100
|
}
|
|
110
101
|
export interface ConvertBlockResult {
|
|
111
102
|
blockData: DocBlock;
|
|
@@ -237,7 +228,6 @@ export interface Block {
|
|
|
237
228
|
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
238
229
|
getResources?: (data: DocBlock) => string[];
|
|
239
230
|
replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
|
|
240
|
-
getContextMenu?: (editor: OnesEditor, srcBlock: BlockElement, isSecureContext: boolean) => OnesContextMenuOptions | undefined;
|
|
241
231
|
}
|
|
242
232
|
export type TextStyles = {
|
|
243
233
|
[index: string]: StyleType;
|
|
@@ -399,7 +389,6 @@ export interface OnesEditorOptionalOptions {
|
|
|
399
389
|
colors?: string[];
|
|
400
390
|
scrollContainer?: HTMLElement;
|
|
401
391
|
enableComments?: boolean;
|
|
402
|
-
enableContextMenu?: boolean;
|
|
403
392
|
settingsProvider?: OnesEditorSettingsProvider;
|
|
404
393
|
}
|
|
405
394
|
export interface OnesEditorOptions {
|
|
@@ -408,15 +397,8 @@ export interface OnesEditorOptions {
|
|
|
408
397
|
[index: string]: unknown;
|
|
409
398
|
};
|
|
410
399
|
enableComments?: boolean;
|
|
411
|
-
enableContextMenu?: boolean;
|
|
412
400
|
scrollContainer?: HTMLElement;
|
|
413
401
|
}
|
|
414
|
-
export interface OnesEditorContextMenuInstance {
|
|
415
|
-
show: (event: MouseEvent) => void;
|
|
416
|
-
}
|
|
417
|
-
interface OnesEditorContextMenu {
|
|
418
|
-
new (editor: OnesEditor): OnesEditorContextMenuInstance;
|
|
419
|
-
}
|
|
420
402
|
export interface OnesEditorComponents {
|
|
421
403
|
blocks?: Block[];
|
|
422
404
|
boxes?: Box[];
|
|
@@ -427,7 +409,6 @@ export interface OnesEditorComponents {
|
|
|
427
409
|
commandProviders?: OnesEditorCommandProvider[];
|
|
428
410
|
textRenders?: OnesEditorBlockRenderer[];
|
|
429
411
|
blockHooks?: OnesEditorBlockHook[];
|
|
430
|
-
contextMenu?: OnesEditorContextMenu;
|
|
431
412
|
options?: {
|
|
432
413
|
[index: string]: unknown;
|
|
433
414
|
};
|
|
@@ -491,7 +472,6 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
491
472
|
readonly options: OnesEditorOptions;
|
|
492
473
|
readonly domEvents: OnesEditorDomEvents;
|
|
493
474
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
494
|
-
readonly contextMenu: OnesEditorContextMenuInstance | null;
|
|
495
475
|
readonly: boolean;
|
|
496
476
|
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
|
|
497
477
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
@@ -585,32 +565,10 @@ export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBl
|
|
|
585
565
|
export type PasteOptions = {
|
|
586
566
|
toPlainText?: boolean;
|
|
587
567
|
};
|
|
588
|
-
export interface EditorInputCallbacks {
|
|
589
|
-
onInsertText: (event: Event, text: string) => void;
|
|
590
|
-
onCompositionStart: (event: Event) => void;
|
|
591
|
-
onUpdateCompositionText: (event: Event, text: string, end: boolean) => void;
|
|
592
|
-
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
593
|
-
onChanged: (action: OnesEditorUndoAction) => void;
|
|
594
|
-
onRemoteChanged: (type: RemoteChangeType) => void;
|
|
595
|
-
onFocus: () => void;
|
|
596
|
-
onBlur: () => void;
|
|
597
|
-
onPaste: (event: ClipboardEvent) => void;
|
|
598
|
-
onPasteText: (text: string, options?: PasteOptions) => void;
|
|
599
|
-
onCopy: (event: ClipboardEvent) => void;
|
|
600
|
-
onCut: (event: ClipboardEvent) => void;
|
|
601
|
-
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
602
|
-
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
603
|
-
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
604
|
-
defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
605
|
-
destroy: () => void;
|
|
606
|
-
pasteDoc: (doc: DocObject) => Promise<void>;
|
|
607
|
-
forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
|
|
608
|
-
}
|
|
609
568
|
export interface OnesEditorInput {
|
|
610
569
|
readonly inputElement: HTMLInputElement;
|
|
611
570
|
destroy: () => void;
|
|
612
571
|
focus: () => void;
|
|
613
|
-
callbacks: EditorInputCallbacks;
|
|
614
572
|
handleDocumentSelectionChange: () => void;
|
|
615
573
|
handleCompositionstart: (event: CompositionEvent) => void;
|
|
616
574
|
handleCompositionend: (event: CompositionEvent) => void;
|
|
@@ -724,4 +682,3 @@ export interface OnesEditorBlockHook {
|
|
|
724
682
|
writable?: (editor: OnesEditor, blockElement: BlockElement | BlockElement[]) => boolean | undefined;
|
|
725
683
|
commands?: (editor: OnesEditor, blockElement: BlockElement) => BlockCommands;
|
|
726
684
|
}
|
|
727
|
-
export {};
|
|
@@ -24,6 +24,7 @@ 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[]>;
|
|
27
28
|
buildResourceUrl(src: string): string;
|
|
28
29
|
request<T>(url: string, opt?: any): Promise<T>;
|
|
29
30
|
broadcastMessage(data: unknown): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockProperties } from '../../../../@ones-editor/core';
|
|
2
|
-
import type { OnesEditor, BlockContentElement, DocEmbedBlock, BlockElement, Logger
|
|
2
|
+
import type { OnesEditor, BlockContentElement, DocEmbedBlock, BlockElement, Logger } from '../../../../@ones-editor/core';
|
|
3
3
|
import type { GraphType, GraphEmbedBlockProperties } from './graph-block-commands';
|
|
4
4
|
export default abstract class GraphBase {
|
|
5
5
|
private graphType;
|
|
@@ -23,7 +23,6 @@ export default abstract class GraphBase {
|
|
|
23
23
|
protected emptyContent(): void;
|
|
24
24
|
protected updateSpecialClasses(embed: HTMLDivElement, code: string | undefined, err: Error | null): void;
|
|
25
25
|
editGraph(content: BlockContentElement): void;
|
|
26
|
-
getContextMenu(): OnesContextMenuOptions;
|
|
27
26
|
getBlockProperties(block: BlockElement, properties?: GraphEmbedBlockProperties): BlockProperties;
|
|
28
27
|
private hasChanged;
|
|
29
28
|
private removeStatusContent;
|
|
@@ -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, };
|
|
@@ -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;
|
|
@@ -30,7 +30,11 @@ 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[]>;
|
|
33
36
|
getFileUrlsByHashes(resourceHashes: string[]): Promise<any[]>;
|
|
37
|
+
patchSyncResourceByHashes(resourceHashes: string[]): Promise<any[]>;
|
|
34
38
|
uploadFile(url: string, file: File, headers: {
|
|
35
39
|
[index: string]: string;
|
|
36
40
|
}, onProgress: OnProgress, options?: {
|
|
@@ -76,6 +76,7 @@ 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[]>;
|
|
79
80
|
uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
|
|
80
81
|
buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
|
|
81
82
|
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
|
+
}
|