mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 10:50:23 +02:00
2d89105670
* Add internal wrappers for tools classes * FIx lint * Change tools collections to map * Apply some more refactoring * Make tool instance private field * Add some docs * Fix eslint * Basic implementation for Block Tunes * Small fix for demo * Review changes * Fix * Add common tunes and ToolsCollection class * Fixes after review * Rename tools collections * Readonly fix * Some fixes after review * Apply suggestions from code review Co-authored-by: Peter Savchenko <specc.dev@gmail.com> * Fixes after review * Add docs and changelog * Update docs/block-tunes.md Co-authored-by: Peter Savchenko <specc.dev@gmail.com> * Apply suggestions from code review Co-authored-by: Peter Savchenko <specc.dev@gmail.com> * Update src/components/block/index.ts Co-authored-by: Murod Khaydarov <murod.haydarov@gmail.com> * [Dev] Tools utils tests (#1602) * Add tests for tools utils and coverage report * Fix eslint * Adjust test * Add more tests * Update after code review * Fix test & bump version Co-authored-by: Peter Savchenko <specc.dev@gmail.com> Co-authored-by: Murod Khaydarov <murod.haydarov@gmail.com>
59 lines
1.2 KiB
TypeScript
59 lines
1.2 KiB
TypeScript
import {ToolConfig} from './tool-config';
|
|
import {ToolConstructable} from './index';
|
|
|
|
/**
|
|
* Tool's Toolbox settings
|
|
*/
|
|
export interface ToolboxConfig {
|
|
/**
|
|
* Tool title for Toolbox
|
|
*/
|
|
title?: string;
|
|
|
|
/**
|
|
* HTML string with an icon for Toolbox
|
|
*/
|
|
icon?: string;
|
|
}
|
|
|
|
/**
|
|
* Object passed to the Tool's constructor by {@link EditorConfig#tools}
|
|
*
|
|
* @template Config - the structure describing a config object supported by the tool
|
|
*/
|
|
export interface ToolSettings <Config extends object = any> {
|
|
|
|
/**
|
|
* Tool's class
|
|
*/
|
|
class: ToolConstructable;
|
|
|
|
/**
|
|
* User configuration object that will be passed to the Tool's constructor
|
|
*/
|
|
config?: ToolConfig<Config>;
|
|
|
|
/**
|
|
* Is need to show Inline Toolbar.
|
|
* Can accept array of Tools for InlineToolbar or boolean.
|
|
*/
|
|
inlineToolbar?: boolean | string[];
|
|
|
|
/**
|
|
* BlockTunes for Tool
|
|
* Can accept array of tune names or boolean.
|
|
*/
|
|
tunes?: boolean | string[];
|
|
|
|
/**
|
|
* Define shortcut that will render Tool
|
|
*/
|
|
shortcut?: string;
|
|
|
|
/**
|
|
* Tool's Toolbox settings
|
|
* It will be hidden from Toolbox when false is specified.
|
|
*/
|
|
toolbox?: ToolboxConfig | false;
|
|
}
|