@ones-editor/editor 1.1.0-beta.1 → 1.1.1
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/context-menu/index.d.ts +3 -0
- package/@ones-editor/context-menu/package.json +8 -0
- package/@ones-editor/context-menu/src/helper/actions.d.ts +5 -0
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +26 -0
- package/@ones-editor/context-menu/src/helper/utils.d.ts +3 -0
- package/@ones-editor/context-menu/src/locale/en-us.d.ts +14 -0
- package/@ones-editor/context-menu/src/locale/ja-jp.d.ts +14 -0
- package/@ones-editor/context-menu/src/locale/zh-cn.d.ts +14 -0
- package/@ones-editor/context-menu/src/menu/index.d.ts +17 -0
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -22
- package/@ones-editor/core/src/core/composition/index.d.ts +1 -1
- 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 +4 -3
- package/@ones-editor/core/src/core/keyboard/default-shortcuts.d.ts +2 -1
- package/@ones-editor/core/src/core/types.d.ts +27 -1
- package/@ones-editor/core/src/utils/blob-to-string.d.ts +1 -0
- package/@ones-editor/core/src/utils/index.d.ts +1 -0
- package/@ones-editor/graph-embed/src/config/index.d.ts +1 -1
- package/@ones-editor/image-embed/src/shortcuts/index.d.ts +2 -1
- 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/icons/index.d.ts +1 -2
- package/@ones-editor/ui-base/src/input/create-input.d.ts +1 -2
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +1 -1
- package/dist/index.js +201 -208
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/@ones-editor/status/package.json +0 -7
- package/@ones-editor/status/src/dom/input.d.ts +0 -1
- package/@ones-editor/status/src/dom/status-palette.d.ts +0 -6
- package/@ones-editor/status/src/index.d.ts +0 -4
- package/@ones-editor/status/src/locale/en-us.d.ts +0 -26
- package/@ones-editor/status/src/locale/ja-jp.d.ts +0 -26
- package/@ones-editor/status/src/locale/zh-cn.d.ts +0 -26
- package/@ones-editor/status/src/status-box-command.d.ts +0 -7
- package/@ones-editor/status/src/status-box-data.d.ts +0 -5
- package/@ones-editor/status/src/status-box-editor.d.ts +0 -20
- package/@ones-editor/status/src/status-box.d.ts +0 -4
- package/@ones-editor/status/src/types.d.ts +0 -8
- /package/@ones-editor/{status → context-menu}/src/locale/index.d.ts +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
export declare function handleCopyAction(editor: OnesEditor): Promise<void>;
|
|
3
|
+
export declare function handleCopyMarkdownAction(editor: OnesEditor): Promise<void>;
|
|
4
|
+
export declare function handleCutAction(editor: OnesEditor): Promise<void>;
|
|
5
|
+
export declare function handleSaveImageFromImageEmbedTypeBlock(editor: OnesEditor, block: BlockElement): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OnesEditor, CommandItem } from '../../../../@ones-editor/core';
|
|
2
|
+
export default class ContextMenuCommandItems {
|
|
3
|
+
private editor;
|
|
4
|
+
private t;
|
|
5
|
+
private clipboardPermission;
|
|
6
|
+
private isSecureContext;
|
|
7
|
+
private externalActionHandleMap;
|
|
8
|
+
constructor(editor: OnesEditor);
|
|
9
|
+
get hasClipboardReadPermission(): boolean;
|
|
10
|
+
get hasClipboardWritePermission(): boolean;
|
|
11
|
+
clipboardSupport(): void;
|
|
12
|
+
get isRangeCollapsed(): boolean;
|
|
13
|
+
get imageTypeCommandItems(): CommandItem[];
|
|
14
|
+
get copyTypeCommandItems(): CommandItem[];
|
|
15
|
+
get cutCommandItem(): CommandItem;
|
|
16
|
+
get stepItem(): CommandItem;
|
|
17
|
+
get selectionCommandItems(): CommandItem[];
|
|
18
|
+
destroy(): void;
|
|
19
|
+
handleActionByExternal: (item: CommandItem) => unknown;
|
|
20
|
+
getPasteCommandItem: () => Promise<CommandItem>;
|
|
21
|
+
getCommandItems: () => Promise<CommandItem[]>;
|
|
22
|
+
private getExternalContextMenuOptions;
|
|
23
|
+
private secureEnvTips;
|
|
24
|
+
private isFocusImageBlock;
|
|
25
|
+
private isFocusImageTypeEmbed;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
contextMenu: {
|
|
3
|
+
copyMarkdown: string;
|
|
4
|
+
paste: string;
|
|
5
|
+
copyImage: string;
|
|
6
|
+
copyImageUrl: string;
|
|
7
|
+
imageSaveAs: string;
|
|
8
|
+
newTabOpenImage: string;
|
|
9
|
+
selectBlock: string;
|
|
10
|
+
selectAll: string;
|
|
11
|
+
uneditableBlockSelected: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
contextMenu: {
|
|
3
|
+
copyMarkdown: string;
|
|
4
|
+
paste: string;
|
|
5
|
+
copyImage: string;
|
|
6
|
+
copyImageUrl: string;
|
|
7
|
+
imageSaveAs: string;
|
|
8
|
+
newTabOpenImage: string;
|
|
9
|
+
selectBlock: string;
|
|
10
|
+
selectAll: string;
|
|
11
|
+
uneditableBlockSelected: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
contextMenu: {
|
|
3
|
+
copyMarkdown: string;
|
|
4
|
+
paste: string;
|
|
5
|
+
copyImage: string;
|
|
6
|
+
copyImageUrl: string;
|
|
7
|
+
imageSaveAs: string;
|
|
8
|
+
newTabOpenImage: string;
|
|
9
|
+
selectBlock: string;
|
|
10
|
+
selectAll: string;
|
|
11
|
+
uneditableBlockSelected: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OnesEditor, OnesEditorCustom } from '../../../../@ones-editor/core';
|
|
2
|
+
import './context-menu.scss';
|
|
3
|
+
declare class OnesEditorContextMenu implements OnesEditorCustom {
|
|
4
|
+
private editor;
|
|
5
|
+
private contextMenu;
|
|
6
|
+
private contextMenuCommandItems;
|
|
7
|
+
constructor(editor: OnesEditor);
|
|
8
|
+
destroy: () => void;
|
|
9
|
+
private updateEditorCaret;
|
|
10
|
+
private handleContextMenu;
|
|
11
|
+
private isInMenu;
|
|
12
|
+
private isInEditor;
|
|
13
|
+
private handleContextMenuShown;
|
|
14
|
+
private handleContextMenuClick;
|
|
15
|
+
private handleImageEmbedAction;
|
|
16
|
+
}
|
|
17
|
+
export default OnesEditorContextMenu;
|
|
@@ -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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment } from './clipboard/copy';
|
|
1
|
+
export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment, editorCopyWithoutEvent } from './clipboard/copy';
|
|
2
2
|
export { copyResourcesFromDoc } from './clipboard/resources/copy-resources';
|
|
@@ -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 {
|
|
2
|
-
import { OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
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[];
|
|
@@ -26,7 +26,8 @@ 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
|
-
|
|
29
|
+
pasteDocs(docs: OnesEditorDocs, event: ClipboardEvent | null, files: File[]): Promise<void>;
|
|
30
30
|
destroy(): void;
|
|
31
31
|
forEach(cb: (handler: OnesEditorInputHandler) => void): void;
|
|
32
|
+
private getClipboardData;
|
|
32
33
|
}
|
|
@@ -66,6 +66,7 @@ export interface Box {
|
|
|
66
66
|
handleClickBox?: (editor: OnesEditor, box: BoxElement, event: MouseEvent) => void;
|
|
67
67
|
toStandardText?: (editor: OnesEditor, box: DocBox) => Promise<DocBlockText | undefined>;
|
|
68
68
|
getBoxProperties?: (editor: OnesEditor, boxElement: BoxElement) => BoxProperties;
|
|
69
|
+
getResources?: (editor: OnesEditor, box: DocBox) => string[] | null;
|
|
69
70
|
}
|
|
70
71
|
export interface Insertion {
|
|
71
72
|
insertionType: string;
|
|
@@ -97,6 +98,7 @@ export interface Embed {
|
|
|
97
98
|
data?: DocBlockAttributes;
|
|
98
99
|
}) => ConvertBlockResult | null;
|
|
99
100
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, path: BlockPath) => Promise<DocObject | undefined>;
|
|
101
|
+
getResources?: (editor: OnesEditor, blockData: DocBlock) => string[];
|
|
100
102
|
}
|
|
101
103
|
export interface ConvertBlockResult {
|
|
102
104
|
blockData: DocBlock;
|
|
@@ -226,7 +228,7 @@ export interface Block {
|
|
|
226
228
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
|
|
227
229
|
getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
|
|
228
230
|
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
229
|
-
getResources?: (data: DocBlock) => string[];
|
|
231
|
+
getResources?: (editor: OnesEditor, data: DocBlock) => string[] | null;
|
|
230
232
|
replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
|
|
231
233
|
}
|
|
232
234
|
export type TextStyles = {
|
|
@@ -389,6 +391,7 @@ export interface OnesEditorOptionalOptions {
|
|
|
389
391
|
colors?: string[];
|
|
390
392
|
scrollContainer?: HTMLElement;
|
|
391
393
|
enableComments?: boolean;
|
|
394
|
+
enableContextMenu?: boolean;
|
|
392
395
|
settingsProvider?: OnesEditorSettingsProvider;
|
|
393
396
|
}
|
|
394
397
|
export interface OnesEditorOptions {
|
|
@@ -397,6 +400,7 @@ export interface OnesEditorOptions {
|
|
|
397
400
|
[index: string]: unknown;
|
|
398
401
|
};
|
|
399
402
|
enableComments?: boolean;
|
|
403
|
+
enableContextMenu?: boolean;
|
|
400
404
|
scrollContainer?: HTMLElement;
|
|
401
405
|
}
|
|
402
406
|
export interface OnesEditorComponents {
|
|
@@ -565,10 +569,32 @@ export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBl
|
|
|
565
569
|
export type PasteOptions = {
|
|
566
570
|
toPlainText?: boolean;
|
|
567
571
|
};
|
|
572
|
+
export interface EditorInputCallbacks {
|
|
573
|
+
onInsertText: (event: Event, text: string) => void;
|
|
574
|
+
onCompositionStart: (event: Event) => void;
|
|
575
|
+
onUpdateCompositionText: (event: Event, text: string, end: boolean) => void;
|
|
576
|
+
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
577
|
+
onChanged: (action: OnesEditorUndoAction) => void;
|
|
578
|
+
onRemoteChanged: (type: RemoteChangeType) => void;
|
|
579
|
+
onFocus: () => void;
|
|
580
|
+
onBlur: () => void;
|
|
581
|
+
onPaste: (event: ClipboardEvent) => void;
|
|
582
|
+
onPasteText: (text: string, options?: PasteOptions) => void;
|
|
583
|
+
onCopy: (event: ClipboardEvent) => void;
|
|
584
|
+
onCut: (event: ClipboardEvent) => void;
|
|
585
|
+
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
586
|
+
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
587
|
+
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
588
|
+
defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
589
|
+
destroy: () => void;
|
|
590
|
+
pasteDoc: (doc: DocObject) => Promise<void>;
|
|
591
|
+
forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
|
|
592
|
+
}
|
|
568
593
|
export interface OnesEditorInput {
|
|
569
594
|
readonly inputElement: HTMLInputElement;
|
|
570
595
|
destroy: () => void;
|
|
571
596
|
focus: () => void;
|
|
597
|
+
callbacks: EditorInputCallbacks;
|
|
572
598
|
handleDocumentSelectionChange: () => void;
|
|
573
599
|
handleCompositionstart: (event: CompositionEvent) => void;
|
|
574
600
|
handleCompositionend: (event: CompositionEvent) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function blob2String(blob: Blob): Promise<string>;
|
|
@@ -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";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OnesEditor, ShortcutRecords } from '../../../../@ones-editor/core';
|
|
2
|
+
import { copyImage } from './copy-image';
|
|
2
3
|
declare function deleteImage(editor: OnesEditor): true | undefined;
|
|
3
4
|
declare const ImageShortcuts: ShortcutRecords;
|
|
4
|
-
export { ImageShortcuts, deleteImage, };
|
|
5
|
+
export { ImageShortcuts, deleteImage, copyImage, };
|