@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
70 lines • 1.84 kB
TypeScript
import type { YooEditor } from '../types';
import type { UpdateElementOptions } from './types';
/**
* Update element properties
*
* @param editor - YooEditor instance
* @param options - Update options
*
* @example Update block element by path
* ```typescript
* editor.updateElement({
* blockId: 'accordion-1',
* type: 'accordion-list-item',
* path: [0, 1],
* props: { isExpanded: false }
* });
* ```
*
* @example Update block element by type
* ```typescript
* editor.updateElement({
* blockId: 'accordion-1',
* type: 'accordion-list-item',
* props: { isExpanded: false }
* });
* ```
*
* @example Update inline element (link)
* ```typescript
* // Update link at current selection
* editor.updateElement({
* blockId: 'paragraph-1',
* type: 'link',
* props: { url: 'https://new-url.com', target: '_self' }
* });
* ```
*
* @example Update inline element text and props
* ```typescript
* // Update both link URL and displayed text
* editor.updateElement({
* blockId: 'paragraph-1',
* type: 'link',
* props: { url: 'https://example.com' },
* text: 'New link text'
* });
* ```
*
* @example Update with custom matcher
* ```typescript
* editor.updateElement({
* blockId: 'accordion-1',
* type: 'accordion-list-item',
* match: (element) => element.props?.id === 'item-5',
* props: { isExpanded: true }
* });
* ```
*
* @example Update mention user name
* ```typescript
* editor.updateElement({
* blockId: 'paragraph-1',
* type: 'mention',
* props: { userName: 'Jane Doe' },
* text: '@Jane Doe' // Update displayed text too
* });
* ```
*/
export declare function updateElement(editor: YooEditor, options: UpdateElementOptions): void;
//# sourceMappingURL=updateElement.d.ts.map