I need to add structure field data several dozens times a day. Therefore I’d like to add a keyboard shortcut to add this data to a single structured field I have. Could I somehow add this keyboard shortcut through a custom field clone of the structure field?
Yea, you could basically just copy the structure field (panel/app/fields/structure) and either rename it or just modify it (it would then overwrite the default structure field. And basically add a kewydown event listener in assets/js/structure.js.
If it’s the only structure field, you could probably just call
$('.structure-add-button').click()
to trigger the add entry modal. At least, I think so.
Would be nice to have this in the core. If you have to add many entries to a structure field, it would really help to have a keyboard shortcut instead of trying to find the add button all over again. Think I’m gonna add this as a feature request on GitHub.
It reminds me of a similar problem I had with my Splitview plugin. I could not use a shortcut key because the focus needed to be in the correct iframe.
In this case, for it to work you need to set focus to an element where the shortcut key should apply. To make it useful it needs to show what element is in focus. That means some kind of new design enhancements to select an element.
I vote for having this in the core and be configurable in the blueprints. Then I can decide which structure field is mostly used and therefore get a keyboard shortcut or I assign different keyboard shortcuts to each.
But I’ll try @distantnative’s solution. Thanks for the help.
BTW Another suggestion: If I limited the number of characters for a page’s title in the blueprint, the add page modal dialogue should count characters too – not only the panel form. (PS I am remembering seeing something like this in a screen recording GIF from Bastian – am I wrong?)
Okay one drawback: A potential title field gets auto-focussed. So when command-tabbing into the browser or control-tabbing to the tab with the panel form, the title field gets automatically focussed. So once I press any key its content gets replaced by that key. Therefore I still need to de-focus with the mouse and then enter my keyboard shortcut to add structure field contents. Little bummer.