@editorjs/editorjs
Advanced tools
Comparing version 2.30.0-rc.12 to 2.30.0-rc.13
{ | ||
"name": "@editorjs/editorjs", | ||
"version": "2.30.0-rc.12", | ||
"version": "2.30.0-rc.13", | ||
"description": "Editor.js — Native JS, based on API and Open Source", | ||
@@ -5,0 +5,0 @@ "main": "dist/editorjs.umd.js", |
@@ -1,2 +0,2 @@ | ||
import {BlockToolData, ToolConfig} from '../tools'; | ||
import {BlockToolData, ToolConfig, ToolboxConfigEntry} from '../tools'; | ||
import {SavedData} from '../data-formats'; | ||
@@ -81,2 +81,8 @@ | ||
dispatchChange(): void; | ||
/** | ||
* Tool could specify several entries to be displayed at the Toolbox (for example, "Heading 1", "Heading 2", "Heading 3") | ||
* This method returns the entry that is related to the Block (depended on the Block data) | ||
*/ | ||
getActiveToolboxEntry(): Promise<ToolboxConfigEntry | undefined> | ||
} |
@@ -0,1 +1,2 @@ | ||
import Block from '../../src/components/block'; | ||
import {OutputBlockData, OutputData} from '../data-formats/output-data'; | ||
@@ -75,2 +76,9 @@ import {BlockToolData, ToolConfig} from '../tools'; | ||
/** | ||
* Get Block API object by html element | ||
* | ||
* @param element - html element to get Block by | ||
*/ | ||
getBlockByElement(element: HTMLElement): BlockAPI | undefined; | ||
/** | ||
* Mark Block as stretched | ||
@@ -77,0 +85,0 @@ * @param {number} index - Block to mark |
@@ -17,1 +17,2 @@ export * from './blocks'; | ||
export * from './ui'; | ||
export * from './tools'; |
@@ -18,2 +18,25 @@ /** | ||
expandToTag(node: HTMLElement): void; | ||
/** | ||
* Sets fake background. | ||
* Allows to immitate selection while focus moved away | ||
*/ | ||
setFakeBackground(): void; | ||
/** | ||
* Removes fake background | ||
*/ | ||
removeFakeBackground(): void; | ||
/** | ||
* Save selection range. | ||
* Allows to save selection to be able to temporally move focus away. | ||
* Might be usefull for inline tools | ||
*/ | ||
save(): void; | ||
/** | ||
* Restore saved selection range | ||
*/ | ||
restore(): void; | ||
} |
import {API, BlockAPI, SanitizerConfig, ToolConfig} from '../index'; | ||
import { BlockTuneData } from './block-tune-data'; | ||
import { TunesMenuConfig } from '../tools'; | ||
import { MenuConfig } from '../tools'; | ||
@@ -10,5 +10,6 @@ /** | ||
/** | ||
* Returns block tune HTMLElement | ||
* Returns BlockTune's UI. | ||
* Either HTMLELement (@deprecated) or MenuConfig (@see https://editorjs.io/menu-config/) | ||
*/ | ||
render(): HTMLElement | TunesMenuConfig; | ||
render(): HTMLElement | MenuConfig; | ||
@@ -15,0 +16,0 @@ /** |
@@ -31,2 +31,3 @@ /** | ||
Ui, | ||
Tools, | ||
} from './api'; | ||
@@ -86,4 +87,2 @@ | ||
PopoverItemDefaultParams, | ||
PopoverItemWithConfirmationParams, | ||
PopoverItemWithoutConfirmationParams | ||
} from '../src/components/utils/popover'; | ||
@@ -115,2 +114,3 @@ | ||
caret: Caret; | ||
tools: Tools; | ||
events: Events; | ||
@@ -117,0 +117,0 @@ listeners: Listeners; |
@@ -8,3 +8,3 @@ import { ConversionConfig, PasteConfig, SanitizerConfig } from '../configs'; | ||
import { MoveEvent } from './hook-events'; | ||
import { TunesMenuConfig } from './tool-settings'; | ||
import { MenuConfig } from './menu-config'; | ||
@@ -31,3 +31,3 @@ /** | ||
*/ | ||
renderSettings?(): HTMLElement | TunesMenuConfig; | ||
renderSettings?(): HTMLElement | MenuConfig; | ||
@@ -34,0 +34,0 @@ /** |
@@ -13,4 +13,5 @@ import { BlockTool, BlockToolConstructable } from './block-tool'; | ||
export * from './hook-events'; | ||
export * from './menu-config'; | ||
export type Tool = BlockTool | InlineTool | BlockTune; | ||
export type ToolConstructable = BlockToolConstructable | InlineToolConstructable | BlockTuneConstructable; |
import {BaseTool, BaseToolConstructable} from './tool'; | ||
import {API, ToolConfig} from '../index'; | ||
import { MenuConfig } from './menu-config'; | ||
/** | ||
* Base structure for the Inline Toolbar Tool | ||
*/ | ||
export interface InlineTool extends BaseTool { | ||
export interface InlineTool extends BaseTool<HTMLElement | MenuConfig> { | ||
/** | ||
@@ -16,4 +17,5 @@ * Shortcut for Tool | ||
* @param {Range} range - selection's range | ||
* @deprecated use {@link MenuConfig} item onActivate property instead | ||
*/ | ||
surround(range: Range): void; | ||
surround?(range: Range): void; | ||
@@ -24,4 +26,5 @@ /** | ||
* @param {Selection} selection - current Selection | ||
* @deprecated use {@link MenuConfig} item isActive property instead | ||
*/ | ||
checkState(selection: Selection): boolean; | ||
checkState?(selection: Selection): boolean; | ||
@@ -31,2 +34,3 @@ /** | ||
* For example, input for the 'link' tool or textarea for the 'comment' tool | ||
* @deprecated use {@link MenuConfig} item children to set item actions instead | ||
*/ | ||
@@ -33,0 +37,0 @@ renderActions?(): HTMLElement; |
import { ToolConfig } from './tool-config'; | ||
import { ToolConstructable, BlockToolData } from './index'; | ||
import { PopoverItemDefaultParams, PopoverItemSeparatorParams, PopoverItemHtmlParams } from '../configs'; | ||
import { ToolConstructable, BlockToolData, MenuConfig, MenuConfigItem } from './index'; | ||
@@ -32,47 +31,2 @@ /** | ||
/** | ||
* Represents single interactive (non-separator) Tunes Menu item | ||
*/ | ||
export type TunesMenuConfigDefaultItem = PopoverItemDefaultParams & { | ||
/** | ||
* Tune displayed text. | ||
*/ | ||
title?: string; | ||
/** | ||
* Tune displayed text. | ||
* Alias for title property | ||
* | ||
* @deprecated - use title property instead | ||
*/ | ||
label?: string | ||
/** | ||
* Menu item parameters that should be applied on item activation. | ||
* May be used to ask user for confirmation before executing menu item activation handler. | ||
*/ | ||
confirmation?: TunesMenuConfigDefaultItem; | ||
} | ||
/** | ||
* Represents single separator Tunes Menu item | ||
*/ | ||
export type TunesMenuConfigSeparatorItem = PopoverItemSeparatorParams; | ||
/** | ||
* Represents single Tunes Menu item with custom HTML contect | ||
*/ | ||
export type TunesMenuConfigHtmlItem = PopoverItemHtmlParams; | ||
/** | ||
* Union of all Tunes Menu item types | ||
*/ | ||
export type TunesMenuConfigItem = TunesMenuConfigDefaultItem | TunesMenuConfigSeparatorItem | TunesMenuConfigHtmlItem; | ||
/** | ||
* Tool may specify its tunes configuration | ||
* that can contain either one or multiple entries | ||
*/ | ||
export type TunesMenuConfig = TunesMenuConfigItem | TunesMenuConfigItem[]; | ||
/** | ||
* Object passed to the Tool's constructor by {@link EditorConfig#tools} | ||
@@ -119,2 +73,14 @@ * | ||
/** | ||
* Tool's tunes configuration. | ||
* @deprecated use {@link MenuConfig} type instead | ||
*/ | ||
export type TunesMenuConfig = MenuConfig; | ||
/** | ||
* Single Tunes Menu Config item | ||
* @deprecated use {@link MenuConfigItem} type instead | ||
*/ | ||
export type TunesMenuConfigItem = MenuConfigItem; | ||
/** | ||
* For internal Tools 'class' property is optional | ||
@@ -121,0 +87,0 @@ */ |
import {API} from '../index'; | ||
import {ToolConfig} from './tool-config'; | ||
import {SanitizerConfig} from '../configs'; | ||
import {MenuConfig} from './menu-config'; | ||
@@ -8,9 +9,12 @@ /** | ||
*/ | ||
export interface BaseTool { | ||
export interface BaseTool<RenderReturnType = HTMLElement> { | ||
/** | ||
* Tool`s render method | ||
* For inline Tools returns inline toolbar button | ||
* For block Tools returns tool`s wrapper | ||
* | ||
* For Inline Tools may return either HTMLElement (deprecated) or {@link MenuConfig} | ||
* @see https://editorjs.io/menu-config | ||
* | ||
* For Block Tools returns tool`s wrapper html element | ||
*/ | ||
render(): HTMLElement; | ||
render(): RenderReturnType | Promise<RenderReturnType>; | ||
} | ||
@@ -30,3 +34,4 @@ | ||
/** | ||
* Title of Inline Tool | ||
* Title of Inline Tool. | ||
* @deprecated use {@link MenuConfig} item title instead | ||
*/ | ||
@@ -33,0 +38,0 @@ title?: string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
57
12864
661169