harden relocate.js: observe stable parent so items re-relocate after #board-container rebuild; v1.1
This commit is contained in:
@@ -77,16 +77,21 @@
|
||||
}
|
||||
|
||||
function init() {
|
||||
if (!document.getElementById("board")) {
|
||||
var container = document.getElementById("board-container");
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
|
||||
apply();
|
||||
|
||||
var container = document.getElementById("board-container");
|
||||
// Observe the STABLE parent, not #board-container: Kanboard replaces the container
|
||||
// on every card drop / AJAX poll (BoardDragAndDrop.refresh), which would kill an
|
||||
// observer bound to the container itself and leave the items un-relocated after a
|
||||
// move. The parent survives, so apply() keeps running on every rebuild.
|
||||
var parent = container.parentNode;
|
||||
|
||||
if (container && window.MutationObserver) {
|
||||
new MutationObserver(apply).observe(container, { childList: true, subtree: true });
|
||||
if (parent && window.MutationObserver) {
|
||||
new MutationObserver(apply).observe(parent, { childList: true, subtree: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class Plugin extends Base
|
||||
|
||||
public function getPluginVersion()
|
||||
{
|
||||
return '1.0.0';
|
||||
return '1.1.0';
|
||||
}
|
||||
|
||||
public function getPluginHomepage()
|
||||
|
||||
Reference in New Issue
Block a user