editorjs-drag-drop
Advanced tools
Comparing version 1.1.6 to 1.1.7
# Changelog | ||
## 1.1.7 (12.09.2022) | ||
* Add OpenSSF BestPractices & Scorecard badges | ||
* Add CDN version documentation | ||
## 1.1.6 (23.08.2022) | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "editorjs-drag-drop", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "drag", |
@@ -0,5 +1,6 @@ | ||
# EditorJS Drag/Drop Plugin | ||
 | ||
[](https://bestpractices.coreinfrastructure.org/projects/6468) | ||
[](https://api.securityscorecards.dev/projects/github.com/kommitters/editorjs-drag-drop) | ||
# EditorJS Drag/Drop Plugin | ||
Drag/Drop feature for [Editor.js](https://editorjs.io). | ||
@@ -25,2 +26,12 @@ | ||
### Load from CDN | ||
You can load a specific version of the package from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/editorjs-drag-drop). | ||
Require this script on a page with Editor.js. | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/editorjs-drag-drop"></script> | ||
``` | ||
## Usage | ||
@@ -50,3 +61,3 @@ | ||
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. | ||
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. | ||
@@ -86,19 +97,19 @@ ```javascript | ||
const editorCore = React.useRef(null) | ||
const handleInitialize = React.useCallback((instance) => { | ||
editorCore.current = instance | ||
}, []) | ||
const handleReady = () => { | ||
const editor = editorCore.current._editorJS; | ||
const editor = editorCore.current._editorJS; | ||
new Undo({ editor }) | ||
new DragDrop(editor); | ||
}; | ||
const ReactEditorJS = createReactEditorJS() | ||
return( | ||
<ReactEditorJS | ||
<ReactEditorJS | ||
onInitialize={handleInitialize} | ||
onReady = {handleReady} | ||
tools={....} | ||
tools={....} | ||
defaultValue={....} | ||
@@ -105,0 +116,0 @@ /> |
Sorry, the diff of this file is not supported yet
31782
161