Show HTML on website

This commit is contained in:
Jason Streifling 2024-02-18 10:48:37 +01:00
parent ad9bfb2439
commit aa034701df
2 changed files with 7 additions and 3 deletions

View File

@ -1,7 +1,7 @@
package handlers
import (
"fmt"
"html/template"
"log"
"net/http"
@ -18,6 +18,6 @@ func HandleFinishedEdit() http.HandlerFunc {
log.Panicln(err)
}
fmt.Println(html)
template.Must(template.ParseFiles("web/templates/editor.html")).ExecuteTemplate(w, "html-result", html)
}
}

View File

@ -1,6 +1,10 @@
{{define "page-content"}}
<form>
<textarea name="editor-textarea"></textarea>
<input type="submit" value="Senden" hx-post="/finished-edit/">
<input type="submit" value="Senden" hx-post="/finished-edit/" hx-target="#page-content">
</form>
{{end}}
{{define "html-result"}}
{{.}}
{{end}}