Editor to gemtext half way
This commit is contained in:
@@ -57,9 +57,6 @@ const editorTemplate = `
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/static/pen.css" />
|
||||
<script src="/static/markdown.js"></script>
|
||||
<script src="/static/pen.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -74,16 +71,15 @@ const editorTemplate = `
|
||||
<input type="text" name="title" placeholder="Naslov" value="{{.Title}}" />
|
||||
<input name="ID" type="hidden" value="{{.ID}}" />
|
||||
<div id="editorcontainer">
|
||||
<div id="editor">{{.MarkdownContent}}</div>
|
||||
<textarea id="editor">{{.GemtextContent}}</textarea>
|
||||
</div>
|
||||
<input type="submit" value="Sačuvaj" />
|
||||
</form>
|
||||
</div>
|
||||
</content>
|
||||
<footer>
|
||||
|
||||
</footer>
|
||||
<script>
|
||||
const editor = new Pen('#editor');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cethttp
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@@ -31,7 +32,7 @@ func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
editedTitle := r.FormValue("title")
|
||||
|
||||
// Update the post content.
|
||||
post.Content = editedContent
|
||||
post.GemtextContent = sql.NullString{String: editedContent, Valid: true}
|
||||
post.Title = editedTitle
|
||||
|
||||
// Save the edited post to the database.
|
||||
|
||||
Reference in New Issue
Block a user