Add Markdown parsing to the preview

This commit is contained in:
2024-05-06 19:35:53 +01:00
parent cb425edd8b
commit 6c42b31ae9
5 changed files with 94 additions and 54 deletions

View File

@@ -20,21 +20,17 @@
<h1> This is an input </h1>
<div class="row">
<div class="column" stye="align-items: center">
<div style="display: flex; justify-content: space-between;">
<span class="input_label">Subject:</span>
<input name="subject" type="text" id="subject" hx-post="/subject_preview"
hx-trigger="keyup changed delay:1000ms" hx-target="#subject-preview">
</div><br>
<textarea name="email_input" id="email_input" rows="32" cols="64" style="resize: none;"
<textarea name="email_input" id="email_input"
style="resize: none; width: 100%; height: 639px; padding: 6px 10px; border-radius: 4px; font-family: inter; font-size: 1em;"
hx-trigger="keyup changed delay:1000ms" hx-post="/mail-content" hx-target="#email-preview"
placeholder="Type out your email here..."></textarea>
<br>
<div class="row" style="justify-content: space-around;">
<button hx-post="/send_email" hx-include="[id='email_input'], [id='subject']"
hx-vals='{"destination": "test"}' hx-swap="none">
<button hx-post="/send_email" hx-include="[id='email_input']" hx-vals='{"destination": "test"}'
hx-swap="none">
Send Test Email
</button>
<button hx-post="/send_email" hx-include="[id='email_input'], [id='subject']"
<button hx-post="/send_email" hx-include="[id='email_input']"
hx-vals='{"destination": "mailing_list"}'
hx-confirm="You are about to send an email to your entire mailing list. Are you sure?"
hx-swap="none">
@@ -44,8 +40,7 @@
</div>
<div class="column">
<div id="subject-preview">&nbsp;</div><br>
<div id="email-preview"></div>
<div id="email-preview" style="display: flex; flex-direction: column; align-items: center;"></div>
</div>
</div>
@@ -71,4 +66,15 @@
<li><a href="mailto:{{ . }}"> {{ . }} </a></li>
{{end}}
</ul>
{{end}}
{{end}}
{{ block "mail_content" . }}
<div style="display: flex; flex-direction: row; width: 100%; padding-left: 4px;">
<div>Subject: </div>
<div style="padding-left: 5%;">{{ . }}</div>
</div>
<br>
<iframe src="/static/preview.html" style="width: 600px; height: 600px; border-radius: 4px;"
title="Email Preivew"></iframe>
{{ end }}