From 2a43443cc3b03aa8fc8e7a9dd124c88d8c35360c Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Fri, 12 Mar 2021 02:09:35 +0100 Subject: [PATCH] Init wrapper in frames with props from domComponents config --- src/canvas/model/Frame.js | 7 ++++--- src/dom_components/model/ComponentWrapper.js | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/canvas/model/Frame.js b/src/canvas/model/Frame.js index 3472dc219..ee0a96d28 100644 --- a/src/canvas/model/Frame.js +++ b/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) { diff --git a/src/dom_components/model/ComponentWrapper.js b/src/dom_components/model/ComponentWrapper.js index 111f509ee..0882d07cf 100644 --- a/src/dom_components/model/ComponentWrapper.js +++ b/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;