This commit is contained in:
2025-10-13 13:41:34 +02:00
parent 90f10143da
commit 4b62a9a64b
23 changed files with 679 additions and 196 deletions

View File

@@ -9,28 +9,26 @@ templ BinPreviewPage(id, content string) {
templ BinEditorPage() {
@base("bin") {
<form action="/" method="post">
<label for="content-editor" class="sr-only">Paste Content</label>
<textarea
id="content-editor"
name="content"
placeholder="bin something"
autofocus
autocomplete="off"
autocorrent="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
></textarea>
<button type="submit"></button>
<button type="submit">Save</button>
</form>
<script>
const form = document.querySelector('form');
const input = document.querySelector('textarea');
const button = document.querySelector('button[type="submit"]');
document.body.addEventListener('keydown', (e) => {
if (e.which === 83 && e.ctrlKey) { // ctrl + s
document.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === 's') {
e.preventDefault();
form.submit();
document.querySelector('form').submit();
}
});
</script>
}
}
}