editor: fix some errors and conflicts
This commit is contained in:
parent
0cce15c46c
commit
a0bb6e75e1
3 changed files with 17 additions and 5 deletions
|
|
@ -14,6 +14,7 @@
|
|||
- added keyboard shortcut `mod + e` for enabling / disabling the editor
|
||||
- added keyboard shortcuts `mod + arrows` for selecting widgets
|
||||
- added keyboard shortcut `mod + a` for selecting a widget's siblings and itself
|
||||
- added keyboard shortcut `mod + shift + a` for cancelling selection
|
||||
- added multi widget selection with mouse
|
||||
|
||||
## 0.37.4
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ Selected widget can be resized using its south, south-east and east handles. It
|
|||
|
||||
## Bulk editing
|
||||
|
||||
When holding the `ctrl` key (or `command` on Mac), multiple widgets can be selected for edition:
|
||||
When holding the `ctrl` key (or `command` on Mac), multiple widgets can be selected for edition by dragging the mouse or clicking on each widget individually.
|
||||
|
||||
- they must share the same parent widget
|
||||
- context-menu actions and properties changes apply to all selected widgets
|
||||
|
|
@ -77,6 +77,7 @@ The following shortcuts are available only when the editor is enabled:
|
|||
| `up, down, left, right` | move selected widgets (1 grid unit, hold `shift` for 5 grid units) |
|
||||
| `alt + [up, down, left, right]` | resize selected widgets (1 grid unit, hold `shift` for 5 grid units) |
|
||||
| `mod + a` | select current widget's siblings and itself |
|
||||
| `mod + shift + a` | cancel current widget selection |
|
||||
| `mod + up` | select current widget's parent |
|
||||
| `mod + down` | select current widget's first child |
|
||||
| `mod + right` | select current widget's next sibling |
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ var Editor = class Editor {
|
|||
if (e.target.classList.contains('no-keybinding')) return
|
||||
$('#container').selectable('enable')
|
||||
}, (e)=>{
|
||||
if (!this.selecting) $('#container').selectable('disable')
|
||||
if (!this.selecting && this.enabled) $('#container').selectable('disable')
|
||||
})
|
||||
keyboardJS.bind(macOs ? 'backspace' : 'delete', (e)=>{
|
||||
if (e.target.classList.contains('no-keybinding')) return
|
||||
|
|
@ -126,8 +126,15 @@ var Editor = class Editor {
|
|||
|
||||
this.moveWidget(deltaX, deltaY)
|
||||
})
|
||||
keyboardJS.bind('mod + shift + a', (e)=>{
|
||||
if (e.target.classList.contains('no-keybinding')) return
|
||||
this.unselect()
|
||||
this.selectedWidgets = []
|
||||
})
|
||||
keyboardJS.bind('mod + a', (e)=>{
|
||||
if (e.target.classList.contains('no-keybinding')) return
|
||||
if (!this.selectedWidgets.length) return
|
||||
|
||||
var curWidget = this.selectedWidgets[0],
|
||||
toSelect
|
||||
if (curWidget.parent !== widgetManager) {
|
||||
|
|
@ -161,6 +168,7 @@ var Editor = class Editor {
|
|||
|
||||
}
|
||||
else if((e.key == 'ArrowLeft') || (e.key == 'ArrowRight')){
|
||||
if (curWidget.parent === widgetManager) return
|
||||
const toSelectList = curWidget.parent.childrenHashes
|
||||
.map(h=>widgetManager.widgets[h])
|
||||
.filter(w=>w && w.parent==curWidget.parent)
|
||||
|
|
@ -200,9 +208,11 @@ var Editor = class Editor {
|
|||
keyboardJS.bind('mod + e', (e)=>{
|
||||
e.preventDefault()
|
||||
if (this.enabled) {
|
||||
this.disable()
|
||||
if (!this.selecting) {
|
||||
this.disable()
|
||||
}
|
||||
} else {
|
||||
this.enable()
|
||||
if (sessionManager.session.length) this.enable()
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -258,7 +268,7 @@ var Editor = class Editor {
|
|||
|
||||
var tmpSelection = []
|
||||
$('#container').selectable({
|
||||
filter: '.widget:not(.not-editable)',
|
||||
filter: '.widget:not(.not-editable), li.tablink',
|
||||
appendTo: '#container',
|
||||
autoRefresh: false,
|
||||
tolerance: 'touch',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue