editor: show keyboard shortcuts in context menu; add shortcuts to change widget order; add shortcut to show widget in project tree
This commit is contained in:
parent
7d59d5cbd5
commit
75251613fb
6 changed files with 119 additions and 9 deletions
|
|
@ -2,9 +2,14 @@
|
|||
|
||||
## 1.3.1
|
||||
|
||||
- bug fixes
|
||||
- project tree: error when dropping a widget at its initial position
|
||||
|
||||
- editor
|
||||
- validate property change when clicking on a widget
|
||||
- cancel property change when hitting escape
|
||||
- add menu and keyboard shortcuts to reorder widgets
|
||||
- add keyboard shortcut to show widget in project tree
|
||||
|
||||
## 1.3.0
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ Clicking on a widget, on a tab label or on an item in the project tree selects t
|
|||
Right clicking on a widget displays a menu with the following actions
|
||||
|
||||
- `Show in tree`: show widget in project tree (hidden when clicking in the project tree)
|
||||
- `Position`:
|
||||
- `Send to back`: Send selected widget to back (first of siblings)
|
||||
- `Send farther`: Send selected widget farther
|
||||
- `Bring closer`: Bring selected widget closer
|
||||
- `Bring to front`: Bring selected widget to front (last of siblings)
|
||||
- `Copy`: copy widget's data
|
||||
- `Cut`: copy widget's data and delete selected widget
|
||||
- `Paste`: paste copied widget in selected container
|
||||
|
|
@ -83,6 +88,12 @@ Multiple widgets can be edited at once.
|
|||
| ++ctrl+down++ | Select current widget's first child |
|
||||
| ++ctrl+right++ | Select current widget's next sibling |
|
||||
| ++ctrl+left++ | Select current widget's previous sibling |
|
||||
| ++t++ | Show selected widget in the project tree |
|
||||
| ++Home++ | Send selected widget to back |
|
||||
| ++Page Up++ | Send selected widget farther |
|
||||
| ++Page Down++ | Bring selected widget closer |
|
||||
| ++End++ | Bring selected widget to front |
|
||||
|
||||
|
||||
=== "Mac"
|
||||
|
||||
|
|
@ -109,3 +120,8 @@ Multiple widgets can be edited at once.
|
|||
| ++cmd+down++ | Select current widget's first child |
|
||||
| ++cmd+right++ | Select current widget's next sibling |
|
||||
| ++cmd+left++ | Select current widget's previous sibling |
|
||||
| ++t++ | Show selected widget in the project tree |
|
||||
| ++Home++ | Send selected widget to back |
|
||||
| ++Page Up++ | Send selected widget farther |
|
||||
| ++Page Down++ | Bring selected widget closer |
|
||||
| ++End++ | Bring selected widget to front |
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ var handleClick = function(event) {
|
|||
label: icon('project-diagram') + ' ' + locales('editor_show_in_tree'),
|
||||
action: ()=>{
|
||||
editor.widgetTree.showWidget(editor.selectedWidgets[0])
|
||||
}
|
||||
},
|
||||
shortcut: 't'
|
||||
})
|
||||
actions.push({
|
||||
separator: true
|
||||
|
|
@ -71,14 +72,55 @@ var handleClick = function(event) {
|
|||
|
||||
}
|
||||
|
||||
if (editor.selectedWidgets[0].parent.children.length > 1) {
|
||||
actions.push({
|
||||
label: icon('layer-group') + ' Position',
|
||||
action: [
|
||||
{
|
||||
label: locales('editor_back'),
|
||||
action: ()=>{
|
||||
editor.handleKeyboard('home')
|
||||
},
|
||||
shortcut: 'Home'
|
||||
},
|
||||
{
|
||||
label: locales('editor_farther'),
|
||||
action: ()=>{
|
||||
editor.handleKeyboard('pageup')
|
||||
},
|
||||
shortcut: 'Page Up'
|
||||
},
|
||||
{
|
||||
label: locales('editor_closer'),
|
||||
action: ()=>{
|
||||
editor.handleKeyboard('pagedown')
|
||||
},
|
||||
shortcut: 'Page Down'
|
||||
},
|
||||
{
|
||||
label: locales('editor_front'),
|
||||
action: ()=>{
|
||||
editor.handleKeyboard('end')
|
||||
},
|
||||
shortcut: 'End'
|
||||
}
|
||||
]
|
||||
})
|
||||
actions.push({
|
||||
separator: true
|
||||
})
|
||||
}
|
||||
|
||||
actions.push({
|
||||
label: icon('copy') + ' ' + locales('editor_copy'),
|
||||
action: editor.copyWidget.bind(editor)
|
||||
action: editor.copyWidget.bind(editor),
|
||||
shortcut: 'mod + c'
|
||||
})
|
||||
|
||||
actions.push({
|
||||
label: icon('cut') + ' ' + locales('editor_cut'),
|
||||
action: editor.cutWidget.bind(editor)
|
||||
action: editor.cutWidget.bind(editor),
|
||||
shortcut: 'mod + x'
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -101,13 +143,16 @@ var handleClick = function(event) {
|
|||
label: icon('paste') + ' ' + locales('editor_paste'),
|
||||
action: ()=>{
|
||||
editor.pasteWidget(clickX, clickY)
|
||||
}
|
||||
},
|
||||
shortcut: 'mod + v'
|
||||
})
|
||||
pasteActions.push({
|
||||
label: icon('plus-square') + ' ' + locales('editor_pasteindent'),
|
||||
action: ()=>{
|
||||
editor.pasteWidget(clickX, clickY, true)
|
||||
}
|
||||
},
|
||||
shortcut: 'mod + shift + v'
|
||||
|
||||
})
|
||||
|
||||
if (editor.idClipboard && widgetManager.getWidgetById(editor.idClipboard).length && editor.clipboard[0].type !== 'tab') {
|
||||
|
|
@ -219,7 +264,8 @@ var handleClick = function(event) {
|
|||
|
||||
actions.push({
|
||||
label: icon('trash') + ' ' + locales('editor_delete'),
|
||||
action: editor.deleteWidget.bind(editor)
|
||||
action: editor.deleteWidget.bind(editor),
|
||||
shortcut: 'delete'
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,11 @@ class Editor {
|
|||
'mod + down',
|
||||
'mod + left',
|
||||
'mod + right',
|
||||
'f2'
|
||||
'pageup',
|
||||
'pagedown',
|
||||
'home',
|
||||
'end',
|
||||
't'
|
||||
]
|
||||
|
||||
for (let c of combos) {
|
||||
|
|
@ -196,9 +200,9 @@ class Editor {
|
|||
|
||||
handleKeyboard(combo, e){
|
||||
|
||||
if (this.inspector.helpModalOpened || e.target && (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT')) return
|
||||
if (this.inspector.helpModalOpened || e && e.target && (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT')) return
|
||||
|
||||
e.preventDefault()
|
||||
if (e) e.preventDefault()
|
||||
|
||||
switch (combo) {
|
||||
|
||||
|
|
@ -339,6 +343,37 @@ class Editor {
|
|||
|
||||
break
|
||||
|
||||
case 'pagedown':
|
||||
case 'pageup':
|
||||
case 'home':
|
||||
case 'end':
|
||||
if (!this.selectedWidgets.length || this.selectedWidgets[0].parent.children.length <= 1) return
|
||||
|
||||
var curWidget = this.selectedWidgets[0],
|
||||
index = curWidget.parent.children.indexOf(curWidget),
|
||||
maxIndex = curWidget.parent.children.length - 1,
|
||||
newIndex
|
||||
|
||||
if (combo === 'pagedown') newIndex = Math.min(index + 1, maxIndex)
|
||||
else if (combo === 'pageup') newIndex = Math.max(index - 1, 0)
|
||||
else if (combo === 'end') newIndex = maxIndex
|
||||
else if (combo === 'home') newIndex = 0
|
||||
|
||||
if (index !== newIndex) {
|
||||
this.widgetTree.trigger('sorted', {
|
||||
widget: curWidget.parent,
|
||||
oldIndex: index,
|
||||
newIndex: newIndex
|
||||
})
|
||||
}
|
||||
break
|
||||
|
||||
case 't':
|
||||
if (!this.selectedWidgets.length) return
|
||||
this.widgetTree.showWidget(editor.selectedWidgets[0])
|
||||
break
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ module.exports = {
|
|||
|
||||
// editor context-menu
|
||||
editor_show_in_tree: 'Show in tree',
|
||||
editor_front: 'Bring to front',
|
||||
editor_closer: 'Bring closer',
|
||||
editor_back: 'Send to back',
|
||||
editor_farther: 'Send farther',
|
||||
editor_copy: 'Copy',
|
||||
editor_cut: 'Cut',
|
||||
editor_paste: 'Paste',
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ module.exports = {
|
|||
|
||||
// editor context-menu
|
||||
editor_show_in_tree: 'Voir dans l\'arborescence',
|
||||
editor_front: 'Amener devant',
|
||||
editor_closer: 'Amener plus près',
|
||||
editor_back: 'Envoyer à l\'arrière',
|
||||
editor_farther: 'Envoyer plus loin',
|
||||
editor_copy: 'Copier',
|
||||
editor_cut: 'Couper',
|
||||
editor_paste: 'Coller',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue