@ones-editor/editor 1.0.6-bate.3 → 1.0.6-bate.6
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/child-block-tracker/src/event-tracker.d.ts +6 -3
- package/@ones-editor/child-block-tracker/src/index.d.ts +3 -3
- 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 +6 -0
- package/@ones-editor/context-menu/src/helper/command-items.d.ts +26 -0
- package/@ones-editor/context-menu/src/helper/utils.d.ts +5 -0
- package/@ones-editor/context-menu/src/locale/en-us.d.ts +14 -0
- package/@ones-editor/context-menu/src/locale/index.d.ts +1 -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/package.json +1 -1
- package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +1 -1
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -0
- package/@ones-editor/core/src/core/containers/children.d.ts +1 -0
- package/@ones-editor/core/src/core/containers/root-container.d.ts +3 -0
- package/@ones-editor/core/src/core/input-handler/actions.d.ts +3 -0
- package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +2 -0
- package/@ones-editor/core/src/core/keyboard/default-shortcuts.d.ts +2 -1
- package/@ones-editor/core/src/core/selection/editor-selection.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +4 -3
- 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/misc/src/index.d.ts +0 -1
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +6 -1
- package/@ones-editor/table-block/src/table-block/chart/index.d.ts +2 -2
- 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/dist/index.d.ts +1 -1
- package/dist/index.js +183 -179
- package/dist/types.d.ts +2 -0
- package/package.json +2 -2
- package/@ones-editor/misc/src/is-secure-env.d.ts +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { BlockElement, OnesEditor, OnesEditorDocCallbacks } from '../../../@ones-editor/core';
|
|
3
|
-
export type ChildBlockAction = 'text-change' | 'data-change';
|
|
2
|
+
import { BlockElement, BlockPathComponent, OnesEditor, OnesEditorDocCallbacks } from '../../../@ones-editor/core';
|
|
3
|
+
export type ChildBlockAction = 'text-change' | 'data-change' | 'insert' | 'remove';
|
|
4
4
|
export interface ChildBlockEvents {
|
|
5
|
-
change: (editor: OnesEditor, parentBlock: BlockElement, childBlock: BlockElement, action: ChildBlockAction) => void;
|
|
5
|
+
change: (editor: OnesEditor, target: BlockPathComponent, parentBlock: BlockElement, childBlock: BlockElement, action: ChildBlockAction) => void;
|
|
6
|
+
insert: (editor: OnesEditor, target: BlockPathComponent) => void;
|
|
6
7
|
}
|
|
7
8
|
export declare class ChildBlockEventTracker extends TypedEmitter<ChildBlockEvents> implements OnesEditorDocCallbacks {
|
|
8
9
|
private editor;
|
|
@@ -10,5 +11,7 @@ export declare class ChildBlockEventTracker extends TypedEmitter<ChildBlockEvent
|
|
|
10
11
|
handleChild(containerId: string, blockIndex: number, action: ChildBlockAction): void;
|
|
11
12
|
onUpdateBlockData(containerId: string, blockIndex: number): void;
|
|
12
13
|
onUpdateBlockText(containerId: string, blockIndex: number): void;
|
|
14
|
+
onInsertBlock(containerId: string, blockIndex: number): void;
|
|
15
|
+
onDeleteBlock(containerId: string, blockIndex: number): void;
|
|
13
16
|
destroy(): void;
|
|
14
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlockElement, OnesEditor } from '../../../@ones-editor/core';
|
|
1
|
+
import { BlockElement, BlockPathComponent, OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
export * from './event-tracker';
|
|
3
|
-
export declare function trackChildBlockEvent(editor: OnesEditor, callback: (editor: OnesEditor,
|
|
4
|
-
export declare function untrackChildBlockEvent(editor: OnesEditor, callback: (editor: OnesEditor,
|
|
3
|
+
export declare function trackChildBlockEvent(editor: OnesEditor, callback: (editor: OnesEditor, target: BlockPathComponent, parentBlock?: BlockElement, childBlock?: BlockElement) => void): void;
|
|
4
|
+
export declare function untrackChildBlockEvent(editor: OnesEditor, callback: (editor: OnesEditor, target: BlockPathComponent, parentBlock?: BlockElement, childBlock?: BlockElement) => void): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
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>;
|
|
6
|
+
export declare function handleMockPasteAction(editor: OnesEditor): 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,5 @@
|
|
|
1
|
+
export declare function blobToString(blob: Blob): Promise<string>;
|
|
2
|
+
export declare function isClipboardEmpty(): Promise<boolean>;
|
|
3
|
+
export declare function saveAs(resourceUrl: string, resourceId: string): void;
|
|
4
|
+
export declare function blob2String(blob: Blob): Promise<string>;
|
|
5
|
+
export declare function getClipboardData(): Promise<DataTransfer>;
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|
|
@@ -4,5 +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): void;
|
|
7
|
+
export declare function editorCopyWithoutEvent(editor: OnesEditor, beforeCopy?: BeforeCopyCallback): void;
|
|
8
8
|
export declare function editorCopyBlock(editor: OnesEditor, block: BlockElement): Promise<boolean>;
|
|
@@ -30,6 +30,7 @@ export declare class EditorInput implements OnesEditorInput {
|
|
|
30
30
|
destroy(): void;
|
|
31
31
|
getInput(): HTMLInputElement;
|
|
32
32
|
focus(): void;
|
|
33
|
+
handleWindowBlur: () => void;
|
|
33
34
|
handleDocumentClick: (event: MouseEvent) => void;
|
|
34
35
|
handleDocumentSelectionChange: () => void;
|
|
35
36
|
handleEditorSelectionChanged: () => void;
|
|
@@ -4,3 +4,4 @@ export declare function getFirstChildBlock(container: ContainerElement): BlockEl
|
|
|
4
4
|
export declare function getLastChildBlock(container: ContainerElement): BlockElement;
|
|
5
5
|
export declare function getChildBlockCount(container: ContainerElement): number;
|
|
6
6
|
export declare function getBlockByIndex(container: ContainerElement, blockIndex: number): BlockElement;
|
|
7
|
+
export declare function findBlockByIndex(container: ContainerElement, blockIndex: number): BlockElement | null;
|
|
@@ -4,6 +4,7 @@ export declare class RootContainer {
|
|
|
4
4
|
private editor;
|
|
5
5
|
rootContainer: ContainerElement;
|
|
6
6
|
resizeObserver: ResizeObserver;
|
|
7
|
+
private isMoved;
|
|
7
8
|
constructor(editor: OnesEditor, rootContainer: ContainerElement);
|
|
8
9
|
private bindEvents;
|
|
9
10
|
private unbindEvents;
|
|
@@ -16,6 +17,8 @@ export declare class RootContainer {
|
|
|
16
17
|
handleMouseDown: (event: MouseEvent) => void;
|
|
17
18
|
handleMouseMove: (event: MouseEvent) => void;
|
|
18
19
|
handleMouseUp: (event: MouseEvent) => void;
|
|
20
|
+
handleCaptureClick: (event: MouseEvent) => void;
|
|
21
|
+
handleCaptureDbClick: (event: MouseEvent) => void;
|
|
19
22
|
reload(): void;
|
|
20
23
|
}
|
|
21
24
|
export declare function createRootContainer(editor: OnesEditor): RootContainer;
|
|
@@ -4,3 +4,6 @@ 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 isSelectedCodeTextBlock(editor: OnesEditor): boolean;
|
|
8
|
+
export declare function getSelectedCodeBlockMarkdown(editor: OnesEditor, codeText: string): string;
|
|
9
|
+
export declare function editorHandleCopyMarkdown(editor: OnesEditor): boolean;
|
|
@@ -11,7 +11,9 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
|
11
11
|
onRemoteChanged(type: RemoteChangeType): void;
|
|
12
12
|
onCompositionStart(event: Event): void;
|
|
13
13
|
onUpdateCompositionText(event: Event, text: string, end: boolean): void;
|
|
14
|
+
private hookExecutionAttempt;
|
|
14
15
|
onCopy(event: ClipboardEvent): void;
|
|
16
|
+
onCopyWithoutEvent(): void;
|
|
15
17
|
onCut(event: ClipboardEvent): void;
|
|
16
18
|
onPaste(event: ClipboardEvent): void;
|
|
17
19
|
onPasteText: (text: string, options?: PasteOptions) => Promise<void>;
|
|
@@ -14,7 +14,7 @@ export declare class EditorSelection implements OnesEditorSelection {
|
|
|
14
14
|
getFocusedBlock(): BlockElement;
|
|
15
15
|
getStartBlock(): BlockElement;
|
|
16
16
|
getEndBlock(): BlockElement;
|
|
17
|
-
selectBlock(block: BlockElement, start: number, end?: number): void;
|
|
17
|
+
selectBlock(block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions): void;
|
|
18
18
|
setSelection(anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions): SelectionRange;
|
|
19
19
|
setRange(range: SelectionRange, options?: ChangeSelectionOptions): SelectionRange;
|
|
20
20
|
updateSelection(): void;
|
|
@@ -66,7 +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[];
|
|
69
|
+
getResources?: (editor: OnesEditor, box: DocBox) => string[] | null;
|
|
70
70
|
}
|
|
71
71
|
export interface Insertion {
|
|
72
72
|
insertionType: string;
|
|
@@ -228,7 +228,7 @@ export interface Block {
|
|
|
228
228
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
|
|
229
229
|
getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
|
|
230
230
|
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
231
|
-
getResources?: (editor: OnesEditor, data: DocBlock) => string[];
|
|
231
|
+
getResources?: (editor: OnesEditor, data: DocBlock) => string[] | null;
|
|
232
232
|
replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
|
|
233
233
|
}
|
|
234
234
|
export type TextStyles = {
|
|
@@ -504,6 +504,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
504
504
|
getBlockById: (id: string) => BlockElement;
|
|
505
505
|
getBoxById: (id: string) => BoxElement;
|
|
506
506
|
getBlockByIndex: (containerId: string, blockIndex: number) => BlockElement;
|
|
507
|
+
findBlockByIndex: (containerId: string, blockIndex: number) => BlockElement | null;
|
|
507
508
|
getBlockIndex: (block: BlockElement | string) => number;
|
|
508
509
|
getContainerById: (id: string) => ContainerElement;
|
|
509
510
|
getParentContainer: (block: BlockElement) => ContainerElement;
|
|
@@ -554,7 +555,7 @@ export interface OnesEditorSelection {
|
|
|
554
555
|
readonly endBlock: BlockElement;
|
|
555
556
|
setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
|
|
556
557
|
setRange: (range: SelectionRange, options?: ChangeSelectionOptions) => SelectionRange;
|
|
557
|
-
selectBlock: (block: BlockElement, start: number, end?: number) => void;
|
|
558
|
+
selectBlock: (block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions) => void;
|
|
558
559
|
updateSelection: (old: SelectionRange | null) => void;
|
|
559
560
|
updateLastCaretRect: () => void;
|
|
560
561
|
getSuggestedCaretX: () => number | undefined;
|
|
@@ -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, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildResourceUrlOptions, DocObject, DocVersion, EventCallbacks, OnesEditorDocHistoryData, OnesEditorDocServer, OnesEditorDocServerMeta, OnesEditorDocVersionExtra, OnesEditorDocVersionHelper, OnesEditorHistoryDataParseHandler, RemoteUsers } from '../../../../@ones-editor/core';
|
|
2
|
-
import { ShareDBDocCallbacks, ShareDBDocOptions } from '../types';
|
|
2
|
+
import { AuthMessage, ShareDBDocCallbacks, ShareDBDocOptions } from '../types';
|
|
3
3
|
import ShareDBSimpleClient from './simple-client';
|
|
4
4
|
export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> implements OnesEditorDocServer, OnesEditorDocVersionHelper {
|
|
5
5
|
private options;
|
|
@@ -26,4 +26,9 @@ export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> i
|
|
|
26
26
|
createVersion(tag: string, publish: boolean): Promise<DocVersion>;
|
|
27
27
|
parseHistoryData(historyData: OnesEditorDocHistoryData, handler: OnesEditorHistoryDataParseHandler): void;
|
|
28
28
|
getServerMeta(): OnesEditorDocServerMeta;
|
|
29
|
+
static auth(auth: AuthMessage, serverUrl: string): Promise<{
|
|
30
|
+
read: string;
|
|
31
|
+
user: string;
|
|
32
|
+
}>;
|
|
33
|
+
static load(options: ShareDBDocOptions): Promise<ShareDBServer>;
|
|
29
34
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement } from '../../../../../@ones-editor/core';
|
|
2
|
-
export declare function handleChartDebounceUpdate(editor: OnesEditor, parentBlock
|
|
1
|
+
import { OnesEditor, BlockElement, BlockPathComponent } from '../../../../../@ones-editor/core';
|
|
2
|
+
export declare function handleChartDebounceUpdate(editor: OnesEditor, target?: BlockPathComponent, parentBlock?: BlockElement): void;
|
|
3
3
|
export declare function handleChartUpdate(editor: OnesEditor, parentBlock: BlockElement): void;
|