kommitters / editorjs-undo

Undo/Redo feature for Editor.js
https://www.npmjs.com/package/editorjs-undo
MIT License
172 stars 51 forks source link

Remove unncesary validation that was causing the problem when draging files to the last position #120

Closed Marthox closed 2 years ago

Marthox commented 2 years ago

Context

It seems that moving blocks (via Drag-and-Drop OR via BlockTune) doesn't behave consistently.

Current behavior

Solution

Solves #117 By removing an unnncesary comparation between component indexes which was the responsible of this swaping error, this error is now fixed. This was happening because of the inital state of the app and the inital behaviour of the drag'n drop component, where the two indexes matched making the droppable condition to fail, and insted of the drop action it executes the default one. And because of the other state comparision is not necesary to compare indexes to assure a correct behaviour of the functionality