From e65cd055e0a002751d55dcb5fedfa996d471b1ad Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Tue, 5 Jul 2016 14:30:16 +0200 Subject: [PATCH] Add protected css to the code viewer --- src/commands/view/ExportTemplate.js | 13 +++++++------ src/editor/config/config.js | 2 +- src/editor/main.js | 5 +++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/commands/view/ExportTemplate.js b/src/commands/view/ExportTemplate.js index fdf7ebffe..22fa33e1a 100644 --- a/src/commands/view/ExportTemplate.js +++ b/src/commands/view/ExportTemplate.js @@ -6,11 +6,12 @@ define(function() { return { run: function(editor, sender){ - this.sender = sender; - this.components = editor.Canvas.getWrapper().get('components'); - this.modal = editor.Dialog || null; - this.cm = editor.CodeManager || null; + this.sender = sender; + this.components = editor.DomComponents.getComponents(); + this.modal = editor.Dialog || null; + this.cm = editor.CodeManager || null; this.cssc = editor.CssComposer || null; + this.protCss = editor.Config.protectedCss; this.enable(); }, @@ -63,9 +64,9 @@ define(function() { this.modal.setContent(this.$editors); this.modal.show(); } - + var addCss = this.protCss || ''; this.htmlEditor.setContent( this.cm.getCode(this.components, 'html') ); - this.cssEditor.setContent( this.cm.getCode(this.components, 'css', this.cssc)); + this.cssEditor.setContent( addCss + this.cm.getCode(this.components, 'css', this.cssc)); if(this.sender) this.sender.set('active',false); diff --git a/src/editor/config/config.js b/src/editor/config/config.js index e0a54fc44..d48ab3e8a 100644 --- a/src/editor/config/config.js +++ b/src/editor/config/config.js @@ -38,7 +38,7 @@ define(function () { storageType: 'local', // The css that could only be seen (for instance, inside the code viewer) - protectedCss: 'body{margin:0}', + protectedCss: 'body{margin:0;}', //Configurations for Asset Manager assetManager : {}, diff --git a/src/editor/main.js b/src/editor/main.js index 062cdb216..b8d7b39ca 100644 --- a/src/editor/main.js +++ b/src/editor/main.js @@ -138,6 +138,11 @@ define(function (require){ */ Utils: em.get('Utils'), + /** + * @property {Utils} + */ + Config: em.get('Config'), + /** * Initialize editor model * @return {this}