diff options
author | Aaron Parecki <aaron@parecki.com> | 2016-04-08 11:54:44 -0700 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2016-04-08 11:54:44 -0700 |
commit | 76dedd3c22cf1613b9930fa0309793cea20cd1b2 (patch) | |
tree | 8bd71ff2761b411bce5b14bfd8fc0118d579b86c | |
parent | 9662af5a17a660a6c921be72a370b3e14cdd08a4 (diff) |
fix posting multiple tags, add more formatting buttons to medium editor
-rw-r--r-- | public/editor/editor.js | 4 | ||||
-rw-r--r-- | views/new-post.php | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/public/editor/editor.js b/public/editor/editor.js index d6fea07..a01f33a 100644 --- a/public/editor/editor.js +++ b/public/editor/editor.js @@ -1,5 +1,7 @@ var editor = new MediumEditor('.editable', { - buttons: ['bold', 'italic', 'anchor', 'header1', 'header2', 'quote', 'unorderedlist', 'pre'], + toolbar: { + buttons: ['bold', 'italic', 'anchor', 'h1', 'h2', 'quote', 'pre', 'unorderedlist'] + }, placeholder: {text: 'Write something nice...'}, paste: { // This example includes the default options for paste, if nothing is passed this is what it used diff --git a/views/new-post.php b/views/new-post.php index 46be7a9..be5dafb 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -146,7 +146,10 @@ $(function(){ // If the user didn't enter any categories, add them from the post if(!userHasSetCategory) { - $("#note_category").val($("#note_content").val().match(/#[a-z0-9]+/g).map(function(tag){ return tag.replace('#',''); }).join(", ")); + var tags = $("#note_content").val().match(/#[a-z0-9]+/g); + if(tags) { + $("#note_category").val(tags.map(function(tag){ return tag.replace('#',''); }).join(", ")); + } } }); @@ -196,7 +199,9 @@ $(function(){ formData.append("location", v); } if(category.length > 0) { - formData.append("category", category); + for(var i in category) { + formData.append("category[]", category[i]); + } } if(syndications.length > 0) { formData.append("syndicate-to", syndications); |