command-pal
command-pal copied to clipboard
Restore text selection after closing modal
Description:
- Saves and restores user's text selection on modal close and open
- 25ms delay is added so that commands which rely on the selection work reliably. Feels hacky, but couldn't come up with better solution.
Usecase is that the user has some text selected and the palette is used to run some commands relating to that selection.
Thanks for exploring this use case. I wanted to have a reformat text option from the command palette.
With your patch, how does the palette command access the selected text?
Do you have an example action that uses this?
Also given #52, how are you triggering commandPal so the selection isn't lost?