Add API shorthands types (#800)

This commit is contained in:
George Berezhnoy 2019-06-12 20:36:41 +03:00 committed by GitHub
parent b1b0e7b48b
commit 0b0fa35f8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 4 deletions

View file

@ -3,10 +3,11 @@
### 2.14
- `Fix` *Config* — User config now has higher priority than internal settings
- `New` — Ability to work with Block Actions and Inline Toolbar from the keyboard by Tab.
- `Fix` — Fix error thrown by click on the empty editor after `blocks.clear()` method calling
- `Fix` — Fix placeholder property appearance. Now you can assign it via `placeholder` property of EditorConfig.
- `Fix` *Config* — User config now has higher priority than internal settings [#771](https://github.com/codex-team/editor.js/issues/771)
- `New` — Ability to work with Block Actions and Inline Toolbar from the keyboard by Tab. [#705](https://github.com/codex-team/editor.js/issues/705)
- `Fix` — Fix error thrown by click on the empty editor after `blocks.clear()` method calling [#761](https://github.com/codex-team/editor.js/issues/761)
- `Fix` — Fix placeholder property appearance. Now you can assign it via `placeholder` property of EditorConfig. [#714](https://github.com/codex-team/editor.js/issues/714)
- `Fix` — Add API shorthands to TS types [#788](https://github.com/codex-team/editor.js/issues/788)
### 2.13

43
types/index.d.ts vendored
View file

@ -6,6 +6,7 @@
import {EditorConfig} from './configs';
import {Blocks, Caret, Events, Listeners, Notifier, Sanitizer, Saver, Selection, Styles, Toolbar, InlineToolbar} from './api';
import {OutputData} from "./data-formats/output-data";
/**
* Interfaces used for development
@ -74,6 +75,48 @@ declare class EditorJS {
public inlineToolbar: InlineToolbar;
constructor(configuration?: EditorConfig|string);
/**
* API shorthands
*/
/**
* @see Saver.save
*/
save(): Promise<OutputData>;
/**
* @see Blocks.clear
*/
clear(): void;
/**
* @see Blocks.render
*/
render(data: OutputData): Promise<void>;
/**
* @see Caret.focus
*/
focus(atEnd?: boolean): boolean;
/**
* @see Events.on
*/
on(eventName: string, callback: (data?: any) => void): void;
/**
* @see Events.off
*/
off(eventName: string, callback: (data?: any) => void): void;
/**
* @see Events.emit
*/
emit(eventName: string, data: any): void;
/**
* Destroy Editor instance and related DOM elements
*/
public destroy(): void;
}