|
@ -5,6 +5,7 @@ tag app-edit |
|
|
|
|
|
|
|
|
def open data |
|
|
def open data |
|
|
link = data |
|
|
link = data |
|
|
|
|
|
new_link_text = value=api.construct_link_text(link) |
|
|
active = yes |
|
|
active = yes |
|
|
|
|
|
|
|
|
def close |
|
|
def close |
|
@ -16,11 +17,7 @@ tag app-edit |
|
|
imba.commit! |
|
|
imba.commit! |
|
|
|
|
|
|
|
|
def handle_click_set_default_bang |
|
|
def handle_click_set_default_bang |
|
|
unless link.is_bang |
|
|
config.set_default_bang link |
|
|
return err "setting default bang", "Link is not a bang." |
|
|
|
|
|
config.data.default_bang = link |
|
|
|
|
|
config.save! |
|
|
|
|
|
api.sort_links! |
|
|
|
|
|
close! |
|
|
close! |
|
|
|
|
|
|
|
|
def handle_delete |
|
|
def handle_delete |
|
@ -32,75 +29,62 @@ tag app-edit |
|
|
|
|
|
|
|
|
def save |
|
|
def save |
|
|
try |
|
|
try |
|
|
if /\s/.test link.name.trim! |
|
|
api.update_link link, new_link_text |
|
|
throw "Link name may not contain spaces." |
|
|
|
|
|
api.update_link link, api.construct_link_text link |
|
|
|
|
|
close! |
|
|
close! |
|
|
catch e |
|
|
catch e |
|
|
err "saving link", e |
|
|
err "saving link", e |
|
|
|
|
|
|
|
|
get new_link_text |
|
|
|
|
|
"wip" |
|
|
|
|
|
|
|
|
|
|
|
def cycle_focus |
|
|
|
|
|
if document.activeElement is $dn |
|
|
|
|
|
$n.focus! |
|
|
|
|
|
elif document.activeElement is $n |
|
|
|
|
|
$u.focus! |
|
|
|
|
|
else |
|
|
|
|
|
$dn.focus! |
|
|
|
|
|
|
|
|
|
|
|
def render |
|
|
def render |
|
|
|
|
|
|
|
|
<self> |
|
|
<self> |
|
|
css d:flex fld:column gap:20px w:100% |
|
|
css d:flex fld:column gap:20px w:100% |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
<input$dn bind=new_link_text> |
|
|
|
|
|
|
|
|
<app-tips> |
|
|
<app-tips> |
|
|
|
|
|
|
|
|
<.tip-row> |
|
|
<.tip-row> |
|
|
|
|
|
|
|
|
<.tip |
|
|
|
|
|
@click=close |
|
|
|
|
|
@hotkey('esc').capture.if(!state.loading)=close |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Esc" |
|
|
|
|
|
<.tip-content> "Cancel" |
|
|
|
|
|
|
|
|
|
|
|
<.tip |
|
|
<.tip |
|
|
@click=handle_delete |
|
|
@click=handle_delete |
|
|
@hotkey('shift+backspace').capture.if(!state.loading)=handle_delete |
|
|
@hotkey('shift+backspace').capture.if(!state.loading)=handle_delete |
|
|
> |
|
|
> |
|
|
css fl:2 |
|
|
|
|
|
<.tip-hotkey> "Shift + Backspace" |
|
|
<.tip-hotkey> "Shift + Backspace" |
|
|
<.tip-content> "Delete Link" |
|
|
<.tip-content> "Delete Link" |
|
|
|
|
|
|
|
|
if link.is_bang |
|
|
|
|
|
<.tip @click=handle_click_set_default_bang> |
|
|
|
|
|
css fl:2 |
|
|
|
|
|
<.tip-content> "Set Default Bang" |
|
|
|
|
|
|
|
|
|
|
|
<.tip |
|
|
<.tip |
|
|
@click=save |
|
|
@click=save |
|
|
@hotkey('shift+return').capture.if(!state.loading)=save |
|
|
@hotkey('return').capture.if(!state.loading)=save |
|
|
> |
|
|
> |
|
|
css fl:2 |
|
|
|
|
|
<.tip-hotkey> "Return" |
|
|
<.tip-hotkey> "Return" |
|
|
<.tip-content> "Update Link" |
|
|
<.tip-content> "Update Link" |
|
|
|
|
|
|
|
|
<.tip.noclick |
|
|
if link.is_bang |
|
|
@hotkey('tab').capture.if(!state.loading)=cycle_focus |
|
|
<.tip @click=handle_click_set_default_bang> |
|
|
|
|
|
<.tip-hotkey> "Click" |
|
|
|
|
|
<.tip-content> "Set Default Bang" |
|
|
|
|
|
else |
|
|
|
|
|
<.tip |
|
|
|
|
|
@click=close |
|
|
|
|
|
@hotkey('esc').capture.if(!state.loading)=close |
|
|
> |
|
|
> |
|
|
<.tip-hotkey> "Tab" |
|
|
<.tip-hotkey> "Esc" |
|
|
<.tip-content> "Next" |
|
|
<.tip-content> "Cancel" |
|
|
|
|
|
|
|
|
<.inputs> |
|
|
if link.is_bang |
|
|
css d:flex fld:column gap:20px |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
<app-tips-more> |
|
|
<input$dn bind=link.display_name> |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
<.tip-row> |
|
|
<input$n bind=link.name> |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
<.tip |
|
|
<input$u bind=link.url> |
|
|
@click=close |
|
|
|
|
|
@hotkey('esc').capture.if(!state.loading)=close |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Esc" |
|
|
|
|
|
<.tip-content> "Cancel" |
|
|
|
|
|
|
|
|
|
|
|
<.tip.placeholder> |
|
|
|
|
|
|
|
|
|
|
|
<.tip.placeholder> |
|
|