mirror of
https://github.com/codex-team/editor.js
synced 2024-05-16 21:36:48 +02:00
6f36707f67
* Add tunes improvements * Allow to show Inline Toolbar at Block Tune Wrapper element * Add fake cursor on block selection * Fix lint * Update types * Fix bugs with selection * Remove selection observer * Update due to comments * Fix tests * Update docs/block-tunes.md Co-authored-by: Peter Savchenko <specc.dev@gmail.com> * Move fake cursor to selection utils * Fix missing range for Safari * Fix data attribute value * Add comment * Update z-index for inline-toolbar * Add changelog * Remove fake cursor visibility for the core Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
72 lines
1.4 KiB
TypeScript
72 lines
1.4 KiB
TypeScript
import {API, BlockAPI, SanitizerConfig, ToolConfig} from '../index';
|
|
import { BlockTuneData } from './block-tune-data';
|
|
|
|
/**
|
|
* Describes BLockTune blueprint
|
|
*/
|
|
export interface BlockTune {
|
|
/**
|
|
* Returns block tune HTMLElement
|
|
*
|
|
* @return {HTMLElement}
|
|
*/
|
|
render(): HTMLElement;
|
|
|
|
/**
|
|
* Method called on Tool render. Pass Tool content as an argument.
|
|
*
|
|
* You can wrap Tool's content with any wrapper you want to provide Tune's UI
|
|
*
|
|
* @param {HTMLElement} pluginsContent — Tool's content wrapper
|
|
*
|
|
* @return {HTMLElement}
|
|
*/
|
|
wrap?(pluginsContent: HTMLElement): HTMLElement;
|
|
|
|
/**
|
|
* Called on Tool's saving. Should return any data Tune needs to save
|
|
*
|
|
* @return {BlockTuneData}
|
|
*/
|
|
save?(): BlockTuneData;
|
|
}
|
|
|
|
/**
|
|
* Describes BlockTune class constructor function
|
|
*/
|
|
export interface BlockTuneConstructable {
|
|
|
|
/**
|
|
* Flag show Tool is Block Tune
|
|
*/
|
|
isTune: boolean;
|
|
|
|
/**
|
|
* Tune's sanitize configuration
|
|
*/
|
|
sanitize?: SanitizerConfig;
|
|
|
|
/**
|
|
* @constructor
|
|
*
|
|
* @param config - Block Tune config
|
|
*/
|
|
new(config: {
|
|
api: API,
|
|
config?: ToolConfig,
|
|
block: BlockAPI,
|
|
data: BlockTuneData,
|
|
}): BlockTune;
|
|
|
|
/**
|
|
* Tune`s prepare method. Can be async
|
|
* @param data
|
|
*/
|
|
prepare?(): Promise<void> | void;
|
|
|
|
/**
|
|
* Tune`s reset method to clean up anything set by prepare. Can be async
|
|
*/
|
|
reset?(): void | Promise<void>;
|
|
}
|