forked from codex-team/editor.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-toolbar.ts
More file actions
44 lines (37 loc) · 827 Bytes
/
api-toolbar.ts
File metadata and controls
44 lines (37 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
declare var Module: any;
import {IToolbarAPI} from '../interfaces/api';
import IModuleConfig from '../interfaces/module-config';
/**
* @class ToolbarsAPI
* provides with methods working with Toolbar
*/
export default class ToolbarAPI extends Module implements IToolbarAPI {
/**
* Save Editor config. API provides passed configuration to the Blocks
*/
constructor({config}: IModuleConfig) {
super({config});
}
/**
* Available methods
* @return {IToolbarAPI}
*/
get methods(): IToolbarAPI {
return {
close: () => this.close(),
open: () => this.open(),
};
}
/**
* Open toolbar
*/
public open(): void {
this.Editor.Toolbar.open();
}
/**
* Close toolbar and all included elements
*/
public close(): void {
this.Editor.Toolbar.close();
}
}