diff --git a/app/api.imba b/app/api.imba index 7f27a19..d5f72fc 100644 --- a/app/api.imba +++ b/app/api.imba @@ -205,3 +205,11 @@ export default new class api catch e err "adding link", e state.loading = no + + def handle_click_link + let link = selected_link + if link.is_bang + state.query = '' + state.active_bang = link + else + navigate link diff --git a/app/components/app-bang.imba b/app/components/app-bang.imba index e4ad4d0..0772963 100644 --- a/app/components/app-bang.imba +++ b/app/components/app-bang.imba @@ -1,8 +1,7 @@ tag app-bang get bang - return active_bang if state.active_bang - config.data.default_bang + state.active_bang or config.data.default_bang get encoded_bang_query "{bang.url}{window.encodeURIComponent(state.query)}" @@ -22,8 +21,8 @@ tag app-bang <.tip-row> <.tip - @click=(state.active_bang = no) - @hotkey('esc').capture.if(!state.loading)=(state.active_bang = no) + @click=handle_bang + @hotkey('return').capture.if(!state.loading)=handle_bang > <.tip-hotkey> "Return" <.tip-content> "Search" @@ -53,12 +52,9 @@ tag app-bang <.tip-hotkey> "Esc" <.tip-content> "Back" else - <.tip - @click.if(!state.loading)=refs.settings.open - @hotkey('esc').capture.if(!state.loading)=refs.settings.open - > - <.tip-hotkey> "Esc" - <.tip-content> "Toggle Settings" + <.tip.noclick> + <.tip-hotkey> "Paste (If Input Empty)" + <.tip-content> "Instant Search" @@ -81,9 +77,12 @@ tag app-bang <.tip-hotkey> "Cut (If No Selection)" <.tip-content> "Cut All Text" - <.tip.noclick> - <.tip-hotkey> "Paste (If Input Empty)" - <.tip-content> "Instant Search" + if state.active_bang + <.tip.noclick> + <.tip-hotkey> "Paste (If Input Empty)" + <.tip-content> "Instant Search" + else + <.tip.placeholder> unless $tips-more.active <.bang.selected@click=handle_bang> diff --git a/app/components/app-home.imba b/app/components/app-home.imba index 7f8b575..bdab0b4 100644 --- a/app/components/app-home.imba +++ b/app/components/app-home.imba @@ -21,27 +21,6 @@ tag app-home api.set_link_selection_index 0 api.sort_links! - def handle_click_link - if state.active_bang or state.sorted_links.length < 1 - return handle_bang! - let link = api.selected_link - if link.is_bang - state.query = '' - state.active_bang = link - else - api.navigate link - - def handle_click_delete link - return unless window.confirm "Do you really want to delete {link..display_name}?" - handle_delete link - - def handle_click_pin link - api.pin_link link - - def handle_shift_backspace - return unless state.sorted_links.length > 0 - refs.edit.open api.selected_link - def render diff --git a/app/components/app-link.imba b/app/components/app-link.imba index 3057aa4..a761e24 100644 --- a/app/components/app-link.imba +++ b/app/components/app-link.imba @@ -3,7 +3,7 @@ tag app-link def render css d:flex fld:row jc:space-between ai:center diff --git a/app/components/app-links.imba b/app/components/app-links.imba index a89b2aa..64fc3b9 100644 --- a/app/components/app-links.imba +++ b/app/components/app-links.imba @@ -1,5 +1,16 @@ tag app-links + def handle_click_delete link + return unless window.confirm "Do you really want to delete {link..display_name}?" + handle_delete link + + def handle_click_pin link + api.pin_link link + + def handle_edit + return unless state.sorted_links.length > 0 + refs.edit.open api.selected_link + def render @@ -10,8 +21,8 @@ tag app-links <.tip-row> <.tip - @click=handle_click_link - @hotkey('return').force.if(!loading)=handle_click_link + @click=api.handle_click_link + @hotkey('return').force.if(!loading)=api.handle_click_link > <.tip-hotkey> "Return" <.tip-content> "Navigate To Link" @@ -34,8 +45,8 @@ tag app-links "\"{sq.join " "}\"" <.tip - @click=handle_shift_backspace - @hotkey('shift+backspace').capture.if(!state.loading)=handle_shift_backspace + @click=handle_edit + @hotkey('shift+backspace').capture.if(!state.loading)=handle_edit > <.tip-hotkey> "Shift + Backspace" <.tip-content> "Edit Link" @@ -53,9 +64,9 @@ tag app-links <.tip @click.if(!state.loading)=refs.settings.open - @hotkey('esc').capture.if(!state.loading)=refs.settings.open + @hotkey('shift+tab').capture.if(!state.loading)=refs.settings.open > - <.tip-hotkey> "Esc" + <.tip-hotkey> "Shift + Tab" <.tip-content> "Toggle Settings" <.tip.noclick diff --git a/app/components/app-settings.imba b/app/components/app-settings.imba index fdb4ccb..519d155 100644 --- a/app/components/app-settings.imba +++ b/app/components/app-settings.imba @@ -98,6 +98,7 @@ tag app-settings <.settings-button @click=close @hotkey("esc")=close + @hotkey("shift+tab")=close > "BACK" <.settings-container> <.settings-button