@ones-editor/editor 2.0.6-beta.4 → 2.0.7-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/block-menu/src/block-menu/items/insert-block-items/index.d.ts +1 -1
- package/@ones-editor/block-menu/src/block-menu-button/drag-preview/element-to-data-url.d.ts +1 -1
- package/@ones-editor/block-menu/src/block-menu-button/index.d.ts +15 -4
- package/@ones-editor/{layout-block → column-block}/package.json +1 -1
- package/@ones-editor/column-block/src/child-containers.d.ts +2 -0
- package/@ones-editor/column-block/src/columns-options.d.ts +2 -0
- package/@ones-editor/column-block/src/columns-properties.d.ts +15 -0
- package/@ones-editor/column-block/src/index.d.ts +4 -0
- package/@ones-editor/column-block/src/types.d.ts +11 -0
- package/@ones-editor/context-menu/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/context-menu/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/context-menu/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/core/src/core/blocks/common/block-wrapper.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/common/insert-empty-block.d.ts +2 -3
- package/@ones-editor/core/src/core/blocks/embed-blocks/embed-block/common.d.ts +0 -1
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -1
- package/@ones-editor/core/src/core/containers/children.d.ts +2 -5
- package/@ones-editor/core/src/core/containers/element.d.ts +0 -1
- package/@ones-editor/core/src/core/doc/container.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/actions/insert-doc/insert-doc.d.ts +1 -1
- package/@ones-editor/core/src/core/editor-doc/handle-block-data-changed.d.ts +1 -2
- package/@ones-editor/core/src/core/selection/editor-selection.d.ts +3 -1
- package/@ones-editor/core/src/core/types.d.ts +9 -61
- package/@ones-editor/core/src/helper/hovering-block.d.ts +1 -3
- package/@ones-editor/core/src/i18n/en-us.d.ts +0 -1
- package/@ones-editor/core/src/i18n/i18n.d.ts +0 -3
- package/@ones-editor/core/src/i18n/ja-jp.d.ts +0 -1
- package/@ones-editor/core/src/i18n/zh-cn.d.ts +0 -1
- package/@ones-editor/core/src/utils/data-url.d.ts +0 -1
- package/@ones-editor/drop-target/src/drop-indicator.d.ts +2 -3
- package/@ones-editor/drop-target/src/drop-target.d.ts +1 -8
- package/@ones-editor/drop-target/src/find-drop-target.d.ts +1 -1
- package/@ones-editor/drop-target/src/index.d.ts +1 -3
- package/@ones-editor/find-dialog/src/shortcuts.d.ts +2 -0
- package/@ones-editor/graph-embed/src/helper/graph-base.d.ts +1 -1
- package/@ones-editor/graph-embed/src/helper/graph-block-commands.d.ts +1 -3
- package/@ones-editor/heading-collapse/src/heading-collapse-button/heading-utils.d.ts +1 -2
- package/@ones-editor/heading-collapse/src/index.d.ts +0 -1
- package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +4 -1
- package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +0 -1
- package/@ones-editor/image-embed/src/image-dom/download-image.d.ts +0 -2
- package/@ones-editor/image-embed/src/image-object.d.ts +0 -3
- package/@ones-editor/image-embed/src/index.d.ts +1 -5
- package/@ones-editor/image-embed/src/types.d.ts +0 -1
- package/@ones-editor/input-handlers/src/enforce-with-document-title/enforce-with-document-title-handler.d.ts +1 -0
- package/@ones-editor/input-handlers/src/enforce-with-document-title/placeholder.d.ts +1 -0
- package/@ones-editor/list-block/src/converter/selection-to-doc.d.ts +2 -0
- package/@ones-editor/misc/src/image.d.ts +1 -2
- package/@ones-editor/table-block/src/index.d.ts +0 -1
- package/@ones-editor/table-block/src/table-block/table-creator/index.d.ts +1 -1
- package/@ones-editor/to-docx/src/doc2other/colors.d.ts +1 -1
- package/@ones-editor/to-docx/src/doc2other/core.d.ts +0 -2
- package/@ones-editor/toc/src/build-toc.d.ts +0 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/index.d.ts +2 -2
- package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +1 -1
- package/@ones-editor/ui/src/quick-menu/index.d.ts +2 -9
- package/@ones-editor/ui/src/quick-menu/quick-menu-items.d.ts +2 -4
- package/@ones-editor/ui/src/quick-menu/types.d.ts +0 -5
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +0 -1
- package/@ones-editor/ui-base/src/color-palette/color-palette.d.ts +1 -2
- package/@ones-editor/ui-base/src/color-palette/create-palette.d.ts +0 -6
- package/@ones-editor/ui-base/src/color-palette/index.d.ts +2 -2
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +0 -1
- package/@ones-editor/ui-base/src/icons/index.d.ts +1 -10
- package/@ones-editor/ui-base/src/index.d.ts +0 -1
- package/@ones-editor/ui-base/src/input/create-input.d.ts +0 -1
- package/@ones-editor/ui-base/src/locale/en-us.d.ts +0 -16
- package/@ones-editor/ui-base/src/locale/ja-jp.d.ts +0 -16
- package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +0 -16
- package/@ones-editor/versions/src/types.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +212 -251
- package/dist/types.d.ts +0 -2
- package/package.json +3 -3
- package/@ones-editor/block-menu/src/block-menu-button/menu-button/index.d.ts +0 -23
- package/@ones-editor/callout-block/package.json +0 -11
- package/@ones-editor/callout-block/src/callout-block/callout-block-content.d.ts +0 -3
- package/@ones-editor/callout-block/src/callout-block/callout-block-doc.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/callout-block.d.ts +0 -3
- package/@ones-editor/callout-block/src/callout-block/callout-drop-target-finder.d.ts +0 -10
- package/@ones-editor/callout-block/src/callout-block/callout-input-handler.d.ts +0 -9
- package/@ones-editor/callout-block/src/callout-block/callout-last-callout-payload.d.ts +0 -3
- package/@ones-editor/callout-block/src/callout-block/callout-options.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/callout-properties.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/callout-quick-menu-item-filter.d.ts +0 -8
- package/@ones-editor/callout-block/src/callout-block/command-items/bg-color-item.d.ts +0 -20
- package/@ones-editor/callout-block/src/callout-block/command-items/delete-icon-item.d.ts +0 -3
- package/@ones-editor/callout-block/src/callout-block/command-items/preset-item.d.ts +0 -10
- package/@ones-editor/callout-block/src/callout-block/covert-to.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/helper.d.ts +0 -2
- package/@ones-editor/callout-block/src/callout-block/index.d.ts +0 -1
- package/@ones-editor/callout-block/src/callout-block/types.d.ts +0 -9
- package/@ones-editor/callout-block/src/index.d.ts +0 -3
- package/@ones-editor/callout-block/src/locale/en-us.d.ts +0 -12
- package/@ones-editor/callout-block/src/locale/index.d.ts +0 -1
- package/@ones-editor/callout-block/src/locale/ja-jp.d.ts +0 -12
- package/@ones-editor/callout-block/src/locale/zh-cn.d.ts +0 -12
- package/@ones-editor/image-embed/src/hovering-toolbar/index.d.ts +0 -22
- package/@ones-editor/layout-block/src/block-drop.d.ts +0 -3
- package/@ones-editor/layout-block/src/caption.d.ts +0 -8
- package/@ones-editor/layout-block/src/child-containers.d.ts +0 -3
- package/@ones-editor/layout-block/src/column-resizer/index.d.ts +0 -2
- package/@ones-editor/layout-block/src/constants.d.ts +0 -32
- package/@ones-editor/layout-block/src/index.d.ts +0 -6
- package/@ones-editor/layout-block/src/layout-creator/index.d.ts +0 -27
- package/@ones-editor/layout-block/src/layout-operations.d.ts +0 -11
- package/@ones-editor/layout-block/src/locale/en-us.d.ts +0 -10
- package/@ones-editor/layout-block/src/locale/index.d.ts +0 -1
- package/@ones-editor/layout-block/src/locale/ja-jp.d.ts +0 -10
- package/@ones-editor/layout-block/src/locale/zh-cn.d.ts +0 -10
- package/@ones-editor/layout-block/src/options.d.ts +0 -2
- package/@ones-editor/layout-block/src/percent-bar.d.ts +0 -3
- package/@ones-editor/layout-block/src/selection.d.ts +0 -5
- package/@ones-editor/layout-block/src/toolbar.d.ts +0 -33
- package/@ones-editor/layout-block/src/types.d.ts +0 -17
- package/@ones-editor/layout-block/src/utils.d.ts +0 -6
- package/@ones-editor/media-embed/src/core/hovering-toolbar/index.d.ts +0 -22
- package/@ones-editor/to-docx/src/doc2other/layout.d.ts +0 -10
- package/@ones-editor/ui-base/src/emoji-item/emoji-item.d.ts +0 -18
- package/@ones-editor/ui-base/src/emoji-item/index.d.ts +0 -2
- package/@ones-editor/ui-base/src/emoji-palette/emoji-content.d.ts +0 -20
- package/@ones-editor/ui-base/src/emoji-palette/emoji-data.d.ts +0 -34
- package/@ones-editor/ui-base/src/emoji-palette/emoji-navigation.d.ts +0 -15
- package/@ones-editor/ui-base/src/emoji-palette/emoji-search.d.ts +0 -11
- package/@ones-editor/ui-base/src/emoji-palette/index.d.ts +0 -25
- package/@ones-editor/ui-base/src/emoji-palette/types.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../../../../@ones-editor/core';
|
|
2
2
|
import type { GetAllQuickMenuItemsOptions } from '../../../../../../@ones-editor/ui';
|
|
3
3
|
import type { BlockMenuItem } from '../types';
|
|
4
|
-
export declare function getAllInsertBlockItems(editor: OnesEditor,
|
|
4
|
+
export declare function getAllInsertBlockItems(editor: OnesEditor, source: 'insert-block' | 'insert-block-before', options: GetAllQuickMenuItemsOptions): BlockMenuItem[];
|
|
5
5
|
export declare function executeInsertBlockCommand(editor: OnesEditor, block: BlockElement, item: BlockMenuItem, insertAbove?: boolean): Promise<BlockElement | null> | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
-
export declare function elementToDataUrl(editor: OnesEditor, element: HTMLElement
|
|
2
|
+
export declare function elementToDataUrl(editor: OnesEditor, element: HTMLElement): Promise<string>;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import EmptyBlockMenu from '../empty-block-menu';
|
|
3
|
+
import BlockMenu from '../block-menu';
|
|
4
|
+
export default class OnesEditorBlockMenuButton {
|
|
4
5
|
private editor;
|
|
5
|
-
|
|
6
|
+
buttonElement: HTMLButtonElement;
|
|
7
|
+
emptyBlockMenu: EmptyBlockMenu;
|
|
8
|
+
blockMenu: BlockMenu;
|
|
9
|
+
private dragHandler;
|
|
6
10
|
constructor(editor: OnesEditor);
|
|
7
11
|
destroy(): void;
|
|
12
|
+
handleHoverBlock: (hoverBlock: BlockElement | null, oldBlock: BlockElement | null, event: MouseEvent) => void;
|
|
13
|
+
handleButtonClick: () => void;
|
|
14
|
+
updatePlaceholder: (block: BlockElement) => void;
|
|
15
|
+
handleChanged: () => void;
|
|
16
|
+
createButton(): HTMLButtonElement;
|
|
17
|
+
setButtonType(type: 'move' | 'insert'): void;
|
|
18
|
+
updateButton(block: BlockElement): void;
|
|
8
19
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BlockCommands, BlockElement, CommandItem, OnesEditor } from '../../../@ones-editor/core';
|
|
2
|
+
export declare class ColumnsBlockCommands implements BlockCommands {
|
|
3
|
+
protected editor: OnesEditor;
|
|
4
|
+
protected block: BlockElement;
|
|
5
|
+
group: string;
|
|
6
|
+
constructor(editor: OnesEditor, block: BlockElement);
|
|
7
|
+
_commands: CommandItem[];
|
|
8
|
+
get commands(): CommandItem[];
|
|
9
|
+
executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function getColumnsBlockProperties(editor: OnesEditor, block: BlockElement): {
|
|
12
|
+
blockCommands: {
|
|
13
|
+
'hovering-toolbar': ColumnsBlockCommands;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DocBlock } from '../../../@ones-editor/core';
|
|
2
|
+
export type ColumnData = {
|
|
3
|
+
type: string;
|
|
4
|
+
columns: 1 | 2 | 3 | 4;
|
|
5
|
+
};
|
|
6
|
+
export declare const COLUMNS: ColumnData[];
|
|
7
|
+
export interface DocColumnsBlock extends DocBlock {
|
|
8
|
+
columnType: string;
|
|
9
|
+
children: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function getColumnData(type: string): ColumnData;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement, BlockPosition, ConvertBlockResult, SelectionRange, BlockStyles
|
|
1
|
+
import { OnesEditor, BlockElement, BlockPosition, ConvertBlockResult, SelectionRange, BlockStyles } from '../../types';
|
|
2
2
|
import { DocBlock, DocBlockAttributes } from '../../doc';
|
|
3
3
|
export declare function getBlockTextLength(editor: OnesEditor, block: BlockElement): number;
|
|
4
4
|
export declare function clearAllSelection(editor: OnesEditor): void;
|
|
5
5
|
export declare function updateBlockSelection(editor: OnesEditor, block: BlockElement, from: BlockPosition, to: BlockPosition): void;
|
|
6
6
|
export declare function getRootBlock(block: BlockElement): BlockElement;
|
|
7
|
-
export declare function getClosestContainerByCondition(_block: BlockElement, condition: (container: ContainerElement) => boolean): BlockElement | undefined;
|
|
8
7
|
export declare function getBlockMinWidth(editor: OnesEditor, block: BlockElement): number | undefined;
|
|
9
8
|
export declare function handleBlockElementUpdated(editor: OnesEditor, block: BlockElement, data: DocBlock): void;
|
|
10
9
|
export declare function convertBlockFrom(editor: OnesEditor, block: BlockElement, type: string, options: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getContainerBlockOverrideOptions(editor: OnesEditor, containerID: string, blockType?: string): ContainerBlockOverrideInsertEmptyBlockInsideOptions | undefined;
|
|
1
|
+
import { OnesEditor } from '../../types';
|
|
3
2
|
export declare function insertEmptyEmbedBlock(editor: OnesEditor, embedType: string, containerId: string, blockIndex: number, data?: Record<string, unknown>): Promise<import("../../types").BlockElement | null>;
|
|
4
|
-
export declare function insertEmptyBlock(editor: OnesEditor, type: string, containerId: string, blockIndex: number, data?: Record<string, unknown
|
|
3
|
+
export declare function insertEmptyBlock(editor: OnesEditor, type: string, containerId: string, blockIndex: number, data?: Record<string, unknown>): Promise<import("../../types").BlockElement | null> | null;
|
|
@@ -27,7 +27,7 @@ export declare class EditorInput implements OnesEditorInput {
|
|
|
27
27
|
callbacks: EditorInputCallbacks;
|
|
28
28
|
inputElement: HTMLInputElement;
|
|
29
29
|
constructor(editor: OnesEditor, callbacks: EditorInputCallbacks);
|
|
30
|
-
private
|
|
30
|
+
private isInCommandbar;
|
|
31
31
|
destroy(): void;
|
|
32
32
|
getInput(): HTMLInputElement;
|
|
33
33
|
focus(): void;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { BlockElement, ContainerElement
|
|
2
|
-
export declare function getChildBlocks(container: ContainerElement
|
|
3
|
-
condition: (block: BlockElement) => boolean;
|
|
4
|
-
editor: OnesEditor;
|
|
5
|
-
}): BlockElement[];
|
|
1
|
+
import { BlockElement, ContainerElement } from '../types';
|
|
2
|
+
export declare function getChildBlocks(container: ContainerElement): BlockElement[];
|
|
6
3
|
export declare function getFirstChildBlock(container: ContainerElement): BlockElement;
|
|
7
4
|
export declare function getLastChildBlock(container: ContainerElement): BlockElement;
|
|
8
5
|
export declare function getChildBlockCount(container: ContainerElement): number;
|
|
@@ -4,4 +4,3 @@ export declare function getContainerById(editor: OnesEditor, containerId: string
|
|
|
4
4
|
export declare function getExistsContainerById(editor: OnesEditor, containerId: string): ContainerElement | null;
|
|
5
5
|
export declare function getContainerBlocksElement(container: ContainerElement): ContainerBlocksElement;
|
|
6
6
|
export declare function getContainerToolsElement(container: ContainerElement): ContainerToolsElement;
|
|
7
|
-
export declare function isContainerBlocksElement(element: Element): element is ContainerBlocksElement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DocBlock,
|
|
2
|
-
export declare function createContainer(doc: OnesEditorDoc,
|
|
1
|
+
import { DocBlock, OnesEditorDoc } from './doc';
|
|
2
|
+
export declare function createContainer(doc: OnesEditorDoc, blocks: DocBlock[]): string;
|
|
3
3
|
export declare function createEmptyContainer(doc: OnesEditorDoc, text?: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DocObject } from '../../../doc';
|
|
2
2
|
import { BlockElement, CloneBlockResultInfo, ContainerElement, OnesEditor } from '../../../types';
|
|
3
3
|
export declare function editorInsertDoc(editor: OnesEditor, block: BlockElement, offset: number, insertedDoc: DocObject, cloneDocResult?: CloneBlockResultInfo): void;
|
|
4
|
-
export declare function editorInsertDocAt(editor: OnesEditor, container: ContainerElement, blockIndex: number,
|
|
4
|
+
export declare function editorInsertDocAt(editor: OnesEditor, container: ContainerElement, blockIndex: number, insertedDoc: DocObject, cloneDocResult?: CloneBlockResultInfo): BlockElement[];
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { DocBlockDelta } from '../doc';
|
|
2
1
|
import { OnesEditor } from '../types';
|
|
3
|
-
export declare function onBlockDataChanged(editor: OnesEditor, containerId: string, blockIndex: number
|
|
2
|
+
export declare function onBlockDataChanged(editor: OnesEditor, containerId: string, blockIndex: number): void;
|
|
@@ -17,7 +17,9 @@ export declare class EditorSelection implements OnesEditorSelection {
|
|
|
17
17
|
selectBlock(block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions): void;
|
|
18
18
|
setSelection(anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions): SelectionRange;
|
|
19
19
|
setRange(range: SelectionRange, options?: ChangeSelectionOptions): SelectionRange;
|
|
20
|
-
updateSelection(
|
|
20
|
+
updateSelection(oldRange: SelectionRange | null, options?: {
|
|
21
|
+
focusBlockChanged: boolean;
|
|
22
|
+
}): void;
|
|
21
23
|
getFocusedPos(): BlockPosition;
|
|
22
24
|
getAnchorPos(): BlockPosition;
|
|
23
25
|
selectionChanging(anchor: BlockPosition, focus: BlockPosition): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { DocBlock, DocBlockAttributes,
|
|
2
|
+
import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange } from './doc';
|
|
3
3
|
export type ContainerElement = HTMLDivElement & {
|
|
4
4
|
__neverUse: 'ContainerElement';
|
|
5
5
|
};
|
|
@@ -118,7 +118,6 @@ export interface Closeable {
|
|
|
118
118
|
click: (item: CommandItem, target: HTMLElement) => void;
|
|
119
119
|
}
|
|
120
120
|
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';
|
|
121
|
-
export type CommandItemMenuType = 'inline' | 'sibling';
|
|
122
121
|
export interface CommandItem {
|
|
123
122
|
id: string;
|
|
124
123
|
name: string;
|
|
@@ -148,14 +147,6 @@ export interface CommandItem {
|
|
|
148
147
|
hideGroupItem?: boolean;
|
|
149
148
|
setCloseable?: (closeable: Closeable) => void;
|
|
150
149
|
beforePopup?: (parent: unknown) => void;
|
|
151
|
-
/**
|
|
152
|
-
* defaults to true
|
|
153
|
-
*/
|
|
154
|
-
shouldShown?: (currentBlock: BlockElement | undefined, menuType: CommandItemMenuType) => boolean;
|
|
155
|
-
/**
|
|
156
|
-
* defaults to true
|
|
157
|
-
*/
|
|
158
|
-
clickToClose?: boolean;
|
|
159
150
|
}
|
|
160
151
|
export interface BlockCommandItem extends CommandItem {
|
|
161
152
|
blockId: string;
|
|
@@ -181,47 +172,10 @@ export interface BlockProperties {
|
|
|
181
172
|
blockCommands?: Record<string, BlockCommands>;
|
|
182
173
|
abstract?: string;
|
|
183
174
|
}
|
|
184
|
-
export interface DropHandler {
|
|
185
|
-
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
|
|
186
|
-
}
|
|
187
|
-
export interface CombineToCreateOptions {
|
|
188
|
-
/**
|
|
189
|
-
* @returns sideway: 两侧合并(左右 indicator)
|
|
190
|
-
*
|
|
191
|
-
* body: 中间合并(target block 激活)(暂未实现)
|
|
192
|
-
*/
|
|
193
|
-
combinable: (editor: OnesEditor, source: BlockElement, target: BlockElement) => undefined | 'sideway' | 'body';
|
|
194
|
-
onCombine: (editor: OnesEditor, source: BlockElement, target: BlockElement, position: CombineDropInsertPos['pos'], dragObject: DragObject | null, handlers: DropHandler[]) => BlockElement | undefined;
|
|
195
|
-
}
|
|
196
|
-
export type ContainerBlockOverrideInsertEmptyBlockInsideOptionsDict = Record<string, ContainerBlockOverrideInsertEmptyBlockInsideOptions>;
|
|
197
|
-
export type ContainerBlockOverrideInsertEmptyBlockInsideOptions = {
|
|
198
|
-
item?: CommandItem;
|
|
199
|
-
data?: Record<string, unknown>;
|
|
200
|
-
};
|
|
201
175
|
export interface BlockOptions {
|
|
202
176
|
name: string;
|
|
203
177
|
insertBlockCommandItems?: CommandItem[];
|
|
204
|
-
overrideInertEmptyBlockInsideOptions?: ContainerBlockOverrideInsertEmptyBlockInsideOptionsDict;
|
|
205
178
|
handleInsertEmptyBlock?: (editor: OnesEditor, options: InsertEmptyBlockOptions) => Promise<BlockElement | null>;
|
|
206
|
-
isMenuButtonBaseContainer?: (container: ContainerElement) => boolean;
|
|
207
|
-
combineToCreate?: CombineToCreateOptions;
|
|
208
|
-
/**
|
|
209
|
-
* defaults to true.
|
|
210
|
-
*
|
|
211
|
-
* 'without-margin': include margin for dragging preview computing.
|
|
212
|
-
*/
|
|
213
|
-
draggingPreview?: boolean | 'margin-included';
|
|
214
|
-
innerToc?: boolean;
|
|
215
|
-
blockMenu?: {
|
|
216
|
-
showComment?: boolean;
|
|
217
|
-
showLocker?: boolean;
|
|
218
|
-
};
|
|
219
|
-
findPreviewElement?: (editor: OnesEditor, complexBlock: BlockElement) => HTMLElement;
|
|
220
|
-
headingCollapsable?: boolean;
|
|
221
|
-
/**
|
|
222
|
-
* 拖拽时,是否显示缩略图容器自带的阴影,默认为 false
|
|
223
|
-
*/
|
|
224
|
-
previewNoShadow?: boolean;
|
|
225
179
|
}
|
|
226
180
|
export interface StandardDragObject {
|
|
227
181
|
type: 'block';
|
|
@@ -239,17 +193,10 @@ export interface CustomDragObject {
|
|
|
239
193
|
}
|
|
240
194
|
export type DragObject = StandardDragObject | CustomDragObject;
|
|
241
195
|
export interface CustomDropInsertPos {
|
|
242
|
-
type: 'custom';
|
|
243
196
|
rect: DOMRect;
|
|
244
197
|
data: unknown;
|
|
245
|
-
targetBlock?: BlockElement;
|
|
246
198
|
}
|
|
247
|
-
export type
|
|
248
|
-
type: 'combine';
|
|
249
|
-
pos: 'left' | 'right';
|
|
250
|
-
onCombine: CombineToCreateOptions['onCombine'];
|
|
251
|
-
};
|
|
252
|
-
export type DropInsertPos = 'before' | 'after' | CombineDropInsertPos | CustomDropInsertPos;
|
|
199
|
+
export type DropInsertPos = 'before' | 'after' | CustomDropInsertPos;
|
|
253
200
|
export interface DropOptions {
|
|
254
201
|
isSourceBlock: boolean;
|
|
255
202
|
targetBlock: BlockElement;
|
|
@@ -270,9 +217,9 @@ export interface Block {
|
|
|
270
217
|
handleBlockElementUpdated?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => void;
|
|
271
218
|
handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
|
|
272
219
|
handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
|
|
273
|
-
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock
|
|
220
|
+
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
|
|
274
221
|
handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | DataTransferItemList | null, x: number, y: number) => DropInsertPos | false | undefined;
|
|
275
|
-
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean |
|
|
222
|
+
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
|
|
276
223
|
getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
|
|
277
224
|
getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
|
|
278
225
|
convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
|
|
@@ -311,7 +258,6 @@ export interface ComplexKindBlock extends Block {
|
|
|
311
258
|
getTextToolbarReferenceClient?: (editor: OnesEditor, complexBlock: BlockElement) => DOMRect | undefined;
|
|
312
259
|
isChildContainerVisible?: (editor: OnesEditor, complexBlock: BlockElement, childContainer: ContainerElement) => boolean;
|
|
313
260
|
showChildContainer?: (editor: OnesEditor, complexBlock: BlockElement, childContainer: ContainerElement) => void;
|
|
314
|
-
beforeInsertDoc?: (editor: OnesEditor, container: ContainerElement, insertDoc: DocObject) => DocObject | undefined;
|
|
315
261
|
}
|
|
316
262
|
export interface SelectedBlock {
|
|
317
263
|
block: BlockElement;
|
|
@@ -500,7 +446,7 @@ export declare class OnesEditorCustomDataWrapper<T> {
|
|
|
500
446
|
getEditor(): OnesEditor;
|
|
501
447
|
destroy(): void;
|
|
502
448
|
}
|
|
503
|
-
export type OnesEditorCustomCreator
|
|
449
|
+
export type OnesEditorCustomCreator = (editor: OnesEditor) => OnesEditorCustom;
|
|
504
450
|
export interface CloneBlockResultInfo {
|
|
505
451
|
containerIdMap: Map<string, string>;
|
|
506
452
|
blockIdMap: Map<string, string>;
|
|
@@ -541,7 +487,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
541
487
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
542
488
|
version: string;
|
|
543
489
|
readonly: boolean;
|
|
544
|
-
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator
|
|
490
|
+
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
|
|
545
491
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
546
492
|
replaceCustom: <T extends OnesEditorCustom>(name: string, newCustom: T) => T;
|
|
547
493
|
findCustom: <T extends OnesEditorCustom>(name: string) => T | null;
|
|
@@ -622,7 +568,9 @@ export interface OnesEditorSelection {
|
|
|
622
568
|
setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
|
|
623
569
|
setRange: (range: SelectionRange, options?: ChangeSelectionOptions) => SelectionRange;
|
|
624
570
|
selectBlock: (block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions) => void;
|
|
625
|
-
updateSelection: (old: SelectionRange | null
|
|
571
|
+
updateSelection: (old: SelectionRange | null, options?: {
|
|
572
|
+
focusBlockChanged: boolean;
|
|
573
|
+
}) => void;
|
|
626
574
|
updateLastCaretRect: () => void;
|
|
627
575
|
getSuggestedCaretX: () => number | undefined;
|
|
628
576
|
getAnchorPos: () => BlockPosition;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import
|
|
2
|
+
import { TextBlockContentChild } from '../core/blocks/text-blocks/base/child';
|
|
3
3
|
import { BlockElement, OnesEditor, OnesEditorCustom } from '../core/types';
|
|
4
4
|
export interface OnesEditorHoveringBlockEvents {
|
|
5
5
|
change: (block: BlockElement | null, old: BlockElement | null, event: MouseEvent) => void;
|
|
6
|
-
targetChange: (block: BlockElement | null, old: BlockElement | null, target: EventTarget | null, oldTarget: EventTarget | null) => void;
|
|
7
6
|
childChange: (block: BlockElement | null, child: TextBlockContentChild | null, old: TextBlockContentChild | null, event: MouseEvent) => void;
|
|
8
7
|
}
|
|
9
8
|
export interface OnesEditorHoveringBlockFilter extends OnesEditorCustom {
|
|
@@ -15,7 +14,6 @@ export interface OnesEditorHoveringBlockFinder extends OnesEditorCustom {
|
|
|
15
14
|
export default class OnesEditorHoveringBlock extends TypedEmitter<OnesEditorHoveringBlockEvents> {
|
|
16
15
|
private editor;
|
|
17
16
|
private hoveringBlock;
|
|
18
|
-
private hoveringElem;
|
|
19
17
|
private hoveringTextChild;
|
|
20
18
|
private filters;
|
|
21
19
|
private finders;
|
|
@@ -14,7 +14,6 @@ declare const langs: {
|
|
|
14
14
|
};
|
|
15
15
|
common: {
|
|
16
16
|
cancel: string;
|
|
17
|
-
downloadAsImage: string;
|
|
18
17
|
};
|
|
19
18
|
docx: {
|
|
20
19
|
imageExportFailed: string;
|
|
@@ -34,7 +33,6 @@ declare const langs: {
|
|
|
34
33
|
};
|
|
35
34
|
common: {
|
|
36
35
|
cancel: string;
|
|
37
|
-
downloadAsImage: string;
|
|
38
36
|
};
|
|
39
37
|
docx: {
|
|
40
38
|
imageExportFailed: string;
|
|
@@ -54,7 +52,6 @@ declare const langs: {
|
|
|
54
52
|
};
|
|
55
53
|
common: {
|
|
56
54
|
cancel: string;
|
|
57
|
-
downloadAsImage: string;
|
|
58
55
|
};
|
|
59
56
|
docx: {
|
|
60
57
|
imageExportFailed: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockElement, DropInsertPos, OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
export declare const INDICATOR_SIZE = 2;
|
|
3
3
|
interface DropTarget {
|
|
4
4
|
block: BlockElement;
|
|
@@ -9,10 +9,9 @@ export default class DropIndicator {
|
|
|
9
9
|
private indicator;
|
|
10
10
|
target: DropTarget | null;
|
|
11
11
|
constructor(editor: OnesEditor);
|
|
12
|
-
createIndicator(): void;
|
|
13
12
|
show(block: BlockElement, insertPos: DropInsertPos): void;
|
|
14
13
|
hide(): void;
|
|
15
14
|
private getIndicatorRect;
|
|
16
|
-
getViewRect(block: BlockElement
|
|
15
|
+
getViewRect(block: BlockElement): DOMRect;
|
|
17
16
|
}
|
|
18
17
|
export {};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { BlockElement,
|
|
1
|
+
import { BlockElement, ContainerElement, OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
import DropIndicator from './drop-indicator';
|
|
3
3
|
export interface DropHandler {
|
|
4
4
|
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
|
|
5
5
|
}
|
|
6
|
-
export type DropTargetFinderId = keyof any;
|
|
7
|
-
export interface DropTargetFinder {
|
|
8
|
-
finder: (editor: OnesEditor, source: BlockElement | null, x: number, y: number) => BlockElement | null;
|
|
9
|
-
}
|
|
10
6
|
export default class OnesEditorDropTarget {
|
|
11
7
|
private editor;
|
|
12
8
|
indicator: DropIndicator;
|
|
@@ -16,12 +12,9 @@ export default class OnesEditorDropTarget {
|
|
|
16
12
|
dropEffect: 'move' | 'none';
|
|
17
13
|
} | undefined;
|
|
18
14
|
handlers: DropHandler[];
|
|
19
|
-
combineToCreate: CombineToCreateOptions[];
|
|
20
|
-
dropTargetFinders: Map<string | number | symbol, DropTargetFinder>;
|
|
21
15
|
constructor(editor: OnesEditor);
|
|
22
16
|
destroy(): void;
|
|
23
17
|
addHandler(handler: DropHandler): void;
|
|
24
|
-
addFinder(id: DropTargetFinderId, finder: DropTargetFinder): void;
|
|
25
18
|
static register(editor: OnesEditor): OnesEditorDropTarget;
|
|
26
19
|
static get(editor: OnesEditor): OnesEditorDropTarget;
|
|
27
20
|
static find(editor: OnesEditor): OnesEditorDropTarget | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../@ones-editor/core';
|
|
2
|
-
export declare function findTargetBlock(editor: OnesEditor, x
|
|
2
|
+
export declare function findTargetBlock(editor: OnesEditor, x: number, y: number): BlockElement | null;
|
|
3
3
|
export declare function canInsertAsSibling(editor: OnesEditor, block: BlockElement): boolean;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { INDICATOR_SIZE } from './drop-indicator';
|
|
2
1
|
import OnesEditorDropTarget from './drop-target';
|
|
3
2
|
import type { DropHandler } from './drop-target';
|
|
4
3
|
import { patchInsertFile } from './handlers/patch-insert-file';
|
|
5
|
-
export type { DropTargetFinder, DropTargetFinderId } from './drop-target';
|
|
6
4
|
export * from './drag-object';
|
|
7
|
-
export { OnesEditorDropTarget, DropHandler, patchInsertFile
|
|
5
|
+
export { OnesEditorDropTarget, DropHandler, patchInsertFile };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../@ones-editor/core';
|
|
2
2
|
import './locale';
|
|
3
3
|
export declare function handleFindReplace(editor: OnesEditor): boolean;
|
|
4
|
+
declare function handleReplaceAndFind(editor: OnesEditor): boolean;
|
|
4
5
|
declare const FindReplaceShortcuts: {
|
|
5
6
|
'CtrlOrCmd+F': typeof handleFindReplace;
|
|
7
|
+
'CtrlOrCmd+Shift+H': typeof handleReplaceAndFind;
|
|
6
8
|
};
|
|
7
9
|
export { FindReplaceShortcuts, };
|
|
@@ -8,7 +8,7 @@ export default abstract class GraphBase {
|
|
|
8
8
|
logger: Logger;
|
|
9
9
|
editing: boolean;
|
|
10
10
|
private graphEmbedContent;
|
|
11
|
-
private
|
|
11
|
+
private status;
|
|
12
12
|
constructor(editor: OnesEditor, graphType: GraphType, codeEmbedDataKey: string);
|
|
13
13
|
protected abstract code2ObjectUrl(code: string): Promise<string>;
|
|
14
14
|
protected abstract code2ResourceId(code: string): Promise<string>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BlockElement } from '../../../../@ones-editor/core';
|
|
2
1
|
import { StandardEmbedBlockCommands } from '../../../../@ones-editor/embed-block-helper';
|
|
3
|
-
import type { CommandItem, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { BlockElement, CommandItem, OnesEditor } from '../../../../@ones-editor/core';
|
|
4
3
|
import type { StandardEmbedBlockProperties } from '../../../../@ones-editor/embed-block-helper';
|
|
5
4
|
export type PresetCommandId = 'edit' | 'help';
|
|
6
5
|
export type GraphType = 'mermaid' | 'flowchart' | 'plantuml';
|
|
@@ -13,7 +12,6 @@ declare class GraphBlockCommands extends StandardEmbedBlockCommands<PresetComman
|
|
|
13
12
|
group: string;
|
|
14
13
|
_commands: CommandItem[];
|
|
15
14
|
constructor(editor: OnesEditor, block: BlockElement, graphType: GraphType, properties?: GraphEmbedBlockProperties | undefined);
|
|
16
|
-
get commands(): CommandItem[];
|
|
17
15
|
executeCommand(editor: OnesEditor, block: BlockElement, item: CommandItem): void;
|
|
18
16
|
}
|
|
19
17
|
export declare function getGraphEmbedBlockProperties(editor: OnesEditor, block: BlockElement, type: 'mermaid' | 'flowchart' | 'plantuml', properties?: GraphEmbedBlockProperties): {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { BlockElement
|
|
1
|
+
import { BlockElement } from '../../../../@ones-editor/core';
|
|
2
2
|
export declare function isTitleBlock(block: BlockElement): boolean;
|
|
3
|
-
export declare function canShowCollapseButtons(editor: OnesEditor, hoverBlock: BlockElement | null): boolean;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { BlockElement, DragObject, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
2
|
import { ImageDragInsertPos } from './types';
|
|
3
|
-
export declare function getDragInsertPos(editor: OnesEditor, block: BlockElement, images: HTMLElement[], x: number, y?: number):
|
|
3
|
+
export declare function getDragInsertPos(editor: OnesEditor, block: BlockElement, images: HTMLElement[], x: number, y?: number): {
|
|
4
|
+
rect: DOMRect;
|
|
5
|
+
data: number;
|
|
6
|
+
};
|
|
4
7
|
export declare function handleDropOver(editor: OnesEditor, block: BlockElement, dragObject: DragObject | DataTransferItemList | null, x: number, y: number): ImageDragInsertPos | undefined;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { BlockElement, DragObject, DropInsertPos, DropOptions, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
export declare function deleteImageFromBlock(editor: OnesEditor, block: BlockElement, index: number): void;
|
|
3
2
|
export declare function handleDrop(editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions): boolean | undefined;
|
|
@@ -10,9 +10,6 @@ export declare class ImageObject implements ImageObjectBase {
|
|
|
10
10
|
private resizing;
|
|
11
11
|
private parentContainerResizerObserver;
|
|
12
12
|
private autoFix;
|
|
13
|
-
focusTimes: number;
|
|
14
|
-
mouseStartX: number;
|
|
15
|
-
mouseStartY: number;
|
|
16
13
|
constructor(editor: OnesEditor, blockData: DocEmbedBlock);
|
|
17
14
|
destroy(): void;
|
|
18
15
|
setAutoFix(autoFix: boolean): void;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { Embed } from '../../../@ones-editor/core';
|
|
2
|
-
import { toImageEmbedData } from './image-data';
|
|
3
2
|
import { ImageObject } from './image-object';
|
|
4
3
|
import './image-embed-style.scss';
|
|
5
|
-
import { deleteImageFromBlock } from './drag-drop/handle-drop';
|
|
6
4
|
import './locale';
|
|
7
5
|
import { getImageContainersByBlock } from './image-dom/helper';
|
|
8
6
|
import EmptyImageConverterInputHandler from './empty-image-converter';
|
|
9
7
|
import { ImagePasteHandler } from './paste-handler';
|
|
10
|
-
import type { ImageDragObject } from './drag-drop/types';
|
|
11
|
-
import { updateImageBlockSize } from './image-size';
|
|
12
8
|
export * from './shortcuts';
|
|
13
9
|
export * from './types';
|
|
14
|
-
export { ImageObject, ImagePasteHandler, getImageContainersByBlock
|
|
10
|
+
export { ImageObject, ImagePasteHandler, getImageContainersByBlock };
|
|
15
11
|
declare const ImageEmbed: Embed;
|
|
16
12
|
export { ImageEmbed, EmptyImageConverterInputHandler };
|
|
@@ -12,6 +12,7 @@ declare class EnforceWithDocumentTitleHandler implements OnesEditorInputHandler
|
|
|
12
12
|
handleSelectionChange: (editor: OnesEditor) => void;
|
|
13
13
|
private reload;
|
|
14
14
|
private applyPlaceholder;
|
|
15
|
+
private removePlaceholder;
|
|
15
16
|
private isDocumentTitleBlock;
|
|
16
17
|
}
|
|
17
18
|
export default EnforceWithDocumentTitleHandler;
|
|
@@ -3,4 +3,5 @@ import { EnforceWithDocumentTitleHandlerOptions } from './types';
|
|
|
3
3
|
export declare function isEmptyTextBlockWithoutCompositionText(editor: OnesEditor, block: BlockElement): boolean;
|
|
4
4
|
export declare function removePlaceholderFromBlock(editor: OnesEditor, block: BlockElement): void;
|
|
5
5
|
export declare function applyPlaceholderToBlock(editor: OnesEditor, block: BlockElement, placeholder: string | Element): void;
|
|
6
|
+
export declare function removeAllPlaceholders(editor: OnesEditor): void;
|
|
6
7
|
export declare function applyPlaceholder(editor: OnesEditor, options: EnforceWithDocumentTitleHandlerOptions): void;
|