Browse Source

Clean canvas view render

pull/3411/head
Artur Arseniev 6 years ago
parent
commit
feed1a5103
  1. 18
      src/canvas/model/Frame.js
  2. 11
      src/canvas/view/CanvasView.js

18
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;

11
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);

Loading…
Cancel
Save