@ones-editor/editor 2.1.7-beta.9 → 2.1.8-beta.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/{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/block-padding/src/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/callout-block/src/index.d.ts +0 -1
- package/@ones-editor/comments/src/index.d.ts +1 -5
- package/@ones-editor/comments/src/text-comments/comments-command-provider.d.ts +3 -4
- package/@ones-editor/core/src/core/blocks/common/block-properties.d.ts +9 -9
- package/@ones-editor/core/src/core/blocks/common/execute-block-command.d.ts +2 -2
- package/@ones-editor/core/src/core/blocks/complex-blocks/child-blocks.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/complex-blocks/complex-block-helper.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/text-blocks/base/child.d.ts +7 -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 +5 -2
- package/@ones-editor/core/src/core/command-providers/editor-command-providers.d.ts +14 -5
- package/@ones-editor/core/src/core/command-providers/index.d.ts +1 -3
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -1
- package/@ones-editor/core/src/core/containers/root-container.d.ts +2 -2
- package/@ones-editor/core/src/core/doc/doc.d.ts +0 -3
- package/@ones-editor/core/src/core/doc/rich-text/text-style.d.ts +0 -2
- package/@ones-editor/core/src/core/editor/actions/clear-selected-contents.d.ts +2 -2
- 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 +28 -40
- package/@ones-editor/core/src/helper/hovering-block.d.ts +2 -2
- 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/embed-block-helper/src/block-properties/embed-block-properties.d.ts +5 -6
- package/@ones-editor/file/src/locale/en-us.d.ts +0 -1
- package/@ones-editor/file/src/locale/ja-jp.d.ts +0 -1
- package/@ones-editor/file/src/locale/zh-cn.d.ts +0 -1
- package/@ones-editor/graph-embed/src/helper/graph-block-commands.d.ts +19 -5
- package/@ones-editor/image-embed/src/hovering-toolbar/index.d.ts +1 -12
- package/@ones-editor/image-embed/src/splitter-resizer/index.d.ts +3 -3
- package/@ones-editor/input-handlers/src/i18n/en-us.d.ts +0 -1
- package/@ones-editor/input-handlers/src/i18n/ja-jp.d.ts +0 -1
- package/@ones-editor/input-handlers/src/i18n/zh-cn.d.ts +0 -1
- package/@ones-editor/layout-block/src/index.d.ts +0 -1
- package/@ones-editor/list-block/src/index.d.ts +1 -2
- package/@ones-editor/media-embed/src/core/hovering-toolbar/index.d.ts +1 -12
- package/@ones-editor/mention/src/locale/en-us.d.ts +0 -3
- package/@ones-editor/mention/src/locale/ja-jp.d.ts +0 -3
- package/@ones-editor/mention/src/locale/zh-cn.d.ts +0 -3
- package/@ones-editor/mention/src/mention.d.ts +0 -15
- package/@ones-editor/mobile-helper/src/index.d.ts +1 -10
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +1 -4
- package/@ones-editor/sharedb-doc/src/index.d.ts +1 -8
- 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 +2 -6
- package/@ones-editor/table-block/src/locale/en-us.d.ts +0 -5
- package/@ones-editor/table-block/src/locale/ja-jp.d.ts +0 -5
- package/@ones-editor/table-block/src/locale/zh-cn.d.ts +0 -5
- 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 +9 -33
- package/@ones-editor/ui/src/locale/en-us.d.ts +0 -5
- package/@ones-editor/ui/src/locale/ja-jp.d.ts +0 -5
- package/@ones-editor/ui/src/locale/zh-cn.d.ts +0 -5
- 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 +19 -7
- 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 +5 -2
- package/@ones-editor/{ui-base → ui}/src/text-button/index.d.ts +1 -1
- package/@ones-editor/ui/src/toolbar/commands/align.d.ts +10 -0
- 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/src/toolbar/toolbar-handler.d.ts +0 -3
- package/@ones-editor/ui/src/tooltips/index.d.ts +21 -9
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +1 -2
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +1 -1
- package/@ones-editor/ui-base/src/color-button/color-button.d.ts +0 -1
- package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +2 -9
- package/@ones-editor/ui-base/src/color-palette/color-palette.d.ts +1 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +2 -3
- package/@ones-editor/ui-base/src/command-bar/fixed-toolbar.d.ts +1 -3
- package/@ones-editor/ui-base/src/command-bar/init-toolbar-item.d.ts +0 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -4
- package/@ones-editor/ui-base/src/icons/index.d.ts +1 -5
- package/@ones-editor/ui-base/src/index.d.ts +0 -2
- package/@ones-editor/ui-base/src/input/create-input.d.ts +3 -23
- package/@ones-editor/ui-base/src/locale/en-us.d.ts +0 -1
- package/@ones-editor/ui-base/src/locale/ja-jp.d.ts +0 -1
- package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +0 -1
- package/@ones-editor/ui-base/src/popup/popup.d.ts +1 -1
- package/@ones-editor/versions/src/constant/index.d.ts +1 -0
- package/@ones-editor/versions/src/history-render/index.d.ts +1 -1
- package/@ones-editor/versions/src/history-tooltip/index.d.ts +10 -0
- package/@ones-editor/versions/src/version-dialog/index.d.ts +1 -0
- package/dist/comments/local-doc-comments-provider.d.ts +1 -2
- package/dist/index.d.ts +4 -65
- package/dist/index.js +26170 -30610
- package/dist/types.d.ts +1 -11
- package/package.json +1 -1
- package/@ones-editor/comments/src/comments-helper/old-version-comment.d.ts +0 -16
- package/@ones-editor/core/src/core/command-providers/abstract-providers.d.ts +0 -25
- 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 -4
- package/@ones-editor/layout-block/src/command-filter.d.ts +0 -6
- package/@ones-editor/main-toolbar/package.json +0 -7
- package/@ones-editor/main-toolbar/src/index.d.ts +0 -18
- package/@ones-editor/main-toolbar/src/items/comment.d.ts +0 -8
- package/@ones-editor/main-toolbar/src/items/find.d.ts +0 -8
- package/@ones-editor/main-toolbar/src/items/font-style.d.ts +0 -40
- package/@ones-editor/main-toolbar/src/items/image.d.ts +0 -8
- package/@ones-editor/main-toolbar/src/items/index.d.ts +0 -16
- package/@ones-editor/main-toolbar/src/items/insert.d.ts +0 -12
- package/@ones-editor/main-toolbar/src/items/link.d.ts +0 -11
- package/@ones-editor/main-toolbar/src/items/list.d.ts +0 -29
- package/@ones-editor/main-toolbar/src/items/paragraph.d.ts +0 -14
- package/@ones-editor/main-toolbar/src/items/quote.d.ts +0 -11
- package/@ones-editor/main-toolbar/src/items/separator.d.ts +0 -7
- package/@ones-editor/main-toolbar/src/items/text-align.d.ts +0 -21
- package/@ones-editor/main-toolbar/src/items/text-color.d.ts +0 -48
- package/@ones-editor/main-toolbar/src/items/undo.d.ts +0 -18
- package/@ones-editor/main-toolbar/src/locale/en-us.d.ts +0 -9
- package/@ones-editor/main-toolbar/src/locale/index.d.ts +0 -1
- package/@ones-editor/main-toolbar/src/locale/ja-jp.d.ts +0 -9
- package/@ones-editor/main-toolbar/src/locale/zh-cn.d.ts +0 -9
- package/@ones-editor/main-toolbar/src/types.d.ts +0 -5
- package/@ones-editor/media-embed/src/utils/dom.d.ts +0 -2
- package/@ones-editor/mobile-helper/src/cursor-toolbar.d.ts +0 -14
- package/@ones-editor/mobile-helper/src/fixed-toolbar/active-observer.d.ts +0 -11
- package/@ones-editor/mobile-helper/src/fixed-toolbar/fixed-providers.d.ts +0 -6
- package/@ones-editor/mobile-helper/src/fixed-toolbar/index.d.ts +0 -21
- 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 -15
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/insert.d.ts +0 -8
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/paragraph.d.ts +0 -9
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/tab-provider.d.ts +0 -10
- 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/locale/en-us.d.ts +0 -9
- package/@ones-editor/mobile-helper/src/locale/index.d.ts +0 -1
- package/@ones-editor/mobile-helper/src/locale/ja-jp.d.ts +0 -9
- package/@ones-editor/mobile-helper/src/locale/zh-cn.d.ts +0 -9
- 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/sharedb-doc/src/doc/sharedb-client-base.d.ts +0 -24
- package/@ones-editor/sharedb-doc/src/doc/sharedb-local-doc.d.ts +0 -17
- package/@ones-editor/table-block/src/commands/table-command-provider.d.ts +0 -12
- package/@ones-editor/ui/src/block-menu/block-command-providers.d.ts +0 -8
- package/@ones-editor/ui/src/box-helper/standard-box-commands.d.ts +0 -10
- package/@ones-editor/ui/src/box-helper/standard-box-provider.d.ts +0 -9
- package/@ones-editor/ui/src/providers/align-dropdown.d.ts +0 -10
- package/@ones-editor/ui/src/providers/align.d.ts +0 -11
- package/@ones-editor/ui/src/providers/block-hook-provider.d.ts +0 -16
- package/@ones-editor/ui/src/providers/clipboard-provider.d.ts +0 -19
- package/@ones-editor/ui/src/providers/color-provider.d.ts +0 -18
- package/@ones-editor/ui/src/providers/edit-link-provider.d.ts +0 -6
- package/@ones-editor/ui/src/providers/heading.d.ts +0 -13
- package/@ones-editor/ui/src/providers/inline-code-provider.d.ts +0 -10
- 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 -12
- package/@ones-editor/ui/src/providers/list.d.ts +0 -13
- package/@ones-editor/ui/src/providers/mobile-link-provider.d.ts +0 -10
- package/@ones-editor/ui/src/providers/paragraph.d.ts +0 -9
- package/@ones-editor/ui/src/providers/proxy-provider.d.ts +0 -9
- package/@ones-editor/ui/src/providers/quoted.d.ts +0 -10
- 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 -16
- 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/utils/add-section.d.ts +0 -2
- package/@ones-editor/ui/src/providers/utils/clipboard.d.ts +0 -6
- package/@ones-editor/ui/src/providers/utils/index.d.ts +0 -2
- package/@ones-editor/ui/src/providers/utils/inject-block-options.d.ts +0 -8
- 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 -8
- package/@ones-editor/ui/src/readonly-toolbar/add-comment-to-old-doc.d.ts +0 -23
- package/@ones-editor/ui/src/readonly-toolbar/index.d.ts +0 -29
- package/@ones-editor/ui/src/readonly-toolbar/types.d.ts +0 -12
- package/@ones-editor/ui/src/toolbar/link-commands.d.ts +0 -11
- package/@ones-editor/ui/src/utils/hide-toolbar.d.ts +0 -2
- package/@ones-editor/ui-base/src/mobile-command-bar/init-menu-item.d.ts +0 -3
- package/@ones-editor/ui-base/src/mobile-command-bar/mobile-bottom-menu.d.ts +0 -23
- package/dist/auto-new-line.d.ts +0 -7
- /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,15 +1,11 @@
|
|
|
1
1
|
import { OnesEditorComments } from './comments';
|
|
2
2
|
import './style.scss';
|
|
3
|
-
import CommentsCommandProvider from './text-comments/comments-command-provider';
|
|
4
3
|
import './locale';
|
|
5
4
|
export * from './types';
|
|
6
5
|
export { OnesEditorCommentsRender } from './comments-render';
|
|
7
6
|
export { OnesEditorCommentPlaceholderHandler } from './comment-placeholder-handler';
|
|
8
|
-
export { OnesEditorComments
|
|
7
|
+
export { OnesEditorComments };
|
|
9
8
|
export type { CommentItem } from './comment-item';
|
|
10
9
|
export type { CommentGroupItem } from './comments-list/group-item';
|
|
11
10
|
export { removeCommentFromBlock } from './actions/remove-comment-from-block';
|
|
12
|
-
export { addCommentToTextBlocks } from './actions/add-comment-to-text-block';
|
|
13
|
-
export { addCommentToBlock } from './actions/add-comment-to-block';
|
|
14
11
|
export { editorAddComment } from './actions/editor-add-comment';
|
|
15
|
-
export * from './comments-helper/old-version-comment';
|
|
@@ -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,10 +1,10 @@
|
|
|
1
|
-
import { BlockCommands, BlockElement,
|
|
1
|
+
import { BlockCommands, BlockElement, OnesEditor } from '../../types';
|
|
2
2
|
export declare function getBlockProperties(editor: OnesEditor, block: BlockElement): import("../../types").BlockProperties | undefined;
|
|
3
|
-
export declare function getBlockCommandsWithHook(editor: OnesEditor, block: BlockElement
|
|
4
|
-
|
|
5
|
-
element:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export declare function getBlockCommandsWithHook(editor: OnesEditor, block: BlockElement): Record<string, BlockCommands>;
|
|
4
|
+
export declare function getSpecialBlockCommands(editor: OnesEditor, blockElement: BlockElement, group: string): {
|
|
5
|
+
element: import("../../types").BlockContentElement;
|
|
6
|
+
commands: import("../../types").CommandItem[];
|
|
7
|
+
} | {
|
|
8
|
+
element: null;
|
|
9
|
+
commands: never[];
|
|
10
|
+
};
|
|
@@ -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,8 +1,7 @@
|
|
|
1
|
-
import { BlockElement, OnesEditor, SelectedBlock
|
|
1
|
+
import { BlockElement, OnesEditor, SelectedBlock } from '../../types';
|
|
2
2
|
export type GetAllChildBlocksOptions = {
|
|
3
3
|
simpleBlockOnly?: boolean;
|
|
4
4
|
visibleOnly?: boolean;
|
|
5
|
-
range?: SelectionRange;
|
|
6
5
|
};
|
|
7
6
|
export declare function getAllChildBlocks(editor: OnesEditor, options?: GetAllChildBlocksOptions): BlockElement[];
|
|
8
7
|
export declare function getAllSelectedBlocks(editor: OnesEditor, options?: GetAllChildBlocksOptions): SelectedBlock[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement, BlockPosition, ContainerElement, ComplexBlockPosition, GetChildContainerOptions
|
|
1
|
+
import { OnesEditor, BlockElement, BlockPosition, ContainerElement, ComplexBlockPosition, GetChildContainerOptions } from '../../types';
|
|
2
2
|
export declare function complexBlockGetAllChildContainers(editor: OnesEditor, block: BlockElement, options?: GetChildContainerOptions): ContainerElement[];
|
|
3
3
|
export declare function complexBlockGetSelectedContainers(editor: OnesEditor, block: BlockElement, start: BlockPosition, end: BlockPosition): ContainerElement[];
|
|
4
4
|
export declare function isFirstChildBlockInComplexBlock(editor: OnesEditor, childBlock: BlockElement): boolean;
|
|
@@ -13,4 +13,3 @@ export declare function complexBlockAdjustSelectionPos(editor: OnesEditor, compl
|
|
|
13
13
|
anchor: ComplexBlockPosition;
|
|
14
14
|
focus: ComplexBlockPosition;
|
|
15
15
|
};
|
|
16
|
-
export declare function isFullSelectedOneComplexBlock(editor: OnesEditor, complexRange?: ComplexSelectionRange): boolean;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { BlockElement,
|
|
2
|
-
export type
|
|
1
|
+
import { BlockElement, BoxElement, InsertionElement } from '../../../types';
|
|
2
|
+
export type TextBlockContentTextChild = HTMLSpanElement & {
|
|
3
|
+
__neverUse: 'TextBlockContentTextChild';
|
|
4
|
+
};
|
|
5
|
+
export type TextBlockContentInsertionChild = InsertionElement;
|
|
6
|
+
export type TextBlockContentBoxChild = BoxElement;
|
|
7
|
+
export type TextBlockContentChild = TextBlockContentTextChild | TextBlockContentBoxChild | TextBlockContentInsertionChild;
|
|
3
8
|
export type TextBlockContentChildren = TextBlockContentChild[];
|
|
4
9
|
export type TextBlockContentChildType = 'text' | 'box' | 'insertion';
|
|
5
10
|
export declare function isTextBlockContentChild(elem: Element): boolean;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function
|
|
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
|
+
[index: string]: CommandResult;
|
|
5
|
+
};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export default class EditorCommandProviders
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { DocBlockTextAttributes } from '../doc';
|
|
2
|
+
import { OnesEditor, OnesEditorCommandProviders, OnesEditorCommandProvider, SelectionRange, CommandParams, BlockCommandItemWithSource } from '../types';
|
|
3
|
+
export default class EditorCommandProviders implements OnesEditorCommandProviders {
|
|
4
|
+
private editor;
|
|
5
|
+
private providers;
|
|
6
|
+
constructor(editor: OnesEditor);
|
|
7
|
+
registerCommandProvider(provider: OnesEditorCommandProvider): void;
|
|
8
|
+
getCommandProviders(): OnesEditorCommandProvider[];
|
|
9
|
+
getCommandProvider(id: string): OnesEditorCommandProvider;
|
|
10
|
+
getCommands(range: SelectionRange, source: string): BlockCommandItemWithSource[];
|
|
11
|
+
executeCommand(range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams): {
|
|
12
|
+
[index: string]: import("../types").CommandResult;
|
|
13
|
+
};
|
|
14
|
+
getEmptyBlockTextAttributes(editor: OnesEditor, blockId: string): DocBlockTextAttributes | undefined;
|
|
6
15
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import EditorCommandProviders from './editor-command-providers';
|
|
2
|
-
import BlockAttributesHandler from './block-attributes';
|
|
3
|
-
import { AbstractProvider } from './abstract-providers';
|
|
4
2
|
export * from './commands';
|
|
5
|
-
export { EditorCommandProviders
|
|
3
|
+
export { EditorCommandProviders };
|
|
@@ -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;
|
|
@@ -15,9 +15,9 @@ export declare class RootContainer {
|
|
|
15
15
|
handleClick: (event: MouseEvent) => void;
|
|
16
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;
|
|
@@ -110,12 +110,10 @@ export interface OnesEditorDocComplexBlockPos {
|
|
|
110
110
|
}
|
|
111
111
|
export type OnesEditorDocBlockPos = OnesEditorDocSimpleBlockPos | OnesEditorDocComplexBlockPos;
|
|
112
112
|
export interface OnesEditorDocSimpleRange {
|
|
113
|
-
reverse?: boolean;
|
|
114
113
|
anchor: OnesEditorDocSimpleBlockPos;
|
|
115
114
|
focus: OnesEditorDocSimpleBlockPos;
|
|
116
115
|
}
|
|
117
116
|
export interface OnesEditorDocComplexRange {
|
|
118
|
-
reverse?: boolean;
|
|
119
117
|
anchor: OnesEditorDocComplexBlockPos;
|
|
120
118
|
focus: OnesEditorDocComplexBlockPos;
|
|
121
119
|
}
|
|
@@ -204,7 +202,6 @@ export interface OnesEditorDocServerMeta {
|
|
|
204
202
|
serverId?: string;
|
|
205
203
|
docId?: string;
|
|
206
204
|
appId?: string;
|
|
207
|
-
apiServer?: string;
|
|
208
205
|
}
|
|
209
206
|
export interface RecognizeLinkResult {
|
|
210
207
|
type?: 'iframe' | 'video' | 'audio' | 'image';
|
|
@@ -14,8 +14,6 @@ export declare function rangeRemoveAttribute(offset: number, length: number, tex
|
|
|
14
14
|
export declare function getAttributesAt(text: DocBlockText, offset: number): DocBlockTextAttributes | undefined;
|
|
15
15
|
export type DocBlockTextProcessor = (op: DocBlockTextOp) => DocBlockTextOp;
|
|
16
16
|
export declare function rangeTransformText(offset: number, length: number, text: DocBlockText, processor: DocBlockTextProcessor): DocBlockText;
|
|
17
|
-
export declare function deleteColor(op: DocBlockTextOp, type: 'color' | 'backgroundColor'): void;
|
|
18
|
-
export declare function addColor(op: DocBlockTextOp, type: 'color' | 'backgroundColor', value: number): void;
|
|
19
17
|
export declare function rangeSetTextColor(offset: number, length: number, docText: DocBlockText, type: 'color' | 'backgroundColor', value: number | null): DocBlockText;
|
|
20
18
|
export declare function getColorFromAttributes(attributes?: DocBlockTextAttributes): [number | null, number | null];
|
|
21
19
|
export declare function setColorToAttributes(attributes: DocBlockTextAttributes, type: 'color' | 'backgroundColor', value: number | null): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OnesEditor
|
|
2
|
-
export declare function editorClearSelectedContents(editor: OnesEditor
|
|
1
|
+
import { OnesEditor } from '../../types';
|
|
2
|
+
export declare function editorClearSelectedContents(editor: OnesEditor): 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
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
2
|
import { DocBlock, DocBlockAttributes, DocBlockDelta, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange, UpdateBlockOptions } from './doc';
|
|
3
|
-
export type TextBlockContentTextChild = HTMLSpanElement & {
|
|
4
|
-
__neverUse: 'TextBlockContentTextChild';
|
|
5
|
-
};
|
|
6
|
-
export type TextBlockContentInsertionChild = InsertionElement;
|
|
7
|
-
export type TextBlockContentBoxChild = BoxElement;
|
|
8
|
-
export type TextBlockContentChild = TextBlockContentTextChild | TextBlockContentBoxChild | TextBlockContentInsertionChild;
|
|
9
3
|
export type ContainerElement = HTMLDivElement & {
|
|
10
4
|
__neverUse: 'ContainerElement';
|
|
11
5
|
};
|
|
@@ -58,7 +52,6 @@ export type BlockPosition = SimpleBlockPosition | ComplexBlockPosition;
|
|
|
58
52
|
export interface BoxCommands {
|
|
59
53
|
group: string;
|
|
60
54
|
commands: CommandItem[];
|
|
61
|
-
startGroup?: boolean;
|
|
62
55
|
executeCommand: (editor: OnesEditor, block: BlockElement, box: BoxElement, item: CommandItem) => unknown;
|
|
63
56
|
}
|
|
64
57
|
export interface BoxProperties {
|
|
@@ -126,6 +119,7 @@ export interface Closeable {
|
|
|
126
119
|
click: (item: CommandItem, target: HTMLElement) => void;
|
|
127
120
|
}
|
|
128
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';
|
|
129
123
|
export interface CommandItem {
|
|
130
124
|
id: string;
|
|
131
125
|
name: string;
|
|
@@ -136,15 +130,13 @@ export interface CommandItem {
|
|
|
136
130
|
type?: CommandItemType;
|
|
137
131
|
element?: HTMLElement | ((item: CommandItem) => HTMLElement);
|
|
138
132
|
icon?: string;
|
|
139
|
-
childrenType?: 'menu' | 'toolbar'
|
|
133
|
+
childrenType?: 'menu' | 'toolbar';
|
|
140
134
|
children?: CommandItem[];
|
|
141
135
|
childrenMenuId?: string;
|
|
142
136
|
data?: unknown;
|
|
143
137
|
group?: string;
|
|
144
138
|
groupOrder?: number;
|
|
145
139
|
dropdown?: boolean;
|
|
146
|
-
dropSplit?: boolean;
|
|
147
|
-
splitTooltip?: string;
|
|
148
140
|
manualShowChildren?: boolean;
|
|
149
141
|
childrenPlacement?: CommandItemChildrenPlacement;
|
|
150
142
|
childrenOffset?: [number, number];
|
|
@@ -153,17 +145,25 @@ export interface CommandItem {
|
|
|
153
145
|
defaultCheckedChildren?: string[];
|
|
154
146
|
ellipsisTooltip?: string;
|
|
155
147
|
disableTooltip?: boolean;
|
|
156
|
-
tooltipPlacement?: CommandItemChildrenPlacement;
|
|
157
148
|
disableReason?: string;
|
|
158
149
|
hideGroupItem?: boolean;
|
|
159
150
|
setCloseable?: (closeable: Closeable) => void;
|
|
160
151
|
beforePopup?: (parent: unknown) => void;
|
|
161
|
-
|
|
152
|
+
/**
|
|
153
|
+
* defaults to true
|
|
154
|
+
*/
|
|
155
|
+
shouldShown?: (currentBlock: BlockElement | undefined, menuType: CommandItemMenuType) => boolean;
|
|
162
156
|
/**
|
|
163
157
|
* defaults to true
|
|
164
158
|
*/
|
|
165
159
|
clickToClose?: boolean;
|
|
166
160
|
}
|
|
161
|
+
export interface BlockCommandItem extends CommandItem {
|
|
162
|
+
blockId: string;
|
|
163
|
+
blockType: string;
|
|
164
|
+
blockKind: BlockKind;
|
|
165
|
+
groupIndex: number;
|
|
166
|
+
}
|
|
167
167
|
export type StyleType = boolean | string | number;
|
|
168
168
|
export type BlockStyles = {
|
|
169
169
|
[index: string]: StyleType;
|
|
@@ -174,11 +174,9 @@ export type BlockPathComponent = {
|
|
|
174
174
|
};
|
|
175
175
|
export type BlockPath = BlockPathComponent[];
|
|
176
176
|
export interface BlockCommands {
|
|
177
|
-
element?: HTMLElement;
|
|
178
177
|
group: string;
|
|
179
178
|
commands: CommandItem[];
|
|
180
|
-
|
|
181
|
-
executeCommand: (editor: OnesEditor, block: BlockElement, item: CommandItem, child: TextBlockContentChild | null) => unknown;
|
|
179
|
+
executeCommand: (editor: OnesEditor, block: BlockElement, item: CommandItem) => unknown;
|
|
182
180
|
}
|
|
183
181
|
export interface BlockProperties {
|
|
184
182
|
blockCommands?: Record<string, BlockCommands>;
|
|
@@ -661,11 +659,11 @@ export interface OnesEditorInput {
|
|
|
661
659
|
export interface OnesEditorSelectionHandler {
|
|
662
660
|
isSelecting: () => boolean;
|
|
663
661
|
stopSelection: () => void;
|
|
664
|
-
handleMouseDown: (event: MouseEvent
|
|
662
|
+
handleMouseDown: (event: MouseEvent, options: {
|
|
665
663
|
autoScroll: boolean;
|
|
666
664
|
}) => void;
|
|
667
665
|
handleMouseMove: (event: MouseEvent) => void;
|
|
668
|
-
handleMouseUp: (event: MouseEvent
|
|
666
|
+
handleMouseUp: (event: MouseEvent) => void;
|
|
669
667
|
handleDblClick: (event: MouseEvent) => void;
|
|
670
668
|
handleTripleClick: (event: MouseEvent) => void;
|
|
671
669
|
}
|
|
@@ -716,42 +714,32 @@ export interface OnesEditorInsertions {
|
|
|
716
714
|
}
|
|
717
715
|
export type CommandParams = {
|
|
718
716
|
[index: string]: unknown;
|
|
719
|
-
} & {
|
|
720
|
-
source?: string[];
|
|
721
717
|
};
|
|
722
718
|
export type CommandResult = {
|
|
723
719
|
[index: string]: unknown;
|
|
724
720
|
};
|
|
725
721
|
export interface OnesEditorCommandProvider {
|
|
726
722
|
id: string;
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
}
|
|
737
|
-
export interface CommandItemWithSource extends CommandItem {
|
|
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;
|
|
728
|
+
getEmptyBlockTextAttributes?: (editor: OnesEditor, blockId: string) => DocBlockTextAttributes | undefined;
|
|
729
|
+
executeRangeCommand?: (editor: OnesEditor, range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams, result: CommandResult) => boolean;
|
|
730
|
+
}
|
|
731
|
+
export interface BlockCommandItemWithSource extends BlockCommandItem {
|
|
738
732
|
source: string;
|
|
739
733
|
}
|
|
740
|
-
export interface CommandFilter {
|
|
741
|
-
filter: (editor: OnesEditor, range: SelectionRange, items: CommandItemWithSource[], source: string[]) => CommandItemWithSource[];
|
|
742
|
-
}
|
|
743
|
-
export type CommandFilterId = keyof any;
|
|
744
734
|
export interface OnesEditorCommandProviders {
|
|
745
|
-
commandFilters?: Map<CommandFilterId, CommandFilter>;
|
|
746
|
-
addFilter?: (id: CommandFilterId, filter: CommandFilter) => void;
|
|
747
|
-
filterItems?: (range: SelectionRange, items: CommandItemWithSource[]) => CommandItemWithSource[];
|
|
748
735
|
registerCommandProvider: (provider: OnesEditorCommandProvider) => void;
|
|
749
736
|
getCommandProviders: () => OnesEditorCommandProvider[];
|
|
750
737
|
getCommandProvider: (id: string) => OnesEditorCommandProvider;
|
|
751
|
-
getCommands: (range: SelectionRange) =>
|
|
752
|
-
executeCommand: (range: SelectionRange, item:
|
|
738
|
+
getCommands: (range: SelectionRange, source: string) => BlockCommandItemWithSource[];
|
|
739
|
+
executeCommand: (range: SelectionRange, item: BlockCommandItemWithSource, params: CommandParams) => {
|
|
753
740
|
[index: string]: CommandResult;
|
|
754
741
|
};
|
|
742
|
+
getEmptyBlockTextAttributes: (editor: OnesEditor, blockId: string) => DocBlockTextAttributes | undefined;
|
|
755
743
|
}
|
|
756
744
|
export interface EditorDocLocalActionCallbacks {
|
|
757
745
|
onBeforeUpdateBlockText: (containerId: string, blockId: string, oldText: DocBlockText, newText: DocBlockText, newRange: OnesEditorDocRange) => void;
|
|
@@ -765,5 +753,5 @@ export interface OnesEditorBlockHook {
|
|
|
765
753
|
create?: (editor: OnesEditor, path: BlockPath, container: ContainerElement, blockElement: BlockElement, blockData: DocBlock) => void;
|
|
766
754
|
update?: (editor: OnesEditor, path: BlockPath, container: ContainerElement, blockElement: BlockElement, blockData: DocBlock) => void;
|
|
767
755
|
writable?: (editor: OnesEditor, blockElement: BlockElement | BlockElement[]) => boolean | undefined;
|
|
768
|
-
commands?: (editor: OnesEditor, blockElement: BlockElement
|
|
756
|
+
commands?: (editor: OnesEditor, blockElement: BlockElement) => BlockCommands;
|
|
769
757
|
}
|
|
@@ -15,8 +15,8 @@ export interface OnesEditorHoveringBlockFinder extends OnesEditorCustom {
|
|
|
15
15
|
export default class OnesEditorHoveringBlock extends TypedEmitter<OnesEditorHoveringBlockEvents> {
|
|
16
16
|
private editor;
|
|
17
17
|
private hoveringBlock;
|
|
18
|
-
hoveringElem
|
|
19
|
-
hoveringTextChild
|
|
18
|
+
private hoveringElem;
|
|
19
|
+
private hoveringTextChild;
|
|
20
20
|
private filters;
|
|
21
21
|
private finders;
|
|
22
22
|
constructor(editor: OnesEditor);
|
|
@@ -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>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { BlockCommands, BlockElement, CommandItem, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
export type
|
|
3
|
-
export interface StandardEmbedBlockProperties<T =
|
|
2
|
+
export type PresetCommandId = 'edit' | 'add-comment';
|
|
3
|
+
export interface StandardEmbedBlockProperties<T = PresetCommandId> {
|
|
4
4
|
presetIds?: T[];
|
|
5
|
-
|
|
6
|
-
extCommands?: CommandItem[] | ((editor: OnesEditor, block: BlockElement) => CommandItem[]);
|
|
5
|
+
extCommands?: CommandItem[];
|
|
7
6
|
handleExecuteCommand?: (editor: OnesEditor, block: BlockElement, item: CommandItem) => boolean;
|
|
8
7
|
}
|
|
9
8
|
export declare function addCommentToBlock(editor: OnesEditor, block: BlockElement): boolean;
|
|
10
|
-
export declare class StandardEmbedBlockCommands<T =
|
|
9
|
+
export declare class StandardEmbedBlockCommands<T = PresetCommandId> implements BlockCommands {
|
|
11
10
|
protected editor: OnesEditor;
|
|
12
11
|
protected block: BlockElement;
|
|
13
12
|
protected properties?: StandardEmbedBlockProperties<T> | undefined;
|
|
@@ -19,6 +18,6 @@ export declare class StandardEmbedBlockCommands<T = CommandId> implements BlockC
|
|
|
19
18
|
}
|
|
20
19
|
export declare function getStandardEmbedBlockProperties(editor: OnesEditor, block: BlockElement, properties?: StandardEmbedBlockProperties): {
|
|
21
20
|
blockCommands: {
|
|
22
|
-
'hovering-toolbar': StandardEmbedBlockCommands<
|
|
21
|
+
'hovering-toolbar': StandardEmbedBlockCommands<PresetCommandId>;
|
|
23
22
|
};
|
|
24
23
|
};
|