diff options
| author | kj_sh604 | 2026-05-31 11:29:58 -0400 |
|---|---|---|
| committer | kj_sh604 | 2026-05-31 11:29:58 -0400 |
| commit | 2b2e511a15414f6c28f15990b75442424f9cc3b9 (patch) | |
| tree | 99a6cc4ad40dd2309bb4a0b2c875e1719dbfe449 /src/templates | |
| parent | 4626e9f40c4678622ef53cc0d9d3fa89768c08f0 (diff) | |
refactor: initial hardening tweaks
store images in localStorage
Diffstat (limited to 'src/templates')
| -rw-r--r-- | src/templates/index.html | 27 | ||||
| -rw-r--r-- | src/templates/partials/upload_error.html | 4 | ||||
| -rw-r--r-- | src/templates/partials/upload_result.html | 12 |
3 files changed, 4 insertions, 39 deletions
diff --git a/src/templates/index.html b/src/templates/index.html index 194a2af..3af58ad 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -7,17 +7,6 @@ <title>likha-pdf</title> <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kj-sh604/noir.css@latest/out/noir.min.css" /> - <script src="https://unpkg.com/htmx.org@1.9.12"></script> - <style> - .htmx-indicator { - display: none; - } - - .htmx-request .htmx-indicator, - .htmx-request.htmx-indicator { - display: inline; - } - </style> </head> <body> @@ -25,7 +14,7 @@ <h1>likha-pdf</h1> <p>simple markdown to pdf export.</p> - <form id="convert-form" hx-post="/convert" hx-target="#result" hx-swap="innerHTML" hx-indicator="#loading"> + <form id="convert-form" action="/convert" method="post"> <label for="markdown"> <h3>textarea</h3> </label> @@ -34,19 +23,11 @@ <section id="image-upload-section"> <label for="image"><small>image file</small></label> - <input id="image" name="image" type="file" accept="image/*" /> - <button id="upload-button" type="button" hx-post="/upload-image" hx-target="#upload-result" hx-swap="innerHTML" - hx-encoding="multipart/form-data" hx-include="#image" hx-indicator="#uploading">upload image</button> - <small id="uploading" class="htmx-indicator">uploading…</small> + <input id="image" type="file" accept="image/*" /> + <button id="upload-button" type="button">insert image</button> <div id="upload-result" aria-live="polite"></div> </section> - <section id="md-file-section"> - <h3>or upload a markdown file</h3> - <label for="md-file"><small><em>(overrides textarea)</em></small></label> - <input id="md-file" type="file" accept=".md,.markdown,text/markdown,text/plain" /> - </section> - <section> <h3>pdf options</h3> @@ -133,7 +114,7 @@ </section> <button id="convert-button" type="submit">generate pdf</button> - <small id="loading" class="htmx-indicator">converting…</small> + <small id="loading" hidden>converting...</small> </form> <section id="result" aria-live="polite"></section> diff --git a/src/templates/partials/upload_error.html b/src/templates/partials/upload_error.html deleted file mode 100644 index d219783..0000000 --- a/src/templates/partials/upload_error.html +++ /dev/null @@ -1,4 +0,0 @@ -<article> - <h4>upload failed</h4> - <pre>{{ message }}</pre> -</article> diff --git a/src/templates/partials/upload_result.html b/src/templates/partials/upload_result.html deleted file mode 100644 index 116c74c..0000000 --- a/src/templates/partials/upload_result.html +++ /dev/null @@ -1,12 +0,0 @@ -<article> - <h4>image uploaded</h4> - <p><a href="{{ preview_url }}" target="_blank" rel="noreferrer">{{ filename }}</a></p> - <p><code id="uploaded-markdown">{{ markdown_snippet }}</code></p> - <button - type="button" - data-insert-markdown="{{ markdown_snippet }}" - class="insert-markdown" - > - insert into markdown - </button> -</article> |
