From 64d2632ef34cb028e282669d7fdabd945e1ecd07 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 29 Nov 2017 21:29:29 +0100 Subject: [PATCH] Add `avoidProtected` option in `getCss()` --- src/editor/index.js | 9 +++++---- src/editor/model/Editor.js | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/editor/index.js b/src/editor/index.js index 3c313396e..bf67fa384 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -244,16 +244,17 @@ module.exports = config => { * Returns HTML built inside canvas * @return {string} HTML string */ - getHtml() { - return em.getHtml(); + getHtml(opts) { + return em.getHtml(opts); }, /** * Returns CSS built inside canvas + * @param {Object} [opts={}] Options * @return {string} CSS string */ - getCss() { - return em.getCss(); + getCss(opts) { + return em.getCss(opts); }, /** diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index dd024749d..5924e7172 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -485,15 +485,17 @@ module.exports = Backbone.Model.extend({ /** * Returns CSS built inside canvas + * @param {Object} [opts={}] Options * @return {string} CSS string * @private */ - getCss() { + getCss(opts = {}) { const config = this.config; const wrappesIsBody = config.wrappesIsBody; - var cssc = this.get('CssComposer'); - var wrp = this.get('DomComponents').getComponent(); - var protCss = config.protectedCss; + const avoidProt = opts.avoidProtected; + const cssc = this.get('CssComposer'); + const wrp = this.get('DomComponents').getComponent(); + const protCss = !avoidProt ? config.protectedCss : ''; return protCss + this.get('CodeManager').getCode(wrp, 'css', { cssc, wrappesIsBody