don't wrap onChange a second time

This commit is contained in:
bdeshi committed 2026-07-19 23:42:33 +06:00
1 parent 79770e59d3
commit c2f9d558fd
1 file changed
+2 -2
+2 -2
View File
@@ -26,7 +26,7 @@ module.exports = class RibbonOrderLock extends Plugin {
onunload() { onunload() {
this.observer?.disconnect(); this.observer?.disconnect();
const ribbon = this.getRibbon(); const ribbon = this.getRibbon();
if (ribbon) { if (ribbon && this.originalOnChange) {
ribbon.onChange = this.originalOnChange; ribbon.onChange = this.originalOnChange;
} }
} }
@@ -53,7 +53,7 @@ module.exports = class RibbonOrderLock extends Plugin {
// our saved order automatically, same as Obsidian's native reorder does // our saved order automatically, same as Obsidian's native reorder does
patchRibbon() { patchRibbon() {
const ribbon = this.getRibbon(); const ribbon = this.getRibbon();
if (!ribbon) return; if (!ribbon || this.originalOnChange) return;
const original = ribbon.onChange.bind(ribbon); const original = ribbon.onChange.bind(ribbon);
this.originalOnChange = original; this.originalOnChange = original;