@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
49 lines • 1.44 kB
TypeScript
import type { SlateElement, YooEditor, YooptaPathIndex } from '../types';
export type DuplicateBlockOptions = {
/**
* Block to duplicate (by path or id)
* @default editor.path.current
*/
at?: YooptaPathIndex;
blockId?: string;
/**
* Position to insert duplicate
* If not provided, inserts after original block
* @default original.meta.order + 1
*/
insertAt?: YooptaPathIndex;
/**
* Focus after duplicate
* @default true
*/
focus?: boolean;
/**
* Custom element structure for duplicate
* If provided, overrides default duplication
*/
elements?: SlateElement;
};
/**
* Duplicate a block
*
* @param editor - YooEditor instance
* @param options - Duplicate options
* @returns ID of the newly created block
*
* @example
* ```typescript
* // Duplicate current block
* const newId = editor.duplicateBlock();
*
* // Duplicate specific block by path
* const newId = editor.duplicateBlock({ at: 3 });
*
* // Duplicate specific block by id
* const newId = editor.duplicateBlock({ blockId: 'block-123' });
*
* // Duplicate and insert at specific position
* const newId = editor.duplicateBlock({ at: 3, insertAt: 0 });
* ```
*/
export declare function duplicateBlock(editor: YooEditor, options?: DuplicateBlockOptions): string | undefined;
//# sourceMappingURL=duplicateBlock.d.ts.map