Browse Source

fix posting multiple tags, add more formatting buttons to medium editor

pull/37/head
Aaron Parecki 8 years ago
parent
commit
76dedd3c22
2 changed files with 10 additions and 3 deletions
  1. +3
    -1
      public/editor/editor.js
  2. +7
    -2
      views/new-post.php

+ 3
- 1
public/editor/editor.js View File

@ -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

+ 7
- 2
views/new-post.php View File

@ -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);

Loading…
Cancel
Save