Skip to content

Commit

Permalink
add SimpleMDE to blog editing
Browse files Browse the repository at this point in the history
  • Loading branch information
TangentFoxy committed Sep 2, 2016
1 parent 13f354b commit 351fa6c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions blog.moon
Expand Up @@ -173,6 +173,27 @@ class extends lapis.Application

if post = Posts\find slug: @params.slug
@html ->
link rel: "stylesheet", href: @build_url "static/simplemde/simplemde.min.css"
script src: @build_url "static/simplemde/simplemde.min.js"
script -> raw "
window.onload = function () { var simplemde = new SimpleMDE({
autosave: {
enabled: true,
uniqueId: '#{@url_for "blog_edit", slug: post.id}' // we use IDs because slugs can change
},
indentWithTabs: false,
insertTexts: {
link: ['[', '](https://)']
},
parsingConfig: {
strikethrough: false
},
renderingConfig: {
singleLineBreaks: false,
// TODO add codeSyntaxHighlighting: true // this uses highlight.js which I already love :P
}
}); }
"
form {
action: @url_for "blog_edit", slug: post.slug
method: "POST"
Expand All @@ -184,6 +205,8 @@ class extends lapis.Application
br!
textarea cols: 80, rows: 13, name: "text", post.text
br!
text "(Note: Tables are not part of standard Markdown, and will not work.)"
br!
element "select", name: "status", ->
for status in *Posts.statuses
if status == Posts.statuses[post.status]
Expand Down

0 comments on commit 351fa6c

Please sign in to comment.