Gathering detailed insights and metrics for editorjs-drag-drop
Gathering detailed insights and metrics for editorjs-drag-drop
Gathering detailed insights and metrics for editorjs-drag-drop
Gathering detailed insights and metrics for editorjs-drag-drop
npm install editorjs-drag-drop
93.7
Supply Chain
94.4
Quality
80.6
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
187 Stars
122 Commits
25 Forks
7 Watching
11 Branches
18 Contributors
Updated on 19 Nov 2024
JavaScript (95.27%)
CSS (4.73%)
Cumulative downloads
Total Downloads
Last day
-12.2%
3,316
Compared to previous day
Last week
4.4%
22,667
Compared to previous week
Last month
31.4%
90,363
Compared to previous month
Last year
319%
759,185
Compared to previous year
Drag/Drop feature for Editor.js.
Get the package
1$ npm i --save-dev editorjs-drag-drop
Include module at your application
1import DragDrop from "editorjs-drag-drop";
You can load a specific version of the package from jsDelivr CDN.
Require this script on a page with Editor.js.
1<script src="https://cdn.jsdelivr.net/npm/editorjs-drag-drop"></script>
Add the plugin to the onReady property of the Editor.js configuration to initialize it:
1const editor = new EditorJS({ 2 onReady: () => { 3 new DragDrop(editor); 4 }, 5});
You can customize the indicator border style by passing a second parameter to the plugin constructor:
1const editor = new EditorJS({ 2 onReady: () => { 3 new DragDrop(editor, "2px solid #fff"); 4 }, 5});
If no parameter is provided, the default border style 1px dashed #aaa
is used.
Select the block, drag the toolbar settings button, and drop it at the desired position.
If you're already using editorjs-undo, your code might look like this:
1const editor = new EditorJS({ 2 onReady: () => { 3 new Undo({ editor }); 4 new DragDrop(editor); 5 }, 6});
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.
1const handleReady = (editor) => { 2 new DragDrop(editor); 3}; 4 5class ReactEditor extends Component { 6 render() { 7 return ( 8 <EditorJs 9 onReady = { handleReady } 10 tools = { ... } 11 /> 12 ) 13 } 14}
Note: If you are also using editorjs-undo your handleReady function must have the editorjs-undo instance as well.
1const handleReady = (editor) => { 2 new Undo({ editor }); 3 new DragDrop(editor); 4};
If you are using react-editor-js, you should use the 'onInitialize' prop in the ReactEditorJS component to obtain the abstract editorjs as follow:
1........ 2export const ReactEditor = () => { 3 const editorCore = React.useRef(null) 4 5 const handleInitialize = React.useCallback((instance) => { 6 editorCore.current = instance 7 }, []) 8 9 const handleReady = () => { 10 const editor = editorCore.current._editorJS; 11 new Undo({ editor }) 12 new DragDrop(editor); 13 }; 14 15 const ReactEditorJS = createReactEditorJS() 16 return( 17 <ReactEditorJS 18 onInitialize={handleInitialize} 19 onReady = {handleReady} 20 tools={....} 21 defaultValue={....} 22 /> 23 ) 24}
Development mode
1$ yarn build:dev
Production release
1$ yarn build
dist/bundle.js
Run tests
1$ yarn test
We welcome everyone to contribute. Make sure you have read the CODE_OF_CONDUCT before.
For information on how to contribute, please refer to our CONTRIBUTING guide.
Features and bug fixes are listed in the CHANGELOG file.
This library is licensed under an MIT license. See LICENSE for details.
Made with 💙 by kommitters Open Source
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
3 different organizations found -- score normalized to 10
Details
Reason
no dangerous workflow patterns detected
Reason
update tool detected
Details
Reason
license file detected
Details
Reason
publishing workflow detected
Details
Reason
all dependencies are pinned
Details
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
security policy file detected
Details
Reason
found 3 unreviewed changesets out of 24 -- score normalized to 8
Reason
SAST tool detected but not run on all commits
Details
Reason
badge detected: passing
Reason
6 commit(s) out of 30 and 1 issue activity out of 30 found in the last 90 days -- score normalized to 5
Reason
5 existing vulnerabilities detected
Details
Reason
14 out of 29 merged PRs checked by a CI test -- score normalized to 4
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-24T01:58:46Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More