Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
FlusherDock1 committed Jun 4, 2020
1 parent 0108e89 commit 2c6a351
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Meet the new Editor. The most advanced "WYSWYG" (if you can say so) editor ever.
- Designed to be extendable and pluggable with a simple API
- Native OctoberCMS events support for convenient extending of custom blocks

**Integrations ready:**
- RainLab.Blog
- RainLab.StaticPages
- Lovata.GoodNews
- Indikator.News

**Blocks supported at the moment:**
- Paragraph
- Header
Expand All @@ -23,14 +29,6 @@ Meet the new Editor. The most advanced "WYSWYG" (if you can say so) editor ever.

**Blocks coming in near future:**
- Image
- ~~Embed~~ (Added in 1.1.0) Just paste link to youtube to test it.
- ~~Raw~~ (Added in 1.1.0)

**Integrations will be added in next updates:**
- RainLab.Blog
- RainLab.StaticPages
- Lovata.GoodNews
- Indikator.News

### **What does it mean «block-styled editor»**

Expand All @@ -52,6 +50,14 @@ Go to Settings –> Updates&Plugins find EditorJS in plugin search. Click on ico

## **Usage**

### How to enable integrations

1. Make sure that the desirable plugin for integration is installed in system (list of supported plugins listed in Key Features section)
2. Go to Settings
3. In the sidebar find `Editor Settings` button inside `Editor tab`
4. Enable desirable integrations
5. Done.

After installing plugin, you are now able to set in `fields.yaml` `type:editorjs` to any desirable field. That's all.
You are not limited of how many editors can be rendered at one page.

Expand Down Expand Up @@ -97,34 +103,30 @@ Example of rendering:
{{ post.content_html|raw }}
```

## Extending
## **Extending**

You can create any new block as you like by reading official documentation that you can find here [Editor.Js docs](https://editorjs.io/api)

After creating new JS scripts with new block type Class, you can go through steps below to extend EditorJS formwidget:
1. Create new method in your Plugin.php file named `registerEditorBlocks()`, and by example below add blocks array and scripts for them.
```
/**
* Registers additional blocks for EditorJS
* @return array
*/
public function registerEditorBlocks()
{
return [
'blocks' =>[
'raw' => [
'class' => 'RawTool'
],
],
'scripts' => [
'/plugins/reazzon/testcontent/assets/js/raw.js'
]
];
}
```
After creating new JS script with new block type Class, you can go through steps below to extend EditorJS formwidget:
1. In `boot()` method of your plugin add two event listeners:
1. ```
// Adding additional JS to page where editorjs presented
\Event::listen('reazzon.editor.extend_editor_scripts', function (){
return '/plugins/reazzon/testcontent/assets/js/raw.js';
});
// Adding new block to EditorJS config
\Event::listen('reazzon.editor.extend_editor_tools_config', function (){
return [
'raw' => [
'class' => 'RawTool'
],
];
});
```
2. Done.

Now you can even publish your editorjs extender plugin to marketplace, so everyone can use your block!
Now you can even publish your editorjs extender plugin to marketplace, so everyone can use your block!

---

Expand Down

0 comments on commit 2c6a351

Please sign in to comment.