editor.js/types/tools/inline-tool.d.ts
George Berezhnoy b223d63c59
Revert "Release: 2.19 (#1341)" (#1363)
This reverts commit 78775703c9.
2020-10-13 00:03:00 +03:00

55 lines
1.3 KiB
TypeScript

import {BaseTool, BaseToolConstructable} from './tool';
import {API, ToolConfig} from "../index";
/**
* Base structure for the Inline Toolbar Tool
*/
export interface InlineTool extends BaseTool {
/**
* Shortcut for Tool
* @type {string}
*/
shortcut?: string;
/**
* Method that accepts selected range and wrap it somehow
* @param {Range} range - selection's range
*/
surround(range: Range): void;
/**
* Get SelectionUtils and detect if Tool was applied
* For example, after that Tool can highlight button or show some details
* @param {Selection} selection - current Selection
*/
checkState(selection: Selection): boolean;
/**
* Make additional element with actions
* For example, input for the 'link' tool or textarea for the 'comment' tool
*/
renderActions?(): HTMLElement;
/**
* Function called with Inline Toolbar closing
*/
clear?(): void;
}
/**
* Describe constructor parameters
*/
export interface InlineToolConstructorOptions {
api: API;
config?: ToolConfig;
}
export interface InlineToolConstructable extends BaseToolConstructable {
/**
* Constructor
*
* @param {InlineToolConstructorOptions} config - constructor parameters
*/
new(config: InlineToolConstructorOptions): BaseTool;
}