Always focus href entry after using mod-k keyboard shortcut
Describe the bug
The behavior of mod-k is still inconsistent.
In particular it will not focus the link entry
if the href already was falsy - for example right after the start.
(Follow up for #7599 )
To Reproduce Steps to reproduce the behavior:
- Open a new text document.
- Enter some word.
- Select the word (mod-a) and turn it into a link (mod-k)
- See that the link entry does not receive focus.
It works after showing the link bubble for a link with an actual href. It does not work directly after showing the link bubble for a link with an empty href.
Expected behavior Whenever the shortcut is used link bubble should open with the link text entry focussed.
Server details:
- Nextcloud version: 31, 32
Client details:
- Browser: tested with Electron and FF
- Device: Desktop
There are no errors in the relevant logs.
It's just that key inside the LinkBubbleView stays the same so the watcher does not trigger.
I tried to watch href instead and distinguish null from an empty string. Made sure href was null when no link was selected and an empty string when a new link as selected. However this also led to the link entry getting focussed when navigating into an empty link for example by using the cursor keys.
Instead I think we want to introduce a new editor command to focus the link entry and use that:
- Call command from the keyboard shortcut.
- command triggers a transaction with a specific meta key.
- transaction updates some value in the state of
LinkBubblePluginView. - That state is handed to the component and watched.