Insert content into editor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2019-08-25 12:56:11 +02:00
parent 5116d35c06
commit 35849b8a33

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"flag"
"fmt"
"html"
"html/template"
"log"
"net/http"
@ -341,8 +342,8 @@ func (h *editHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
} else {
editor = `
<textarea name="content" rows="24" style="width:100%">{{ .Content }}</textarea>
editor = template.HTML(fmt.Sprintf(`
<textarea name="content" rows="24" style="width:100%%">%s</textarea>
<br>
<div class="field">
@ -352,7 +353,7 @@ func (h *editHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
</div>
</div>
<button class="button is-primary" type="submit">Save</button>
`
`, html.EscapeString(pageText)))
}
data := editPage{