@ones-editor/editor 1.0.6-bate.1 → 1.0.6-bate.2
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/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 +0 -1
- package/@ones-editor/core/src/core/editor-doc/editor-doc.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 -4
- package/@ones-editor/core/src/core/keyboard/default-shortcuts.d.ts +1 -2
- package/@ones-editor/core/src/core/types.d.ts +2 -25
- package/@ones-editor/core/src/local-doc/index.d.ts +0 -1
- package/@ones-editor/core/src/utils/index.d.ts +0 -1
- package/@ones-editor/graph-embed/src/config/index.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 +0 -4
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +0 -1
- 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 +0 -1
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +1 -1
- package/dist/index.js +827 -75342
- 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 -17
- package/@ones-editor/core/src/utils/blob-to-string.d.ts +0 -1
|
@@ -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';
|
|
@@ -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,7 +213,6 @@ 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[]>;
|
|
217
216
|
uploadResource: (file: File, options?: UploadResourceOptions) => Promise<UploadResourceResult>;
|
|
218
217
|
request: <T = unknown>(url: string, options?: unknown) => Promise<T>;
|
|
219
218
|
broadcastMessage: (data: unknown) => void;
|
|
@@ -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,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,8 +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
|
-
private getClipboardData;
|
|
33
32
|
}
|
|
@@ -97,6 +97,7 @@ export interface Embed {
|
|
|
97
97
|
data?: DocBlockAttributes;
|
|
98
98
|
}) => ConvertBlockResult | null;
|
|
99
99
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, path: BlockPath) => Promise<DocObject | undefined>;
|
|
100
|
+
getResources?: (editor: OnesEditor, blockData: DocBlock) => string[];
|
|
100
101
|
}
|
|
101
102
|
export interface ConvertBlockResult {
|
|
102
103
|
blockData: DocBlock;
|
|
@@ -226,7 +227,7 @@ export interface Block {
|
|
|
226
227
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
|
|
227
228
|
getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
|
|
228
229
|
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
229
|
-
getResources?: (data: DocBlock) => string[];
|
|
230
|
+
getResources?: (editor: OnesEditor, data: DocBlock) => string[];
|
|
230
231
|
replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
|
|
231
232
|
}
|
|
232
233
|
export type TextStyles = {
|
|
@@ -389,7 +390,6 @@ export interface OnesEditorOptionalOptions {
|
|
|
389
390
|
colors?: string[];
|
|
390
391
|
scrollContainer?: HTMLElement;
|
|
391
392
|
enableComments?: boolean;
|
|
392
|
-
enableContextMenu?: boolean;
|
|
393
393
|
settingsProvider?: OnesEditorSettingsProvider;
|
|
394
394
|
}
|
|
395
395
|
export interface OnesEditorOptions {
|
|
@@ -398,7 +398,6 @@ export interface OnesEditorOptions {
|
|
|
398
398
|
[index: string]: unknown;
|
|
399
399
|
};
|
|
400
400
|
enableComments?: boolean;
|
|
401
|
-
enableContextMenu?: boolean;
|
|
402
401
|
scrollContainer?: HTMLElement;
|
|
403
402
|
}
|
|
404
403
|
export interface OnesEditorComponents {
|
|
@@ -567,32 +566,10 @@ export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBl
|
|
|
567
566
|
export type PasteOptions = {
|
|
568
567
|
toPlainText?: boolean;
|
|
569
568
|
};
|
|
570
|
-
export interface EditorInputCallbacks {
|
|
571
|
-
onInsertText: (event: Event, text: string) => void;
|
|
572
|
-
onCompositionStart: (event: Event) => void;
|
|
573
|
-
onUpdateCompositionText: (event: Event, text: string, end: boolean) => void;
|
|
574
|
-
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
575
|
-
onChanged: (action: OnesEditorUndoAction) => void;
|
|
576
|
-
onRemoteChanged: (type: RemoteChangeType) => void;
|
|
577
|
-
onFocus: () => void;
|
|
578
|
-
onBlur: () => void;
|
|
579
|
-
onPaste: (event: ClipboardEvent) => void;
|
|
580
|
-
onPasteText: (text: string, options?: PasteOptions) => void;
|
|
581
|
-
onCopy: (event: ClipboardEvent) => void;
|
|
582
|
-
onCut: (event: ClipboardEvent) => void;
|
|
583
|
-
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
584
|
-
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
585
|
-
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
586
|
-
defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
587
|
-
destroy: () => void;
|
|
588
|
-
pasteDoc: (doc: DocObject) => Promise<void>;
|
|
589
|
-
forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
|
|
590
|
-
}
|
|
591
569
|
export interface OnesEditorInput {
|
|
592
570
|
readonly inputElement: HTMLInputElement;
|
|
593
571
|
destroy: () => void;
|
|
594
572
|
focus: () => void;
|
|
595
|
-
callbacks: EditorInputCallbacks;
|
|
596
573
|
handleDocumentSelectionChange: () => void;
|
|
597
574
|
handleCompositionstart: (event: CompositionEvent) => void;
|
|
598
575
|
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
|
|
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";
|
|
@@ -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,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>;
|