watch for icons that load in after startup

This commit is contained in:
bdeshi committed 2026-06-13 01:50:22 +06:00
1 parent ef8fbfced9
commit b5f2c62676
1 file changed
+9
+9
View File
@@ -7,9 +7,18 @@ module.exports = class RibbonOrderLock extends Plugin {
this.app.workspace.onLayoutReady(() => { this.app.workspace.onLayoutReady(() => {
this.patchRibbon(); this.patchRibbon();
this.enforceOrder(); 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 // hook the ribbon's own onChange so drags and hide/show toggles update
// our saved order automatically, same as Obsidian's native reorder does // our saved order automatically, same as Obsidian's native reorder does
patchRibbon() { patchRibbon() {