The DragDrop class is the main entrypoint for enabling drag-and-drop functionality in Editor.js. It must be instantiated with an object containing the Editor.js API methods and a configuration object.
To use it, pass an object with the following keys:
configuration: An object containing holder (the ID of the editor container or the DOM element itself) and readOnly (boolean).blocks: The Editor.js blocks API object (used to access getCurrentBlockIndex, getBlocksCount, and move).toolbar: The Editor.js toolbar API object (used to close the toolbar during drag).save: The Editor.js save method.
You can optionally provide a borderStyle string to customize the visual indicator used during dragging (defaults to '1px dashed #aaa').
import DragDrop from 'editorjs-drag-drop';
const dragDrop = new DragDrop({
configuration: {
holder: 'editorjs-container',
readOnly: false
},
blocks: editorInstance.blocks,
toolbar: editorInstance.toolbar,
save: editorInstance.save
}, '2px solid blue');