From b5f2c62676a7eb44324c43852da006783fd9c7e6 Mon Sep 17 00:00:00 2001 From: bdeshi Date: Sat, 13 Jun 2026 01:50:22 +0600 Subject: [PATCH] watch for icons that load in after startup --- main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.js b/main.js index 8055b9a..c837b76 100644 --- a/main.js +++ b/main.js @@ -7,9 +7,18 @@ module.exports = class RibbonOrderLock extends Plugin { this.app.workspace.onLayoutReady(() => { this.patchRibbon(); this.enforceOrder(); + this.observeRibbon(); }); } + observeRibbon() { + const ribbon = this.app.workspace.leftRibbon; + const containerEl = ribbon.ribbonItemsEl; + + this.observer = new MutationObserver(() => this.enforceOrder()); + this.observer.observe(containerEl, { childList: true }); + } + // hook the ribbon's own onChange so drags and hide/show toggles update // our saved order automatically, same as Obsidian's native reorder does patchRibbon() {