|
@ -32,6 +32,7 @@ tag app |
|
|
fatal_error = no |
|
|
fatal_error = no |
|
|
bang = no |
|
|
bang = no |
|
|
holding_shift = no |
|
|
holding_shift = no |
|
|
|
|
|
editing_link = no |
|
|
|
|
|
|
|
|
get render? do mounted? |
|
|
get render? do mounted? |
|
|
|
|
|
|
|
@ -225,11 +226,13 @@ tag app |
|
|
link_text |
|
|
link_text |
|
|
|
|
|
|
|
|
def handle_edit link |
|
|
def handle_edit link |
|
|
|
|
|
editing_link = link |
|
|
|
|
|
state.query = construct_link_text(link) |
|
|
|
|
|
|
|
|
|
|
|
def make_edit link, new_link_text |
|
|
def edit_link |
|
|
def edit_link |
|
|
let input = window.prompt "Enter the new link name and url:", construct_link_text(link) |
|
|
|
|
|
return if input is null |
|
|
|
|
|
try |
|
|
try |
|
|
await update_link link, input |
|
|
await update_link link, new_link_text |
|
|
catch e |
|
|
catch e |
|
|
return err "editing link", e |
|
|
return err "editing link", e |
|
|
loading = yes |
|
|
loading = yes |
|
@ -281,12 +284,12 @@ tag app |
|
|
sort_links! |
|
|
sort_links! |
|
|
|
|
|
|
|
|
def handle_click_delete link |
|
|
def handle_click_delete link |
|
|
|
|
|
return unless window.confirm "Do you really want to delete {link..display_name}?" |
|
|
handle_delete link |
|
|
handle_delete link |
|
|
|
|
|
|
|
|
def handle_delete link |
|
|
def handle_delete link |
|
|
|
|
|
|
|
|
def delete_link |
|
|
def delete_link |
|
|
return unless window.confirm "Do you really want to delete {link..display_name}?" |
|
|
|
|
|
try |
|
|
try |
|
|
await db.links.delete(link.id) |
|
|
await db.links.delete(link.id) |
|
|
catch e |
|
|
catch e |
|
@ -322,12 +325,32 @@ tag app |
|
|
window.alert "{link.display_name} is now the default bang" |
|
|
window.alert "{link.display_name} is now the default bang" |
|
|
|
|
|
|
|
|
def handle_shift_backspace |
|
|
def handle_shift_backspace |
|
|
|
|
|
if editing_link |
|
|
|
|
|
await handle_delete editing_link |
|
|
|
|
|
editing_link = no |
|
|
|
|
|
state.query = '' |
|
|
|
|
|
sort_links! |
|
|
|
|
|
else |
|
|
return unless state.scored_links.length > 0 |
|
|
return unless state.scored_links.length > 0 |
|
|
handle_edit state.scored_links[selection_index] |
|
|
handle_edit state.scored_links[selection_index] |
|
|
|
|
|
|
|
|
def handle_shift_return |
|
|
def handle_shift_return |
|
|
|
|
|
if editing_link |
|
|
|
|
|
try |
|
|
|
|
|
await update_link editing_link, state.query |
|
|
|
|
|
editing_link = no |
|
|
|
|
|
state.query = '' |
|
|
|
|
|
sort_links! |
|
|
|
|
|
catch e |
|
|
|
|
|
err "updating link", e |
|
|
|
|
|
else |
|
|
handle_add! |
|
|
handle_add! |
|
|
|
|
|
|
|
|
|
|
|
def handle_esc |
|
|
|
|
|
editing_link = no |
|
|
|
|
|
state.query = '' |
|
|
|
|
|
sort_links! |
|
|
|
|
|
|
|
|
def handle_click_add |
|
|
def handle_click_add |
|
|
handle_add! |
|
|
handle_add! |
|
|
|
|
|
|
|
@ -617,6 +640,7 @@ tag app |
|
|
# placeholder=pretty_date |
|
|
# placeholder=pretty_date |
|
|
@hotkey('return').capture=handle_return |
|
|
@hotkey('return').capture=handle_return |
|
|
@hotkey('shift+return').capture.if(can_add)=handle_shift_return |
|
|
@hotkey('shift+return').capture.if(can_add)=handle_shift_return |
|
|
|
|
|
@hotkey('esc').capture=handle_esc |
|
|
@hotkey('shift+backspace').capture=handle_shift_backspace |
|
|
@hotkey('shift+backspace').capture=handle_shift_backspace |
|
|
@hotkey('down').capture=increment_selection_index |
|
|
@hotkey('down').capture=increment_selection_index |
|
|
@hotkey('up').capture=decrement_selection_index |
|
|
@hotkey('up').capture=decrement_selection_index |
|
@ -632,6 +656,29 @@ tag app |
|
|
<svg src="./assets/settings.svg"> |
|
|
<svg src="./assets/settings.svg"> |
|
|
|
|
|
|
|
|
if config.enable_tips and not config.enable_simplify_ui |
|
|
if config.enable_tips and not config.enable_simplify_ui |
|
|
|
|
|
if editing_link |
|
|
|
|
|
<.middle-button> |
|
|
|
|
|
|
|
|
|
|
|
<.tip[jc:start ta:left fl:1] |
|
|
|
|
|
@click=handle_esc |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Esc" |
|
|
|
|
|
<.tip-content> "Cancel Edits" |
|
|
|
|
|
|
|
|
|
|
|
<.tip[jc:center ta:center fl:1 px:15px] |
|
|
|
|
|
@click=handle_shift_return |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Shift + Return" |
|
|
|
|
|
<.tip-content[of:hidden text-overflow:ellipsis white-space:nowrap]> |
|
|
|
|
|
"Update Link" |
|
|
|
|
|
|
|
|
|
|
|
<.tip[jc:end ta:right fl:1] |
|
|
|
|
|
@click=handle_shift_backspace |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Shift + Backspace" |
|
|
|
|
|
<.tip-content> "Delete Link" |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
<.middle-button> |
|
|
<.middle-button> |
|
|
<.tip[jc:start ta:left fl:1] @click=handle_return> |
|
|
<.tip[jc:start ta:left fl:1] @click=handle_return> |
|
|
<.tip-hotkey> "Return" |
|
|
<.tip-hotkey> "Return" |
|
@ -661,6 +708,7 @@ tag app |
|
|
<.tip-hotkey> "Shift + Backspace" |
|
|
<.tip-hotkey> "Shift + Backspace" |
|
|
<.tip-content> "Edit Link" |
|
|
<.tip-content> "Edit Link" |
|
|
|
|
|
|
|
|
|
|
|
unless editing_link |
|
|
<.links> |
|
|
<.links> |
|
|
if bang or state.scored_links.length < 1 |
|
|
if bang or state.scored_links.length < 1 |
|
|
<a.link.selected |
|
|
<a.link.selected |
|
|