codex-team / editor.js

A block-style editor with clean JSON output
https://editorjs.io
Apache License 2.0
27.64k stars 2.03k forks source link

Unwanted text duplication with sortableJS #2601

Open raphaelriehl opened 5 months ago

raphaelriehl commented 5 months ago

Hello, I want to create a block in which the elements are sortable. The problem is that when I sort the elements with sortableJS, their content is duplicated and added after my block. Here is a video to explain :

https://github.com/codex-team/editor.js/assets/16758858/9acd028b-7dfa-4d16-87a9-d632dc400c0f

And a Codepen link that reproduces the problem : https://codepen.io/raphaelriehl/pen/QWoxqaE

The purpose of this plugin is to create a photo gallery with the possibility of reordering photos.

How to solve this problem ?

raphaelriehl commented 5 months ago

I updated my first post to better understand how to reproduce the bug (video + codepen). If someone has an idea ?

SlavaDidenko commented 5 months ago

The same problem, who has a solution, please share.

raphaelriehl commented 5 months ago

@SlavaDidenko I submitted a pull request which corrects the problem but I don't know if it will be validated and if it doesn't create a regression. You can test the solution if you want : https://github.com/codex-team/editor.js/commit/0d1d53abf4be74b2c0b99df757ba28745d1f2630