Add copy id button next to delete button in web UI

This commit is contained in:
2026-06-12 13:03:49 +00:00
parent 13dbdd3260
commit ca8b74d724
+3 -2
View File
@@ -244,6 +244,8 @@ UI_HTML = r"""<!DOCTYPE html>
.entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.del-btn { background: none; border: 1px solid #ccc; color: #999; cursor: pointer; font-size: .8rem; padding: .15rem .5rem; border-radius: 4px; }
.del-btn:hover { background: #e55; border-color: #e55; color: #fff; }
.copy-btn { background: none; border: 1px solid #ccc; color: #999; cursor: pointer; font-size: .8rem; padding: .15rem .5rem; border-radius: 4px; }
.copy-btn:hover { background: #ddd; border-color: #bbb; color: #333; }
.entry-text strong { font-weight: 600; }
.entry-text em { font-style: italic; }
.entry-text a { color: #06c; }
@@ -305,9 +307,8 @@ def ui_index():
for e in entries:
rendered = _render_markdown(e["text"])
short_id = e["id"][:8]
card = (
'<div class="entry">'
f'<div class="entry-header"><span class="entry-id">{_html.escape(short_id)}</span>'
'<button class="copy-btn" type="button" onclick="navigator.clipboard.writeText(\'{_html.escape(e["id"])}\')">copy id</button>'
'<form method="post" action="/-/delete/' + _html.escape(e['id']) + '" style="margin:0" onsubmit="return confirm(\'Delete this entry?\')">'
'<button class="del-btn" type="submit">delete</button></form></div>'
f'<div class="entry-text">{rendered}</div>'