editorjs-drag-drop
Advanced tools
# Changelog | ||
## 0.2.1 (22.09.2021) | ||
* Added react-editor-js support | ||
* Updated packages with known security breaches. | ||
## 0.2.0 (09.09.2021) | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "editorjs-drag-drop", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"keywords": [ | ||
@@ -28,3 +28,3 @@ "drag", | ||
"@babel/preset-env": "^7.10.1", | ||
"babel-jest": "^26.0.1", | ||
"babel-jest": "^27.2.1", | ||
"babel-loader": "^8.0.5", | ||
@@ -36,3 +36,3 @@ "css-loader": "^1.0.0", | ||
"eslint-plugin-jest": "^23.13.2", | ||
"jest": "^26.0.1", | ||
"jest": "^27.2.1", | ||
"nock": "^12.0.3", | ||
@@ -39,0 +39,0 @@ "style-loader": "^0.21.0", |
@@ -47,3 +47,32 @@  | ||
``` | ||
### Usage with [react-editor-js](https://github.com/Jungwoo-An/react-editor-js). | ||
If you are using [react-editor-js](https://github.com/Jungwoo-An/react-editor-js), you could create a function to handle the onReady property, the function will store the DragDrop instance. Then, you must call the function in onReady in the editorJS instance. | ||
```javascript | ||
const handleReady = (editor) => { | ||
new DragDrop(editor); | ||
}; | ||
class ReactEditor extends Component { | ||
render() { | ||
return ( | ||
<EditorJs | ||
onReady = { handleReady } | ||
tools = { ... } | ||
/> | ||
) | ||
} | ||
} | ||
``` | ||
**Note:** If you are already using [editorjs-undo](https://github.com/kommitters/editorjs-undo) your handleReady function must have the editorjs-undo instance. | ||
```javascript | ||
const handleReady = (editor) => { | ||
new Undo({ editor }); | ||
new DragDrop(editor); | ||
}; | ||
``` | ||
## Development | ||
@@ -50,0 +79,0 @@ |
25187
3.94%120
31.87%