Merge branch 'MDL-44762-master' of git://github.com/FMCorz/moodle

This commit is contained in:
Sam Hemelryk
2014-04-02 09:29:11 +13:00
5 changed files with 47 additions and 14 deletions
@@ -616,6 +616,9 @@ EditorPluginButtons.prototype = {
* @private
*/
_hideMenu: function(e, menuDialogue) {
if (menuDialogue.get('preventHideMenu') === true) {
return;
}
menuDialogue.hide();
new Y.EventHandle(this._menuHideHandlers).detach();
},
@@ -636,11 +639,18 @@ EditorPluginButtons.prototype = {
// And the normalized callback configuration.
buttonConfig = this._normalizeCallback(config.items[index], config.globalItemConfig);
// Clear the focus after hide so that focus is returned to the editor and changes are made correctly.
menuDialogue.set('focusAfterHide', null);
// Prevent the dialogue to be closed because of some browser weirdness.
menuDialogue.set('preventHideMenu', true);
// Call the callback for this button.
buttonConfig.callback(e, buttonConfig._callback, buttonConfig.callbackArgs);
// Cancel the hide menu prevention.
menuDialogue.set('preventHideMenu', false);
// Set the focus after hide so that focus is returned to the editor and changes are made correctly.
menuDialogue.set('focusAfterHide', this.get('host').editor);
this._hideMenu(e, menuDialogue);
},
/**
@@ -720,6 +730,7 @@ EditorPluginButtons.prototype = {
* @param {EventFacade} e
* @param {Function} callback The function to call which makes the relevant changes.
* @param {Array} [callbackArgs] The arguments passed to this callback.
* @return {Mixed} The value returned by the callback.
* @private
*/
_callbackWrapper: function(e, callback, callbackArgs) {
@@ -750,7 +761,7 @@ EditorPluginButtons.prototype = {
var args = [e, callbackArgs];
// Actually call the callback now.
callback.apply(this, args);
return callback.apply(this, args);
},
/**
@@ -1128,7 +1139,7 @@ EditorPluginDialogue.prototype = {
if (focusAfterHide === true) {
this._dialogue.set('focusAfterHide', this.buttons[this.buttonNames[0]]);
} else if (typeof setFocusAfter === 'string') {
} else if (typeof focusAfterHide === 'string') {
this._dialogue.set('focusAfterHide', this.buttons[focusAfterHide]);
} else {
File diff suppressed because one or more lines are too long
@@ -614,6 +614,9 @@ EditorPluginButtons.prototype = {
* @private
*/
_hideMenu: function(e, menuDialogue) {
if (menuDialogue.get('preventHideMenu') === true) {
return;
}
menuDialogue.hide();
new Y.EventHandle(this._menuHideHandlers).detach();
},
@@ -634,11 +637,18 @@ EditorPluginButtons.prototype = {
// And the normalized callback configuration.
buttonConfig = this._normalizeCallback(config.items[index], config.globalItemConfig);
// Clear the focus after hide so that focus is returned to the editor and changes are made correctly.
menuDialogue.set('focusAfterHide', null);
// Prevent the dialogue to be closed because of some browser weirdness.
menuDialogue.set('preventHideMenu', true);
// Call the callback for this button.
buttonConfig.callback(e, buttonConfig._callback, buttonConfig.callbackArgs);
// Cancel the hide menu prevention.
menuDialogue.set('preventHideMenu', false);
// Set the focus after hide so that focus is returned to the editor and changes are made correctly.
menuDialogue.set('focusAfterHide', this.get('host').editor);
this._hideMenu(e, menuDialogue);
},
/**
@@ -718,6 +728,7 @@ EditorPluginButtons.prototype = {
* @param {EventFacade} e
* @param {Function} callback The function to call which makes the relevant changes.
* @param {Array} [callbackArgs] The arguments passed to this callback.
* @return {Mixed} The value returned by the callback.
* @private
*/
_callbackWrapper: function(e, callback, callbackArgs) {
@@ -748,7 +759,7 @@ EditorPluginButtons.prototype = {
var args = [e, callbackArgs];
// Actually call the callback now.
callback.apply(this, args);
return callback.apply(this, args);
},
/**
@@ -1123,7 +1134,7 @@ EditorPluginDialogue.prototype = {
if (focusAfterHide === true) {
this._dialogue.set('focusAfterHide', this.buttons[this.buttonNames[0]]);
} else if (typeof setFocusAfter === 'string') {
} else if (typeof focusAfterHide === 'string') {
this._dialogue.set('focusAfterHide', this.buttons[focusAfterHide]);
} else {
+14 -3
View File
@@ -474,6 +474,9 @@ EditorPluginButtons.prototype = {
* @private
*/
_hideMenu: function(e, menuDialogue) {
if (menuDialogue.get('preventHideMenu') === true) {
return;
}
menuDialogue.hide();
new Y.EventHandle(this._menuHideHandlers).detach();
},
@@ -494,11 +497,18 @@ EditorPluginButtons.prototype = {
// And the normalized callback configuration.
buttonConfig = this._normalizeCallback(config.items[index], config.globalItemConfig);
// Clear the focus after hide so that focus is returned to the editor and changes are made correctly.
menuDialogue.set('focusAfterHide', null);
// Prevent the dialogue to be closed because of some browser weirdness.
menuDialogue.set('preventHideMenu', true);
// Call the callback for this button.
buttonConfig.callback(e, buttonConfig._callback, buttonConfig.callbackArgs);
// Cancel the hide menu prevention.
menuDialogue.set('preventHideMenu', false);
// Set the focus after hide so that focus is returned to the editor and changes are made correctly.
menuDialogue.set('focusAfterHide', this.get('host').editor);
this._hideMenu(e, menuDialogue);
},
/**
@@ -578,6 +588,7 @@ EditorPluginButtons.prototype = {
* @param {EventFacade} e
* @param {Function} callback The function to call which makes the relevant changes.
* @param {Array} [callbackArgs] The arguments passed to this callback.
* @return {Mixed} The value returned by the callback.
* @private
*/
_callbackWrapper: function(e, callback, callbackArgs) {
@@ -608,7 +619,7 @@ EditorPluginButtons.prototype = {
var args = [e, callbackArgs];
// Actually call the callback now.
callback.apply(this, args);
return callback.apply(this, args);
},
/**
@@ -92,7 +92,7 @@ EditorPluginDialogue.prototype = {
if (focusAfterHide === true) {
this._dialogue.set('focusAfterHide', this.buttons[this.buttonNames[0]]);
} else if (typeof setFocusAfter === 'string') {
} else if (typeof focusAfterHide === 'string') {
this._dialogue.set('focusAfterHide', this.buttons[focusAfterHide]);
} else {