watch for icons that load in after startup
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user