@ones-editor/editor 2.1.2-beta.2 → 2.1.2-beta.20
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/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 +3 -4
- package/@ones-editor/callout-block/src/index.d.ts +1 -0
- package/@ones-editor/comments/src/block-hook/block-comment-hook.d.ts +10 -0
- package/@ones-editor/comments/src/comments-helper/get-comment-abstract.d.ts +2 -1
- package/@ones-editor/comments/src/index.d.ts +2 -1
- package/@ones-editor/comments/src/text-comments/comments-command-provider.d.ts +4 -3
- package/@ones-editor/core/src/core/block-renderers/block-renderers.d.ts +1 -0
- package/@ones-editor/core/src/core/blocks/common/execute-block-command.d.ts +2 -2
- package/@ones-editor/core/src/core/blocks/complex-blocks/complex-block-helper.d.ts +2 -5
- package/@ones-editor/core/src/core/blocks/text-blocks/base/child.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/text-blocks/base/line-breaks.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/text-blocks/base/range.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/text-blocks/base/text-offset.d.ts +1 -2
- package/@ones-editor/core/src/core/command-providers/abstract-providers.d.ts +25 -0
- package/@ones-editor/core/src/core/command-providers/block-attributes.d.ts +16 -0
- package/@ones-editor/core/src/core/command-providers/commands/index.d.ts +2 -0
- package/@ones-editor/core/src/core/command-providers/commands/inject-source.d.ts +3 -0
- package/@ones-editor/core/src/core/command-providers/commands/merge-commands.d.ts +4 -0
- package/@ones-editor/core/src/core/command-providers/commands/range-commands.d.ts +2 -5
- package/@ones-editor/core/src/core/command-providers/editor-command-providers.d.ts +5 -14
- package/@ones-editor/core/src/core/command-providers/index.d.ts +3 -1
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -1
- package/@ones-editor/core/src/core/containers/root-container.d.ts +3 -2
- package/@ones-editor/core/src/core/doc/doc.d.ts +1 -1
- package/@ones-editor/core/src/core/doc/rich-text/text-style.d.ts +2 -0
- package/@ones-editor/core/src/core/editor/actions/clear-selected-contents.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/editor-dom/editor-dom.d.ts +1 -0
- package/@ones-editor/core/src/core/editor/index.d.ts +1 -1
- package/@ones-editor/core/src/core/insertions/editor-insertions.d.ts +1 -0
- package/@ones-editor/core/src/core/selection/actions/index.d.ts +2 -1
- package/@ones-editor/core/src/core/selection/adjust-selection-pos.d.ts +5 -1
- package/@ones-editor/core/src/core/selection/index.d.ts +1 -0
- package/@ones-editor/core/src/core/selection/select-handler.d.ts +3 -3
- package/@ones-editor/core/src/core/types.d.ts +42 -28
- package/@ones-editor/core/src/core/undo-manager/actions/action.d.ts +5 -1
- package/@ones-editor/core/src/core/undo-manager/actions/block-action.d.ts +1 -0
- package/@ones-editor/core/src/core/undo-manager/actions/update-block-data-action.d.ts +1 -0
- package/@ones-editor/core/src/helper/hovering-block.d.ts +3 -4
- package/@ones-editor/core/src/utils/animate-scroll.d.ts +2 -0
- package/@ones-editor/core/src/utils/dom.d.ts +4 -1
- package/@ones-editor/core/src/utils/drag-drop.d.ts +8 -3
- package/@ones-editor/embed-block-helper/src/block-properties/embed-block-properties.d.ts +6 -5
- package/@ones-editor/excalidraw/package.json +4 -0
- package/@ones-editor/file/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/file/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/file/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/graph-embed/src/helper/graph-block-commands.d.ts +5 -19
- package/@ones-editor/html-to-doc/src/html-to-doc/index.d.ts +2 -0
- package/@ones-editor/html-to-doc/src/html-to-doc/normal-html/html-to-doc.d.ts +4 -0
- package/@ones-editor/image-embed/src/hovering-toolbar/index.d.ts +1 -1
- package/@ones-editor/image-embed/src/image-object.d.ts +1 -0
- package/@ones-editor/image-embed/src/splitter-resizer/index.d.ts +3 -3
- package/@ones-editor/input-handlers/src/i18n/en-us.d.ts +1 -0
- package/@ones-editor/input-handlers/src/i18n/ja-jp.d.ts +1 -0
- package/@ones-editor/input-handlers/src/i18n/zh-cn.d.ts +1 -0
- package/@ones-editor/layout-block/src/command-filter.d.ts +6 -0
- package/@ones-editor/layout-block/src/index.d.ts +1 -0
- package/@ones-editor/list-block/src/index.d.ts +2 -1
- package/@ones-editor/media-embed/src/core/hovering-toolbar/index.d.ts +3 -10
- package/@ones-editor/media-embed/src/utils/dom.d.ts +2 -0
- package/@ones-editor/mention/src/locale/en-us.d.ts +3 -0
- package/@ones-editor/mention/src/locale/ja-jp.d.ts +3 -0
- package/@ones-editor/mention/src/locale/zh-cn.d.ts +3 -0
- package/@ones-editor/mention/src/mention.d.ts +24 -1
- package/@ones-editor/mobile-helper/src/cursor-toolbar.d.ts +15 -0
- package/@ones-editor/mobile-helper/src/embed-mask.d.ts +10 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/active-observer.d.ts +11 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/fixed-providers.d.ts +6 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/index.d.ts +18 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/align-dropdown.d.ts +9 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/group.d.ts +7 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/insert-menu.d.ts +13 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/insert.d.ts +8 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/paragraph.d.ts +9 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/tab-provider.d.ts +10 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/text-dropdown.d.ts +9 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/turn-into.d.ts +8 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/toolbar-handler.d.ts +15 -0
- package/@ones-editor/mobile-helper/src/index.d.ts +14 -2
- package/@ones-editor/mobile-helper/src/locale/en-us.d.ts +9 -0
- package/@ones-editor/mobile-helper/src/locale/ja-jp.d.ts +9 -0
- package/@ones-editor/mobile-helper/src/locale/zh-cn.d.ts +9 -0
- package/@ones-editor/mobile-helper/src/selection-gripper/index.d.ts +19 -0
- package/@ones-editor/mobile-helper/src/selection-gripper/select-handle.d.ts +3 -0
- package/@ones-editor/scroll-container/src/utils.d.ts +1 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/types.d.ts +3 -1
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +1 -1
- package/@ones-editor/sharedb-doc/src/versions/simple-client.d.ts +1 -1
- package/@ones-editor/table-block/src/commands/index.d.ts +2 -0
- package/@ones-editor/table-block/src/commands/mobile-command-provider.d.ts +12 -0
- package/@ones-editor/table-block/src/commands/table-block-commands.d.ts +4 -3
- package/@ones-editor/table-block/src/index.d.ts +2 -1
- package/@ones-editor/table-block/src/locale/en-us.d.ts +5 -0
- package/@ones-editor/table-block/src/locale/ja-jp.d.ts +5 -0
- package/@ones-editor/table-block/src/locale/zh-cn.d.ts +5 -0
- package/@ones-editor/table-block/src/table-block/cell-menu/table-cell-dom.d.ts +6 -0
- 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 +1 -3
- package/@ones-editor/to-docx/src/doc2other/core.d.ts +1 -1
- package/@ones-editor/to-docx/src/doc2other/table.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/block-menu/block-command-providers.d.ts +8 -0
- package/@ones-editor/{block-menu → ui}/src/block-menu/index.d.ts +3 -1
- package/@ones-editor/ui/src/box-helper/standard-box-commands.d.ts +10 -0
- package/@ones-editor/ui/src/box-helper/standard-box-provider.d.ts +9 -0
- package/@ones-editor/ui/src/index.d.ts +30 -8
- package/@ones-editor/ui/src/link-popup/mobile-link-popup.d.ts +22 -0
- package/@ones-editor/ui/src/link-popup/types.d.ts +34 -0
- package/@ones-editor/ui/src/link-popup/web-link-popup.d.ts +19 -0
- package/@ones-editor/ui/src/locale/en-us.d.ts +14 -0
- package/@ones-editor/ui/src/locale/ja-jp.d.ts +14 -0
- package/@ones-editor/ui/src/locale/zh-cn.d.ts +14 -0
- package/@ones-editor/ui/src/providers/align-dropdown.d.ts +10 -0
- package/@ones-editor/ui/src/providers/align.d.ts +11 -0
- package/@ones-editor/ui/src/providers/block-hook-provider.d.ts +16 -0
- package/@ones-editor/ui/src/providers/clipboard-provider.d.ts +20 -0
- package/@ones-editor/ui/src/providers/color-provider.d.ts +18 -0
- package/@ones-editor/ui/src/providers/edit-link-provider.d.ts +6 -0
- package/@ones-editor/ui/src/providers/heading.d.ts +13 -0
- package/@ones-editor/ui/src/providers/inline-code-provider.d.ts +10 -0
- package/@ones-editor/ui/src/providers/inline-style-provider.d.ts +10 -0
- package/@ones-editor/ui/src/providers/insert-above.d.ts +9 -0
- package/@ones-editor/ui/src/providers/insert-after.d.ts +9 -0
- package/@ones-editor/ui/src/providers/insert-box-provider.d.ts +12 -0
- package/@ones-editor/ui/src/providers/insert-group.d.ts +7 -0
- package/@ones-editor/ui/src/providers/insert-menu.d.ts +16 -0
- package/@ones-editor/ui/src/providers/link.d.ts +12 -0
- package/@ones-editor/ui/src/providers/list.d.ts +13 -0
- package/@ones-editor/ui/src/providers/mobile-link-provider.d.ts +13 -0
- package/@ones-editor/ui/src/providers/paragraph.d.ts +9 -0
- package/@ones-editor/ui/src/providers/proxy-provider.d.ts +9 -0
- package/@ones-editor/ui/src/providers/quoted.d.ts +10 -0
- package/@ones-editor/ui/src/providers/script-with-dropdown.d.ts +9 -0
- package/@ones-editor/ui/src/providers/selection-provider.d.ts +9 -0
- package/@ones-editor/ui/src/providers/text-command-provider.d.ts +16 -0
- package/@ones-editor/ui/src/providers/text-fixed-provider.d.ts +16 -0
- package/@ones-editor/ui/src/providers/text-script-provider.d.ts +10 -0
- package/@ones-editor/ui/src/providers/text-styles.d.ts +9 -0
- package/@ones-editor/ui/src/providers/turn-into.d.ts +9 -0
- package/@ones-editor/ui/src/providers/utils/add-section.d.ts +2 -0
- package/@ones-editor/ui/src/{quick-menu → providers/utils}/basic-commands.d.ts +1 -2
- package/@ones-editor/ui/src/providers/utils/clipboard.d.ts +6 -0
- package/@ones-editor/ui/src/providers/utils/index.d.ts +2 -0
- package/@ones-editor/ui/src/providers/utils/inject-block-options.d.ts +8 -0
- package/@ones-editor/ui/src/providers/utils/text-styles.d.ts +6 -0
- package/@ones-editor/ui/src/quick-menu/index.d.ts +7 -19
- package/@ones-editor/ui/src/quick-menu/quick-command-providers.d.ts +8 -0
- package/@ones-editor/ui/src/quick-menu/types.d.ts +2 -5
- package/@ones-editor/ui/src/readonly-toolbar/add-comment-to-old-doc.d.ts +2 -0
- package/@ones-editor/ui/src/readonly-toolbar/helper.d.ts +2 -0
- package/@ones-editor/ui/src/readonly-toolbar/index.d.ts +2 -2
- package/@ones-editor/ui/src/toolbar/link-commands.d.ts +4 -0
- package/@ones-editor/ui/src/toolbar/text-commands.d.ts +2 -2
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +2 -1
- package/@ones-editor/ui/src/tooltips/index.d.ts +21 -9
- package/@ones-editor/ui/src/utils/hide-toolbar.d.ts +2 -0
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +5 -2
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +3 -1
- package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +14 -7
- package/@ones-editor/ui-base/src/color-palette/color-palette.d.ts +7 -1
- package/@ones-editor/ui-base/src/color-palette/index.d.ts +3 -3
- package/@ones-editor/ui-base/src/command-bar/active-observer.d.ts +11 -0
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +5 -3
- package/@ones-editor/ui-base/src/command-bar/fixed-toolbar.d.ts +2 -1
- package/@ones-editor/ui-base/src/command-bar/init-toolbar-item.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +8 -3
- package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +1 -1
- package/@ones-editor/ui-base/src/icons/index.d.ts +5 -1
- package/@ones-editor/ui-base/src/index.d.ts +3 -0
- package/@ones-editor/ui-base/src/input/create-input.d.ts +24 -3
- package/@ones-editor/ui-base/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/ui-base/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/ui-base/src/mobile-command-bar/init-menu-item.d.ts +3 -0
- package/@ones-editor/ui-base/src/mobile-command-bar/mobile-bottom-menu.d.ts +21 -0
- package/@ones-editor/ui-base/src/mobile-command-bar/scroll-into-view.d.ts +3 -0
- package/@ones-editor/ui-base/src/popup/popup.d.ts +1 -1
- package/@ones-editor/{ui → ui-base}/src/text-button/index.d.ts +1 -1
- package/@ones-editor/versions/package.json +3 -0
- package/@ones-editor/versions/src/constant/index.d.ts +2 -0
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +2 -2
- package/@ones-editor/versions/src/history-render/index.d.ts +15 -1
- package/@ones-editor/versions/src/history-tooltip/index.d.ts +14 -0
- package/@ones-editor/versions/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/versions/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/versions/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/versions/src/types.d.ts +4 -0
- package/@ones-editor/versions/src/utils/block-text.d.ts +3 -1
- package/dist/auto-new-line.d.ts +7 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +18976 -13983
- package/dist/lang/en-us.d.ts +1 -1
- package/dist/lang/ja-jp.d.ts +1 -1
- package/dist/lang/zh-cn.d.ts +1 -1
- package/dist/types.d.ts +7 -2
- package/package.json +2 -3
- package/@ones-editor/block-menu/src/block-menu/items/block-command-items.d.ts +0 -3
- package/@ones-editor/block-menu/src/block-menu/items/index.d.ts +0 -5
- package/@ones-editor/block-menu/src/block-menu/items/insert-block-items/index.d.ts +0 -5
- package/@ones-editor/block-menu/src/block-menu/items/text-styles/text-style-item.d.ts +0 -30
- package/@ones-editor/block-menu/src/block-menu/items/types.d.ts +0 -5
- package/@ones-editor/text-commands/src/locale/en-us.d.ts +0 -13
- package/@ones-editor/text-commands/src/locale/ja-jp.d.ts +0 -13
- package/@ones-editor/text-commands/src/locale/zh-cn.d.ts +0 -13
- package/@ones-editor/text-commands/src/text-command-provider.d.ts +0 -24
- package/@ones-editor/text-commands/src/text-commands.d.ts +0 -4
- package/@ones-editor/text-commands/src/text-styles.d.ts +0 -4
- package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +0 -16
- package/@ones-editor/ui/src/quick-menu/inline-box-items.d.ts +0 -8
- package/@ones-editor/ui/src/quick-menu/insert-empty-block.d.ts +0 -4
- package/@ones-editor/ui/src/quick-menu/order.d.ts +0 -1
- package/@ones-editor/ui/src/quick-menu/quick-menu-items.d.ts +0 -9
- package/@ones-editor/ui/src/toolbar/commands/align.d.ts +0 -10
- package/@ones-editor/ui/src/toolbar/commands/paragraph.d.ts +0 -11
- package/@ones-editor/ui/src/toolbar/commands/turn-into.d.ts +0 -10
- package/@ones-editor/ui/src/toolbar/merge-commands.d.ts +0 -2
- /package/@ones-editor/{text-commands → mobile-helper}/src/locale/index.d.ts +0 -0
- /package/@ones-editor/{block-menu → ui}/src/block-menu/standard-block-actions/hook.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { BlockMenu } from '../../../../../@ones-editor/ui';
|
|
2
3
|
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,8 +1,7 @@
|
|
|
1
|
-
import { OnesEditor, OnesEditorCustom } from '../../../../@ones-editor/core';
|
|
2
|
-
|
|
3
|
-
export declare class CalloutQuickMenuItemFilter implements QuickMenuItemFilter, OnesEditorCustom {
|
|
1
|
+
import { CommandFilter, CommandItemWithSource, OnesEditor, OnesEditorCustom, SelectionRange } from '../../../../@ones-editor/core';
|
|
2
|
+
export declare class CalloutQuickMenuItemFilter implements CommandFilter, OnesEditorCustom {
|
|
4
3
|
constructor(editor: OnesEditor);
|
|
5
|
-
filter(editor: OnesEditor, items:
|
|
4
|
+
filter(editor: OnesEditor, range: SelectionRange, items: CommandItemWithSource[], source: string[]): CommandItemWithSource[];
|
|
6
5
|
destroy(): void;
|
|
7
6
|
static init(editor: OnesEditor): CalloutQuickMenuItemFilter;
|
|
8
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BlockCommands, BlockElement, CommandItem, OnesEditor, OnesEditorBlockHook, TextBlockContentChild } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { OnesEditorComments } from '../comments';
|
|
3
|
+
import { OnesEditorCommentsProvider } from '../types';
|
|
4
|
+
export default class HoveringCommentBlockHook implements OnesEditorBlockHook {
|
|
5
|
+
private provider;
|
|
6
|
+
private editorComments;
|
|
7
|
+
constructor(provider: OnesEditorCommentsProvider, editorComments: OnesEditorComments);
|
|
8
|
+
commands(editor: OnesEditor, blockElement: BlockElement, child: TextBlockContentChild | null): BlockCommands | undefined;
|
|
9
|
+
executeCommand: (editor: OnesEditor, block: BlockElement, item: CommandItem) => void;
|
|
10
|
+
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
|
|
1
|
+
import { BlockElement, OnesEditor, SelectedBlock } from '../../../../@ones-editor/core';
|
|
2
2
|
export declare function getCommentAbstract(editor: OnesEditor, blocks: BlockElement[]): string;
|
|
3
|
+
export declare function getCommentAbstractFromSelectedBlocks(editor: OnesEditor, blocks: SelectedBlock[]): string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { OnesEditorComments } from './comments';
|
|
2
2
|
import './style.scss';
|
|
3
|
+
import CommentsCommandProvider from './text-comments/comments-command-provider';
|
|
3
4
|
import './locale';
|
|
4
5
|
export * from './types';
|
|
5
6
|
export { OnesEditorCommentsRender } from './comments-render';
|
|
6
7
|
export { OnesEditorCommentPlaceholderHandler } from './comment-placeholder-handler';
|
|
7
|
-
export { OnesEditorComments };
|
|
8
|
+
export { OnesEditorComments, CommentsCommandProvider };
|
|
8
9
|
export type { CommentItem } from './comment-item';
|
|
9
10
|
export type { CommentGroupItem } from './comments-list/group-item';
|
|
10
11
|
export { removeCommentFromBlock } from './actions/remove-comment-from-block';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockElement, CommandItem, CommandItemWithSource, 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;
|
|
8
9
|
constructor(provider: OnesEditorCommentsProvider, editorComments: OnesEditorComments);
|
|
9
|
-
getAvailableCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange):
|
|
10
|
+
getAvailableCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange, params?: CommandParams): CommandItem[];
|
|
10
11
|
hideToolbar(editor: OnesEditor): void;
|
|
11
|
-
executeRangeCommand(editor: OnesEditor, range: SelectionRange, command:
|
|
12
|
+
executeRangeCommand(editor: OnesEditor, range: SelectionRange, command: CommandItemWithSource, params: CommandParams, result?: CommandResult): boolean;
|
|
12
13
|
}
|
|
@@ -9,4 +9,5 @@ export declare class EditorBlockRenderers implements OnesEditorBlockRenderers {
|
|
|
9
9
|
renderText(path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
|
|
10
10
|
renderBlock(editor: OnesEditor, path: BlockPath, blockData: DocBlock): OnesEditorBlockRenderResult;
|
|
11
11
|
updateBlock(editor: OnesEditor, path: BlockPath, blockElement: BlockElement, blockData: DocBlock): void;
|
|
12
|
+
renderChildContainer(editor: OnesEditor, path: BlockPath, containerId: string): OnesEditorBlockRenderResult;
|
|
12
13
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockElement, CommandItem, CommandItemWithSource, 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: CommandItemWithSource): unknown;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement, BlockPosition, ContainerElement,
|
|
1
|
+
import { OnesEditor, BlockElement, BlockPosition, ContainerElement, GetChildContainerOptions, ComplexSelectionRange } from '../../types';
|
|
2
|
+
export declare const logger: import("../../../utils").Logger;
|
|
2
3
|
export declare function complexBlockGetAllChildContainers(editor: OnesEditor, block: BlockElement, options?: GetChildContainerOptions): ContainerElement[];
|
|
3
4
|
export declare function complexBlockGetSelectedContainers(editor: OnesEditor, block: BlockElement, start: BlockPosition, end: BlockPosition): ContainerElement[];
|
|
4
5
|
export declare function isFirstChildBlockInComplexBlock(editor: OnesEditor, childBlock: BlockElement): boolean;
|
|
@@ -9,8 +10,4 @@ export declare function findPrevSimpleBlockBeforeChildContainer(editor: OnesEdit
|
|
|
9
10
|
export declare function complexBlockGetTopChildContainers(editor: OnesEditor, complexBlock: BlockElement): ContainerElement[];
|
|
10
11
|
export declare function complexBlockGetBottomChildContainers(editor: OnesEditor, complexBlock: BlockElement): ContainerElement[];
|
|
11
12
|
export declare function complexBlockFindNearestChildBlock(editor: OnesEditor, complexBlock: BlockElement, x: number, y: number): BlockElement;
|
|
12
|
-
export declare function complexBlockAdjustSelectionPos(editor: OnesEditor, complexBlock: BlockElement, anchor: ComplexBlockPosition, focus: ComplexBlockPosition): {
|
|
13
|
-
anchor: ComplexBlockPosition;
|
|
14
|
-
focus: ComplexBlockPosition;
|
|
15
|
-
};
|
|
16
13
|
export declare function isFullSelectedOneComplexBlock(editor: OnesEditor, complexRange?: ComplexSelectionRange): boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BlockElement,
|
|
2
|
-
export type { TextBlockContentTextChild, TextBlockContentBoxChild, TextBlockContentInsertionChild, TextBlockContentChild };
|
|
1
|
+
import { BlockElement, TextBlockContentChild } from '../../../types';
|
|
3
2
|
export type TextBlockContentChildren = TextBlockContentChild[];
|
|
4
3
|
export type TextBlockContentChildType = 'text' | 'box' | 'insertion';
|
|
5
4
|
export declare function isTextBlockContentChild(elem: Element): boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BlockElement, SimpleBlockPosition } from '../../../types';
|
|
2
|
-
import { TextBlockContentChild } from './child';
|
|
1
|
+
import { BlockElement, SimpleBlockPosition, TextBlockContentChild } from '../../../types';
|
|
3
2
|
export interface LineBreakInfo {
|
|
4
3
|
offset: number;
|
|
5
4
|
type: 'betweenChild' | 'textBreakWord';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BlockElement, BoxElement, InsertionElement } from '../../../types';
|
|
2
|
-
import { TextBlockContentChild } from './child';
|
|
1
|
+
import { BlockElement, BoxElement, InsertionElement, TextBlockContentChild } from '../../../types';
|
|
3
2
|
export interface BlockRangeInfo {
|
|
4
3
|
child: TextBlockContentChild;
|
|
5
4
|
container: Text | BoxElement | HTMLBRElement | InsertionElement;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BlockElement } from '../../../types';
|
|
2
|
-
import { TextBlockContentChild } from './child';
|
|
1
|
+
import { BlockElement, TextBlockContentChild } from '../../../types';
|
|
3
2
|
export declare function getChildOffset(block: BlockElement, child: TextBlockContentChild): {
|
|
4
3
|
start: number;
|
|
5
4
|
end: number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { OnesEditor, OnesEditorCommandProviders, OnesEditorCommandProvider, SelectionRange, CommandParams, CommandItemWithSource, CommandFilterId, CommandFilter, CommandResult, BlockElement } from '../types';
|
|
2
|
+
type RangeCommandResult = {
|
|
3
|
+
[index: string]: CommandResult;
|
|
4
|
+
};
|
|
5
|
+
export declare abstract class AbstractProvider implements OnesEditorCommandProviders {
|
|
6
|
+
protected editor: OnesEditor;
|
|
7
|
+
abstract id: string;
|
|
8
|
+
commandProviders: OnesEditorCommandProvider[];
|
|
9
|
+
commandFilters: Map<string | number | symbol, CommandFilter>;
|
|
10
|
+
constructor(editor: OnesEditor);
|
|
11
|
+
addFilter(id: CommandFilterId, filter: CommandFilter): void;
|
|
12
|
+
registerCommandProvider: (provider: OnesEditorCommandProvider) => void;
|
|
13
|
+
getCommandProviders: () => OnesEditorCommandProvider[];
|
|
14
|
+
getCommandProvider: (id: string) => OnesEditorCommandProvider;
|
|
15
|
+
filterItems: (range: SelectionRange, items: CommandItemWithSource[]) => CommandItemWithSource[];
|
|
16
|
+
getCommands(range: SelectionRange): CommandItemWithSource[];
|
|
17
|
+
executeBlockCommand: (editor: OnesEditor, block: BlockElement, range: SelectionRange, command: CommandItemWithSource, params: CommandParams, result: RangeCommandResult) => boolean;
|
|
18
|
+
executeRangeCommand: (range: SelectionRange, command: CommandItemWithSource, params: CommandParams) => {
|
|
19
|
+
[index: string]: CommandResult;
|
|
20
|
+
};
|
|
21
|
+
executeCommand(range: SelectionRange, command: CommandItemWithSource, params: CommandParams): {
|
|
22
|
+
[index: string]: CommandResult;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DocBlockTextAttributes } from '../doc';
|
|
2
|
+
import { CommandParams, OnesEditor, OnesEditorCustom } from '../types';
|
|
3
|
+
export default class BlockAttributesHandler implements OnesEditorCustom {
|
|
4
|
+
private editor;
|
|
5
|
+
private textBlockAttributes;
|
|
6
|
+
private activeBlockAttributes;
|
|
7
|
+
private lastRange;
|
|
8
|
+
constructor(editor: OnesEditor);
|
|
9
|
+
clear: () => void;
|
|
10
|
+
handleSelectionChanged: () => void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
getEmptyBlockTextAttributes(blockId: string): DocBlockTextAttributes | undefined;
|
|
13
|
+
setActiveBlockAttributes: (attributes: CommandParams) => void;
|
|
14
|
+
setEmptyBlockTextAttributes: (blockId: string, attributes: CommandParams) => void;
|
|
15
|
+
setActiveAttribute: (attribute: string, value: unknown) => void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CommandItem } from '../../types';
|
|
2
|
+
export declare function mergeCommands(blockCommands: CommandItem[]): CommandItem[];
|
|
3
|
+
export declare const flatCommands: (allCommands: Map<number, CommandItem[]>, sort?: boolean) => CommandItem[];
|
|
4
|
+
export declare const groupEachCommand: (allCommands: CommandItem[]) => CommandItem[];
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function executeRangeCommand(range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams): {
|
|
4
|
-
[index: string]: CommandResult;
|
|
5
|
-
};
|
|
1
|
+
import { CommandItemWithSource, BlockElement, OnesEditor, SelectionRange, OnesEditorCommandProvider } from '../../types';
|
|
2
|
+
export declare function getBlockCommands(providers: OnesEditorCommandProvider[], editor: OnesEditor, block: BlockElement, range: SelectionRange, source: string): CommandItemWithSource[];
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export default class EditorCommandProviders implements OnesEditorCommandProviders {
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
|
1
|
+
import { CommandItemWithSource, OnesEditorCommandProviders, SelectionRange } from '../types';
|
|
2
|
+
import { AbstractProvider } from './abstract-providers';
|
|
3
|
+
export default class EditorCommandProviders extends AbstractProvider implements OnesEditorCommandProviders {
|
|
4
|
+
id: string;
|
|
5
|
+
getCommands(range: SelectionRange): CommandItemWithSource[];
|
|
15
6
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import EditorCommandProviders from './editor-command-providers';
|
|
2
|
+
import BlockAttributesHandler from './block-attributes';
|
|
3
|
+
import { AbstractProvider } from './abstract-providers';
|
|
2
4
|
export * from './commands';
|
|
3
|
-
export { EditorCommandProviders };
|
|
5
|
+
export { EditorCommandProviders, BlockAttributesHandler, AbstractProvider };
|
|
@@ -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) => void;
|
|
37
|
+
handleDocumentClick: (event: MouseEvent | TouchEvent) => void;
|
|
38
38
|
handleDocumentSelectionChange: () => void;
|
|
39
39
|
handleEditorSelectionChanged: () => void;
|
|
40
40
|
handleReadonlyChanged: () => void;
|
|
@@ -6,6 +6,7 @@ export declare class RootContainer {
|
|
|
6
6
|
resizeObserver: ResizeObserver;
|
|
7
7
|
private isMoved;
|
|
8
8
|
private mouseDownEvent;
|
|
9
|
+
private dbClickRef;
|
|
9
10
|
constructor(editor: OnesEditor, rootContainer: ContainerElement);
|
|
10
11
|
private bindEvents;
|
|
11
12
|
private unbindEvents;
|
|
@@ -15,9 +16,9 @@ export declare class RootContainer {
|
|
|
15
16
|
handleClick: (event: MouseEvent) => void;
|
|
16
17
|
handleBlockClick: (event: MouseEvent, block: BlockElement, elem: Element) => void;
|
|
17
18
|
handleDblClick: (event: MouseEvent) => void;
|
|
18
|
-
handleMouseDown: (event: MouseEvent) => void;
|
|
19
|
+
handleMouseDown: (event: TouchEvent | MouseEvent) => void;
|
|
19
20
|
handleMouseMove: (event: MouseEvent) => void;
|
|
20
|
-
handleMouseUp: (event: MouseEvent) => void;
|
|
21
|
+
handleMouseUp: (event: MouseEvent | TouchEvent) => void;
|
|
21
22
|
handleCaptureClick: (event: MouseEvent) => void;
|
|
22
23
|
handleCaptureDbClick: (event: MouseEvent) => void;
|
|
23
24
|
reload(): void;
|
|
@@ -268,7 +268,7 @@ export interface OnesEditorHistoryDataParseHandler {
|
|
|
268
268
|
onUpdateComment: (commentId: string, local: boolean) => void;
|
|
269
269
|
}
|
|
270
270
|
export interface OnesEditorDocVersionHelper {
|
|
271
|
-
getVersions: () => Promise<DocVersion[]>;
|
|
271
|
+
getVersions: (showPublished?: boolean) => Promise<DocVersion[]>;
|
|
272
272
|
getVersion: (ver: number) => Promise<DocObject>;
|
|
273
273
|
getLatestVersion: () => Promise<DocObject>;
|
|
274
274
|
getHistoryData: (version: number, from?: number) => Promise<{
|
|
@@ -14,6 +14,8 @@ 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;
|
|
17
19
|
export declare function rangeSetTextColor(offset: number, length: number, docText: DocBlockText, type: 'color' | 'backgroundColor', value: number | null): DocBlockText;
|
|
18
20
|
export declare function getColorFromAttributes(attributes?: DocBlockTextAttributes): [number | null, number | null];
|
|
19
21
|
export declare function setColorToAttributes(attributes: DocBlockTextAttributes, type: 'color' | 'backgroundColor', value: number | null): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OnesEditor } from '../../types';
|
|
2
|
-
export declare function editorClearSelectedContents(editor: OnesEditor): void;
|
|
1
|
+
import { OnesEditor, SelectionRange } from '../../types';
|
|
2
|
+
export declare function editorClearSelectedContents(editor: OnesEditor, selectionRange?: SelectionRange): void;
|
|
@@ -7,5 +7,6 @@ export declare function isBlockPositionVisible(editor: OnesEditor, pos: SimpleBl
|
|
|
7
7
|
export declare function scrollIntoView(editor: OnesEditor, target: HTMLElement, options?: {
|
|
8
8
|
animation?: boolean;
|
|
9
9
|
verticalOffset?: number;
|
|
10
|
+
elementToScroll?: HTMLElement;
|
|
10
11
|
}): void;
|
|
11
12
|
export declare function editorScrollIntoView(editor: OnesEditor): void;
|
|
@@ -6,5 +6,6 @@ export default class EditorInsertions {
|
|
|
6
6
|
constructor(editor: OnesEditor);
|
|
7
7
|
registerInsertionClass(insertionClass: Insertion): void;
|
|
8
8
|
getInsertionClass(type: string): Insertion;
|
|
9
|
+
private createInsertionElement;
|
|
9
10
|
createInsertion(blockContent: BlockContentElement, insertion: DocInsertion): InsertionElement;
|
|
10
11
|
}
|
|
@@ -23,4 +23,5 @@ 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
|
-
|
|
26
|
+
import { editorSelectWord } from './select-word';
|
|
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, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlockPosition, OnesEditor } from '../types';
|
|
1
|
+
import { BlockElement, BlockPosition, OnesEditor, ComplexBlockPosition } from '../types';
|
|
2
2
|
import { EditorComplexBlockPosition, EditorSimpleBlockPosition } from './editor-position';
|
|
3
3
|
type AdjustSelectionPosResult = {
|
|
4
4
|
anchor: EditorSimpleBlockPosition;
|
|
@@ -7,5 +7,9 @@ type AdjustSelectionPosResult = {
|
|
|
7
7
|
anchor: EditorComplexBlockPosition;
|
|
8
8
|
focus: EditorComplexBlockPosition;
|
|
9
9
|
};
|
|
10
|
+
export declare function complexBlockAdjustSelectionPos(editor: OnesEditor, complexBlock: BlockElement, anchor: ComplexBlockPosition, focus: ComplexBlockPosition): {
|
|
11
|
+
anchor: ComplexBlockPosition;
|
|
12
|
+
focus: ComplexBlockPosition;
|
|
13
|
+
};
|
|
10
14
|
export declare function adjustSelectionPos(editor: OnesEditor, anchor: BlockPosition, focus: BlockPosition): AdjustSelectionPosResult | null;
|
|
11
15
|
export {};
|
|
@@ -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: MouseEvent | null;
|
|
7
|
+
mouseDownEvent: TouchEvent | MouseEvent | null;
|
|
8
8
|
autoScroll: AutoScroll | null;
|
|
9
9
|
constructor(editor: OnesEditor);
|
|
10
10
|
isSelecting(): boolean;
|
|
11
11
|
stopSelection(): void;
|
|
12
|
-
handleMouseDown: (event: MouseEvent, options: {
|
|
12
|
+
handleMouseDown: (event: MouseEvent | TouchEvent, options: {
|
|
13
13
|
autoScroll: boolean;
|
|
14
14
|
}) => void;
|
|
15
15
|
handleMouseMove: (event: MouseEvent) => void;
|
|
16
|
-
handleMouseUp: (event: MouseEvent) => void;
|
|
16
|
+
handleMouseUp: (event: MouseEvent | TouchEvent) => void;
|
|
17
17
|
handleDblClick(event: MouseEvent): void;
|
|
18
18
|
handleTripleClick(event: MouseEvent): void;
|
|
19
19
|
}
|
|
@@ -58,7 +58,6 @@ export type BlockPosition = SimpleBlockPosition | ComplexBlockPosition;
|
|
|
58
58
|
export interface BoxCommands {
|
|
59
59
|
group: string;
|
|
60
60
|
commands: CommandItem[];
|
|
61
|
-
startGroup?: boolean;
|
|
62
61
|
executeCommand: (editor: OnesEditor, block: BlockElement, box: BoxElement, item: CommandItem) => unknown;
|
|
63
62
|
}
|
|
64
63
|
export interface BoxProperties {
|
|
@@ -126,7 +125,6 @@ export interface Closeable {
|
|
|
126
125
|
click: (item: CommandItem, target: HTMLElement) => void;
|
|
127
126
|
}
|
|
128
127
|
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';
|
|
129
|
-
export type CommandItemMenuType = 'inline' | 'sibling';
|
|
130
128
|
export interface CommandItem {
|
|
131
129
|
id: string;
|
|
132
130
|
name: string;
|
|
@@ -137,13 +135,15 @@ export interface CommandItem {
|
|
|
137
135
|
type?: CommandItemType;
|
|
138
136
|
element?: HTMLElement | ((item: CommandItem) => HTMLElement);
|
|
139
137
|
icon?: string;
|
|
140
|
-
childrenType?: 'menu' | 'toolbar';
|
|
138
|
+
childrenType?: 'menu' | 'toolbar' | 'mobile-bottom-menu';
|
|
141
139
|
children?: CommandItem[];
|
|
142
140
|
childrenMenuId?: string;
|
|
143
141
|
data?: unknown;
|
|
144
142
|
group?: string;
|
|
145
143
|
groupOrder?: number;
|
|
146
144
|
dropdown?: boolean;
|
|
145
|
+
dropSplit?: boolean;
|
|
146
|
+
splitTooltip?: string;
|
|
147
147
|
manualShowChildren?: boolean;
|
|
148
148
|
childrenPlacement?: CommandItemChildrenPlacement;
|
|
149
149
|
childrenOffset?: [number, number];
|
|
@@ -152,25 +152,17 @@ export interface CommandItem {
|
|
|
152
152
|
defaultCheckedChildren?: string[];
|
|
153
153
|
ellipsisTooltip?: string;
|
|
154
154
|
disableTooltip?: boolean;
|
|
155
|
+
tooltipPlacement?: CommandItemChildrenPlacement;
|
|
155
156
|
disableReason?: string;
|
|
156
157
|
hideGroupItem?: boolean;
|
|
157
158
|
setCloseable?: (closeable: Closeable) => void;
|
|
158
159
|
beforePopup?: (parent: unknown) => void;
|
|
159
|
-
|
|
160
|
-
* defaults to true
|
|
161
|
-
*/
|
|
162
|
-
shouldShown?: (currentBlock: BlockElement | undefined, menuType: CommandItemMenuType) => boolean;
|
|
160
|
+
switchable?: boolean;
|
|
163
161
|
/**
|
|
164
162
|
* defaults to true
|
|
165
163
|
*/
|
|
166
164
|
clickToClose?: boolean;
|
|
167
165
|
}
|
|
168
|
-
export interface BlockCommandItem extends CommandItem {
|
|
169
|
-
blockId: string;
|
|
170
|
-
blockType: string;
|
|
171
|
-
blockKind: BlockKind;
|
|
172
|
-
groupIndex: number;
|
|
173
|
-
}
|
|
174
166
|
export type StyleType = boolean | string | number;
|
|
175
167
|
export type BlockStyles = {
|
|
176
168
|
[index: string]: StyleType;
|
|
@@ -184,7 +176,6 @@ export interface BlockCommands {
|
|
|
184
176
|
element?: HTMLElement;
|
|
185
177
|
group: string;
|
|
186
178
|
commands: CommandItem[];
|
|
187
|
-
startGroup?: boolean;
|
|
188
179
|
executeCommand: (editor: OnesEditor, block: BlockElement, item: CommandItem, child: TextBlockContentChild | null) => unknown;
|
|
189
180
|
}
|
|
190
181
|
export interface BlockProperties {
|
|
@@ -363,6 +354,8 @@ export interface OnesEditorUndoAction {
|
|
|
363
354
|
redo: (editor: OnesEditor) => boolean;
|
|
364
355
|
combinable: (other: OnesEditorUndoAction) => boolean;
|
|
365
356
|
combine: (other: OnesEditorUndoAction) => void;
|
|
357
|
+
getTimeStamp: () => number;
|
|
358
|
+
getBatchActionId?: () => string | undefined;
|
|
366
359
|
}
|
|
367
360
|
export interface OnesEditorUndoManager {
|
|
368
361
|
reset: () => void;
|
|
@@ -409,12 +402,14 @@ export interface OnesEditorBlockRenderer {
|
|
|
409
402
|
renderBox?: (editor: OnesEditor, path: BlockPath, attributes: DocBlockTextAttributes) => OnesEditorBlockRenderResult;
|
|
410
403
|
renderText?: (editor: OnesEditor, path: BlockPath, attributes: DocBlockTextAttributes) => OnesEditorBlockRenderResult;
|
|
411
404
|
renderBlock?: (editor: OnesEditor, path: BlockPath, blockData: DocBlock) => OnesEditorBlockRenderResult;
|
|
405
|
+
renderChildContainer?: (editor: OnesEditor, path: BlockPath, containerId: string) => OnesEditorBlockRenderResult;
|
|
412
406
|
updateBlock?: (editor: OnesEditor, path: BlockPath, blockElement: BlockElement, blockData: DocBlock) => void;
|
|
413
407
|
}
|
|
414
408
|
export interface OnesEditorBlockRenderers {
|
|
415
409
|
renderBox: (path: BlockPath, attributes: DocBlockTextAttributes) => OnesEditorBlockRenderResult;
|
|
416
410
|
renderText: (path: BlockPath, attributes: DocBlockTextAttributes) => OnesEditorBlockRenderResult;
|
|
417
411
|
renderBlock: (editor: OnesEditor, path: BlockPath, blockData: DocBlock) => OnesEditorBlockRenderResult;
|
|
412
|
+
renderChildContainer: (editor: OnesEditor, path: BlockPath, containerId: string) => OnesEditorBlockRenderResult;
|
|
418
413
|
updateBlock: (editor: OnesEditor, path: BlockPath, blockElement: BlockElement, blockData: DocBlock) => void;
|
|
419
414
|
registerRender: (decorator: OnesEditorBlockRenderer) => void;
|
|
420
415
|
}
|
|
@@ -649,6 +644,7 @@ export type PasteOptions = {
|
|
|
649
644
|
};
|
|
650
645
|
export interface OnesEditorInput {
|
|
651
646
|
readonly inputElement: HTMLTextAreaElement;
|
|
647
|
+
getInput: () => HTMLTextAreaElement;
|
|
652
648
|
destroy: () => void;
|
|
653
649
|
focus: () => void;
|
|
654
650
|
handleDocumentSelectionChange: () => void;
|
|
@@ -668,11 +664,11 @@ export interface OnesEditorInput {
|
|
|
668
664
|
export interface OnesEditorSelectionHandler {
|
|
669
665
|
isSelecting: () => boolean;
|
|
670
666
|
stopSelection: () => void;
|
|
671
|
-
handleMouseDown: (event: MouseEvent, options: {
|
|
667
|
+
handleMouseDown: (event: MouseEvent | TouchEvent, options: {
|
|
672
668
|
autoScroll: boolean;
|
|
673
669
|
}) => void;
|
|
674
670
|
handleMouseMove: (event: MouseEvent) => void;
|
|
675
|
-
handleMouseUp: (event: MouseEvent) => void;
|
|
671
|
+
handleMouseUp: (event: MouseEvent | TouchEvent) => void;
|
|
676
672
|
handleDblClick: (event: MouseEvent) => void;
|
|
677
673
|
handleTripleClick: (event: MouseEvent) => void;
|
|
678
674
|
}
|
|
@@ -723,32 +719,43 @@ export interface OnesEditorInsertions {
|
|
|
723
719
|
}
|
|
724
720
|
export type CommandParams = {
|
|
725
721
|
[index: string]: unknown;
|
|
722
|
+
} & {
|
|
723
|
+
source?: string[];
|
|
724
|
+
isFilter?: boolean;
|
|
726
725
|
};
|
|
727
726
|
export type CommandResult = {
|
|
728
727
|
[index: string]: unknown;
|
|
729
728
|
};
|
|
730
729
|
export interface OnesEditorCommandProvider {
|
|
731
730
|
id: string;
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
731
|
+
groupIndex?: number;
|
|
732
|
+
getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange, params?: CommandParams) => CommandItem[];
|
|
733
|
+
getInsertCommands?: (editor: OnesEditor, containerId: string) => CommandItem[];
|
|
734
|
+
executeInsertCommand?: (editor: OnesEditor, containerId: string, blockIndex: number, item: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
|
|
735
|
+
executeRangeCommand?: (editor: OnesEditor, range: SelectionRange, command: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
|
|
736
|
+
executeCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
|
|
737
|
+
filterCommands?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, commands: CommandItemWithSource[]) => CommandItemWithSource[] | undefined;
|
|
738
|
+
beforeExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams) => boolean | undefined;
|
|
739
|
+
afterExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams, result: CommandResult) => void;
|
|
740
|
+
}
|
|
741
|
+
export interface CommandItemWithSource extends CommandItem {
|
|
741
742
|
source: string;
|
|
742
743
|
}
|
|
744
|
+
export interface CommandFilter {
|
|
745
|
+
filter: (editor: OnesEditor, range: SelectionRange, items: CommandItemWithSource[], source: string[]) => CommandItemWithSource[];
|
|
746
|
+
}
|
|
747
|
+
export type CommandFilterId = keyof any;
|
|
743
748
|
export interface OnesEditorCommandProviders {
|
|
749
|
+
commandFilters?: Map<CommandFilterId, CommandFilter>;
|
|
750
|
+
addFilter?: (id: CommandFilterId, filter: CommandFilter) => void;
|
|
751
|
+
filterItems?: (range: SelectionRange, items: CommandItemWithSource[]) => CommandItemWithSource[];
|
|
744
752
|
registerCommandProvider: (provider: OnesEditorCommandProvider) => void;
|
|
745
753
|
getCommandProviders: () => OnesEditorCommandProvider[];
|
|
746
754
|
getCommandProvider: (id: string) => OnesEditorCommandProvider;
|
|
747
|
-
getCommands: (range: SelectionRange
|
|
748
|
-
executeCommand: (range: SelectionRange, item:
|
|
755
|
+
getCommands: (range: SelectionRange) => CommandItemWithSource[];
|
|
756
|
+
executeCommand: (range: SelectionRange, item: CommandItemWithSource, params: CommandParams) => {
|
|
749
757
|
[index: string]: CommandResult;
|
|
750
758
|
};
|
|
751
|
-
getEmptyBlockTextAttributes: (editor: OnesEditor, blockId: string) => DocBlockTextAttributes | undefined;
|
|
752
759
|
}
|
|
753
760
|
export interface EditorDocLocalActionCallbacks {
|
|
754
761
|
onBeforeUpdateBlockText: (containerId: string, blockId: string, oldText: DocBlockText, newText: DocBlockText, newRange: OnesEditorDocRange) => void;
|
|
@@ -764,3 +771,10 @@ export interface OnesEditorBlockHook {
|
|
|
764
771
|
writable?: (editor: OnesEditor, blockElement: BlockElement | BlockElement[]) => boolean | undefined;
|
|
765
772
|
commands?: (editor: OnesEditor, blockElement: BlockElement, child: TextBlockContentChild | null) => BlockCommands | undefined;
|
|
766
773
|
}
|
|
774
|
+
export interface MobileClient {
|
|
775
|
+
getViewPortHeight: () => number;
|
|
776
|
+
getOffsetHeight: () => number;
|
|
777
|
+
virtualViewportHeight: number;
|
|
778
|
+
virtualViewportOffsetTop: number;
|
|
779
|
+
isAndroidApp: boolean;
|
|
780
|
+
}
|
|
@@ -4,11 +4,15 @@ export default class Action implements OnesEditorUndoAction {
|
|
|
4
4
|
protected containerId: string;
|
|
5
5
|
beforeRange: OnesEditorDocRange;
|
|
6
6
|
afterRange: OnesEditorDocRange;
|
|
7
|
-
|
|
7
|
+
batchActionId?: string;
|
|
8
|
+
ts: number;
|
|
9
|
+
constructor(editor: OnesEditor, containerId: string, afterRange: OnesEditorDocRange, batchActionId?: string);
|
|
10
|
+
getTimeStamp(): number;
|
|
8
11
|
undo(editor: OnesEditor): boolean;
|
|
9
12
|
redo(editor: OnesEditor): boolean;
|
|
10
13
|
combinable(other: OnesEditorUndoAction): boolean;
|
|
11
14
|
combine(other: OnesEditorUndoAction): void;
|
|
15
|
+
getBatchActionId(): string | undefined;
|
|
12
16
|
setAfterRange(range: OnesEditorDocRange): void;
|
|
13
17
|
hasDocContainerId(editor: OnesEditor, id: string): boolean;
|
|
14
18
|
findDocBlockById(editor: OnesEditor, id: string): DocBlock | undefined;
|
|
@@ -7,4 +7,5 @@ export default class BlockAction extends Action {
|
|
|
7
7
|
constructor(editor: OnesEditor, containerId: string, blockIndex: number, data: DocBlock, afterRange: OnesEditorDocRange);
|
|
8
8
|
deleteBlock(editor: OnesEditor, newRange: OnesEditorDocRange): boolean;
|
|
9
9
|
insertBlock(editor: OnesEditor, newRange: OnesEditorDocRange): boolean;
|
|
10
|
+
getBatchActionId(): string | undefined;
|
|
10
11
|
}
|