@ones-editor/editor 1.0.2-beta.2 → 1.0.2-beta.21
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/clipboard/copy.d.ts +1 -3
- 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/input-handler.d.ts +2 -2
- package/@ones-editor/core/src/core/types.d.ts +0 -11
- package/@ones-editor/core/src/local-doc/index.d.ts +1 -0
- 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-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 +183 -183
- 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 -2
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +0 -17
- package/@ones-editor/context-menu/src/helper/is-clipboard-empty.d.ts +0 -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
- 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
|
@@ -4,7 +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
|
-
export declare function editorCopyWithoutEvent(editor: OnesEditor
|
|
8
|
-
copyAsMarkdown: boolean;
|
|
9
|
-
}): void;
|
|
7
|
+
export declare function editorCopyWithoutEvent(editor: OnesEditor): void;
|
|
10
8
|
export declare function editorCopyBlock(editor: OnesEditor, block: BlockElement): Promise<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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorInputCallbacks } from '../composition/editor-input';
|
|
2
|
-
import { OnesEditor,
|
|
2
|
+
import { OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
3
3
|
import { DocObject } from '../doc';
|
|
4
4
|
export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
5
5
|
editor: OnesEditor;
|
|
@@ -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
|
}
|
|
@@ -389,7 +389,6 @@ export interface OnesEditorOptionalOptions {
|
|
|
389
389
|
colors?: string[];
|
|
390
390
|
scrollContainer?: HTMLElement;
|
|
391
391
|
enableComments?: boolean;
|
|
392
|
-
enableContextMenu?: boolean;
|
|
393
392
|
settingsProvider?: OnesEditorSettingsProvider;
|
|
394
393
|
}
|
|
395
394
|
export interface OnesEditorOptions {
|
|
@@ -398,15 +397,8 @@ export interface OnesEditorOptions {
|
|
|
398
397
|
[index: string]: unknown;
|
|
399
398
|
};
|
|
400
399
|
enableComments?: boolean;
|
|
401
|
-
enableContextMenu?: boolean;
|
|
402
400
|
scrollContainer?: HTMLElement;
|
|
403
401
|
}
|
|
404
|
-
export interface OnesEditorContextMenuInstance {
|
|
405
|
-
show: (event: MouseEvent) => void;
|
|
406
|
-
}
|
|
407
|
-
interface OnesEditorContextMenu {
|
|
408
|
-
new (editor: OnesEditor): OnesEditorContextMenuInstance;
|
|
409
|
-
}
|
|
410
402
|
export interface OnesEditorComponents {
|
|
411
403
|
blocks?: Block[];
|
|
412
404
|
boxes?: Box[];
|
|
@@ -417,7 +409,6 @@ export interface OnesEditorComponents {
|
|
|
417
409
|
commandProviders?: OnesEditorCommandProvider[];
|
|
418
410
|
textRenders?: OnesEditorBlockRenderer[];
|
|
419
411
|
blockHooks?: OnesEditorBlockHook[];
|
|
420
|
-
contextMenu?: OnesEditorContextMenu;
|
|
421
412
|
options?: {
|
|
422
413
|
[index: string]: unknown;
|
|
423
414
|
};
|
|
@@ -481,7 +472,6 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
481
472
|
readonly options: OnesEditorOptions;
|
|
482
473
|
readonly domEvents: OnesEditorDomEvents;
|
|
483
474
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
484
|
-
readonly contextMenu: OnesEditorContextMenuInstance | null;
|
|
485
475
|
readonly: boolean;
|
|
486
476
|
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
|
|
487
477
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
@@ -692,4 +682,3 @@ export interface OnesEditorBlockHook {
|
|
|
692
682
|
writable?: (editor: OnesEditor, blockElement: BlockElement | BlockElement[]) => boolean | undefined;
|
|
693
683
|
commands?: (editor: OnesEditor, blockElement: BlockElement) => BlockCommands;
|
|
694
684
|
}
|
|
695
|
-
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,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
|
+
}
|