Artur Arseniev
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
8 additions and
8 deletions
-
src/code_manager/model/CssGenerator.js
-
src/code_manager/model/HtmlGenerator.js
-
src/editor/config/config.js
-
src/editor/model/Editor.js
|
|
|
@ -20,7 +20,7 @@ export default Backbone.Model.extend({ |
|
|
|
const avoidInline = em && em.getConfig('avoidInlineStyle'); |
|
|
|
const style = model.styleToString(); |
|
|
|
const classes = model.get('classes'); |
|
|
|
const wrappesIsBody = opts.wrappesIsBody; |
|
|
|
const wrapperIsBody = opts.wrapperIsBody; |
|
|
|
const isWrapper = model.get('wrapper'); |
|
|
|
this.ids.push(`#${model.getId()}`); |
|
|
|
|
|
|
|
@ -29,7 +29,7 @@ export default Backbone.Model.extend({ |
|
|
|
|
|
|
|
if (!avoidInline && style) { |
|
|
|
let selector = `#${model.getId()}`; |
|
|
|
selector = wrappesIsBody && isWrapper ? 'body' : selector; |
|
|
|
selector = wrapperIsBody && isWrapper ? 'body' : selector; |
|
|
|
code = `${selector}{${style}}`; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -5,7 +5,7 @@ export default Backbone.Model.extend({ |
|
|
|
const models = model.get('components'); |
|
|
|
|
|
|
|
if (opts.exportWrapper) { |
|
|
|
return opts.wrappesIsBody |
|
|
|
return opts.wrapperIsBody |
|
|
|
? `<body>${this.buildModels(models)}</body>` |
|
|
|
: model.toHTML(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -117,7 +117,7 @@ export default { |
|
|
|
exportWrapper: 0, |
|
|
|
|
|
|
|
// The wrapper, if visible, will be shown as a `<body>`
|
|
|
|
wrappesIsBody: 1, |
|
|
|
wrapperIsBody: 1, |
|
|
|
|
|
|
|
// Usually when you update the `style` of the component this changes the
|
|
|
|
// element's `style` attribute. Unfortunately, inline styling doesn't allow
|
|
|
|
|
|
|
|
@ -417,12 +417,12 @@ export default Backbone.Model.extend({ |
|
|
|
getHtml() { |
|
|
|
const config = this.config; |
|
|
|
const exportWrapper = config.exportWrapper; |
|
|
|
const wrappesIsBody = config.wrappesIsBody; |
|
|
|
const wrapperIsBody = config.wrapperIsBody; |
|
|
|
const js = config.jsInHtml ? this.getJs() : ''; |
|
|
|
var wrp = this.get('DomComponents').getComponent(); |
|
|
|
var html = this.get('CodeManager').getCode(wrp, 'html', { |
|
|
|
exportWrapper, |
|
|
|
wrappesIsBody |
|
|
|
wrapperIsBody |
|
|
|
}); |
|
|
|
html += js ? `<script>${js}</script>` : ''; |
|
|
|
return html; |
|
|
|
@ -436,7 +436,7 @@ export default Backbone.Model.extend({ |
|
|
|
*/ |
|
|
|
getCss(opts = {}) { |
|
|
|
const config = this.config; |
|
|
|
const wrappesIsBody = config.wrappesIsBody; |
|
|
|
const wrapperIsBody = config.wrapperIsBody; |
|
|
|
const avoidProt = opts.avoidProtected; |
|
|
|
const keepUnusedStyles = !isUndefined(opts.keepUnusedStyles) |
|
|
|
? opts.keepUnusedStyles |
|
|
|
@ -449,7 +449,7 @@ export default Backbone.Model.extend({ |
|
|
|
protCss + |
|
|
|
this.get('CodeManager').getCode(wrp, 'css', { |
|
|
|
cssc, |
|
|
|
wrappesIsBody, |
|
|
|
wrapperIsBody, |
|
|
|
keepUnusedStyles |
|
|
|
}) |
|
|
|
); |
|
|
|
|