Browse Source

Adjust export template command

pull/261/head
Artur Arseniev 9 years ago
parent
commit
1dde7a3450
  1. 5
      src/code_manager/model/CssGenerator.js
  2. 28
      src/commands/view/ExportTemplate.js
  3. 4
      src/editor/model/Editor.js

5
src/code_manager/model/CssGenerator.js

@ -58,13 +58,14 @@ module.exports = Backbone.Model.extend({
},
/** @inheritdoc */
build(model, cssc) {
build(model, opts = {}) {
const cssc = opts.cssc;
this.compCls = [];
var code = this.buildFromModel(model);
code += this.buildFromComp(model);
var compCls = this.compCls;
if(cssc){
if (cssc) {
var rules = cssc.getAll();
var mediaRules = {};
rules.each(function(rule) {

28
src/commands/view/ExportTemplate.js

@ -25,18 +25,18 @@ module.exports = {
if(!this.codeMirror)
this.codeMirror = this.cm.getViewer('CodeMirror');
var $input = $('<textarea>'),
var $input = $('<textarea>'),
editor = this.codeMirror.clone().set({
editor = this.codeMirror.clone().set({
label,
codeName,
theme,
input : $input[0],
input: $input[0],
}),
$editor = new this.cm.EditorView({
model : editor,
config : this.cm.getConfig()
$editor = new this.cm.EditorView({
model: editor,
config: this.cm.getConfig()
}).render().$el;
editor.init( $input[0] );
@ -46,11 +46,11 @@ module.exports = {
enable() {
if(!this.$editors){
var oHtmlEd = this.buildEditor('htmlmixed', 'hopscotch', 'HTML'),
oCsslEd = this.buildEditor('css', 'hopscotch', 'CSS');
this.htmlEditor = oHtmlEd.el;
this.cssEditor = oCsslEd.el;
this.$editors = $('<div>', {class: this.pfx + 'export-dl'});
var oHtmlEd = this.buildEditor('htmlmixed', 'hopscotch', 'HTML');
var oCsslEd = this.buildEditor('css', 'hopscotch', 'CSS');
this.htmlEditor = oHtmlEd.el;
this.cssEditor = oCsslEd.el;
this.$editors = $('<div>', {class: this.pfx + 'export-dl'});
this.$editors.append(oHtmlEd.$el).append(oCsslEd.$el);
}
@ -59,10 +59,10 @@ module.exports = {
this.modal.setContent(this.$editors);
this.modal.open();
}
const em = this.em;
var addCss = this.protCss || '';
//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));
this.htmlEditor.setContent(em.getHtml());
this.cssEditor.setContent(em.getCss());
if(this.sender)
this.sender.set('active',false);

4
src/editor/model/Editor.js

@ -428,7 +428,9 @@ module.exports = Backbone.Model.extend({
var wrp = this.get('DomComponents').getComponent();
var protCss = this.config.protectedCss;
return protCss + this.get('CodeManager').getCode(wrp, 'css', cssc);
return protCss + this.get('CodeManager').getCode(wrp, 'css', {
cssc
});
},
/**

Loading…
Cancel
Save