editor: wrap in: insert wrapper at selected widget's index & set label to false by default when wrapping in a strip or a panel (#225)

This commit is contained in:
jean-emmanuel 2018-03-12 09:21:26 +01:00
parent cbbb6b7ab9
commit 4cc8144239
2 changed files with 9 additions and 3 deletions

View file

@ -6,6 +6,9 @@
- strip: nested strips were inheriting their parent's `spacing`
- modal: prevent error when retrieving a child's property
- text: vertical centering issues in narrow widgets
- editor
- wrap in: insert wrapper at selected widget's index
- wrap in: set label to false by default when wrapping in a strip or a panel
## 0.26.3

View file

@ -198,7 +198,7 @@ var handleClick = function(event) {
for (let c of categories.Containers) {
if (c === 'clone') continue
actions['<i class="fa fa-box"></i> Wrap in'][c] = ()=>{
var wrap = {type: c, widgets:[]}
var wrap = {type: c, widgets:[], label: c === 'modal' ? 'auto' : false}
wrap.widgets = data
@ -213,10 +213,13 @@ var handleClick = function(event) {
if (!isNaN(w.left)) w.left = Math.max(w.left - minLeft, 0)
}
for (var i of index) {
var i
for (i of index) {
parent.props.widgets.splice(i,1)
}
parent.props.widgets.push(wrap)
parent.props.widgets = parent.props.widgets.slice(0, i - 1).concat(wrap, parent.props.widgets.slice(i, parent.props.widgets.length))
editor.select(updateWidget(parent, {preventSelect: true}))
}
}