You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.2 KiB

tag app-edit
active = no
2 years ago
def mount
$dn.setSelectionRange 0, 0
$dn.focus!
def open data
link = data
new_link_text = value=api.construct_link_text(link)
active = yes
def close
active = no
2 years ago
def handle_click_set_default_bang
config.set_default_bang link
2 years ago
close!
2 years ago
def handle_delete
try
await api.delete_link link
close!
catch e
err "deleting link", e
def save
try
api.update_link link, new_link_text
close!
catch e
err "saving link", e
2 years ago
get tips
2 years ago
let result = []
2 years ago
2 years ago
result.push <>
2 years ago
<.tip
@click=handle_delete
@hotkey('shift+backspace').force=handle_delete
2 years ago
>
<.tip-hotkey> "Shift + Backspace"
<.tip-content> "Delete Link"
2 years ago
result.push <>
2 years ago
<.tip
@click=save
@hotkey('return').force=save
2 years ago
>
<.tip-hotkey> "Return"
<.tip-content> "Update Link"
if link.is_bang
2 years ago
result.push <>
2 years ago
<.tip @click=handle_click_set_default_bang>
<.tip-hotkey> "Click"
<.tip-content> "Set Default Bang"
2 years ago
result.push <>
2 years ago
<.tip
@click=close
@hotkey('esc').force=close
2 years ago
>
<.tip-hotkey> "Esc"
<.tip-content> "Cancel"
2 years ago
2 years ago
result
2 years ago
2 years ago
def render
2 years ago
<self>
css d:flex fld:column gap:20px w:100%
<div>
2 years ago
<input$dn autofocus bind=new_link_text>
2 years ago
<app-tips tips=tips>