editor: added keyboard shortcut F2 for editing the label quickly (#377)

This commit is contained in:
jean-emmanuel 2018-10-08 22:41:02 +02:00
parent 4a7182404c
commit 66a27914c0
2 changed files with 11 additions and 2 deletions

View file

@ -5,6 +5,7 @@
- editor
- removed widget deletion confirmation popup
- properties categories can now be folded
- added keyboard shortcut `F2` for editing the label quickly
## 0.37.4

View file

@ -21,7 +21,7 @@ var Editor = class Editor {
</div>
</div>
`)
this.form = DOM.get(this.wrapper, '#editor-form')[0]
this.form.addEventListener('fast-click', (e)=>{
if (e.target.classList.contains('separator')) {
@ -119,7 +119,15 @@ var Editor = class Editor {
this.moveWidget(deltaX, deltaY)
})
keyboardJS.bind('f2', (e)=>{
var input = DOM.get(this.form, 'textarea[title="label"]')[0]
if (input) {
var folded = input.closest('.category.folded')
if (folded) DOM.dispatchEvent(DOM.get(folded, '.separator'), 'fast-click')
input.focus()
input.setSelectionRange(0, input.value.length)
}
})
})