@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
48 lines • 1.29 kB
TypeScript
import type { YooEditor, YooptaPathIndex } from '../types';
export type DeleteBlockOptions = {
/**
* Block to delete (by path or id)
* @default editor.path.current
*/
at?: YooptaPathIndex;
blockId?: string;
/**
* Focus after delete
* @default true
*/
focus?: boolean;
/**
* Focus target after delete
* - 'previous': focus previous block (default)
* - 'next': focus next block
* - 'none': don't focus anything
* @default 'previous'
*/
focusTarget?: 'previous' | 'next' | 'none';
};
/**
* Delete a block
*
* @param editor - YooEditor instance
* @param options - Delete options
*
* @example
* ```typescript
* // Delete current block
* editor.deleteBlock();
*
* // Delete specific block by path
* editor.deleteBlock({ at: 3 });
*
* // Delete specific block by id
* editor.deleteBlock({ blockId: 'block-123' });
*
* // Delete without focusing
* editor.deleteBlock({ at: 3, focus: false });
*
* // Delete and focus next block instead of previous
* editor.deleteBlock({ at: 3, focusTarget: 'next' });
* ```
*/
export declare function deleteBlock(editor: YooEditor, options?: DeleteBlockOptions): void;
//# sourceMappingURL=deleteBlock.d.ts.map