summaryrefslogtreecommitdiffstats
path: root/templates/note.html.template
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-09-20 12:15:57 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-09-20 12:15:57 -0700
commitb8aec40bdc5cb5a5703113a6a89298d20a2cd896 (patch)
tree2236cce971e3dfb02def9a340c655f69f96eeb9d /templates/note.html.template
parent4f374aedfc0b70f1472fa357ac3d17ccecf70aff (diff)
downloadroseh.moe-b8aec40bdc5cb5a5703113a6a89298d20a2cd896.tar.zst
Add support for a private notepad
Diffstat (limited to 'templates/note.html.template')
-rw-r--r--templates/note.html.template32
1 files changed, 32 insertions, 0 deletions
diff --git a/templates/note.html.template b/templates/note.html.template
new file mode 100644
index 0000000..eac0e02
--- /dev/null
+++ b/templates/note.html.template
@@ -0,0 +1,32 @@
+{{define "head"}}
+<script src="/static/htmx.min.js"></script>
+<title>Notepad</title>
+
+<meta name="viewport" content="interactive-widget=resizes-content"> <!-- https://stackoverflow.com/q/76026292 -->
+{{end}}
+
+<form method="post">
+ <div class="save-indicator-container">
+ {{block "saveIndicator" ""}}
+ <span id="save-indicator">{{.}}</span>
+ {{end}}
+ <noscript><input type="submit" value="Save"></noscript>
+ </div>
+ <div class="content-container">
+ <textarea
+ name="content"
+ hx-post="/notepad/autosave"
+ hx-on:input="
+ const indicator = htmx.find('#save-indicator');
+ htmx.addClass(indicator, 'htmx-indicator');
+ indicator.innerHTML = 'Saving...';
+ "
+ hx-trigger="input delay:1s"
+ hx-indicator="#save-indicator"
+ hx-target="#save-indicator"
+ hx-swap="outerHTML"
+ autofocus>
+ {{- .Content -}}
+ </textarea>
+ </div>
+</form>