Fix kanban color picker preventing items drag&drop #277

pull/1/head
yflory 6 years ago
parent 98db6057c8
commit e3b89a5e59

@ -51,6 +51,9 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 10px 5px 10px 10px; padding: 10px 5px 10px 10px;
.kanban-item-text {
cursor: text;
}
} }
.kanban-board { .kanban-board {

@ -247,7 +247,7 @@ define([
}; };
var jscolorL; var jscolorL;
el._jscLinkedInstance = undefined; 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(); jscolorL.show();
var currentColor = boardJSON.color; var currentColor = boardJSON.color;
if (currentColor === undefined) { if (currentColor === undefined) {

@ -178,18 +178,21 @@
}) })
.on('dragend', function (el) { .on('dragend', function (el) {
console.log("In dragend"); console.log("In dragend");
el.classList.remove('is-moving');
self.options.dragendEl(el); self.options.dragendEl(el);
if (el !== null && typeof (el.dragendfn) === 'function') if (el !== null && typeof (el.dragendfn) === 'function')
el.dragendfn(el); el.dragendfn(el);
}) })
.on('cancel', function (el, container, source) { .on('cancel', function (el, container, source) {
console.log("In cancel"); console.log("In cancel");
el.classList.remove('is-moving');
// FIXME custom code // FIXME custom code
var boardId = source.parentNode.dataset.id; var boardId = source.parentNode.dataset.id;
self.options.dragcancelEl(el, boardId); self.options.dragcancelEl(el, boardId);
}) })
.on('drop', function(el, target, source, sibling) { .on('drop', function(el, target, source, sibling) {
self.enableAllBoards(); self.enableAllBoards();
el.classList.remove('is-moving');
console.log("In drop"); console.log("In drop");
@ -335,7 +338,7 @@
}); });
if (board.color !== '' && board.color !== undefined) { if (board.color !== '' && board.color !== undefined) {
headerBoard._jscLinkedInstance = undefined; headerBoard._jscLinkedInstance = undefined;
jscolorL = new jscolor(headerBoard,{valueElement:undefined}); jscolorL = new jscolor(headerBoard,{showOnClick: false, valueElement:undefined});
jscolorL.fromString(board.color); jscolorL.fromString(board.color);
headerBoard._jscLinkedInstance = undefined; headerBoard._jscLinkedInstance = undefined;
headerBoard.classList.add("kanban-header-" + board.color); headerBoard.classList.add("kanban-header-" + board.color);
@ -380,7 +383,7 @@
//add click handler of item //add click handler of item
__onclickHandler(nodeItemText); __onclickHandler(nodeItemText);
if (itemKanban.color !== '' && itemKanban.color !== undefined) { if (itemKanban.color !== '' && itemKanban.color !== undefined) {
jscolorL = new jscolor(nodeItem,{valueElement:undefined}); jscolorL = new jscolor(nodeItem,{showOnClick: false, valueElement:undefined});
jscolorL.fromString(itemKanban.color); jscolorL.fromString(itemKanban.color);
} }
__onColorClickHandler(nodeItem, "item"); __onColorClickHandler(nodeItem, "item");
@ -517,6 +520,7 @@
function __onclickHandler(nodeItem, clickfn) { function __onclickHandler(nodeItem, clickfn) {
nodeItem.addEventListener('click', function (e) { nodeItem.addEventListener('click', function (e) {
e.preventDefault; e.preventDefault;
e.stopPropagation();
self.options.click(this); self.options.click(this);
if (typeof (this.clickfn) === 'function') if (typeof (this.clickfn) === 'function')
this.clickfn(this); this.clickfn(this);
@ -534,7 +538,11 @@
function __onColorClickHandler(nodeItem, type) { function __onColorClickHandler(nodeItem, type) {
nodeItem.addEventListener('click', function (e) { nodeItem.addEventListener('click', function (e) {
if (Array.prototype.slice.call(nodeItem.classList).indexOf('is-moving') !== -1) {
return;
}
e.preventDefault; e.preventDefault;
e.stopPropagation();
self.options.colorClick(this, type); self.options.colorClick(this, type);
}); });
} }

Loading…
Cancel
Save