leave onChange alone if another plugin patched it after us

This commit is contained in:
bdeshi committed 2026-08-02 01:50:20 +06:00
1 parent 14cfe46c26
commit 0983970abf
1 file changed
+5 -3
+5 -3
View File
@@ -24,7 +24,8 @@ module.exports = class RibbonClasp extends Plugin {
this.debouncedEnforce?.cancel();
const ribbon = this.getRibbon();
if (ribbon && this.originalOnChange) {
// don't restore over someone else's patch, just go inert instead
if (ribbon && ribbon.onChange === this.wrapper) {
ribbon.onChange = this.originalOnChange;
}
}
@@ -56,12 +57,13 @@ module.exports = class RibbonClasp extends Plugin {
const original = ribbon.onChange.bind(ribbon);
this.originalOnChange = original;
ribbon.onChange = (save) => {
this.wrapper = (save) => {
original(save);
if (save && !this.enforcing) {
if (save && !this.enforcing && !this.unloaded) {
this.recordOrder(ribbon);
}
};
ribbon.onChange = this.wrapper;
}
enforceOrder() {