|
|
@ -7,6 +7,7 @@ import ( |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
"git.stephensearles.com/stephen/acedoc" |
|
|
|
"git.stephensearles.com/stephen/acedoc" |
|
|
|
|
|
|
|
|
|
|
@ -106,23 +107,18 @@ func baseNoExt(name string) string { |
|
|
|
func (t tmplData) IframeSource() string { |
|
|
|
func (t tmplData) IframeSource() string { |
|
|
|
name := baseNoExt(t.docref.name) |
|
|
|
name := baseNoExt(t.docref.name) |
|
|
|
ctype := baseNoExt(path.Dir(t.docref.name)) |
|
|
|
ctype := baseNoExt(path.Dir(t.docref.name)) |
|
|
|
return fmt.Sprintf("/hugo/draft/%s/%s/%s/", base64.RawURLEncoding.EncodeToString([]byte(t.docref.name)), ctype, name) |
|
|
|
return fmt.Sprintf("/hugo/draft/%s/%s/%s/", base64.RawURLEncoding.EncodeToString([]byte(t.docref.name)), ctype, strings.Replace(name, " ", "-", -1)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var EditPage = `<html> |
|
|
|
var EditPage = `<html> |
|
|
|
<head> |
|
|
|
<head> |
|
|
|
<script src="/hugo/simplemde.js"></script> |
|
|
|
<script src="/hugo/simplemde.js"></script> |
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js"></script> |
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ext-settings_menu.js"></script> |
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ext-keybinding_menu.js"></script> |
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/keybinding-vim.js"></script> |
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/mode-markdown.js"></script> |
|
|
|
|
|
|
|
<style type="text/css" media="screen"> |
|
|
|
<style type="text/css" media="screen"> |
|
|
|
#editor {
|
|
|
|
#editor-wrapper {
|
|
|
|
position: absolute; |
|
|
|
position: absolute; |
|
|
|
top: 50px; |
|
|
|
top: 50px; |
|
|
|
right: 0; |
|
|
|
right: 0; |
|
|
|
bottom: 0; |
|
|
|
bottom: 150px; |
|
|
|
left: 40%; |
|
|
|
left: 40%; |
|
|
|
} |
|
|
|
} |
|
|
|
#draft { |
|
|
|
#draft { |
|
|
@ -151,8 +147,10 @@ var EditPage = `<html> |
|
|
|
<span v-else>saved</span> |
|
|
|
<span v-else>saved</span> |
|
|
|
<span v-if="connectionError">, ${connectionError}</span> |
|
|
|
<span v-if="connectionError">, ${connectionError}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div id="editor-wrapper"> |
|
|
|
<textarea id="editor">{{ .LoadContent }}</textarea> |
|
|
|
<textarea id="editor">{{ .LoadContent }}</textarea> |
|
|
|
<div id="draft"><!--<iframe src="{{ .IframeSource }}">Loading draft...</iframe>--></div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div id="draft"><iframe src="{{ .IframeSource }}">Loading draft...</iframe></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
var uiBindings = { |
|
|
|
var uiBindings = { |
|
|
|