Browse Source

Init wrapper in frames with props from domComponents config

pull/3411/head
Artur Arseniev 6 years ago
parent
commit
2a43443cc3
  1. 7
      src/canvas/model/Frame.js
  2. 20
      src/dom_components/model/ComponentWrapper.js

7
src/canvas/model/Frame.js

@ -1,6 +1,5 @@
import { Model } from 'backbone';
import { result, forEach, isEmpty } from 'underscore';
import Component from 'dom_components/model/Component';
import { isComponent, isObject } from 'utils/mixins';
const keyAutoW = '__aw';
@ -22,7 +21,8 @@ export default Model.extend({
const { config } = opts;
const { em } = config;
const { styles, components } = this.attributes;
const conf = em.get('DomComponents').getConfig();
const domc = em.get('DomComponents');
const conf = domc.getConfig();
const allRules = em.get('CssComposer').getAll();
this.em = em;
const modOpts = { em, config: conf, frame: this };
@ -30,7 +30,8 @@ export default Model.extend({
if (!isComponent(components)) {
const wrp = isObject(components) ? components : { components };
wrp.type = 'wrapper';
this.set('components', new Component(wrp, modOpts));
const Wrapper = domc.getType('wrapper').model;
this.set('components', new Wrapper({ ...conf.wrapper, ...wrp }, modOpts));
}
if (!styles) {

20
src/dom_components/model/ComponentWrapper.js

@ -2,7 +2,25 @@
import Component from './Component';
export default Component.extend(
{},
{
defaults: () => ({
...Component.prototype.defaults,
removable: false,
copyable: false,
draggable: false,
components: [],
traits: [],
stylable: [
'background',
'background-color',
'background-image',
'background-repeat',
'background-attachment',
'background-position',
'background-size'
]
})
},
{
isComponent() {
return false;

Loading…
Cancel
Save