@yoopta/editor
Version:
<h2 align="center">Yoopta-Editor v1 🎉</h2> <p align="center">Yoopta-Editor - is an open source notion-like editor 💥</p> <div align="center"> <img width="574" alt="Screen Shot 2023-01-25 at 16 04 29" src="https://user-images.githubusercontent.com/2909311
55 lines • 1.58 kB
TypeScript
import type { Location } from 'slate';
import type { YooEditor, YooptaPathIndex } from '../types';
export type SplitBlockOptions = {
/**
* Block to split
* @default editor.path.current
*/
at?: YooptaPathIndex;
blockId?: string;
/**
* Split position (selection point)
* If not provided, uses current selection
* @default slate.selection
*/
splitAt?: Location;
/**
* Focus after split
* @default true
*/
focus?: boolean;
/**
* Focus target after split
* - 'new': focus the new block (default)
* - 'original': focus the original block
* - 'none': don't focus anything
* @default 'new'
*/
focusTarget?: 'new' | 'original' | 'none';
/**
* Preserve content in both blocks
* @default true
*/
preserveContent?: boolean;
};
/**
* Split a block at the selection point or specified position
*
* @param editor - YooEditor instance
* @param options - Split options
* @returns ID of the newly created block, or undefined if split failed
*
* @example
* ```typescript
* // Split current block at selection
* const newBlockId = editor.splitBlock();
*
* // Split specific block
* const newBlockId = editor.splitBlock({ at: 3 });
*
* // Split and focus original block
* const newBlockId = editor.splitBlock({ focusTarget: 'original' });
* ```
*/
export declare function splitBlock(editor: YooEditor, options?: SplitBlockOptions): string | undefined;
//# sourceMappingURL=splitBlock.d.ts.map