Fire the ime-enable/disable hook upon saving the preferences
Change-Id: I98e502cd8dc1990b10b1f824614c84d3bf5b993f
This commit is contained in:
committed by
Niklas Laxström
parent
6cf1486399
commit
4e04182ecd
@@ -110,16 +110,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Log IME disabling
|
* Log IME disabling
|
||||||
|
* @param {string} context Where the setting was changed.
|
||||||
*/
|
*/
|
||||||
disableIME: function () {
|
disableIME: function ( context ) {
|
||||||
this.log( { action: 'ime-disable' } );
|
this.log( { action: 'ime-disable', context: context } );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log IME enabling
|
* Log IME enabling
|
||||||
|
* @param {string} context Where the setting was changed.
|
||||||
*/
|
*/
|
||||||
enableIME: function () {
|
enableIME: function ( context ) {
|
||||||
this.log( { action: 'ime-enable' } );
|
this.log( { action: 'ime-enable', context: context } );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -81,13 +81,11 @@
|
|||||||
disable: function () {
|
disable: function () {
|
||||||
this.registry.isDirty = true;
|
this.registry.isDirty = true;
|
||||||
this.registry.enable = false;
|
this.registry.enable = false;
|
||||||
mw.hook( 'mw.uls.ime.disable' ).fire();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function () {
|
enable: function () {
|
||||||
this.registry.isDirty = true;
|
this.registry.isDirty = true;
|
||||||
this.registry.enable = true;
|
this.registry.enable = true;
|
||||||
mw.hook( 'mw.uls.ime.enable' ).fire();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isEnabled: function () {
|
isEnabled: function () {
|
||||||
@@ -152,6 +150,7 @@
|
|||||||
$.ime.preferences.save( function () {
|
$.ime.preferences.save( function () {
|
||||||
mw.ime.disable();
|
mw.ime.disable();
|
||||||
imeNotification();
|
imeNotification();
|
||||||
|
mw.hook( 'mw.uls.ime.disable' ).fire( 'menu' );
|
||||||
} );
|
} );
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -528,12 +528,20 @@
|
|||||||
* Handle the apply button press
|
* Handle the apply button press
|
||||||
*/
|
*/
|
||||||
apply: function () {
|
apply: function () {
|
||||||
var inputSettings = this;
|
var toggleHookName,
|
||||||
|
inputSettings = this;
|
||||||
|
|
||||||
mw.hook( 'mw.uls.ime.change' ).fire(
|
mw.hook( 'mw.uls.ime.change' ).fire(
|
||||||
$.ime.preferences.getIM( $.ime.preferences.getLanguage() )
|
$.ime.preferences.getIM( $.ime.preferences.getLanguage() )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( inputSettings.savedRegistry.enable !== $.ime.preferences.isEnabled() ) {
|
||||||
|
toggleHookName = $.ime.preferences.isEnabled() ?
|
||||||
|
'mw.uls.ime.enable' :
|
||||||
|
'mw.uls.ime.disable';
|
||||||
|
mw.hook( toggleHookName ).fire( 'inputsettings' );
|
||||||
|
}
|
||||||
|
|
||||||
// Save the preferences
|
// Save the preferences
|
||||||
$.ime.preferences.save( function ( result ) {
|
$.ime.preferences.save( function ( result ) {
|
||||||
// closure for not losing the scope
|
// closure for not losing the scope
|
||||||
|
|||||||
Reference in New Issue
Block a user