diff --git a/src/code_manager/model/JsGenerator.js b/src/code_manager/model/JsGenerator.js
index e238bff53..5c3420261 100644
--- a/src/code_manager/model/JsGenerator.js
+++ b/src/code_manager/model/JsGenerator.js
@@ -16,7 +16,6 @@ define(['backbone'], function (Backbone) {
var attr = model.get('attributes');
attr = _.extend({}, attr, {id: id});
model.set('attributes', attr);
- // TODO put above html code or i will not see model changes
var scrStr = 'function(){' + script + '}';
scrStr = typeof script == 'function' ? script.toString() : scrStr;
diff --git a/src/commands/view/ExportTemplate.js b/src/commands/view/ExportTemplate.js
index 8e9313c24..12c9b7223 100644
--- a/src/commands/view/ExportTemplate.js
+++ b/src/commands/view/ExportTemplate.js
@@ -65,8 +65,9 @@ define(function() {
this.modal.open();
}
var addCss = this.protCss || '';
- this.htmlEditor.setContent(this.cm.getCode(this.components, 'html', this.cssc));
- this.cssEditor.setContent(addCss + this.cm.getCode(this.wrapper, 'css', this.cssc));
+ //this.htmlEditor.setContent(this.cm.getCode(this.components, 'html', this.cssc));
+ this.htmlEditor.setContent(this.em.getHtml());
+ this.cssEditor.setContent(addCss + this.cm.getCode(this.wrapper, 'css', this.cssc));
if(this.sender)
this.sender.set('active',false);
diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js
index 052559d9f..58e892ffc 100644
--- a/src/editor/model/Editor.js
+++ b/src/editor/model/Editor.js
@@ -362,14 +362,10 @@ define(['backbone', 'backboneUndo', 'keymaster', 'Utils', 'StorageManager', 'Dev
* @private
*/
getHtml: function() {
+ var js = this.config.jsInHtml ? this.getJs() : '';
var wrp = this.get('DomComponents').getComponent();
var html = this.get('CodeManager').getCode(wrp, 'html');
-
- if (this.config.jsInHtml) {
- var js = this.getJs().trim();
- html += js ? '' : '';
- }
-
+ html += js ? '' : '';
return html;
},
@@ -393,7 +389,7 @@ define(['backbone', 'backboneUndo', 'keymaster', 'Utils', 'StorageManager', 'Dev
*/
getJs: function() {
var wrp = this.get('DomComponents').getWrapper();
- return this.get('CodeManager').getCode(wrp, 'js');
+ return this.get('CodeManager').getCode(wrp, 'js').trim();
},
/**