editor: added keyboard shortcut F2 for editing the label quickly (#377)
This commit is contained in:
parent
f50b78ba87
commit
da5db1e11a
2 changed files with 11 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue