Browse Source

Pass correct options to Components

pull/2524/head
Artur Arseniev 7 years ago
parent
commit
646ac0e0ae
  1. 4
      src/canvas/model/Canvas.js
  2. 1
      src/canvas/model/Frame.js
  3. 22
      src/canvas/view/FrameView.js
  4. 4
      src/css_composer/index.js

4
src/canvas/model/Canvas.js

@ -15,11 +15,11 @@ export default Backbone.Model.extend({
initialize(config = {}) {
const { styles = [], scripts = [] } = config;
const frame = new Frame();
const frame = new Frame({}, config);
styles.forEach(style => frame.addLink(style));
scripts.forEach(script => frame.addScript(script));
this.set('frame', frame);
this.set('frames', new Frames([frame]));
this.set('frames', new Frames([frame], config));
this.listenTo(this, 'change:zoom', this.onZoomChange);
},

1
src/canvas/model/Frame.js

@ -22,6 +22,7 @@ export default Backbone.Model.extend({
this.set('head', []);
const modOpts = {
em: opts.em,
config: opts.em.get('DomComponents').getConfig(),
frame: this
};

22
src/canvas/view/FrameView.js

@ -284,8 +284,26 @@ export default Backbone.View.extend({
${conf.protectedCss || ''}
</style>`
);
append(body, new ComponentView({ model: root, config }).render().el);
append(body, new CssRulesView({ collection: styles, config }).render().el);
append(
body,
new ComponentView({
model: root,
config: {
...root.config,
frameView: this
}
}).render().el
);
append(
body,
new CssRulesView({
collection: styles,
config: {
...em.get('CssComposer').getConfig(),
frameView: this
}
}).render().el
);
append(body, this.getJsContainer());
// em.trigger('loaded'); // I need to manage only the first one maybe
//this.updateOffset(); // TOFIX (check if I need it)

4
src/css_composer/index.js

@ -50,6 +50,10 @@ export default () => {
*/
name: 'CssComposer',
getConfig() {
return c;
},
/**
* Mandatory for the storage manager
* @type {String}

Loading…
Cancel
Save