From e3b89a5e5999de2c972b7245e309c2a1a7b8df88 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 23 Oct 2018 18:25:39 +0200 Subject: [PATCH] Fix kanban color picker preventing items drag&drop #277 --- www/kanban/app-kanban.less | 3 +++ www/kanban/inner.js | 2 +- www/kanban/jkanban.js | 12 ++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/www/kanban/app-kanban.less b/www/kanban/app-kanban.less index 38af510c4..a7df39d4d 100644 --- a/www/kanban/app-kanban.less +++ b/www/kanban/app-kanban.less @@ -51,6 +51,9 @@ align-items: center; justify-content: space-between; padding: 10px 5px 10px 10px; + .kanban-item-text { + cursor: text; + } } .kanban-board { diff --git a/www/kanban/inner.js b/www/kanban/inner.js index 48e4e76e0..ababeb565 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -247,7 +247,7 @@ define([ }; var jscolorL; el._jscLinkedInstance = undefined; - jscolorL = new window.jscolor(el,{onFineChange: onchange, valueElement:undefined}); + jscolorL = new window.jscolor(el,{showOnClick: false, onFineChange: onchange, valueElement:undefined}); jscolorL.show(); var currentColor = boardJSON.color; if (currentColor === undefined) { diff --git a/www/kanban/jkanban.js b/www/kanban/jkanban.js index 971226384..6bb51fe63 100644 --- a/www/kanban/jkanban.js +++ b/www/kanban/jkanban.js @@ -178,18 +178,21 @@ }) .on('dragend', function (el) { console.log("In dragend"); + el.classList.remove('is-moving'); self.options.dragendEl(el); if (el !== null && typeof (el.dragendfn) === 'function') el.dragendfn(el); }) .on('cancel', function (el, container, source) { console.log("In cancel"); + el.classList.remove('is-moving'); // FIXME custom code var boardId = source.parentNode.dataset.id; self.options.dragcancelEl(el, boardId); }) .on('drop', function(el, target, source, sibling) { self.enableAllBoards(); + el.classList.remove('is-moving'); console.log("In drop"); @@ -335,7 +338,7 @@ }); if (board.color !== '' && board.color !== undefined) { headerBoard._jscLinkedInstance = undefined; - jscolorL = new jscolor(headerBoard,{valueElement:undefined}); + jscolorL = new jscolor(headerBoard,{showOnClick: false, valueElement:undefined}); jscolorL.fromString(board.color); headerBoard._jscLinkedInstance = undefined; headerBoard.classList.add("kanban-header-" + board.color); @@ -380,7 +383,7 @@ //add click handler of item __onclickHandler(nodeItemText); if (itemKanban.color !== '' && itemKanban.color !== undefined) { - jscolorL = new jscolor(nodeItem,{valueElement:undefined}); + jscolorL = new jscolor(nodeItem,{showOnClick: false, valueElement:undefined}); jscolorL.fromString(itemKanban.color); } __onColorClickHandler(nodeItem, "item"); @@ -517,6 +520,7 @@ function __onclickHandler(nodeItem, clickfn) { nodeItem.addEventListener('click', function (e) { e.preventDefault; + e.stopPropagation(); self.options.click(this); if (typeof (this.clickfn) === 'function') this.clickfn(this); @@ -534,7 +538,11 @@ function __onColorClickHandler(nodeItem, type) { nodeItem.addEventListener('click', function (e) { + if (Array.prototype.slice.call(nodeItem.classList).indexOf('is-moving') !== -1) { + return; + } e.preventDefault; + e.stopPropagation(); self.options.colorClick(this, type); }); }