mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Merge branch 'MDL-71603-master' of git://github.com/rezaies/moodle
This commit is contained in:
commit
d91e9ccee8
@ -37,7 +37,8 @@ var PLUGINNAME = 'atto_collapse',
|
||||
ATTRSHOWGROUPS = 'showgroups',
|
||||
COLLAPSE = 'collapse',
|
||||
COLLAPSED = 'collapsed',
|
||||
GROUPS = '.atto_group';
|
||||
GROUPS = '.atto_group',
|
||||
ROWS = '.atto_toolbar_row';
|
||||
|
||||
Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
@ -62,11 +63,24 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
|
||||
// Perform a toggle after all plugins have been loaded for the first time.
|
||||
this.get('host').on('pluginsloaded', function(e, button) {
|
||||
this._setVisibility(button);
|
||||
// Add 2 rows in the toolbar.
|
||||
var toolbarRows = [
|
||||
Y.Node.create('<div class="atto_toolbar_row"></div>'),
|
||||
Y.Node.create('<div class="atto_toolbar_row" tabindex="-1"></div>'),
|
||||
];
|
||||
this.toolbar.appendChild(toolbarRows[0]).insert(toolbarRows[1], 'after');
|
||||
|
||||
// Set the toolbar to break after the initial those displayed by default.
|
||||
var firstGroup = this.toolbar.all(GROUPS).item(this.get(ATTRSHOWGROUPS));
|
||||
firstGroup.insert('<div class="toolbarbreak"></div>', 'before');
|
||||
// Split toolbar buttons between the 2 rows created above.
|
||||
var buttonGroups = this.toolbar.all(GROUPS);
|
||||
buttonGroups.slice(0, this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) {
|
||||
toolbarRows[0].appendChild(buttonGroup);
|
||||
});
|
||||
buttonGroups.slice(this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) {
|
||||
toolbarRows[1].appendChild(buttonGroup);
|
||||
});
|
||||
|
||||
this._setVisibility(button);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}, this, button);
|
||||
},
|
||||
|
||||
@ -84,12 +98,12 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
if (button.getData(COLLAPSED)) {
|
||||
this.highlightButtons(COLLAPSE);
|
||||
this._setVisibility(button, true);
|
||||
this.toolbar.all(ROWS).item(1).focus();
|
||||
} else {
|
||||
this.unHighlightButtons(COLLAPSE);
|
||||
this._setVisibility(button);
|
||||
this.buttons[this.name].focus();
|
||||
}
|
||||
|
||||
this.buttons[this.name].focus();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -101,18 +115,22 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
* @private
|
||||
*/
|
||||
_setVisibility: function(button, visibility) {
|
||||
var groups = this.toolbar.all(GROUPS).slice(this.get(ATTRSHOWGROUPS));
|
||||
var secondaryRow = this.toolbar.all(ROWS).item(1);
|
||||
|
||||
if (visibility) {
|
||||
button.set('title', M.util.get_string('showfewer', PLUGINNAME));
|
||||
groups.show();
|
||||
secondaryRow.show();
|
||||
button.setData(COLLAPSED, false);
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
} else {
|
||||
button.set('title', M.util.get_string('showmore', PLUGINNAME));
|
||||
groups.hide();
|
||||
secondaryRow.hide();
|
||||
button.setData(COLLAPSED, true);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
// We don't want to have both aria-pressed and aria-expanded set. So we remove aria-pressed here.
|
||||
button.removeAttribute('aria-pressed');
|
||||
}
|
||||
}, {
|
||||
ATTRS: {
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-atto_collapse-button",function(s,t){var o="atto_collapse",e="showgroups",l="collapse",a="collapsed",n=".atto_group";s.namespace("M.atto_collapse").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{initializer:function(){var t,i=s.Object.size(this.get("host").get("plugins"));i<=1+parseInt(this.get(e),10)||this.toolbar.all(n).size()>this.get(e)||(t=this.addButton({icon:"icon",iconComponent:o,callback:this._toggle}),this.get("host").on("pluginsloaded",function(t,i){this._setVisibility(i),this.toolbar.all(n).item(this.get(e)).insert('<div class="toolbarbreak"></div>',"before")},this,t))},_toggle:function(t){t.preventDefault();var i=this.buttons[l];i.getData(a)?(this.highlightButtons(l),this._setVisibility(i,!0)):(this.unHighlightButtons(l),this._setVisibility(i)),this.buttons[this.name].focus()},_setVisibility:function(t,i){var s=this.toolbar.all(n).slice(this.get(e));i?(t.set("title",M.util.get_string("showfewer",o)),s.show(),t.setData(a,!1)):(t.set("title",M.util.get_string("showmore",o)),s.hide(),t.setData(a,!0))}},{ATTRS:{showgroups:{value:3}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
YUI.add("moodle-atto_collapse-button",function(s,t){var o="atto_collapse",a="showgroups",e="collapse",l="collapsed",n=".atto_group",r=".atto_toolbar_row";s.namespace("M.atto_collapse").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{initializer:function(){var t,i=s.Object.size(this.get("host").get("plugins"));i<=1+parseInt(this.get(a),10)||this.toolbar.all(n).size()>this.get(a)||(t=this.addButton({icon:"icon",iconComponent:o,callback:this._toggle}),this.get("host").on("pluginsloaded",function(t,i){var e,o=[s.Node.create('<div class="atto_toolbar_row"></div>'),s.Node.create('<div class="atto_toolbar_row" tabindex="-1"></div>')];this.toolbar.appendChild(o[0]).insert(o[1],"after"),(e=this.toolbar.all(n)).slice(0,this.get(a)).each(function(t){o[0].appendChild(t)}),e.slice(this.get(a)).each(function(t){o[1].appendChild(t)}),this._setVisibility(i),i.setAttribute("aria-expanded","false")},this,t))},_toggle:function(t){t.preventDefault();var i=this.buttons[e];i.getData(l)?(this.highlightButtons(e),this._setVisibility(i,!0),this.toolbar.all(r).item(1).focus()):(this.unHighlightButtons(e),this._setVisibility(i),this.buttons[this.name].focus())},_setVisibility:function(t,i){var e=this.toolbar.all(r).item(1);i?(t.set("title",M.util.get_string("showfewer",o)),e.show(),t.setData(l,!1),t.setAttribute("aria-expanded","true")):(t.set("title",M.util.get_string("showmore",o)),e.hide(),t.setData(l,!0),t.setAttribute("aria-expanded","false")),t.removeAttribute("aria-pressed")}},{ATTRS:{showgroups:{value:3}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
@ -37,7 +37,8 @@ var PLUGINNAME = 'atto_collapse',
|
||||
ATTRSHOWGROUPS = 'showgroups',
|
||||
COLLAPSE = 'collapse',
|
||||
COLLAPSED = 'collapsed',
|
||||
GROUPS = '.atto_group';
|
||||
GROUPS = '.atto_group',
|
||||
ROWS = '.atto_toolbar_row';
|
||||
|
||||
Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
@ -58,11 +59,24 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
|
||||
// Perform a toggle after all plugins have been loaded for the first time.
|
||||
this.get('host').on('pluginsloaded', function(e, button) {
|
||||
this._setVisibility(button);
|
||||
// Add 2 rows in the toolbar.
|
||||
var toolbarRows = [
|
||||
Y.Node.create('<div class="atto_toolbar_row"></div>'),
|
||||
Y.Node.create('<div class="atto_toolbar_row" tabindex="-1"></div>'),
|
||||
];
|
||||
this.toolbar.appendChild(toolbarRows[0]).insert(toolbarRows[1], 'after');
|
||||
|
||||
// Set the toolbar to break after the initial those displayed by default.
|
||||
var firstGroup = this.toolbar.all(GROUPS).item(this.get(ATTRSHOWGROUPS));
|
||||
firstGroup.insert('<div class="toolbarbreak"></div>', 'before');
|
||||
// Split toolbar buttons between the 2 rows created above.
|
||||
var buttonGroups = this.toolbar.all(GROUPS);
|
||||
buttonGroups.slice(0, this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) {
|
||||
toolbarRows[0].appendChild(buttonGroup);
|
||||
});
|
||||
buttonGroups.slice(this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) {
|
||||
toolbarRows[1].appendChild(buttonGroup);
|
||||
});
|
||||
|
||||
this._setVisibility(button);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}, this, button);
|
||||
},
|
||||
|
||||
@ -80,12 +94,12 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
if (button.getData(COLLAPSED)) {
|
||||
this.highlightButtons(COLLAPSE);
|
||||
this._setVisibility(button, true);
|
||||
this.toolbar.all(ROWS).item(1).focus();
|
||||
} else {
|
||||
this.unHighlightButtons(COLLAPSE);
|
||||
this._setVisibility(button);
|
||||
this.buttons[this.name].focus();
|
||||
}
|
||||
|
||||
this.buttons[this.name].focus();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -97,18 +111,22 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
* @private
|
||||
*/
|
||||
_setVisibility: function(button, visibility) {
|
||||
var groups = this.toolbar.all(GROUPS).slice(this.get(ATTRSHOWGROUPS));
|
||||
var secondaryRow = this.toolbar.all(ROWS).item(1);
|
||||
|
||||
if (visibility) {
|
||||
button.set('title', M.util.get_string('showfewer', PLUGINNAME));
|
||||
groups.show();
|
||||
secondaryRow.show();
|
||||
button.setData(COLLAPSED, false);
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
} else {
|
||||
button.set('title', M.util.get_string('showmore', PLUGINNAME));
|
||||
groups.hide();
|
||||
secondaryRow.hide();
|
||||
button.setData(COLLAPSED, true);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
// We don't want to have both aria-pressed and aria-expanded set. So we remove aria-pressed here.
|
||||
button.removeAttribute('aria-pressed');
|
||||
}
|
||||
}, {
|
||||
ATTRS: {
|
||||
|
@ -35,7 +35,8 @@ var PLUGINNAME = 'atto_collapse',
|
||||
ATTRSHOWGROUPS = 'showgroups',
|
||||
COLLAPSE = 'collapse',
|
||||
COLLAPSED = 'collapsed',
|
||||
GROUPS = '.atto_group';
|
||||
GROUPS = '.atto_group',
|
||||
ROWS = '.atto_toolbar_row';
|
||||
|
||||
Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
@ -60,11 +61,24 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
|
||||
// Perform a toggle after all plugins have been loaded for the first time.
|
||||
this.get('host').on('pluginsloaded', function(e, button) {
|
||||
this._setVisibility(button);
|
||||
// Add 2 rows in the toolbar.
|
||||
var toolbarRows = [
|
||||
Y.Node.create('<div class="atto_toolbar_row"></div>'),
|
||||
Y.Node.create('<div class="atto_toolbar_row" tabindex="-1"></div>'),
|
||||
];
|
||||
this.toolbar.appendChild(toolbarRows[0]).insert(toolbarRows[1], 'after');
|
||||
|
||||
// Set the toolbar to break after the initial those displayed by default.
|
||||
var firstGroup = this.toolbar.all(GROUPS).item(this.get(ATTRSHOWGROUPS));
|
||||
firstGroup.insert('<div class="toolbarbreak"></div>', 'before');
|
||||
// Split toolbar buttons between the 2 rows created above.
|
||||
var buttonGroups = this.toolbar.all(GROUPS);
|
||||
buttonGroups.slice(0, this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) {
|
||||
toolbarRows[0].appendChild(buttonGroup);
|
||||
});
|
||||
buttonGroups.slice(this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) {
|
||||
toolbarRows[1].appendChild(buttonGroup);
|
||||
});
|
||||
|
||||
this._setVisibility(button);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}, this, button);
|
||||
},
|
||||
|
||||
@ -82,12 +96,12 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
if (button.getData(COLLAPSED)) {
|
||||
this.highlightButtons(COLLAPSE);
|
||||
this._setVisibility(button, true);
|
||||
this.toolbar.all(ROWS).item(1).focus();
|
||||
} else {
|
||||
this.unHighlightButtons(COLLAPSE);
|
||||
this._setVisibility(button);
|
||||
this.buttons[this.name].focus();
|
||||
}
|
||||
|
||||
this.buttons[this.name].focus();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -99,18 +113,22 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
* @private
|
||||
*/
|
||||
_setVisibility: function(button, visibility) {
|
||||
var groups = this.toolbar.all(GROUPS).slice(this.get(ATTRSHOWGROUPS));
|
||||
var secondaryRow = this.toolbar.all(ROWS).item(1);
|
||||
|
||||
if (visibility) {
|
||||
button.set('title', M.util.get_string('showfewer', PLUGINNAME));
|
||||
groups.show();
|
||||
secondaryRow.show();
|
||||
button.setData(COLLAPSED, false);
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
} else {
|
||||
button.set('title', M.util.get_string('showmore', PLUGINNAME));
|
||||
groups.hide();
|
||||
secondaryRow.hide();
|
||||
button.setData(COLLAPSED, true);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
// We don't want to have both aria-pressed and aria-expanded set. So we remove aria-pressed here.
|
||||
button.removeAttribute('aria-pressed');
|
||||
}
|
||||
}, {
|
||||
ATTRS: {
|
||||
|
@ -2282,7 +2282,13 @@ EditorToolbarNav.prototype = {
|
||||
var buttons = this.toolbar.all('button'),
|
||||
direction = 1,
|
||||
button,
|
||||
current = e.target.ancestor('button', true);
|
||||
current = e.target.ancestor('button', true),
|
||||
innerButtons = e.target.all('button');
|
||||
|
||||
// If we are not on a button and the element we are on contains some buttons, then move between the inner buttons.
|
||||
if (!current && innerButtons) {
|
||||
buttons = innerButtons;
|
||||
}
|
||||
|
||||
if (e.keyCode === 37) {
|
||||
// Moving left so reverse the direction.
|
||||
@ -2310,7 +2316,6 @@ EditorToolbarNav.prototype = {
|
||||
*/
|
||||
_findFirstFocusable: function(buttons, startAt, direction) {
|
||||
var checkCount = 0,
|
||||
group,
|
||||
candidate,
|
||||
button,
|
||||
index;
|
||||
@ -2340,12 +2345,8 @@ EditorToolbarNav.prototype = {
|
||||
// Loop while:
|
||||
// * we haven't checked every button;
|
||||
// * the button is hidden or disabled;
|
||||
// * the group is hidden.
|
||||
if (candidate.hasAttribute('hidden') || candidate.hasAttribute('disabled')) {
|
||||
continue;
|
||||
}
|
||||
group = candidate.ancestor('.atto_group');
|
||||
if (group.hasAttribute('hidden')) {
|
||||
// * the button is inside a hidden wrapper element.
|
||||
if (candidate.hasAttribute('hidden') || candidate.hasAttribute('disabled') || candidate.ancestor('[hidden]')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -2259,7 +2259,13 @@ EditorToolbarNav.prototype = {
|
||||
var buttons = this.toolbar.all('button'),
|
||||
direction = 1,
|
||||
button,
|
||||
current = e.target.ancestor('button', true);
|
||||
current = e.target.ancestor('button', true),
|
||||
innerButtons = e.target.all('button');
|
||||
|
||||
// If we are not on a button and the element we are on contains some buttons, then move between the inner buttons.
|
||||
if (!current && innerButtons) {
|
||||
buttons = innerButtons;
|
||||
}
|
||||
|
||||
if (e.keyCode === 37) {
|
||||
// Moving left so reverse the direction.
|
||||
@ -2286,7 +2292,6 @@ EditorToolbarNav.prototype = {
|
||||
*/
|
||||
_findFirstFocusable: function(buttons, startAt, direction) {
|
||||
var checkCount = 0,
|
||||
group,
|
||||
candidate,
|
||||
button,
|
||||
index;
|
||||
@ -2315,12 +2320,8 @@ EditorToolbarNav.prototype = {
|
||||
// Loop while:
|
||||
// * we haven't checked every button;
|
||||
// * the button is hidden or disabled;
|
||||
// * the group is hidden.
|
||||
if (candidate.hasAttribute('hidden') || candidate.hasAttribute('disabled')) {
|
||||
continue;
|
||||
}
|
||||
group = candidate.ancestor('.atto_group');
|
||||
if (group.hasAttribute('hidden')) {
|
||||
// * the button is inside a hidden wrapper element.
|
||||
if (candidate.hasAttribute('hidden') || candidate.hasAttribute('disabled') || candidate.ancestor('[hidden]')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -182,6 +182,7 @@ var MENUTEMPLATE = '' +
|
||||
'id="{{id}}" ' +
|
||||
'tabindex="-1" ' +
|
||||
'title="{{title}}" ' +
|
||||
'aria-label="{{title}}" ' +
|
||||
'aria-haspopup="true" ' +
|
||||
'aria-controls="{{id}}_menu">' +
|
||||
'<span class="editor_atto_menu_icon"></span>' +
|
||||
@ -363,8 +364,10 @@ EditorPluginButtons.prototype = {
|
||||
button = Y.Node.create('<button type="button" class="' + buttonClass + '"' +
|
||||
'tabindex="-1"></button>');
|
||||
button.setAttribute('title', title);
|
||||
button.setAttribute('aria-label', title);
|
||||
window.require(['core/templates'], function(Templates) {
|
||||
Templates.renderPix(config.icon, config.iconComponent, title).then(function(iconhtml) {
|
||||
// The button already has title and label, so no need to set them again on the icon.
|
||||
Templates.renderPix(config.icon, config.iconComponent, '').then(function(iconhtml) {
|
||||
button.append(iconhtml);
|
||||
});
|
||||
});
|
||||
@ -398,10 +401,12 @@ EditorPluginButtons.prototype = {
|
||||
|
||||
if (this._primaryKeyboardShortcut[buttonClass]) {
|
||||
// If we have a valid keyboard shortcut description, then set it with the title.
|
||||
button.setAttribute('title', M.util.get_string('plugin_title_shortcut', 'editor_atto', {
|
||||
title: title,
|
||||
shortcut: this._primaryKeyboardShortcut[buttonClass]
|
||||
}));
|
||||
title = M.util.get_string('plugin_title_shortcut', 'editor_atto', {
|
||||
title: title,
|
||||
shortcut: this._primaryKeyboardShortcut[buttonClass]
|
||||
});
|
||||
button.setAttribute('title', title);
|
||||
button.setAttribute('aria-label', title);
|
||||
}
|
||||
}
|
||||
|
||||
@ -542,7 +547,8 @@ EditorPluginButtons.prototype = {
|
||||
config.buttonId = id;
|
||||
|
||||
window.require(['core/templates'], function(Templates) {
|
||||
Templates.renderPix(config.icon, config.iconComponent, title).then(function(iconhtml) {
|
||||
// The button already has title and label, so no need to set them again on the icon.
|
||||
Templates.renderPix(config.icon, config.iconComponent, '').then(function(iconhtml) {
|
||||
button.one(CSS.MENUICON).append(iconhtml);
|
||||
});
|
||||
Templates.renderPix('t/expanded', 'core', '').then(function(iconhtml) {
|
||||
@ -1035,11 +1041,13 @@ EditorPluginButtons.prototype = {
|
||||
if (button) {
|
||||
if (this.buttons[button]) {
|
||||
this.buttons[button][method](HIGHLIGHT);
|
||||
this.buttons[button].setAttribute('aria-pressed', highlight ? 'true' : 'false');
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}
|
||||
} else {
|
||||
Y.Object.each(this.buttons, function(button) {
|
||||
button[method](HIGHLIGHT);
|
||||
button.setAttribute('aria-pressed', highlight ? 'true' : 'false');
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}, this);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -182,6 +182,7 @@ var MENUTEMPLATE = '' +
|
||||
'id="{{id}}" ' +
|
||||
'tabindex="-1" ' +
|
||||
'title="{{title}}" ' +
|
||||
'aria-label="{{title}}" ' +
|
||||
'aria-haspopup="true" ' +
|
||||
'aria-controls="{{id}}_menu">' +
|
||||
'<span class="editor_atto_menu_icon"></span>' +
|
||||
@ -363,8 +364,10 @@ EditorPluginButtons.prototype = {
|
||||
button = Y.Node.create('<button type="button" class="' + buttonClass + '"' +
|
||||
'tabindex="-1"></button>');
|
||||
button.setAttribute('title', title);
|
||||
button.setAttribute('aria-label', title);
|
||||
window.require(['core/templates'], function(Templates) {
|
||||
Templates.renderPix(config.icon, config.iconComponent, title).then(function(iconhtml) {
|
||||
// The button already has title and label, so no need to set them again on the icon.
|
||||
Templates.renderPix(config.icon, config.iconComponent, '').then(function(iconhtml) {
|
||||
button.append(iconhtml);
|
||||
});
|
||||
});
|
||||
@ -398,10 +401,12 @@ EditorPluginButtons.prototype = {
|
||||
|
||||
if (this._primaryKeyboardShortcut[buttonClass]) {
|
||||
// If we have a valid keyboard shortcut description, then set it with the title.
|
||||
button.setAttribute('title', M.util.get_string('plugin_title_shortcut', 'editor_atto', {
|
||||
title: title,
|
||||
shortcut: this._primaryKeyboardShortcut[buttonClass]
|
||||
}));
|
||||
title = M.util.get_string('plugin_title_shortcut', 'editor_atto', {
|
||||
title: title,
|
||||
shortcut: this._primaryKeyboardShortcut[buttonClass]
|
||||
});
|
||||
button.setAttribute('title', title);
|
||||
button.setAttribute('aria-label', title);
|
||||
}
|
||||
}
|
||||
|
||||
@ -540,7 +545,8 @@ EditorPluginButtons.prototype = {
|
||||
config.buttonId = id;
|
||||
|
||||
window.require(['core/templates'], function(Templates) {
|
||||
Templates.renderPix(config.icon, config.iconComponent, title).then(function(iconhtml) {
|
||||
// The button already has title and label, so no need to set them again on the icon.
|
||||
Templates.renderPix(config.icon, config.iconComponent, '').then(function(iconhtml) {
|
||||
button.one(CSS.MENUICON).append(iconhtml);
|
||||
});
|
||||
Templates.renderPix('t/expanded', 'core', '').then(function(iconhtml) {
|
||||
@ -1031,11 +1037,13 @@ EditorPluginButtons.prototype = {
|
||||
if (button) {
|
||||
if (this.buttons[button]) {
|
||||
this.buttons[button][method](HIGHLIGHT);
|
||||
this.buttons[button].setAttribute('aria-pressed', highlight ? 'true' : 'false');
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}
|
||||
} else {
|
||||
Y.Object.each(this.buttons, function(button) {
|
||||
button[method](HIGHLIGHT);
|
||||
button.setAttribute('aria-pressed', highlight ? 'true' : 'false');
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}, this);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ var MENUTEMPLATE = '' +
|
||||
'id="{{id}}" ' +
|
||||
'tabindex="-1" ' +
|
||||
'title="{{title}}" ' +
|
||||
'aria-label="{{title}}" ' +
|
||||
'aria-haspopup="true" ' +
|
||||
'aria-controls="{{id}}_menu">' +
|
||||
'<span class="editor_atto_menu_icon"></span>' +
|
||||
@ -213,8 +214,10 @@ EditorPluginButtons.prototype = {
|
||||
button = Y.Node.create('<button type="button" class="' + buttonClass + '"' +
|
||||
'tabindex="-1"></button>');
|
||||
button.setAttribute('title', title);
|
||||
button.setAttribute('aria-label', title);
|
||||
window.require(['core/templates'], function(Templates) {
|
||||
Templates.renderPix(config.icon, config.iconComponent, title).then(function(iconhtml) {
|
||||
// The button already has title and label, so no need to set them again on the icon.
|
||||
Templates.renderPix(config.icon, config.iconComponent, '').then(function(iconhtml) {
|
||||
button.append(iconhtml);
|
||||
});
|
||||
});
|
||||
@ -248,10 +251,12 @@ EditorPluginButtons.prototype = {
|
||||
|
||||
if (this._primaryKeyboardShortcut[buttonClass]) {
|
||||
// If we have a valid keyboard shortcut description, then set it with the title.
|
||||
button.setAttribute('title', M.util.get_string('plugin_title_shortcut', 'editor_atto', {
|
||||
title: title,
|
||||
shortcut: this._primaryKeyboardShortcut[buttonClass]
|
||||
}));
|
||||
title = M.util.get_string('plugin_title_shortcut', 'editor_atto', {
|
||||
title: title,
|
||||
shortcut: this._primaryKeyboardShortcut[buttonClass]
|
||||
});
|
||||
button.setAttribute('title', title);
|
||||
button.setAttribute('aria-label', title);
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,7 +397,8 @@ EditorPluginButtons.prototype = {
|
||||
config.buttonId = id;
|
||||
|
||||
window.require(['core/templates'], function(Templates) {
|
||||
Templates.renderPix(config.icon, config.iconComponent, title).then(function(iconhtml) {
|
||||
// The button already has title and label, so no need to set them again on the icon.
|
||||
Templates.renderPix(config.icon, config.iconComponent, '').then(function(iconhtml) {
|
||||
button.one(CSS.MENUICON).append(iconhtml);
|
||||
});
|
||||
Templates.renderPix('t/expanded', 'core', '').then(function(iconhtml) {
|
||||
@ -885,11 +891,13 @@ EditorPluginButtons.prototype = {
|
||||
if (button) {
|
||||
if (this.buttons[button]) {
|
||||
this.buttons[button][method](HIGHLIGHT);
|
||||
this.buttons[button].setAttribute('aria-pressed', highlight ? 'true' : 'false');
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}
|
||||
} else {
|
||||
Y.Object.each(this.buttons, function(button) {
|
||||
button[method](HIGHLIGHT);
|
||||
button.setAttribute('aria-pressed', highlight ? 'true' : 'false');
|
||||
this._buttonHighlightToggled(button, highlight);
|
||||
}, this);
|
||||
}
|
||||
|
@ -78,7 +78,13 @@ EditorToolbarNav.prototype = {
|
||||
var buttons = this.toolbar.all('button'),
|
||||
direction = 1,
|
||||
button,
|
||||
current = e.target.ancestor('button', true);
|
||||
current = e.target.ancestor('button', true),
|
||||
innerButtons = e.target.all('button');
|
||||
|
||||
// If we are not on a button and the element we are on contains some buttons, then move between the inner buttons.
|
||||
if (!current && innerButtons) {
|
||||
buttons = innerButtons;
|
||||
}
|
||||
|
||||
if (e.keyCode === 37) {
|
||||
// Moving left so reverse the direction.
|
||||
@ -106,7 +112,6 @@ EditorToolbarNav.prototype = {
|
||||
*/
|
||||
_findFirstFocusable: function(buttons, startAt, direction) {
|
||||
var checkCount = 0,
|
||||
group,
|
||||
candidate,
|
||||
button,
|
||||
index;
|
||||
@ -136,12 +141,8 @@ EditorToolbarNav.prototype = {
|
||||
// Loop while:
|
||||
// * we haven't checked every button;
|
||||
// * the button is hidden or disabled;
|
||||
// * the group is hidden.
|
||||
if (candidate.hasAttribute('hidden') || candidate.hasAttribute('disabled')) {
|
||||
continue;
|
||||
}
|
||||
group = candidate.ancestor('.atto_group');
|
||||
if (group.hasAttribute('hidden')) {
|
||||
// * the button is inside a hidden wrapper element.
|
||||
if (candidate.hasAttribute('hidden') || candidate.hasAttribute('disabled') || candidate.ancestor('[hidden]')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,14 @@ div.editor_atto_toolbar div.atto_group {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
div.editor_atto_toolbar .atto_toolbar_row {
|
||||
margin: 6px 0 -3px 5px;
|
||||
display: table;
|
||||
div.atto_group {
|
||||
margin: 3px 5px 3px 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.editor_atto_content img {
|
||||
resize: both;
|
||||
overflow: auto;
|
||||
|
@ -159,6 +159,7 @@ a:not([class]),
|
||||
.btn-link,
|
||||
.nav-link,
|
||||
.editor_atto_toolbar button,
|
||||
.editor_atto_toolbar .atto_toolbar_row,
|
||||
[role="button"],
|
||||
.list-group-item-action,
|
||||
input[type="checkbox"],
|
||||
|
@ -9786,6 +9786,8 @@ a:not([class]):focus:hover,
|
||||
.nav-link:focus,
|
||||
.editor_atto_toolbar button.focus,
|
||||
.editor_atto_toolbar button:focus,
|
||||
.editor_atto_toolbar .atto_toolbar_row.focus,
|
||||
.editor_atto_toolbar .atto_toolbar_row:focus,
|
||||
[role="button"].focus,
|
||||
[role="button"]:focus,
|
||||
.list-group-item-action.focus,
|
||||
@ -9817,6 +9819,7 @@ button.close:focus,
|
||||
.btn-link:focus:hover,
|
||||
.nav-link:focus:hover,
|
||||
.editor_atto_toolbar button:focus:hover,
|
||||
.editor_atto_toolbar .atto_toolbar_row:focus:hover,
|
||||
[role="button"]:focus:hover,
|
||||
.list-group-item-action:focus:hover,
|
||||
input[type="checkbox"]:focus:hover,
|
||||
@ -19677,6 +19680,12 @@ div.editor_atto_toolbar div.atto_group {
|
||||
margin: 9px 0 0 9px;
|
||||
background: #fff; }
|
||||
|
||||
div.editor_atto_toolbar .atto_toolbar_row {
|
||||
margin: 6px 0 -3px 5px;
|
||||
display: table; }
|
||||
div.editor_atto_toolbar .atto_toolbar_row div.atto_group {
|
||||
margin: 3px 5px 3px 4px; }
|
||||
|
||||
.editor_atto_content img {
|
||||
resize: both;
|
||||
overflow: auto; }
|
||||
|
@ -9998,6 +9998,8 @@ a:not([class]):focus:hover,
|
||||
.nav-link:focus,
|
||||
.editor_atto_toolbar button.focus,
|
||||
.editor_atto_toolbar button:focus,
|
||||
.editor_atto_toolbar .atto_toolbar_row.focus,
|
||||
.editor_atto_toolbar .atto_toolbar_row:focus,
|
||||
[role="button"].focus,
|
||||
[role="button"]:focus,
|
||||
.list-group-item-action.focus,
|
||||
@ -10029,6 +10031,7 @@ button.close:focus,
|
||||
.btn-link:focus:hover,
|
||||
.nav-link:focus:hover,
|
||||
.editor_atto_toolbar button:focus:hover,
|
||||
.editor_atto_toolbar .atto_toolbar_row:focus:hover,
|
||||
[role="button"]:focus:hover,
|
||||
.list-group-item-action:focus:hover,
|
||||
input[type="checkbox"]:focus:hover,
|
||||
@ -19867,6 +19870,12 @@ div.editor_atto_toolbar div.atto_group {
|
||||
margin: 9px 0 0 9px;
|
||||
background: #fff; }
|
||||
|
||||
div.editor_atto_toolbar .atto_toolbar_row {
|
||||
margin: 6px 0 -3px 5px;
|
||||
display: table; }
|
||||
div.editor_atto_toolbar .atto_toolbar_row div.atto_group {
|
||||
margin: 3px 5px 3px 4px; }
|
||||
|
||||
.editor_atto_content img {
|
||||
resize: both;
|
||||
overflow: auto; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user