Merge "Use mw.hook for notifying cancel of settings window to modules"
This commit is contained in:
@@ -549,6 +549,8 @@
|
|||||||
$button.addClass( 'down' );
|
$button.addClass( 'down' );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
mw.hook( 'mw.uls.settings.cancel' ).add( $.proxy( this.cancel, this ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -474,6 +474,8 @@
|
|||||||
inputSettings.enableInputTools();
|
inputSettings.enableInputTools();
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
mw.hook( 'mw.uls.settings.cancel' ).add( $.proxy( this.cancel, this ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* @licence MIT License
|
* @licence MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
( function ( $ ) {
|
( function ( $, mw ) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var closeRow, settingsMenu, settingsPanel, windowTemplate, panelsRow;
|
var closeRow, settingsMenu, settingsPanel, windowTemplate, panelsRow;
|
||||||
@@ -217,13 +217,7 @@
|
|||||||
this.options.onClose();
|
this.options.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are closing language settings. That also means we are cancelling
|
mw.hook( 'mw.uls.settings.cancel' ).fire();
|
||||||
// any changes the user did, but not saved, in all registered modules.
|
|
||||||
$.each( this.modules, function( id, module ) {
|
|
||||||
// Modules should make sure to return early if no changes were made
|
|
||||||
// They can use some kind of 'dirty bits' to implement this.
|
|
||||||
module.cancel();
|
|
||||||
} );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
click: function ( e ) {
|
click: function ( e ) {
|
||||||
@@ -265,4 +259,4 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.fn.languagesettings.Constructor = LanguageSettings;
|
$.fn.languagesettings.Constructor = LanguageSettings;
|
||||||
}( jQuery ) );
|
}( jQuery, mediaWiki ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user