mirror of
https://github.com/codex-team/editor.js
synced 2024-05-06 08:33:20 +02:00
63eeec0f3b
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com> Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com> Co-authored-by: tasuku-s <tasuku@freemind.co.jp> Co-authored-by: Athul Anil Kumar <athul7744@outlook.com> Co-authored-by: Taly <vitalik7tv@yandex.ru> Co-authored-by: flaming-cl <51183663+flaming-cl@users.noreply.github.com> Co-authored-by: Nguyen Ngoc Son <sonnn.se@gmail.com> Co-authored-by: Sisir Das K <37764463+sis-dk@users.noreply.github.com> Co-authored-by: Sisir <sisir@hellosivi.com>
66 lines
1.3 KiB
TypeScript
66 lines
1.3 KiB
TypeScript
import {BlockToolData, ToolConfig} from '../tools';
|
|
import {SavedData} from '../../src/types-internal/block-data';
|
|
|
|
/**
|
|
* @interface BlockAPI Describes Block API methods and properties
|
|
*/
|
|
export interface BlockAPI {
|
|
/**
|
|
* Tool name
|
|
*/
|
|
readonly name: string;
|
|
|
|
/**
|
|
* Tool config passed on Editor's initialization
|
|
*/
|
|
readonly config: ToolConfig;
|
|
|
|
/**
|
|
* Wrapper of Tool's HTML element
|
|
*/
|
|
readonly holder: HTMLElement;
|
|
|
|
/**
|
|
* True if Block content is empty
|
|
*/
|
|
readonly isEmpty: boolean;
|
|
|
|
/**
|
|
* True if Block is selected with Cross-Block selection
|
|
*/
|
|
readonly selected: boolean;
|
|
|
|
/**
|
|
* Setter sets Block's stretch state
|
|
*
|
|
* Getter returns true if Block is stretched
|
|
*/
|
|
stretched: boolean;
|
|
|
|
/**
|
|
* Call Tool method with errors handler under-the-hood
|
|
*
|
|
* @param {string} methodName - method to call
|
|
* @param {object} param - object with parameters
|
|
*
|
|
* @return {void}
|
|
*/
|
|
call(methodName: string, param?: object): void;
|
|
|
|
/**
|
|
* Save Block content
|
|
*
|
|
* @return {Promise<void|SavedData>}
|
|
*/
|
|
save(): Promise<void|SavedData>;
|
|
|
|
/**
|
|
* Validate Block data
|
|
*
|
|
* @param {BlockToolData} data
|
|
*
|
|
* @return {Promise<boolean>}
|
|
*/
|
|
validate(data: BlockToolData): Promise<boolean>;
|
|
}
|