Halfway trough editor
This commit is contained in:
@@ -1,16 +1,97 @@
|
||||
package cethttp
|
||||
|
||||
const editorPage = `
|
||||
<form action="/save" method="POST">
|
||||
<input type="text" name="title" placeholder="Naslov" />
|
||||
<input type="hidden" value="{{.PostID}}" />
|
||||
<div id="editor"></div>
|
||||
import (
|
||||
"html/template"
|
||||
"strings"
|
||||
|
||||
"github.com/senaduka/cetvorke/database"
|
||||
)
|
||||
|
||||
const editorTemplate = `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>IslamBosna</title>
|
||||
<style>
|
||||
html, body {
|
||||
background-color: #171714;
|
||||
color: #f9f5c3;
|
||||
font-family: sans-serif;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
header {
|
||||
width: 100%;
|
||||
padding-top: 0.5em;
|
||||
padding-bottom: 0.5em;
|
||||
font-family: sans-serif;
|
||||
font-size: 3em;
|
||||
background-color: #0f1115;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
header div, content div {
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
color: #f9f5c3;
|
||||
}
|
||||
header a:link {
|
||||
color: #f9f5c3;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
header a:visited {
|
||||
color: #f9f5c3;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #e6fbfb;
|
||||
}
|
||||
|
||||
#editorcontainer {
|
||||
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>
|
||||
<header>
|
||||
<div>
|
||||
<a href="/">☙ IslamBosna</a>
|
||||
</div>
|
||||
</header>
|
||||
<content>
|
||||
<div>
|
||||
<form method="POST">
|
||||
<input type="text" name="title" placeholder="Naslov" value="{{.Title}}" />
|
||||
<input name="ID" type="hidden" value="{{.ID}}" />
|
||||
<div id="editorcontainer">
|
||||
<div id="editor">{{.MarkdownContent}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</content>
|
||||
<footer>
|
||||
|
||||
</footer>
|
||||
<script>
|
||||
const editor = new Editor({
|
||||
el: document.querySelector('#editor'),
|
||||
height: '500px',
|
||||
initialEditType: 'wysiwyg',
|
||||
previewStyle: 'tab'
|
||||
});
|
||||
const editor = new Pen('#editor');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
|
||||
func editorHtml5Page(post *database.Post) string {
|
||||
t1 := template.New("editorHtml5Page")
|
||||
t1, _ = t1.Parse(editorTemplate)
|
||||
result := new(strings.Builder)
|
||||
t1.Execute(result, post)
|
||||
return result.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user