[FIX] web_editor: html widget: escape value before save.

This commit is contained in:
Christophe Matthieu
2015-09-01 09:23:24 +02:00
parent a223111b92
commit 3d00c210f9
+9 -1
View File
@@ -307,7 +307,15 @@ var FieldTextHtml = widget.extend({
return this.editor.save();
} else if (this._dirty_flag && this.editor && this.editor.buildingBlock) {
this.editor.buildingBlock.clean_for_save();
this.internal_set_value( this.$content.html() );
// escape text nodes for xml saving
var $escaped_el = this.$content.clone();
$escaped_el.find('*').addBack().not('script,style').contents().each(function(){
if(this.nodeType == 3) {
this.nodeValue = _.escape(this.nodeValue);
}
});
this.internal_set_value( $escaped_el.html() );
}
},
destroy: function () {