Browse Source

Show JS inside Export Panel

pull/67/head
Artur Arseniev 9 years ago
parent
commit
8b9c3a760f
  1. 1
      src/code_manager/model/JsGenerator.js
  2. 5
      src/commands/view/ExportTemplate.js
  3. 10
      src/editor/model/Editor.js

1
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;

5
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);

10
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 ? '<script>'+ js +'</script>' : '';
}
html += js ? '<script>'+ js +'</script>' : '';
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();
},
/**

Loading…
Cancel
Save