- Issue created by @traviscarden
- 🇫🇮Finland lauriii Finland
The component insert should be cancelled at least by pressing Esc-key or by dropping within the admin. UI (i.e. sidebars or the top bar). There might be other interactions but we could start with these.
- 🇮🇩Indonesia el7cosmos 🇮🇩 GMT+7
Here are issues on sortable js library: https://github.com/SortableJS/Sortable/issues?q=esc+
- First commit to issue fork.
- 🇺🇸United States sea2709 Texas
@traviscarden @lauriii : I would like to pick up this issue. I did some debugging and found out a way to prevent adding component by pressing Esc or dropping it in an invalid zone. When you have time, could you review my change?
Thanks!
- Merge request !442only add the item to the components sortable list if the dragend is not by... → (Merged) created by lauriii
- 🇫🇮Finland lauriii Finland
UX wise this seems like a nice improvement! I asked review from @jessebaker on the solution.
- First commit to issue fork.
- 🇺🇸United States sea2709 Texas
Thanks @jessebaker for reviewing my work. I scanned through the source code of Sortable library, I saw the property "originalEvent" is assigned to event object by using the function Object.defineProperty(), and originalEvent is not an official property of SortableEvent. After googling a while, this is what I came up with
if ('originalEvent' in ev) { const originalEvent: DragEvent = ev.originalEvent as DragEvent; // dataTransfer.dropEffect will be 'none' if the dragend event is fired by hitting escape or releasing mouse on // an invalid drop area. If it's 'none', remove the dropped item from the DOM and don't call updateData. if (originalEvent.dataTransfer?.dropEffect !== 'none') { updateData(ev, false); } else { ev.item.remove(); } }
- Assigned to jessebaker
- Status changed to Needs review
15 days ago 3:20pm 7 January 2025 - First commit to issue fork.
-
hooroomoo →
committed 96842a76 on 0.x authored by
lauriii →
Issue #3484944 by sea2709, jessebaker, traviscarden: Add the ability to...
-
hooroomoo →
committed 96842a76 on 0.x authored by
lauriii →
Automatically closed - issue fixed for 2 weeks with no activity.