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