editor.js/types/index.d.ts
Peter Savchenko ff91466b14
feat(toolbar): toolbar refactored and ui improved (#1815)
* chore(block-tune-toggler): toggler moved to the left (draft)

* toolbox ui updated

* fixd caret jumpling, improved some styles

* toolbar moving by block-hover

- UI module triggers 'block-hovered' event
- Toolbar uses 'block-hovered' for appearing
- `currentBlock` setter added to the BlockManager
- (reactangle-selection): the throttling added to the mousemove and scroll handlers
- `getBlockIndex` method added to the Api
- (api-blocks): toolbar moving logic removed from `blocks.move()` and `blocks.swap()` methods. Instead, MoveUp and MoveDown tunes uses Toolbar API

* the dark-theme to the example-dev.html

* positioning improved

* fix(rectangle-selection): first click after RS does not clears selection state

* toolbox position fixed

* the toolbox module became a standalone class

- Toolbox became a standalone class from the editor module. It can be accessed only via the owner (the Toolbar module)
- (api.blocks) the insert() method now has the `replace` param. Also, it returns inserted Block API now.

* new(api.listeners): `on()` now returns the listener id. The new `offById()` method added

* fix bug with Tab pressing on hovered but not focused block

* mobile version improved

* upd example dev

* small updaets

* add nested-list

* linting

* (api.toolbar): `toggleBlockSettings` now fires toggling event with the same state

* EventDispatcher used instead of callbacks for the Toolbox

* UIApi added

* fix ci

* git submodules removed from the ci flow

* add paragraph submodule to the ci flow

* Update CHANGELOG.md

* Update package.json

* use ubuntu-latest for chrome ci
2021-11-24 21:14:24 +03:00

165 lines
3 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,
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,
} 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;