| 1 |
efrain |
1 |
// This file is part of Moodle - http://moodle.org/
|
|
|
2 |
//
|
|
|
3 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
4 |
// it under the terms of the GNU General Public License as published by
|
|
|
5 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
6 |
// (at your option) any later version.
|
|
|
7 |
//
|
|
|
8 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
9 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
10 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
11 |
// GNU General Public License for more details.
|
|
|
12 |
//
|
|
|
13 |
// You should have received a copy of the GNU General Public License
|
|
|
14 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* @module moodle-editor_atto-editor
|
|
|
18 |
* @submodule toolbar
|
|
|
19 |
*/
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* Toolbar functions for the Atto editor.
|
|
|
23 |
*
|
|
|
24 |
* See {{#crossLink "M.editor_atto.Editor"}}{{/crossLink}} for details.
|
|
|
25 |
*
|
|
|
26 |
* @namespace M.editor_atto
|
|
|
27 |
* @class EditorToolbar
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
function EditorToolbar() {}
|
|
|
31 |
|
|
|
32 |
EditorToolbar.ATTRS = {
|
|
|
33 |
};
|
|
|
34 |
|
|
|
35 |
EditorToolbar.prototype = {
|
|
|
36 |
/**
|
|
|
37 |
* A reference to the toolbar Node.
|
|
|
38 |
*
|
|
|
39 |
* @property toolbar
|
|
|
40 |
* @type Node
|
|
|
41 |
*/
|
|
|
42 |
toolbar: null,
|
|
|
43 |
|
|
|
44 |
/**
|
|
|
45 |
* A reference to any currently open menus in the toolbar.
|
|
|
46 |
*
|
|
|
47 |
* @property openMenus
|
|
|
48 |
* @type Array
|
|
|
49 |
*/
|
|
|
50 |
openMenus: null,
|
|
|
51 |
|
|
|
52 |
/**
|
|
|
53 |
* Setup the toolbar on the editor.
|
|
|
54 |
*
|
|
|
55 |
* @method setupToolbar
|
|
|
56 |
* @chainable
|
|
|
57 |
*/
|
|
|
58 |
setupToolbar: function() {
|
|
|
59 |
this.toolbar = Y.Node.create('<div class="' + CSS.TOOLBAR + '" role="toolbar" aria-live="off"/>');
|
|
|
60 |
this.openMenus = [];
|
|
|
61 |
this._wrapper.appendChild(this.toolbar);
|
|
|
62 |
|
|
|
63 |
if (this.textareaLabel) {
|
|
|
64 |
this.toolbar.setAttribute('aria-labelledby', this.textareaLabel.get("id"));
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
// Add keyboard navigation for the toolbar.
|
|
|
68 |
this.setupToolbarNavigation();
|
|
|
69 |
|
|
|
70 |
return this;
|
|
|
71 |
}
|
|
|
72 |
};
|
|
|
73 |
|
|
|
74 |
Y.Base.mix(Y.M.editor_atto.Editor, [EditorToolbar]);
|