Merge branch 'MDL-48467-28' of git://github.com/merrill-oakland/moodle into MOODLE_28_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2015-05-19 01:33:14 +02:00
4 changed files with 67 additions and 4 deletions
@@ -39,6 +39,12 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
icon: 'e/source_code',
callback: this._toggleHTML
});
// Attach a submit listener to the form.
var form = this.get('host').textarea.ancestor('form');
if (form) {
form.on('submit', this._submitClean, this);
}
},
/**
@@ -109,10 +115,25 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.editor.hide();
host.textarea.show();
// Focus on the textarea.
host.textarea.focus();
}
},
/**
* Run the textarea content through the HTML scrubber if it was form submitted in HTML mode.
*
* @method _submitClean
* @private
*/
_submitClean: function() {
// If we are in HTML mode, clean the text area.
if (this.get('isHTML')) {
var host = this.get('host');
// Update the editor from text area then textarea from editor. This ensures all proper cleaning happens.
host.updateFromTextArea();
host.updateOriginal();
}
}
}, {
ATTRS: {
@@ -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");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"]});
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});var e=this.get("host").textarea.ancestor("form");e&&e.on("submit",this._submitClean,this)},_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())},_submitClean:function(){if(this.get("isHTML")){var e=this.get("host");e.updateFromTextArea(),e.updateOriginal()}}},{ATTRS:{isHTML:{value:!1}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","event-valuechange"]});
@@ -39,6 +39,12 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
icon: 'e/source_code',
callback: this._toggleHTML
});
// Attach a submit listener to the form.
var form = this.get('host').textarea.ancestor('form');
if (form) {
form.on('submit', this._submitClean, this);
}
},
/**
@@ -109,10 +115,25 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.editor.hide();
host.textarea.show();
// Focus on the textarea.
host.textarea.focus();
}
},
/**
* Run the textarea content through the HTML scrubber if it was form submitted in HTML mode.
*
* @method _submitClean
* @private
*/
_submitClean: function() {
// If we are in HTML mode, clean the text area.
if (this.get('isHTML')) {
var host = this.get('host');
// Update the editor from text area then textarea from editor. This ensures all proper cleaning happens.
host.updateFromTextArea();
host.updateOriginal();
}
}
}, {
ATTRS: {
+22 -1
View File
@@ -37,6 +37,12 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
icon: 'e/source_code',
callback: this._toggleHTML
});
// Attach a submit listener to the form.
var form = this.get('host').textarea.ancestor('form');
if (form) {
form.on('submit', this._submitClean, this);
}
},
/**
@@ -107,10 +113,25 @@ Y.namespace('M.atto_html').Button = Y.Base.create('button', Y.M.editor_atto.Edit
this.editor.hide();
host.textarea.show();
// Focus on the textarea.
host.textarea.focus();
}
},
/**
* Run the textarea content through the HTML scrubber if it was form submitted in HTML mode.
*
* @method _submitClean
* @private
*/
_submitClean: function() {
// If we are in HTML mode, clean the text area.
if (this.get('isHTML')) {
var host = this.get('host');
// Update the editor from text area then textarea from editor. This ensures all proper cleaning happens.
host.updateFromTextArea();
host.updateOriginal();
}
}
}, {
ATTRS: {