mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-71669 editor_atto: Fire custom event when toggling button highlight
This commit is contained in:
parent
45906644be
commit
2dcede1b0b
@ -1035,16 +1035,35 @@ EditorPluginButtons.prototype = {
|
||||
if (button) {
|
||||
if (this.buttons[button]) {
|
||||
this.buttons[button][method](HIGHLIGHT);
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}
|
||||
} else {
|
||||
Y.Object.each(this.buttons, function(button) {
|
||||
button[method](HIGHLIGHT);
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires a custom event that notifies listeners that a button's highlight has been toggled.
|
||||
*
|
||||
* @param {String} buttonName The button name.
|
||||
* @param {Boolean} highlight True when the button was highlighted. False, otherwise.
|
||||
* @private
|
||||
*/
|
||||
_buttonHighlightToggled: function(buttonName, highlight) {
|
||||
var toggledButton = this.buttons[buttonName];
|
||||
if (toggledButton) {
|
||||
// Fire an event that the button highlight was toggled.
|
||||
require(['editor_atto/events'], function(attoEvents) {
|
||||
attoEvents.notifyButtonHighlightToggled(toggledButton.getDOMNode(), buttonName, highlight);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the default meta key to use with keyboard events.
|
||||
*
|
||||
|
File diff suppressed because one or more lines are too long
@ -1031,16 +1031,35 @@ EditorPluginButtons.prototype = {
|
||||
if (button) {
|
||||
if (this.buttons[button]) {
|
||||
this.buttons[button][method](HIGHLIGHT);
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}
|
||||
} else {
|
||||
Y.Object.each(this.buttons, function(button) {
|
||||
button[method](HIGHLIGHT);
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires a custom event that notifies listeners that a button's highlight has been toggled.
|
||||
*
|
||||
* @param {String} buttonName The button name.
|
||||
* @param {Boolean} highlight True when the button was highlighted. False, otherwise.
|
||||
* @private
|
||||
*/
|
||||
_buttonHighlightToggled: function(buttonName, highlight) {
|
||||
var toggledButton = this.buttons[buttonName];
|
||||
if (toggledButton) {
|
||||
// Fire an event that the button highlight was toggled.
|
||||
require(['editor_atto/events'], function(attoEvents) {
|
||||
attoEvents.notifyButtonHighlightToggled(toggledButton.getDOMNode(), buttonName, highlight);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the default meta key to use with keyboard events.
|
||||
*
|
||||
|
@ -885,16 +885,35 @@ EditorPluginButtons.prototype = {
|
||||
if (button) {
|
||||
if (this.buttons[button]) {
|
||||
this.buttons[button][method](HIGHLIGHT);
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}
|
||||
} else {
|
||||
Y.Object.each(this.buttons, function(button) {
|
||||
button[method](HIGHLIGHT);
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires a custom event that notifies listeners that a button's highlight has been toggled.
|
||||
*
|
||||
* @param {String} buttonName The button name.
|
||||
* @param {Boolean} highlight True when the button was highlighted. False, otherwise.
|
||||
* @private
|
||||
*/
|
||||
_buttonHighlightToggled: function(buttonName, highlight) {
|
||||
var toggledButton = this.buttons[buttonName];
|
||||
if (toggledButton) {
|
||||
// Fire an event that the button highlight was toggled.
|
||||
require(['editor_atto/events'], function(attoEvents) {
|
||||
attoEvents.notifyButtonHighlightToggled(toggledButton.getDOMNode(), buttonName, highlight);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the default meta key to use with keyboard events.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user