2019-03-27 13:46:42 +01:00
|
|
|
import {API, ToolSettings} from '../index';
|
2018-11-23 17:11:50 +01:00
|
|
|
import {ToolConfig} from './tool-config';
|
|
|
|
import {SanitizerConfig} from '../configs';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract interface of all Tools
|
|
|
|
*/
|
2019-01-25 04:21:34 +01:00
|
|
|
export interface BaseTool {
|
2018-11-23 17:11:50 +01:00
|
|
|
/**
|
|
|
|
* Tool`s render method
|
|
|
|
* For inline Tools returns inline toolbar button
|
|
|
|
* For block Tools returns tool`s wrapper
|
|
|
|
*/
|
|
|
|
render(): HTMLElement;
|
|
|
|
}
|
|
|
|
|
2019-01-25 04:21:34 +01:00
|
|
|
export interface BaseToolConstructable {
|
2018-11-23 17:11:50 +01:00
|
|
|
/**
|
|
|
|
* Define Tool type as Inline
|
|
|
|
*/
|
|
|
|
isInline?: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tool`s sanitizer configuration
|
|
|
|
*/
|
|
|
|
sanitize?: SanitizerConfig;
|
|
|
|
|
2019-11-30 21:42:39 +01:00
|
|
|
/**
|
|
|
|
* Title of Inline Tool
|
|
|
|
*/
|
|
|
|
title?: string;
|
|
|
|
|
2018-11-23 17:11:50 +01:00
|
|
|
/**
|
|
|
|
* Describe constructor parameters
|
|
|
|
*/
|
2019-03-27 13:46:42 +01:00
|
|
|
new (config: {api: API, config?: ToolSettings}): BaseTool;
|
2018-11-23 17:11:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tool`s prepare method. Can be async
|
|
|
|
* @param data
|
|
|
|
*/
|
|
|
|
prepare?(data: {toolName: string, config: ToolConfig}): void | Promise<void>;
|
|
|
|
}
|