leave onChange alone if another plugin patched it after us
This commit is contained in:
1 parent
14cfe46c26
commit
0983970abf
1 file changed
+5
-3
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user