Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image can only be dragged once inside a table #4893

Open
ivol37 opened this issue Mar 14, 2025 · 0 comments
Open

Image can only be dragged once inside a table #4893

ivol37 opened this issue Mar 14, 2025 · 0 comments

Comments

@ivol37
Copy link

ivol37 commented Mar 14, 2025

Summary
After having dragged an image that is inside a table, you can not drag that same image a second time. The second time you try to drag the image, dragging it is 'forbidden'.

Expected behavior
You should be able to drag an image in a table as many times you want.

Actual behavior
You can drag it only once, second time dragging is forbidden.

Steps to reproduce the problem
You can reproduce the issue using this Fiddle link: Image in table.

  1. Drag the Froala image to another cell in the table
  2. Try dragging that same image again to another cell

Also note that as a result of the first drag, two cells of the table have been selected; the ‘from’ and ‘to’ cell. And when you move the mouse over other cells, they are automatically selected.

Analysis
The problem seems to be in the Froala table plugin. It assumes that a mouseup event is triggered after releasing the mouse button after dragging, but this is not true. If you click on an image, drag it and release, the mouseup event is not being triggered. The Froala table plugin keeps track of the mouse button being holded in order to select table cells, in the mouseDownCellFlag variable. After dropping the element, this flag still is true. Hence after moving the mouse afterwards, the _mouseEnter function thinks the mouse button is still down and so it will trigger the selectCells function, which in its turn disables the “editing in table” mode (editor.edit.off();). Hence editor.edit.isDisabled() will return true afterwards, which (besides other side-effects) ensures elements can no longer be dragged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant