summaryrefslogtreecommitdiffstats
path: root/templates/note.html.template
blob: 3c7049c0b9dcdb7075ae5f0691662d1e9f5f08f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{{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}}

{{define "body" -}}
		<form id="form" method="post">
			<div class="save-indicator-container">
			{{- block "saveIndicator" ""}}
				<span id="save-indicator">{{.}}</span>
			{{- end}}
			</div>
			<div class="content-container">
				<textarea
						name="content"
						hx-post="/notepad"
						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>
{{- end}}