Skip to content

Commit

Permalink
Solve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRodriguezS committed Apr 22, 2024
1 parent f0e0063 commit 373792e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ Require this script on a page with Editor.js.
```javascript
const editor = new EditorJS({
onReady: () => {
new DragDrop(editor, '1px solid red');
new DragDrop(editor);
},
});
```

Select the block, drag the toolbar settings button, and drop it at the desired position. The optional second parameter adds styles to the indicator border; otherwise, the default border style value is used.
Select the block, drag the toolbar settings button, and drop it at the desired position.

You can optionally provide a second parameter to customize the indicator border style. If no parameter is provided, the default border style `1px dashed #aaa` is used.

If you're already using [editorjs-undo](https://github.com/kommitters/editorjs-undo), then your code will look somewhat like this:

Expand Down
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ export default class DragDrop {
blockContent.style.removeProperty('border-bottom');
} else {
const index = Object.keys(allBlocks).find((key) => allBlocks[key] === blockFocused);
if (index > this.startBlock) {
blockContent.style.borderBottom = this.borderStyle;
} else blockContent.style.borderTop = this.borderStyle;
if (index > this.startBlock) blockContent.style.borderBottom = this.borderStyle;
else blockContent.style.borderTop = this.borderStyle;
}
});
}
Expand Down

0 comments on commit 373792e

Please sign in to comment.