clone: copy all classes from target widget (fixes #219); apply target's default size if there's one;

This commit is contained in:
jean-emmanuel 2018-03-13 20:16:05 +01:00
parent c705641a71
commit 993742d065
3 changed files with 17 additions and 6 deletions

View file

@ -6,6 +6,7 @@
- strip: nested strips were inheriting their parent's `spacing`
- modal: prevent error when retrieving a child's property
- modal: prevent touch event from affecting elements behind the popup when closing it
- clone: some properies in target widget were not applied to the clone
- text: vertical centering issues in narrow widgets
- editor
- wrap in: insert wrapper at selected widget's index

View file

@ -42,8 +42,10 @@ module.exports = class Clone extends Widget {
this.cloneLock = false
this.cloneTarget = null
this.cloneClass = '_'
this.cloneClass = []
this.container.classList.add('empty')
this.getCloneTarget()
if (this.cloneTarget) this.createClone()
@ -102,7 +104,9 @@ module.exports = class Clone extends Widget {
widgetManager.removeWidgets(this.childrenHashes)
this.widget.innerHTML = ''
this.childrenHashes = []
this.container.classList.remove(this.cloneClass)
this.container.classList.remove(...this.cloneClass)
this.container.classList.add('clone-container', 'empty')
this.cloneClass = []
}
@ -113,8 +117,9 @@ module.exports = class Clone extends Widget {
this.cleanClone()
this.cloneClass = this.cloneTarget.container.getAttribute('class').match(/[^\s]*-container/)[0]
this.container.classList.add(this.cloneClass)
this.cloneClass = this.cloneTarget.container.classList
this.container.classList.remove('empty')
this.container.classList.add(...this.cloneClass)
parser.parse([{...Widget.deepCopy(this.cloneTarget.props), ...this.getProp('props')}], this.widget, this)

View file

@ -292,11 +292,16 @@
}
.clone-container {
width: 100rem;
height: 100rem;
&.empty {
width: 100rem;
height: 100rem;
}
> .label {
display: none;
}
.clone {
position: relative;
height: 100%;