Revert "Merge branch 'MDL-46917-27' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE"

This reverts commit 439f2e7e83, reversing
changes made to b523d5bc33.
This commit is contained in:
Damyon Wiese
2014-08-26 17:20:41 +08:00
parent 767dfb307d
commit 22290d726a
8 changed files with 25 additions and 172 deletions
@@ -64,9 +64,7 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
* @private
*/
_showHTML: function() {
var host = this.get('host'),
textareaLabel = host.textareaLabel;
var host = this.get('host');
if (!this.get('isHTML')) {
// Unhighlight icon.
this.unHighlightButtons('html');
@@ -81,11 +79,6 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
host.textarea.hide();
this.editor.show();
if (textareaLabel) {
// Update the textarea label.
textareaLabel.setAttribute('for', this.editor.getAttribute('id'));
}
// Focus on the editor.
host.focus();
@@ -116,10 +109,6 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.editor.hide();
host.textarea.show();
if (textareaLabel) {
// Update the textarea label.
textareaLabel.setAttribute('for', host.textarea.getAttribute('id'));
}
// Focus on the textarea.
host.textarea.focus();
@@ -1 +1 @@
YUI.add("moodle-atto_html-button",function(e,t){e.namespace("M.atto_html").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/source_code",callback:this._toggleHTML})},_toggleHTML:function(){this.set("isHTML",!this.get("isHTML")),this._showHTML()},_showHTML:function(){var e=this.get("host"),t=e.textareaLabel;this.get("isHTML")?(this.highlightButtons("html"),e.disablePlugins(),e.enablePlugins(this.name),e.updateOriginal(),e.textarea.setStyles({width:this.editor.getComputedStyle("width"),height:this.editor.getComputedStyle("height"),margin:this.editor.getComputedStyle("margin"),padding:this.editor.getComputedStyle("padding")}),this.editor.hide(),e.textarea.show(),t&&t.setAttribute("for",e.textarea.getAttribute("id")),e.textarea.focus()):(this.unHighlightButtons("html"),e.enablePlugins(),e.updateFromTextArea(),e.textarea.hide(),this.editor.show(),t&&t.setAttribute("for",this.editor.getAttribute("id")),e.focus(),this.markUpdated())}},{ATTRS:{isHTML:{value:!1}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","event-valuechange"]});
YUI.add("moodle-atto_html-button",function(e,t){e.namespace("M.atto_html").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/source_code",callback:this._toggleHTML})},_toggleHTML:function(){this.set("isHTML",!this.get("isHTML")),this._showHTML()},_showHTML:function(){var e=this.get("host");this.get("isHTML")?(this.highlightButtons("html"),e.disablePlugins(),e.enablePlugins(this.name),e.updateOriginal(),e.textarea.setStyles({width:this.editor.getComputedStyle("width"),height:this.editor.getComputedStyle("height"),margin:this.editor.getComputedStyle("margin"),padding:this.editor.getComputedStyle("padding")}),this.editor.hide(),e.textarea.show(),e.textarea.focus()):(this.unHighlightButtons("html"),e.enablePlugins(),e.updateFromTextArea(),e.textarea.hide(),this.editor.show(),e.focus(),this.markUpdated())}},{ATTRS:{isHTML:{value:!1}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","event-valuechange"]});
@@ -64,9 +64,7 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
* @private
*/
_showHTML: function() {
var host = this.get('host'),
textareaLabel = host.textareaLabel;
var host = this.get('host');
if (!this.get('isHTML')) {
// Unhighlight icon.
this.unHighlightButtons('html');
@@ -81,11 +79,6 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
host.textarea.hide();
this.editor.show();
if (textareaLabel) {
// Update the textarea label.
textareaLabel.setAttribute('for', this.editor.getAttribute('id'));
}
// Focus on the editor.
host.focus();
@@ -116,10 +109,6 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.editor.hide();
host.textarea.show();
if (textareaLabel) {
// Update the textarea label.
textareaLabel.setAttribute('for', host.textarea.getAttribute('id'));
}
// Focus on the textarea.
host.textarea.focus();
+1 -12
View File
@@ -62,9 +62,7 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
* @private
*/
_showHTML: function() {
var host = this.get('host'),
textareaLabel = host.textareaLabel;
var host = this.get('host');
if (!this.get('isHTML')) {
// Unhighlight icon.
this.unHighlightButtons('html');
@@ -79,11 +77,6 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
host.textarea.hide();
this.editor.show();
if (textareaLabel) {
// Update the textarea label.
textareaLabel.setAttribute('for', this.editor.getAttribute('id'));
}
// Focus on the editor.
host.focus();
@@ -114,10 +107,6 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.editor.hide();
host.textarea.show();
if (textareaLabel) {
// Update the textarea label.
textareaLabel.setAttribute('for', host.textarea.getAttribute('id'));
}
// Focus on the textarea.
host.textarea.focus();
@@ -185,8 +185,12 @@ Y.extend(Editor, Y.Base, {
CSS: CSS
}));
// Setup the labels and ARIA labelledby.
this._setupLabelling();
// Add a labelled-by attribute to the contenteditable.
this.textareaLabel = Y.one('[for="' + this.get('elementid') + '"]');
if (this.textareaLabel) {
this.textareaLabel.generateID();
this.editor.setAttribute('aria-labelledby', this.textareaLabel.get("id"));
}
// Add everything to the wrapper.
this.setupToolbar();
@@ -368,48 +372,6 @@ Y.extend(Editor, Y.Base, {
*/
_registerEventHandle: function(handle) {
this._eventHandles.push(handle);
},
/**
* Setup editor labelling. This includes the aria-labelledby attribute
* too.
*
* @method _setupLabelling
* @chainable
* @private
*/
_setupLabelling: function() {
// Copy the ARIA labelledby attribute from the textarea.
var labelledby = this.textarea.getAttribute('aria-labelledby'),
labels = [];
if (labelledby) {
// The original textarea has a labelledby field, convert the list of IDs into a list.
labels = labelledby.split(' ');
}
// Search for any labels for the original textarea.
this.textareaLabel = Y.one('[for="' + this.get('elementid') + '"]');
if (this.textareaLabel) {
// Ensure that the label has an ID.
this.textareaLabel.generateID();
// Add the label to the list of labels. It may be there already, but we can dedupe the list.
labels.push(this.textareaLabel.get('id'));
// Update the label to point to the Atto editor instead of the original textarea.
this.textareaLabel.setAttribute('for', this.editor.getAttribute('id'));
// Register an event handle for the label - labels don't normally focus on non-input elements so we must add
// a click handler.
// If something changes what the label is for (e.g. an HTML plugin), then this will cease to match and
// standard browser behaviour will resume.
this._registerEventHandle(Y.delegate('click', this.focus,
Y.config.doc.body, '[for="' + this.editor.getAttribute('id') + '"]', this));
}
// Add the list of labelling attributes to the atto editor.
this.editor.setAttribute('aria-labelledby', Y.Array.unique(labels).join(' '));
}
}, {
File diff suppressed because one or more lines are too long
@@ -183,8 +183,12 @@ Y.extend(Editor, Y.Base, {
CSS: CSS
}));
// Setup the labels and ARIA labelledby.
this._setupLabelling();
// Add a labelled-by attribute to the contenteditable.
this.textareaLabel = Y.one('[for="' + this.get('elementid') + '"]');
if (this.textareaLabel) {
this.textareaLabel.generateID();
this.editor.setAttribute('aria-labelledby', this.textareaLabel.get("id"));
}
// Add everything to the wrapper.
this.setupToolbar();
@@ -365,48 +369,6 @@ Y.extend(Editor, Y.Base, {
*/
_registerEventHandle: function(handle) {
this._eventHandles.push(handle);
},
/**
* Setup editor labelling. This includes the aria-labelledby attribute
* too.
*
* @method _setupLabelling
* @chainable
* @private
*/
_setupLabelling: function() {
// Copy the ARIA labelledby attribute from the textarea.
var labelledby = this.textarea.getAttribute('aria-labelledby'),
labels = [];
if (labelledby) {
// The original textarea has a labelledby field, convert the list of IDs into a list.
labels = labelledby.split(' ');
}
// Search for any labels for the original textarea.
this.textareaLabel = Y.one('[for="' + this.get('elementid') + '"]');
if (this.textareaLabel) {
// Ensure that the label has an ID.
this.textareaLabel.generateID();
// Add the label to the list of labels. It may be there already, but we can dedupe the list.
labels.push(this.textareaLabel.get('id'));
// Update the label to point to the Atto editor instead of the original textarea.
this.textareaLabel.setAttribute('for', this.editor.getAttribute('id'));
// Register an event handle for the label - labels don't normally focus on non-input elements so we must add
// a click handler.
// If something changes what the label is for (e.g. an HTML plugin), then this will cease to match and
// standard browser behaviour will resume.
this._registerEventHandle(Y.delegate('click', this.focus,
Y.config.doc.body, '[for="' + this.editor.getAttribute('id') + '"]', this));
}
// Add the list of labelling attributes to the atto editor.
this.editor.setAttribute('aria-labelledby', Y.Array.unique(labels).join(' '));
}
}, {
+6 -44
View File
@@ -183,8 +183,12 @@ Y.extend(Editor, Y.Base, {
CSS: CSS
}));
// Setup the labels and ARIA labelledby.
this._setupLabelling();
// Add a labelled-by attribute to the contenteditable.
this.textareaLabel = Y.one('[for="' + this.get('elementid') + '"]');
if (this.textareaLabel) {
this.textareaLabel.generateID();
this.editor.setAttribute('aria-labelledby', this.textareaLabel.get("id"));
}
// Add everything to the wrapper.
this.setupToolbar();
@@ -366,48 +370,6 @@ Y.extend(Editor, Y.Base, {
*/
_registerEventHandle: function(handle) {
this._eventHandles.push(handle);
},
/**
* Setup editor labelling. This includes the aria-labelledby attribute
* too.
*
* @method _setupLabelling
* @chainable
* @private
*/
_setupLabelling: function() {
// Copy the ARIA labelledby attribute from the textarea.
var labelledby = this.textarea.getAttribute('aria-labelledby'),
labels = [];
if (labelledby) {
// The original textarea has a labelledby field, convert the list of IDs into a list.
labels = labelledby.split(' ');
}
// Search for any labels for the original textarea.
this.textareaLabel = Y.one('[for="' + this.get('elementid') + '"]');
if (this.textareaLabel) {
// Ensure that the label has an ID.
this.textareaLabel.generateID();
// Add the label to the list of labels. It may be there already, but we can dedupe the list.
labels.push(this.textareaLabel.get('id'));
// Update the label to point to the Atto editor instead of the original textarea.
this.textareaLabel.setAttribute('for', this.editor.getAttribute('id'));
// Register an event handle for the label - labels don't normally focus on non-input elements so we must add
// a click handler.
// If something changes what the label is for (e.g. an HTML plugin), then this will cease to match and
// standard browser behaviour will resume.
this._registerEventHandle(Y.delegate('click', this.focus,
Y.config.doc.body, '[for="' + this.editor.getAttribute('id') + '"]', this));
}
// Add the list of labelling attributes to the atto editor.
this.editor.setAttribute('aria-labelledby', Y.Array.unique(labels).join(' '));
}
}, {