Skip to content

Commit

Permalink
enter command mode when replacing selection
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Nov 15, 2023
1 parent 1e25f43 commit bb58f22
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions frontend/src/lib/components/CommandBar/searchBarLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,14 @@ export const searchBarLogic = kea<searchBarLogicType>([
// hide command bar
actions.hideCommandBar()
} else if (event.key === '>') {
if (values.searchQuery.length === 0) {
// transition to actions when entering '>' with empty input
const { value, selectionStart, selectionEnd } = event.target as HTMLInputElement
if (
values.searchQuery.length === 0 ||
(selectionStart !== null &&
selectionEnd !== null &&
(value.substring(0, selectionStart) + value.substring(selectionEnd)).length === 0)
) {
// transition to actions when entering '>' with empty input, or when replacing the whole input
event.preventDefault()
actions.setCommandBar(BarStatus.SHOW_ACTIONS)
}
Expand Down

0 comments on commit bb58f22

Please sign in to comment.