@ones-editor/editor 2.0.4-beta.7 → 2.0.4-beta.8
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/core/src/core/containers/children.d.ts +5 -2
- package/@ones-editor/core/src/core/editor-doc/handle-block-data-changed.d.ts +2 -1
- package/@ones-editor/core/src/core/types.d.ts +6 -3
- package/@ones-editor/layout-block/src/toolbar.d.ts +1 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +94 -94
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { BlockElement, ContainerElement } from '../types';
|
|
2
|
-
export declare function getChildBlocks(container: ContainerElement
|
|
1
|
+
import { BlockElement, ContainerElement, OnesEditor } from '../types';
|
|
2
|
+
export declare function getChildBlocks(container: ContainerElement, traverseChild?: {
|
|
3
|
+
condition: (block: BlockElement) => boolean;
|
|
4
|
+
editor: OnesEditor;
|
|
5
|
+
}): BlockElement[];
|
|
3
6
|
export declare function getFirstChildBlock(container: ContainerElement): BlockElement;
|
|
4
7
|
export declare function getLastChildBlock(container: ContainerElement): BlockElement;
|
|
5
8
|
export declare function getChildBlockCount(container: ContainerElement): number;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { DocBlockDelta } from '../doc';
|
|
1
2
|
import { OnesEditor } from '../types';
|
|
2
|
-
export declare function onBlockDataChanged(editor: OnesEditor, containerId: string, blockIndex: number): void;
|
|
3
|
+
export declare function onBlockDataChanged(editor: OnesEditor, containerId: string, blockIndex: number, delta?: DocBlockDelta): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange } from './doc';
|
|
2
|
+
import { DocBlock, DocBlockAttributes, DocBlockDelta, 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
|
};
|
|
@@ -177,6 +177,9 @@ export interface BlockProperties {
|
|
|
177
177
|
blockCommands?: Record<string, BlockCommands>;
|
|
178
178
|
abstract?: string;
|
|
179
179
|
}
|
|
180
|
+
export interface DropHandler {
|
|
181
|
+
handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
|
|
182
|
+
}
|
|
180
183
|
export interface CombineToCreateOptions {
|
|
181
184
|
/**
|
|
182
185
|
* @returns sideway: 两侧合并(左右 indicator)
|
|
@@ -184,7 +187,7 @@ export interface CombineToCreateOptions {
|
|
|
184
187
|
* body: 中间合并(target block 激活)(暂未实现)
|
|
185
188
|
*/
|
|
186
189
|
combinable: (editor: OnesEditor, source: BlockElement, target: BlockElement) => undefined | 'sideway' | 'body';
|
|
187
|
-
onCombine: (editor: OnesEditor, source: BlockElement, target: BlockElement, position: CombineDropInsertPos['pos'], dragObject: DragObject | null) => BlockElement | undefined;
|
|
190
|
+
onCombine: (editor: OnesEditor, source: BlockElement, target: BlockElement, position: CombineDropInsertPos['pos'], dragObject: DragObject | null, handlers: DropHandler[]) => BlockElement | undefined;
|
|
188
191
|
}
|
|
189
192
|
export type ContainerBlockOverrideInsertEmptyBlockInsideOptionsDict = Record<string, ContainerBlockOverrideInsertEmptyBlockInsideOptions>;
|
|
190
193
|
export type ContainerBlockOverrideInsertEmptyBlockInsideOptions = {
|
|
@@ -263,7 +266,7 @@ export interface Block {
|
|
|
263
266
|
handleBlockElementUpdated?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => void;
|
|
264
267
|
handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
|
|
265
268
|
handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
|
|
266
|
-
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
|
|
269
|
+
handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock, delta?: DocBlockDelta) => boolean;
|
|
267
270
|
handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | DataTransferItemList | null, x: number, y: number) => DropInsertPos | false | undefined;
|
|
268
271
|
handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | ContainerElement | undefined;
|
|
269
272
|
getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnesEditor, BlockElement, AutoScroll, OnesEditorCustom, ContainerElement } from '../../../@ones-editor/core';
|
|
2
2
|
import { Instance } from 'tippy.js';
|
|
3
|
-
export declare function createSeparatorContainer(editor: OnesEditor,
|
|
3
|
+
export declare function createSeparatorContainer(editor: OnesEditor, blockElement: BlockElement, index: number): HTMLDivElement;
|
|
4
4
|
export declare function createActionBar(editor: OnesEditor, containerID: string, _blockElement: BlockElement, columnRemovable?: boolean): {
|
|
5
5
|
actionBarContainer: HTMLDivElement;
|
|
6
6
|
tippyInstance?: undefined;
|