tree: add "r" shortcut for "show widget in session"

This commit is contained in:
jean-emmanuel 2025-03-14 03:22:48 +01:00
parent 03eaab432a
commit 343a18541c
4 changed files with 32 additions and 15 deletions

View file

@ -105,20 +105,10 @@ var handleClick = function(event) {
label: icon('eye') + ' ' + locales('editor_show_in_session'),
action: ()=>{
for (let w of editor.selectedWidgets) {
var parent = w
while (parent !== widgetManager) {
if (parent.getProp('type') === 'tab') parent.parent.setValue(parent.parent.children.indexOf(parent), {sync: true, send: true})
else if (parent.getProp('type') === 'modal') parent.setValue(1, {sync: true, send: true})
parent = parent.parent
}
w.container.classList.add('editor-blink')
w.container.scrollIntoView({block: 'center'})
setTimeout(()=>{
w.container.classList.remove('editor-blink')
}, 800)
editor.widgetTree.showWidgetInSession(w)
}
}
},
shortcut: 'r'
})
}

View file

@ -210,6 +210,7 @@ class Editor {
'home',
'end',
't',
'r',
'f2',
'h',
'mod + f'
@ -452,7 +453,13 @@ class Editor {
if (!this.selectedWidgets.length) return
this.widgetTree.showWidget(editor.selectedWidgets[0])
this.widgetTree.blinkSelected()
break
case 'r':
if (!this.selectedWidgets.length) return
for (let w of editor.selectedWidgets) {
this.widgetTree.showWidgetInSession(w)
}
this.widgetTree.showWidget(editor.selectedWidgets[0])
break
case 'f2':
if (!this.selectedWidgets.length) return

View file

@ -240,6 +240,22 @@ class UiTree extends UiWidget {
}
showWidgetInSession(widget) {
var parent = widget
while (parent !== widgetManager) {
if (parent.getProp('type') === 'tab') parent.parent.setValue(parent.parent.children.indexOf(parent), {sync: true, send: true})
else if (parent.getProp('type') === 'modal') parent.setValue(1, {sync: true, send: true})
parent = parent.parent
}
widget.container.classList.add('editor-blink')
widget.container.scrollIntoView({block: 'center'})
setTimeout(()=>{
widget.container.classList.remove('editor-blink')
}, 800)
}
select() {
// hint selection in folded containers