From feed1a5103d098dafbab157c49b8017c886bffba Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sun, 21 Feb 2021 19:29:25 +0100 Subject: [PATCH] Clean canvas view render --- src/canvas/model/Frame.js | 18 +++++++++--------- src/canvas/view/CanvasView.js | 11 ----------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/canvas/model/Frame.js b/src/canvas/model/Frame.js index a1643a5b3..e39ae5f95 100644 --- a/src/canvas/model/Frame.js +++ b/src/canvas/model/Frame.js @@ -4,29 +4,25 @@ import CssRules from 'css_composer/model/CssRules'; import { isString } from 'underscore'; export default Backbone.Model.extend({ - defaults: { + defaults: () => ({ width: null, height: null, - head: '', + head: [], x: 0, y: 0, root: 0, components: 0, styles: 0, attributes: {} - }, + }), initialize(props, opts = {}) { const { config } = opts; const { em } = config; const { root, styles, components } = this.attributes; - this.set('head', []); + const conf = em.get('DomComponents').getConfig(); this.em = em; - const modOpts = { - em, - config: em.get('DomComponents').getConfig(), - frame: this - }; + const modOpts = { em, config: conf, frame: this }; !root && this.set( @@ -44,6 +40,10 @@ export default Backbone.Model.extend({ this.set('styles', new CssRules(styles, modOpts)); }, + getComponent() {}, + + getStyle() {}, + remove() { this.view = 0; const coll = this.collection; diff --git a/src/canvas/view/CanvasView.js b/src/canvas/view/CanvasView.js index 95c5742da..4739553d4 100644 --- a/src/canvas/view/CanvasView.js +++ b/src/canvas/view/CanvasView.js @@ -330,20 +330,9 @@ export default Backbone.View.extend({ render() { const { el, $el, ppfx, model, em, frames } = this; - const cssc = em.get('CssComposer'); - const wrapper = model.get('wrapper'); $el.html(this.template()); const $frames = $el.find('[data-frames]'); this.framesArea = $frames.get(0); - this.wrapper = wrapper; - - if (wrapper && typeof wrapper.render == 'function') { - model.get('frame').set({ - wrapper, - root: wrapper.getWrapper(), - styles: cssc.getAll() - }); - } const toolsWrp = $el.find('[data-tools]'); this.toolsWrapper = toolsWrp.get(0);