mirror of
https://github.com/codex-team/editor.js
synced 2026-03-15 23:25:47 +01:00
started writing docs
This commit is contained in:
parent
022023f27e
commit
ca5beae222
5 changed files with 61 additions and 5 deletions
|
|
@ -1831,10 +1831,17 @@ var API = function (_Module) {
|
|||
* @param {@link CodexEditor#moduleInstances} Editor - module can set editor public methods
|
||||
*/
|
||||
set: function set(Editor) {
|
||||
var _this2 = this;
|
||||
|
||||
this.EditorModules = Editor;
|
||||
this.Editor = {
|
||||
block: {
|
||||
moveDown: this.moveDownBlock,
|
||||
moveUp: this.moveUpBlock
|
||||
moveDown: function moveDown() {
|
||||
_this2.moveDownBlock();
|
||||
},
|
||||
moveUp: function moveUp() {
|
||||
_this2.moveUpBlock();
|
||||
}
|
||||
},
|
||||
caret: {},
|
||||
sanitizer: {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
18
docs/api.md
18
docs/api.md
|
|
@ -1 +1,19 @@
|
|||
# CodeX Editor API
|
||||
|
||||
Each Block instance provided API by default. Plugin and Tune Developers
|
||||
can use Editor API as they want.
|
||||
|
||||
Example:
|
||||
|
||||
1) Developing Tunes:
|
||||
|
||||
Create Class that implements block-tune.ts
|
||||
|
||||
Your Tune's constructor gets two arguments:
|
||||
- {Object} api - object contains public methods from modules
|
||||
- {Object} settings - settings contains block default state.
|
||||
This object could have information about cover, anchor and so on.
|
||||
|
||||
---
|
||||
|
||||
### Api object description
|
||||
|
|
|
|||
|
|
@ -1 +1,25 @@
|
|||
# CodeX Editor Toolbar Settings Module
|
||||
|
||||
Toolbar Module has space for Block settings. Settings divided into:
|
||||
- space for plugin's settings, that is described by «Plugin»'s Developer
|
||||
- space for default settings. This option is also can be implemented end expanded
|
||||
|
||||
They difference between zones is that the first option is specified by plugin
|
||||
and each Block may have different options, when second option is for every Block
|
||||
regardless to the plugin's option.
|
||||
|
||||
### Let's look the examples:
|
||||
|
||||
«Plugin»'s Developers need to expand «makeSettings» method that returns HTML.
|
||||
Every user action will be handled by itself. So, you can easily write
|
||||
callbacks that switches your content or makes better. For more information
|
||||
read [Tools](tools.md).
|
||||
|
||||
«Tune»'s Developers need to implement core-provided interface to develop
|
||||
tunes that will be appeared in Toolbar-settings zone.
|
||||
|
||||
Tunes must expand two important methods:
|
||||
- `render()` - returns HTML and it is appended to the default settings zone
|
||||
- `save()` - extracts important information to be saved
|
||||
|
||||
No restrictions. Handle user action by yourself
|
||||
|
|
|
|||
|
|
@ -17,14 +17,21 @@ export default class API extends Module {
|
|||
|
||||
protected Editor: any;
|
||||
|
||||
/**
|
||||
* Editor Modules
|
||||
* API has access to all Module public methods
|
||||
*/
|
||||
private EditorModules: any;
|
||||
|
||||
/**
|
||||
* @param {@link CodexEditor#moduleInstances} Editor - module can set editor public methods
|
||||
*/
|
||||
set state(Editor) {
|
||||
this.EditorModules = Editor;
|
||||
this.Editor = {
|
||||
block: {
|
||||
moveDown: this.moveDownBlock,
|
||||
moveUp: this.moveUpBlock,
|
||||
moveDown: () => { this.moveDownBlock(); } ,
|
||||
moveUp: () => { this.moveUpBlock(); },
|
||||
},
|
||||
caret: {},
|
||||
sanitizer: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue