harden relocate.js: observe stable parent so items re-relocate after #board-container rebuild; v1.1

This commit is contained in:
2026-07-06 21:19:06 -03:00
parent 9c27b51eed
commit a5721890a6
3 changed files with 11 additions and 6 deletions

View File

@@ -77,16 +77,21 @@
} }
function init() { function init() {
if (!document.getElementById("board")) { var container = document.getElementById("board-container");
if (!container) {
return; return;
} }
apply(); 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) { if (parent && window.MutationObserver) {
new MutationObserver(apply).observe(container, { childList: true, subtree: true }); new MutationObserver(apply).observe(parent, { childList: true, subtree: true });
} }
} }

View File

@@ -60,7 +60,7 @@ class Plugin extends Base
public function getPluginVersion() public function getPluginVersion()
{ {
return '1.0.0'; return '1.1.0';
} }
public function getPluginHomepage() public function getPluginHomepage()

View File

@@ -1 +1 @@
OrganonTweaks v1.0 OrganonTweaks v1.1