mirror of
https://github.com/skidoodle/pastebin
synced 2025-10-14 09:44:48 +02:00
init
This commit is contained in:
36
view/bin.templ
Normal file
36
view/bin.templ
Normal file
@@ -0,0 +1,36 @@
|
||||
package view
|
||||
|
||||
templ BinPreviewPage(id, content string) {
|
||||
@base("bin@" + id) {
|
||||
@templ.Raw(content)
|
||||
}
|
||||
}
|
||||
|
||||
templ BinEditorPage() {
|
||||
@base("bin") {
|
||||
<form action="/" method="post">
|
||||
<textarea
|
||||
name="content"
|
||||
placeholder="bin something"
|
||||
autofocus
|
||||
autocomplete="off"
|
||||
autocorrent="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
></textarea>
|
||||
<button type="submit"></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
|
||||
e.preventDefault();
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user