@ones-editor/editor 1.0.2-beta.9 → 1.0.3
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/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 +1 -0
- 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 -27
- package/@ones-editor/core/src/local-doc/index.d.ts +1 -0
- 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 +1 -2
- 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/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/history-doc/history-doc.d.ts +1 -0
- package/dist/index.js +174 -175
- 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 -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/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';
|
|
@@ -213,6 +213,7 @@ export interface OnesEditorDoc extends OnesEditorDocServer {
|
|
|
213
213
|
}[]) => void;
|
|
214
214
|
localDeleteChildContainers: (containerIds: string[]) => void;
|
|
215
215
|
addResources: (resourceIds: string[]) => Promise<string[]>;
|
|
216
|
+
patchSyncResources: (resourceIds: string[]) => Promise<string[]>;
|
|
216
217
|
uploadResource: (file: File, options?: UploadResourceOptions) => Promise<UploadResourceResult>;
|
|
217
218
|
request: <T = unknown>(url: string, options?: unknown) => Promise<T>;
|
|
218
219
|
broadcastMessage: (data: unknown) => void;
|
|
@@ -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
|
}
|
|
@@ -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,12 +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
402
|
export interface OnesEditorComponents {
|
|
408
403
|
blocks?: Block[];
|
|
409
404
|
boxes?: Box[];
|
|
@@ -570,32 +565,10 @@ export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBl
|
|
|
570
565
|
export type PasteOptions = {
|
|
571
566
|
toPlainText?: boolean;
|
|
572
567
|
};
|
|
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
|
-
}
|
|
594
568
|
export interface OnesEditorInput {
|
|
595
569
|
readonly inputElement: HTMLInputElement;
|
|
596
570
|
destroy: () => void;
|
|
597
571
|
focus: () => void;
|
|
598
|
-
callbacks: EditorInputCallbacks;
|
|
599
572
|
handleDocumentSelectionChange: () => void;
|
|
600
573
|
handleCompositionstart: (event: CompositionEvent) => void;
|
|
601
574
|
handleCompositionend: (event: CompositionEvent) => void;
|
|
@@ -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,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";
|
|
@@ -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: {
|
|
19
19
|
'hovering-toolbar': GraphBlockCommands;
|
|
20
20
|
};
|
|
21
21
|
abstract: string;
|
|
@@ -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, };
|
|
@@ -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>;
|