From 7a4c200d05248d5de863e68192806a138f9161ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Alejandro=20Rodr=C3=ADguez?= <64106728+MarioRodriguezS@users.noreply.github.com> Date: Tue, 18 Jan 2022 17:43:44 -0500 Subject: [PATCH 1/2] update the readme (#61) --- README.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 24849a9..3c63447 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,9 @@ const editor = new EditorJS({ }, }); ``` -### Usage with [react-editor-js](https://github.com/Jungwoo-An/react-editor-js). +### Usage with React. -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. +If you are using React, 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) => { @@ -72,6 +72,36 @@ const handleReady = (editor) => { new DragDrop(editor); }; +``` +### 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 should use the 'onInitialize' prop in the ReactEditorJS component to obtain the abstract editorjs as follow: + +```javascript +........ +export const ReactEditor = () => { + const editorCore = React.useRef(null) + + const handleInitialize = React.useCallback((instance) => { + editorCore.current = instance + }, []) + + const handleReady = () => { + const editor = editorCore.current._editorJS; + new Undo({ editor }) + new DragDrop(editor); + }; + + const ReactEditorJS = createReactEditorJS() + return( + + ) +} ``` ## Development From aa27ce44e34f1412a4ec7277d2c6a303ac22f8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Alejandro=20Rodr=C3=ADguez?= <64106728+MarioRodriguezS@users.noreply.github.com> Date: Tue, 18 Jan 2022 20:28:53 -0500 Subject: [PATCH 2/2] Prepare v1.0.2 release (#62) --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb2ed3e..fb830e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.0.2 (18.01.2022) + +* Added react-editor-js support + ## 1.0.1 (10.12.2021) * Add a feature to avoid moving an only block in the editor. diff --git a/package.json b/package.json index de72bf1..7bc15c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "editorjs-drag-drop", - "version": "1.0.1", + "version": "1.0.2", "keywords": [ "drag", "drop",