editor.js/types/index.d.ts
Tatiana Fomina 581289c03e
Block tunes as a popover (#2091)
* Default tunes to popover

* Add the rest of default tunes

* Add popover

* Cleanup

* Rename custom content

* Cleanup

* Add ability to open block settings upwards

* Fix tests

* Cleanup default tunes

* Rename and cleanup

* Add ability to display rendered custom tunes

* cleanup

* Rename

* Add flag to close tunes popover

* Cleanup

* i18n

* Cleanup

* Fix build and tests

* Fix for iframe

* Add comments

* Display active item, move closeOnActivate to popover

* Add confirmation support to popover

* Handle boolean value in confirmation param

* Clarify flippable logic in popover

* Comments

* Pass editor element as a param of popover constructor

* Fix readability

* Tests

* Fix flipper for confirmation element

* Update confirmation config structure

* Rename onClick to onActivate

* Fix tests and build

* Make confirmation props optional

* Simplify processing tunes

* Renamings

* Fix text block tunes

* Docs

* Update event type

* Move enabling confirmation state to separate method

* move popover types

* Unhardcode color

* Support toggling

* Add support of disabled items

* Fix tab in empty block leading to selecting second item in popover

* Remove margins for styles api settings button class

* Fix arrow navigation between blocks after opening block tunes

* Cleaup in default tunes code

* Fix chaining confirmations

* Colors

* Types

* Change the way flippable elements of popover custom area are set

* Remove borders around popover icons

* Fix untabbable inline toolbar

* Fix locked scroll after closing tunes popover on mobile

* Cleanup

* Set max popover width

* Make popover icon's border outside

* Fix tab issue

* Fix focus/hover issue

* Reformat

* Cleanup

* Fix opening block tunes via keyboard

* Add disableSpecialHoverAndFocusBehavior

* Add deprecated comment

* Cleanup

* Fix popover active state

* Fix checklist deletion with confirmation

* Fix checklist deletion 2

* Fix popover focus

* Fix popover items being impossible to flip after searching

* Fix popover item highlighting issue

* Update flipper.spec.ts

* Fixes after review

* Add Tunes Api tests

* Fix multiple popover entries configured by one tune

* Add tool's renderSettings() tests

* Add popover confirmation state test

* Fix popover width on mobile

* Add popover tests

* Add changelog and update version

* Update changelog

* Fix block tunes being unable to open after tune activation

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2022-11-03 20:52:33 +03:00

169 lines
3.1 KiB
TypeScript

/**
* For export type there should be one entry point,
* so we export all types from this file
* ------------------------------------
*/
import {
Dictionary,
DictValue,
EditorConfig,
I18nConfig,
I18nDictionary,
} from './configs';
import {
Blocks,
Caret,
Events,
InlineToolbar,
Listeners,
Notifier,
ReadOnly,
Sanitizer,
Saver,
Selection,
Styles,
Toolbar,
Tooltip,
I18n,
Ui,
} from './api';
import { OutputData } from './data-formats';
/**
* Interfaces used for development
*/
export {
BaseTool,
BaseToolConstructable,
InlineTool,
InlineToolConstructable,
InlineToolConstructorOptions,
BlockToolConstructable,
BlockToolConstructorOptions,
BlockTool,
BlockToolData,
Tool,
ToolConstructable,
ToolboxConfig,
ToolboxConfigEntry,
ToolSettings,
ToolConfig,
PasteEvent,
PasteEventDetail,
PatternPasteEvent,
PatternPasteEventDetail,
HTMLPasteEvent,
HTMLPasteEventDetail,
FilePasteEvent,
FilePasteEventDetail,
} from './tools';
export {BlockTune, BlockTuneConstructable} from './block-tunes';
export {
EditorConfig,
SanitizerConfig,
PasteConfig,
LogLevels,
ConversionConfig,
I18nDictionary,
Dictionary,
DictValue,
I18nConfig,
PopoverItem,
PopoverItemWithConfirmation,
PopoverItemWithoutConfirmation
} from './configs';
export {OutputData, OutputBlockData} from './data-formats/output-data';
export { BlockAPI } from './api'
/**
* We have a namespace API {@link ./api/index.d.ts} (APIMethods) but we can not use it as interface
* So we should create new interface for exporting API type
*/
export interface API {
blocks: Blocks;
caret: Caret;
events: Events;
listeners: Listeners;
notifier: Notifier;
sanitizer: Sanitizer;
saver: Saver;
selection: Selection;
styles: Styles;
toolbar: Toolbar;
inlineToolbar: InlineToolbar;
tooltip: Tooltip;
i18n: I18n;
readOnly: ReadOnly;
ui: Ui;
}
/**
* Main Editor class
*/
declare class EditorJS {
public static version: string;
public isReady: Promise<void>;
public blocks: Blocks;
public caret: Caret;
public sanitizer: Sanitizer;
public saver: Saver;
public selection: Selection;
public styles: Styles;
public toolbar: Toolbar;
public inlineToolbar: InlineToolbar;
public readOnly: ReadOnly;
constructor(configuration?: EditorConfig|string);
/**
* API shorthands
*/
/**
* @see Saver.save
*/
public save(): Promise<OutputData>;
/**
* @see Blocks.clear
*/
public clear(): void;
/**
* @see Blocks.render
*/
public render(data: OutputData): Promise<void>;
/**
* @see Caret.focus
*/
public focus(atEnd?: boolean): boolean;
/**
* @see Events.on
*/
public on(eventName: string, callback: (data?: any) => void): void;
/**
* @see Events.off
*/
public off(eventName: string, callback: (data?: any) => void): void;
/**
* @see Events.emit
*/
public emit(eventName: string, data: any): void;
/**
* Destroy Editor instance and related DOM elements
*/
public destroy(): void;
}
export as namespace EditorJS;
export default EditorJS;