From 6085480ea1fd52632b1e35b9bc093c21df3bf24d Mon Sep 17 00:00:00 2001 From: Lucas Perais Date: Fri, 23 Dec 2022 12:42:03 +0000 Subject: [PATCH] [IMP] web: core: draggable: execute willStartDrag Before this commit, the draggable hook did not execute willStartDrag, that is, before the element is actually moved. After this commit it does, allowing for implementing some features, like copyOnDrag. Part-of: odoo/odoo#115799 --- addons/web/static/src/core/utils/draggable.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/core/utils/draggable.js b/addons/web/static/src/core/utils/draggable.js index 9f8b102be4e..342866f4e61 100644 --- a/addons/web/static/src/core/utils/draggable.js +++ b/addons/web/static/src/core/utils/draggable.js @@ -43,6 +43,7 @@ import { pick } from "@web/core/utils/objects"; /** @type {(params: DraggableParams) => DraggableState} */ export const useDraggable = makeDraggableHook({ name: "useDraggable", + onWillStartDrag: ({ctx}) => pick(ctx.current, "element"), onDragStart: ({ ctx }) => pick(ctx.current, "element"), onDrag: ({ ctx }) => pick(ctx.current, "element"), onDragEnd: ({ ctx }) => pick(ctx.current, "element"),