From 373792e97f584f9cbe38a289a2e0626c9a09fd3c Mon Sep 17 00:00:00 2001 From: Mario Rodriguez <64106728+MarioRodriguezS@users.noreply.github.com> Date: Mon, 22 Apr 2024 10:57:10 -0500 Subject: [PATCH] Solve comments --- README.md | 6 ++++-- src/index.js | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6fc3d07..3d2a5dc 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/src/index.js b/src/index.js index f185297..0255681 100644 --- a/src/index.js +++ b/src/index.js @@ -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; } }); }