@ones-editor/editor 2.1.0-beta.6 → 2.1.0-beta.7
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/{ui → block-menu}/src/block-menu/index.d.ts +1 -3
- package/@ones-editor/block-menu/src/block-menu/items/block-command-items.d.ts +3 -0
- package/@ones-editor/block-menu/src/block-menu/items/index.d.ts +5 -0
- package/@ones-editor/block-menu/src/block-menu/items/insert-block-items/index.d.ts +5 -0
- package/@ones-editor/block-menu/src/block-menu/items/text-styles/text-style-item.d.ts +30 -0
- package/@ones-editor/block-menu/src/block-menu/items/types.d.ts +5 -0
- package/@ones-editor/block-menu/src/block-menu-button/menu-button/index.d.ts +1 -1
- package/@ones-editor/callout-block/src/callout-block/callout-quick-menu-item-filter.d.ts +4 -3
- package/@ones-editor/comments/src/text-comments/comments-command-provider.d.ts +3 -4
- package/@ones-editor/core/src/core/blocks/common/execute-block-command.d.ts +2 -2
- package/@ones-editor/core/src/core/command-providers/commands/index.d.ts +0 -2
- package/@ones-editor/core/src/core/command-providers/commands/range-commands.d.ts +3 -3
- package/@ones-editor/core/src/core/command-providers/editor-command-providers.d.ts +3 -4
- package/@ones-editor/core/src/core/command-providers/index.d.ts +1 -2
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -1
- package/@ones-editor/core/src/core/containers/root-container.d.ts +4 -4
- package/@ones-editor/core/src/core/selection/actions/index.d.ts +1 -2
- package/@ones-editor/core/src/core/selection/index.d.ts +0 -1
- package/@ones-editor/core/src/core/selection/select-handler.d.ts +3 -3
- package/@ones-editor/core/src/core/types.d.ts +24 -27
- package/@ones-editor/core/src/utils/dom.d.ts +0 -3
- package/@ones-editor/core/src/utils/drag-drop.d.ts +3 -8
- package/@ones-editor/image-embed/src/splitter-resizer/index.d.ts +3 -3
- package/@ones-editor/mobile-helper/src/index.d.ts +0 -6
- package/@ones-editor/table-block/src/commands/index.d.ts +0 -2
- package/@ones-editor/table-block/src/commands/table-block-commands.d.ts +3 -4
- package/@ones-editor/table-block/src/index.d.ts +1 -4
- package/@ones-editor/table-block/src/table-block/cell-menu/table-cell-dom.d.ts +0 -6
- package/@ones-editor/table-block/src/table-block/table-resize/resize-drag-drop.d.ts +4 -4
- package/@ones-editor/text-commands/src/index.d.ts +2 -1
- package/@ones-editor/text-commands/src/text-command-provider.d.ts +24 -0
- package/@ones-editor/text-commands/src/text-commands.d.ts +4 -0
- package/@ones-editor/{ui/src/providers/utils → text-commands/src}/text-styles.d.ts +1 -3
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/index.d.ts +7 -22
- package/@ones-editor/ui/src/{providers/utils → quick-menu}/basic-commands.d.ts +2 -1
- package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +16 -0
- package/@ones-editor/ui/src/quick-menu/index.d.ts +18 -6
- package/@ones-editor/ui/src/quick-menu/inline-box-items.d.ts +8 -0
- package/@ones-editor/ui/src/quick-menu/insert-empty-block.d.ts +4 -0
- package/@ones-editor/ui/src/quick-menu/order.d.ts +1 -0
- package/@ones-editor/ui/src/quick-menu/quick-menu-items.d.ts +9 -0
- package/@ones-editor/ui/src/quick-menu/types.d.ts +4 -0
- package/@ones-editor/ui/src/{providers → toolbar/commands}/align.d.ts +4 -4
- package/@ones-editor/ui/src/toolbar/commands/paragraph.d.ts +11 -0
- package/@ones-editor/ui/src/toolbar/commands/turn-into.d.ts +10 -0
- package/@ones-editor/ui/src/toolbar/merge-commands.d.ts +2 -0
- package/@ones-editor/ui/src/toolbar/text-commands.d.ts +2 -2
- package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +0 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -2
- package/@ones-editor/ui-base/src/popup/popup.d.ts +1 -1
- package/dist/index.js +4872 -6295
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/@ones-editor/core/src/core/command-providers/block-attributes.d.ts +0 -14
- package/@ones-editor/core/src/core/command-providers/commands/inject-source.d.ts +0 -3
- package/@ones-editor/core/src/core/command-providers/commands/merge-commands.d.ts +0 -3
- package/@ones-editor/layout-block/src/command-filter.d.ts +0 -7
- package/@ones-editor/mobile-helper/src/fixed-toolbar/fixed-providers.d.ts +0 -7
- package/@ones-editor/mobile-helper/src/fixed-toolbar/index.d.ts +0 -18
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/align-dropdown.d.ts +0 -9
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/group.d.ts +0 -7
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/insert-menu.d.ts +0 -13
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/insert.d.ts +0 -8
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/text-dropdown.d.ts +0 -9
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/turn-into.d.ts +0 -8
- package/@ones-editor/mobile-helper/src/fixed-toolbar/toolbar-handler.d.ts +0 -11
- package/@ones-editor/mobile-helper/src/selection-gripper/index.d.ts +0 -19
- package/@ones-editor/mobile-helper/src/selection-gripper/select-handle.d.ts +0 -3
- package/@ones-editor/mobile-helper/src/ui/init-menu-item.d.ts +0 -3
- package/@ones-editor/mobile-helper/src/ui/mobile-bottom-menu.d.ts +0 -22
- package/@ones-editor/ui/src/block-menu/block-command-providers.d.ts +0 -10
- package/@ones-editor/ui/src/providers/abstract-providers.d.ts +0 -27
- package/@ones-editor/ui/src/providers/align-dropdown.d.ts +0 -10
- package/@ones-editor/ui/src/providers/block-hook-provider.d.ts +0 -16
- package/@ones-editor/ui/src/providers/color-provider.d.ts +0 -16
- package/@ones-editor/ui/src/providers/heading.d.ts +0 -13
- package/@ones-editor/ui/src/providers/inline-code-provider.d.ts +0 -12
- package/@ones-editor/ui/src/providers/inline-style-provider.d.ts +0 -10
- package/@ones-editor/ui/src/providers/insert-above.d.ts +0 -9
- package/@ones-editor/ui/src/providers/insert-after.d.ts +0 -9
- package/@ones-editor/ui/src/providers/insert-box-provider.d.ts +0 -12
- package/@ones-editor/ui/src/providers/insert-group.d.ts +0 -7
- package/@ones-editor/ui/src/providers/insert-menu.d.ts +0 -16
- package/@ones-editor/ui/src/providers/link.d.ts +0 -17
- package/@ones-editor/ui/src/providers/list.d.ts +0 -14
- package/@ones-editor/ui/src/providers/paragraph.d.ts +0 -8
- package/@ones-editor/ui/src/providers/proxy-provider.d.ts +0 -10
- package/@ones-editor/ui/src/providers/quoted.d.ts +0 -12
- package/@ones-editor/ui/src/providers/script-with-dropdown.d.ts +0 -9
- package/@ones-editor/ui/src/providers/text-command-provider.d.ts +0 -18
- package/@ones-editor/ui/src/providers/text-fixed-provider.d.ts +0 -16
- package/@ones-editor/ui/src/providers/text-script-provider.d.ts +0 -10
- package/@ones-editor/ui/src/providers/text-styles.d.ts +0 -9
- package/@ones-editor/ui/src/providers/turn-into.d.ts +0 -9
- package/@ones-editor/ui/src/providers/types.d.ts +0 -3
- package/@ones-editor/ui/src/providers/utils/add-section.d.ts +0 -2
- package/@ones-editor/ui/src/providers/utils/inject-block-options.d.ts +0 -5
- package/@ones-editor/ui/src/providers/utils/range-commands.d.ts +0 -2
- package/@ones-editor/ui/src/providers/utils/text-commands.d.ts +0 -3
- package/@ones-editor/ui/src/quick-menu/quick-command-providers.d.ts +0 -10
- package/@ones-editor/ui-base/src/command-bar/mobile-bottom-menu.d.ts +0 -18
- /package/@ones-editor/{ui → block-menu}/src/block-menu/standard-block-actions/hook.d.ts +0 -0
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { BlockElement, OnesEditor,
|
|
1
|
+
import { BlockElement, OnesEditor, CommandItem } from '../../../../@ones-editor/core';
|
|
2
2
|
import type { ManualShowCommandBarOptions } from '../../../../@ones-editor/ui-base';
|
|
3
3
|
export default class BlockMenu {
|
|
4
4
|
private editor;
|
|
5
5
|
private menu;
|
|
6
6
|
currentBlock: BlockElement | null;
|
|
7
7
|
private commandBlock;
|
|
8
|
-
private blockCommandProviders;
|
|
9
8
|
constructor(editor: OnesEditor);
|
|
10
|
-
addFilter(id: CommandFilterId, filter: CommandFilter): void;
|
|
11
9
|
show(target: HTMLElement, options?: ManualShowCommandBarOptions): void;
|
|
12
10
|
isInMenu(eventTarget: EventTarget | null): boolean;
|
|
13
11
|
handleShow: () => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BlockElement, OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { TextStyleItemOptions } from './text-styles/text-style-item';
|
|
3
|
+
import { BlockMenuItem } from './types';
|
|
4
|
+
export declare function getBlockMenuItems(editor: OnesEditor, block: BlockElement, options: TextStyleItemOptions): BlockMenuItem[];
|
|
5
|
+
export declare function handleBlockMenuItemClick(editor: OnesEditor, block: BlockElement, item: BlockMenuItem): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BlockElement, OnesEditor } from '../../../../../../@ones-editor/core';
|
|
2
|
+
import type { GetAllQuickMenuItemsOptions } from '../../../../../../@ones-editor/ui';
|
|
3
|
+
import type { BlockMenuItem } from '../types';
|
|
4
|
+
export declare function getAllInsertBlockItems(editor: OnesEditor, block: BlockElement, source: 'insert-block' | 'insert-block-before', options: GetAllQuickMenuItemsOptions): BlockMenuItem[];
|
|
5
|
+
export declare function executeInsertBlockCommand(editor: OnesEditor, block: BlockElement, item: BlockMenuItem, insertAbove?: boolean): Promise<BlockElement | null> | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BlockElement, OnesEditor, DocBlock } from '../../../../../../@ones-editor/core';
|
|
2
|
+
import { BlockMenuItem } from '../types';
|
|
3
|
+
export interface ParagraphBlockAttribute extends DocBlock {
|
|
4
|
+
'heading'?: number;
|
|
5
|
+
quoted?: boolean;
|
|
6
|
+
align?: 'left' | 'center' | 'right';
|
|
7
|
+
checkbox?: 'checked' | 'unchecked';
|
|
8
|
+
ordered?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type TextStyleItemOptions = {
|
|
11
|
+
fromEmbed?: boolean;
|
|
12
|
+
onAfterStyleItemClick?: () => void;
|
|
13
|
+
};
|
|
14
|
+
export default class TextStyleItem implements BlockMenuItem {
|
|
15
|
+
private editor;
|
|
16
|
+
private block;
|
|
17
|
+
private options;
|
|
18
|
+
source: string;
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
element: HTMLElement;
|
|
22
|
+
private textStylesTooltips;
|
|
23
|
+
constructor(editor: OnesEditor, block: BlockElement, options: TextStyleItemOptions);
|
|
24
|
+
createItemElement(editor: OnesEditor, block: BlockElement): HTMLDivElement;
|
|
25
|
+
private createHeadingItemElement;
|
|
26
|
+
private createListItemElement;
|
|
27
|
+
createItem(id: string, icon: string, parent: HTMLElement, active?: boolean): void;
|
|
28
|
+
handleClick: (editor: OnesEditor, event: Event) => void;
|
|
29
|
+
private calcTextStyleItemTooltipsEnum;
|
|
30
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
-
import { BlockMenu } from '../../../../../@ones-editor/ui';
|
|
3
2
|
import EmptyBlockMenu from '../../empty-block-menu';
|
|
3
|
+
import BlockMenu from '../../block-menu';
|
|
4
4
|
export default class OnesEditorBlockMenuButton {
|
|
5
5
|
private editor;
|
|
6
6
|
buttonElement: HTMLButtonElement;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { OnesEditor, OnesEditorCustom } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { QuickMenuItem, QuickMenuItemFilter } from '../../../../@ones-editor/ui';
|
|
3
|
+
export declare class CalloutQuickMenuItemFilter implements QuickMenuItemFilter, OnesEditorCustom {
|
|
3
4
|
constructor(editor: OnesEditor);
|
|
4
|
-
filter(editor: OnesEditor,
|
|
5
|
+
filter(editor: OnesEditor, items: QuickMenuItem[], from: string): QuickMenuItem[];
|
|
5
6
|
destroy(): void;
|
|
6
7
|
static init(editor: OnesEditor): CalloutQuickMenuItemFilter;
|
|
7
8
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockCommandItem, BlockCommandItemWithSource, BlockElement, CommandParams, CommandResult, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../@ones-editor/core';
|
|
2
2
|
import { OnesEditorCommentsProvider } from '../types';
|
|
3
3
|
import type { OnesEditorComments } from '../comments';
|
|
4
4
|
export default class CommentsCommandProvider implements OnesEditorCommandProvider {
|
|
5
5
|
private provider;
|
|
6
6
|
private editorComments;
|
|
7
7
|
id: string;
|
|
8
|
-
groupIndex: number;
|
|
9
8
|
constructor(provider: OnesEditorCommentsProvider, editorComments: OnesEditorComments);
|
|
10
|
-
getAvailableCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange):
|
|
9
|
+
getAvailableCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange): BlockCommandItem[];
|
|
11
10
|
hideToolbar(editor: OnesEditor): void;
|
|
12
|
-
executeRangeCommand(editor: OnesEditor, range: SelectionRange, command:
|
|
11
|
+
executeRangeCommand(editor: OnesEditor, range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams, result: CommandResult): boolean;
|
|
13
12
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BlockElement, CommandItem,
|
|
1
|
+
import { BlockCommandItemWithSource, BlockElement, CommandItem, OnesEditor } from '../../types';
|
|
2
2
|
export declare function executeEmbedBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item: CommandItem): unknown;
|
|
3
|
-
export declare function executeBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item:
|
|
3
|
+
export declare function executeBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item: BlockCommandItemWithSource): unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getRangeCommands(range: SelectionRange, source: string):
|
|
3
|
-
export declare function executeRangeCommand(range: SelectionRange, command:
|
|
1
|
+
import { BlockCommandItemWithSource, CommandParams, CommandResult, SelectionRange } from '../../types';
|
|
2
|
+
export declare function getRangeCommands(range: SelectionRange, source: string): BlockCommandItemWithSource[];
|
|
3
|
+
export declare function executeRangeCommand(range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams): {
|
|
4
4
|
[index: string]: CommandResult;
|
|
5
5
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { DocBlockTextAttributes } from '../doc';
|
|
2
|
-
import { OnesEditor, OnesEditorCommandProviders, OnesEditorCommandProvider, SelectionRange, CommandParams,
|
|
2
|
+
import { OnesEditor, OnesEditorCommandProviders, OnesEditorCommandProvider, SelectionRange, CommandParams, BlockCommandItemWithSource } from '../types';
|
|
3
3
|
export default class EditorCommandProviders implements OnesEditorCommandProviders {
|
|
4
4
|
private editor;
|
|
5
|
-
id: string;
|
|
6
5
|
private providers;
|
|
7
6
|
constructor(editor: OnesEditor);
|
|
8
7
|
registerCommandProvider(provider: OnesEditorCommandProvider): void;
|
|
9
8
|
getCommandProviders(): OnesEditorCommandProvider[];
|
|
10
9
|
getCommandProvider(id: string): OnesEditorCommandProvider;
|
|
11
|
-
getCommands(range: SelectionRange):
|
|
12
|
-
executeCommand(range: SelectionRange, command:
|
|
10
|
+
getCommands(range: SelectionRange, source: string): BlockCommandItemWithSource[];
|
|
11
|
+
executeCommand(range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams): {
|
|
13
12
|
[index: string]: import("../types").CommandResult;
|
|
14
13
|
};
|
|
15
14
|
getEmptyBlockTextAttributes(editor: OnesEditor, blockId: string): DocBlockTextAttributes | undefined;
|
|
@@ -34,7 +34,7 @@ export declare class EditorInput implements OnesEditorInput {
|
|
|
34
34
|
isInDisableScrollMask(target: Node): boolean;
|
|
35
35
|
handleWindowBlur: () => void;
|
|
36
36
|
handleWindowFocus: () => void;
|
|
37
|
-
handleDocumentClick: (event: MouseEvent
|
|
37
|
+
handleDocumentClick: (event: MouseEvent) => void;
|
|
38
38
|
handleDocumentSelectionChange: () => void;
|
|
39
39
|
handleEditorSelectionChanged: () => void;
|
|
40
40
|
handleReadonlyChanged: () => void;
|
|
@@ -12,12 +12,12 @@ export declare class RootContainer {
|
|
|
12
12
|
destroy(): void;
|
|
13
13
|
handleContextMenu: (event: MouseEvent) => void;
|
|
14
14
|
handleResize: () => void;
|
|
15
|
-
handleClick: (event: MouseEvent
|
|
16
|
-
handleBlockClick: (event: MouseEvent
|
|
15
|
+
handleClick: (event: MouseEvent) => void;
|
|
16
|
+
handleBlockClick: (event: MouseEvent, block: BlockElement, elem: Element) => void;
|
|
17
17
|
handleDblClick: (event: MouseEvent) => void;
|
|
18
|
-
handleMouseDown: (event:
|
|
18
|
+
handleMouseDown: (event: MouseEvent) => void;
|
|
19
19
|
handleMouseMove: (event: MouseEvent) => void;
|
|
20
|
-
handleMouseUp: (event: MouseEvent
|
|
20
|
+
handleMouseUp: (event: MouseEvent) => void;
|
|
21
21
|
handleCaptureClick: (event: MouseEvent) => void;
|
|
22
22
|
handleCaptureDbClick: (event: MouseEvent) => void;
|
|
23
23
|
reload(): void;
|
|
@@ -23,5 +23,4 @@ import { editorMovePageDown } from './move-page-down';
|
|
|
23
23
|
import { editorSelectPageUp } from './select-page-up';
|
|
24
24
|
import { editorSelectPageDown } from './select-page-down';
|
|
25
25
|
import { editorSelectAll, editorSelectContainer, isContainerSelectedAllChildBlocks } from './select-all';
|
|
26
|
-
|
|
27
|
-
export { editorMoveLeft, editorMoveRight, editorMoveUp, editorMoveDown, editorSelectDown, editorSelectUp, editorSelectLeft, editorSelectRight, editorSelectWord, editorMoveWordLeft, editorMoveWordEnd, editorSelectWordLeft, editorSelectWordEnd, editorMoveHome, editorMoveEnd, editorSelectHome, editorSelectEnd, editorMovePageUp, editorMovePageDown, editorSelectPageUp, editorSelectPageDown, editorSelectLineHome, editorSelectLineEnd, editorMoveLineHome, editorMoveLineEnd, editorSelectAll, editorSelectContainer, isContainerSelectedAllChildBlocks, };
|
|
26
|
+
export { editorMoveLeft, editorMoveRight, editorMoveUp, editorMoveDown, editorSelectDown, editorSelectUp, editorSelectLeft, editorSelectRight, editorMoveWordLeft, editorMoveWordEnd, editorSelectWordLeft, editorSelectWordEnd, editorMoveHome, editorMoveEnd, editorSelectHome, editorSelectEnd, editorMovePageUp, editorMovePageDown, editorSelectPageUp, editorSelectPageDown, editorSelectLineHome, editorSelectLineEnd, editorMoveLineHome, editorMoveLineEnd, editorSelectAll, editorSelectContainer, isContainerSelectedAllChildBlocks, };
|
|
@@ -4,16 +4,16 @@ export declare class EditorSelectionHandler implements OnesEditorSelectionHandle
|
|
|
4
4
|
editor: OnesEditor;
|
|
5
5
|
startPos: BlockPosition | null;
|
|
6
6
|
lastCaretRect: DOMRect;
|
|
7
|
-
mouseDownEvent:
|
|
7
|
+
mouseDownEvent: MouseEvent | null;
|
|
8
8
|
autoScroll: AutoScroll | null;
|
|
9
9
|
constructor(editor: OnesEditor);
|
|
10
10
|
isSelecting(): boolean;
|
|
11
11
|
stopSelection(): void;
|
|
12
|
-
handleMouseDown: (event: MouseEvent
|
|
12
|
+
handleMouseDown: (event: MouseEvent, options: {
|
|
13
13
|
autoScroll: boolean;
|
|
14
14
|
}) => void;
|
|
15
15
|
handleMouseMove: (event: MouseEvent) => void;
|
|
16
|
-
handleMouseUp: (event: MouseEvent
|
|
16
|
+
handleMouseUp: (event: MouseEvent) => void;
|
|
17
17
|
handleDblClick(event: MouseEvent): void;
|
|
18
18
|
handleTripleClick(event: MouseEvent): void;
|
|
19
19
|
}
|
|
@@ -119,6 +119,7 @@ export interface Closeable {
|
|
|
119
119
|
click: (item: CommandItem, target: HTMLElement) => void;
|
|
120
120
|
}
|
|
121
121
|
export type CommandItemChildrenPlacement = 'auto' | 'top' | 'left' | 'right' | 'bottom' | 'auto-start' | 'auto-end' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end';
|
|
122
|
+
export type CommandItemMenuType = 'inline' | 'sibling';
|
|
122
123
|
export interface CommandItem {
|
|
123
124
|
id: string;
|
|
124
125
|
name: string;
|
|
@@ -129,7 +130,7 @@ export interface CommandItem {
|
|
|
129
130
|
type?: CommandItemType;
|
|
130
131
|
element?: HTMLElement | ((item: CommandItem) => HTMLElement);
|
|
131
132
|
icon?: string;
|
|
132
|
-
childrenType?: 'menu' | 'toolbar'
|
|
133
|
+
childrenType?: 'menu' | 'toolbar';
|
|
133
134
|
children?: CommandItem[];
|
|
134
135
|
childrenMenuId?: string;
|
|
135
136
|
data?: unknown;
|
|
@@ -151,8 +152,18 @@ export interface CommandItem {
|
|
|
151
152
|
/**
|
|
152
153
|
* defaults to true
|
|
153
154
|
*/
|
|
155
|
+
shouldShown?: (currentBlock: BlockElement | undefined, menuType: CommandItemMenuType) => boolean;
|
|
156
|
+
/**
|
|
157
|
+
* defaults to true
|
|
158
|
+
*/
|
|
154
159
|
clickToClose?: boolean;
|
|
155
160
|
}
|
|
161
|
+
export interface BlockCommandItem extends CommandItem {
|
|
162
|
+
blockId: string;
|
|
163
|
+
blockType: string;
|
|
164
|
+
blockKind: BlockKind;
|
|
165
|
+
groupIndex: number;
|
|
166
|
+
}
|
|
156
167
|
export type StyleType = boolean | string | number;
|
|
157
168
|
export type BlockStyles = {
|
|
158
169
|
[index: string]: StyleType;
|
|
@@ -648,11 +659,11 @@ export interface OnesEditorInput {
|
|
|
648
659
|
export interface OnesEditorSelectionHandler {
|
|
649
660
|
isSelecting: () => boolean;
|
|
650
661
|
stopSelection: () => void;
|
|
651
|
-
handleMouseDown: (event: MouseEvent
|
|
662
|
+
handleMouseDown: (event: MouseEvent, options: {
|
|
652
663
|
autoScroll: boolean;
|
|
653
664
|
}) => void;
|
|
654
665
|
handleMouseMove: (event: MouseEvent) => void;
|
|
655
|
-
handleMouseUp: (event: MouseEvent
|
|
666
|
+
handleMouseUp: (event: MouseEvent) => void;
|
|
656
667
|
handleDblClick: (event: MouseEvent) => void;
|
|
657
668
|
handleTripleClick: (event: MouseEvent) => void;
|
|
658
669
|
}
|
|
@@ -703,46 +714,32 @@ export interface OnesEditorInsertions {
|
|
|
703
714
|
}
|
|
704
715
|
export type CommandParams = {
|
|
705
716
|
[index: string]: unknown;
|
|
706
|
-
} & {
|
|
707
|
-
source?: string[];
|
|
708
717
|
};
|
|
709
718
|
export type CommandResult = {
|
|
710
719
|
[index: string]: unknown;
|
|
711
720
|
};
|
|
712
721
|
export interface OnesEditorCommandProvider {
|
|
713
722
|
id: string;
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
executeInsertCommand?: (editor: OnesEditor, containerId: string, blockIndex: number, item: CommandItem, params: CommandParams, result?: CommandResult) => boolean;
|
|
720
|
-
executeRangeCommand?: (editor: OnesEditor, range: SelectionRange, command: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
|
|
721
|
-
executeCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams, result?: CommandResult) => boolean;
|
|
722
|
-
filterCommands?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, commands: CommandItemWithSource[]) => CommandItemWithSource[] | undefined;
|
|
723
|
-
beforeExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams) => boolean | undefined;
|
|
724
|
-
afterExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams, result: CommandResult) => void;
|
|
723
|
+
getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => BlockCommandItem[];
|
|
724
|
+
executeCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: BlockCommandItem, params: CommandParams, result: CommandResult) => boolean;
|
|
725
|
+
filterCommands?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, commands: BlockCommandItemWithSource[]) => BlockCommandItemWithSource[] | undefined;
|
|
726
|
+
beforeExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: BlockCommandItem, params: CommandParams) => boolean | undefined;
|
|
727
|
+
afterExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: BlockCommandItem, params: CommandParams, result: CommandResult) => void;
|
|
725
728
|
getEmptyBlockTextAttributes?: (editor: OnesEditor, blockId: string) => DocBlockTextAttributes | undefined;
|
|
729
|
+
executeRangeCommand?: (editor: OnesEditor, range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams, result: CommandResult) => boolean;
|
|
726
730
|
}
|
|
727
|
-
export interface
|
|
731
|
+
export interface BlockCommandItemWithSource extends BlockCommandItem {
|
|
728
732
|
source: string;
|
|
729
733
|
}
|
|
730
|
-
export interface CommandFilter {
|
|
731
|
-
filter: (editor: OnesEditor, range: SelectionRange, items: CommandItemWithSource[], source: string[]) => CommandItemWithSource[];
|
|
732
|
-
}
|
|
733
|
-
export type CommandFilterId = keyof any;
|
|
734
734
|
export interface OnesEditorCommandProviders {
|
|
735
|
-
commandFilters?: Map<CommandFilterId, CommandFilter>;
|
|
736
|
-
addFilter?: (id: CommandFilterId, filter: CommandFilter) => void;
|
|
737
|
-
filterItems?: (range: SelectionRange, items: CommandItemWithSource[]) => CommandItemWithSource[];
|
|
738
735
|
registerCommandProvider: (provider: OnesEditorCommandProvider) => void;
|
|
739
736
|
getCommandProviders: () => OnesEditorCommandProvider[];
|
|
740
737
|
getCommandProvider: (id: string) => OnesEditorCommandProvider;
|
|
741
|
-
getCommands: (range: SelectionRange) =>
|
|
742
|
-
executeCommand: (range: SelectionRange, item:
|
|
738
|
+
getCommands: (range: SelectionRange, source: string) => BlockCommandItemWithSource[];
|
|
739
|
+
executeCommand: (range: SelectionRange, item: BlockCommandItemWithSource, params: CommandParams) => {
|
|
743
740
|
[index: string]: CommandResult;
|
|
744
741
|
};
|
|
745
|
-
getEmptyBlockTextAttributes
|
|
742
|
+
getEmptyBlockTextAttributes: (editor: OnesEditor, blockId: string) => DocBlockTextAttributes | undefined;
|
|
746
743
|
}
|
|
747
744
|
export interface EditorDocLocalActionCallbacks {
|
|
748
745
|
onBeforeUpdateBlockText: (containerId: string, blockId: string, oldText: DocBlockText, newText: DocBlockText, newRange: OnesEditorDocRange) => void;
|
|
@@ -37,7 +37,4 @@ export declare function bindKeyDownEvent(input: HTMLInputElement | HTMLTextAreaE
|
|
|
37
37
|
export declare function getElementFromPoint(x: number, y: number, options?: {
|
|
38
38
|
noFilter: boolean;
|
|
39
39
|
}): Element;
|
|
40
|
-
export declare function ensureIsMobileEvent(events: MouseEvent | TouchEvent): events is TouchEvent;
|
|
41
|
-
export declare function createMouseEventFromTouchEvent(event: TouchEvent, type: 'mousedown' | 'mousemove' | 'mouseup' | 'click'): MouseEvent;
|
|
42
|
-
export declare function bindTouchEnd(elem: HTMLElement | Document, callback: (e: any) => void): void;
|
|
43
40
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type DragStartHandler<T> = (drag: DragDrop<T>, event: MouseEvent
|
|
2
|
-
export type DraggingHandler<T> = (drag: DragDrop<T>, event: MouseEvent
|
|
3
|
-
export type DragEndHandler<T> = (drag: DragDrop<T>, event: MouseEvent
|
|
1
|
+
export type DragStartHandler<T> = (drag: DragDrop<T>, event: MouseEvent, elem: HTMLElement) => void;
|
|
2
|
+
export type DraggingHandler<T> = (drag: DragDrop<T>, event: MouseEvent, elem: HTMLElement, deltaX: number, deltaY: number) => void;
|
|
3
|
+
export type DragEndHandler<T> = (drag: DragDrop<T>, event: MouseEvent, elem: HTMLElement, deltaX: number, deltaY: number) => void;
|
|
4
4
|
export interface DragDropOptions<T> {
|
|
5
5
|
elem: HTMLElement;
|
|
6
6
|
onDragStart: DragStartHandler<T>;
|
|
@@ -10,7 +10,6 @@ export interface DragDropOptions<T> {
|
|
|
10
10
|
minThreshold?: number;
|
|
11
11
|
cursor?: string;
|
|
12
12
|
mouseDownEvent?: MouseEvent;
|
|
13
|
-
mobile?: boolean;
|
|
14
13
|
}
|
|
15
14
|
export declare const MIN_DISTANCE_THRESHOLD = 3;
|
|
16
15
|
export declare class DragDrop<T> {
|
|
@@ -38,9 +37,5 @@ export declare class DragDrop<T> {
|
|
|
38
37
|
private onDragging;
|
|
39
38
|
private onDragEnd;
|
|
40
39
|
destroy(): void;
|
|
41
|
-
static getEventPosition(event: MouseEvent | TouchEvent): {
|
|
42
|
-
x: number;
|
|
43
|
-
y: number;
|
|
44
|
-
};
|
|
45
40
|
}
|
|
46
41
|
export declare function registerDragDrop<T>(options: DragDropOptions<T>): DragDrop<T>;
|
|
@@ -11,7 +11,7 @@ export declare class ImageSplitterResizer implements DragDropOptions<ImageSplitt
|
|
|
11
11
|
cursor: string;
|
|
12
12
|
initWidths: number[];
|
|
13
13
|
constructor(editor: OnesEditor, elem: HTMLElement, data: ImageSplitterResizerData, mouseDownEvent: MouseEvent);
|
|
14
|
-
onDragStart(drag: DragDrop<ImageSplitterResizerData>, event: MouseEvent
|
|
15
|
-
onDragging(drag: DragDrop<ImageSplitterResizerData>, event: MouseEvent
|
|
16
|
-
onDragEnd(drag: DragDrop<ImageSplitterResizerData>, event: MouseEvent
|
|
14
|
+
onDragStart(drag: DragDrop<ImageSplitterResizerData>, event: MouseEvent, elem: HTMLElement): void;
|
|
15
|
+
onDragging(drag: DragDrop<ImageSplitterResizerData>, event: MouseEvent, elem: HTMLElement, deltaX: number, deltaY: number): void;
|
|
16
|
+
onDragEnd(drag: DragDrop<ImageSplitterResizerData>, event: MouseEvent, elem: HTMLElement, deltaX: number, deltaY: number): void;
|
|
17
17
|
}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { OnesEditor, OnesEditorCustom } from '../../../@ones-editor/core';
|
|
2
|
-
import { CommandHandler } from './fixed-toolbar';
|
|
3
|
-
import './mobile-helper-styles.scss';
|
|
4
|
-
export { CommandHandler };
|
|
5
2
|
export declare class OnesEditorMobileHelper implements OnesEditorCustom {
|
|
6
3
|
private editor;
|
|
7
4
|
private longPressTimeout;
|
|
8
|
-
private gripper;
|
|
9
5
|
constructor(editor: OnesEditor);
|
|
10
6
|
destroy(): void;
|
|
11
7
|
handleSelectionChange: () => void;
|
|
12
8
|
handleLongPress: (event: TouchEvent) => void;
|
|
13
|
-
private isMoving;
|
|
14
|
-
handleTouchMove: (event: TouchEvent) => void;
|
|
15
9
|
handleTouchStart: (event: TouchEvent) => void;
|
|
16
10
|
handleTouchEnd: (event: TouchEvent) => void;
|
|
17
11
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockCommandItem, BlockElement, CommandParams, CommandResult, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../@ones-editor/core';
|
|
2
2
|
declare const TableCommands: readonly ["table/merge-cells", "table/split-cell", "table/insert-column", "table/insert-row", "table/delete-rows", "table/delete-columns", "table/delete"];
|
|
3
3
|
export type TableCommand = typeof TableCommands[number];
|
|
4
4
|
export default class TableBlockCommandProvider implements OnesEditorCommandProvider {
|
|
5
5
|
id: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
executeCommand(editor: OnesEditor, block: BlockElement, range: SelectionRange, command: CommandItem, params: CommandParams, result?: CommandResult): boolean;
|
|
6
|
+
getAvailableCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange): BlockCommandItem[];
|
|
7
|
+
executeCommand(editor: OnesEditor, block: BlockElement, range: SelectionRange, command: BlockCommandItem, params: CommandParams, result: CommandResult): boolean;
|
|
9
8
|
}
|
|
10
9
|
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import TableBlock, { includeBigTable } from './table-block';
|
|
2
|
-
import { TableBlockCommandProvider
|
|
2
|
+
import { TableBlockCommandProvider } from './commands';
|
|
3
3
|
import './locale';
|
|
4
4
|
import './table-style.scss';
|
|
5
5
|
import TableShortcuts from './table-block/table-shortcuts';
|
|
6
|
-
import { createEntireRowAndColumnRange, getAbstractTableSelectionRange } from './table-block/cell-menu/table-cell-dom';
|
|
7
6
|
export * from './types';
|
|
8
7
|
export { TableBlock, TableBlockCommandProvider, TableShortcuts, includeBigTable };
|
|
9
|
-
export { deleteColumns, deleteRows, setStripeStyle, setColTitle, setRowTitle, insertColumn, insertRow, };
|
|
10
|
-
export { createEntireRowAndColumnRange, getAbstractTableSelectionRange };
|
|
11
8
|
export type { CreateTableData } from './table-block/table-creator';
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { BlockElement, ComplexBlockPosition, OnesEditor, SimpleBlockPosition } from '../../../../../@ones-editor/core';
|
|
2
2
|
export declare function getCellElementByChildBlockId(editor: OnesEditor, tableBlock: BlockElement, blockId: string): HTMLTableCellElement;
|
|
3
3
|
export declare function createComplexPosFromBlockPos(editor: OnesEditor, tableBlock: BlockElement, blockPosition: ComplexBlockPosition | SimpleBlockPosition): ComplexBlockPosition;
|
|
4
|
-
export declare function getAbstractTableSelectionRange(editor: OnesEditor, tableBlock: BlockElement): {
|
|
5
|
-
fromRow: number;
|
|
6
|
-
toRow: number;
|
|
7
|
-
fromCol: number;
|
|
8
|
-
toCol: number;
|
|
9
|
-
};
|
|
10
4
|
export declare function updateBarsDangerStatus(editor: OnesEditor, tableBlock: BlockElement, selectedRows: number[], selectedColumns: number[]): void;
|
|
11
5
|
export declare function updateCellsDangerStatus(editor: OnesEditor, tableBlock: BlockElement, isDanger?: boolean, isCol?: boolean): void;
|
|
12
6
|
export declare function updateCellBarsDangerStatus(editor: OnesEditor, tableBlock: BlockElement, isDanger?: boolean, isCol?: boolean): void;
|
|
@@ -10,8 +10,8 @@ export declare class TableResizeDragDrop implements DragDropOptions<TableResizeD
|
|
|
10
10
|
data: TableResizeDragDropData;
|
|
11
11
|
private onEnd;
|
|
12
12
|
cursor: string;
|
|
13
|
-
constructor(editor: OnesEditor, elem: HTMLDivElement, data: TableResizeDragDropData, onEnd: ((event: MouseEvent
|
|
14
|
-
onDragStart(drag: DragDrop<TableResizeDragDropData>, event: MouseEvent
|
|
15
|
-
onDragging(drag: DragDrop<TableResizeDragDropData>, event: MouseEvent
|
|
16
|
-
onDragEnd(drag: DragDrop<TableResizeDragDropData>, event: MouseEvent
|
|
13
|
+
constructor(editor: OnesEditor, elem: HTMLDivElement, data: TableResizeDragDropData, onEnd: ((event: MouseEvent) => void) | null);
|
|
14
|
+
onDragStart(drag: DragDrop<TableResizeDragDropData>, event: MouseEvent, elem: HTMLElement): void;
|
|
15
|
+
onDragging(drag: DragDrop<TableResizeDragDropData>, event: MouseEvent, elem: HTMLElement, deltaX: number, deltaY: number): void;
|
|
16
|
+
onDragEnd(drag: DragDrop<TableResizeDragDropData>, event: MouseEvent, elem: HTMLElement, deltaX: number, deltaY: number): void;
|
|
17
17
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BlockCommandItem, BlockElement, CommandParams, CommandResult, DocBlockTextAttributes, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../@ones-editor/core';
|
|
2
|
+
export default class TextCommandProvider implements OnesEditorCommandProvider {
|
|
3
|
+
private editor;
|
|
4
|
+
id: string;
|
|
5
|
+
private emptyTextBlockAttributes;
|
|
6
|
+
private colorItem;
|
|
7
|
+
constructor(editor: OnesEditor);
|
|
8
|
+
destroy(): void;
|
|
9
|
+
private updateButtonColor;
|
|
10
|
+
getAvailableCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange): BlockCommandItem[];
|
|
11
|
+
executeCommand(editor: OnesEditor, block: BlockElement, range: SelectionRange, item: BlockCommandItem, params: CommandParams, result: CommandResult): boolean;
|
|
12
|
+
private executeCommandOnEmptyText;
|
|
13
|
+
private getCommandsOnEmptyText;
|
|
14
|
+
private setCommandsStates;
|
|
15
|
+
getEmptyBlockTextAttributes(editor: OnesEditor, blockId: string): DocBlockTextAttributes | undefined;
|
|
16
|
+
private handleChangeColor;
|
|
17
|
+
private getEmptyTextBlockColor;
|
|
18
|
+
private setEmptyTextBlockColor;
|
|
19
|
+
private static toTextCommand;
|
|
20
|
+
private static fromTextCommandId;
|
|
21
|
+
private static fromTextCommand;
|
|
22
|
+
private static toTextCommands;
|
|
23
|
+
private static fromTextCommands;
|
|
24
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BlockCommandItem, BlockElement, CommandParams, CommandResult, OnesEditor, SelectionRange } from '../../../@ones-editor/core';
|
|
2
|
+
export declare function getStandardEmptyStyleCommands(editor: OnesEditor, block: BlockElement): BlockCommandItem[];
|
|
3
|
+
export declare function getAvailableStyleCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange): BlockCommandItem[];
|
|
4
|
+
export declare function executeStyleCommand(editor: OnesEditor, block: BlockElement, range: SelectionRange, command: string, params: CommandParams, result: CommandResult): boolean;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { BlockElement,
|
|
1
|
+
import { BlockElement, DocBlockText, OnesEditor, SelectionRange, TextStyles } from '../../../@ones-editor/core';
|
|
2
2
|
export declare function getIntersectionStyles(text: DocBlockText): Map<any, any>;
|
|
3
3
|
export declare function getTextStyles(editor: OnesEditor, block: BlockElement, range: SelectionRange): TextStyles;
|
|
4
4
|
export declare function applyTextStyle(editor: OnesEditor, block: BlockElement, range: SelectionRange, style: string, value?: boolean | string | number): DocBlockText;
|
|
5
|
-
export declare function getStandardTextStyles(textStyles: CommandItem[], text: DocBlockText): CommandItem[];
|
|
6
|
-
export declare function getSubText(editor: OnesEditor, block: BlockElement, range: SelectionRange): DocBlockText;
|