Browse Source
split tags using tokenfield instead of comma-separated
this allows tag values to contain spaces, which is up to your own micropub server to handle appropriately.
closes #95 and replaces #96
pull/108/head
Aaron Parecki
7 years ago
No known key found for this signature in database
GPG Key ID: 276C2817346D6056
6 changed files with
7 additions and
20 deletions
-
public/editor-files/editor.js
-
public/js/script.js
-
views/event.php
-
views/new-bookmark.php
-
views/new-itinerary.php
-
views/new-post.php
|
|
@ -72,7 +72,7 @@ $(function() { |
|
|
|
$('#publish-in-progress').removeClass('hidden'); |
|
|
|
$('#publish-fields').addClass('hidden'); |
|
|
|
|
|
|
|
var category = csv_to_array($("#post-tags").tokenfield('getTokensList')); |
|
|
|
var category = $("#note_category").tokenfield("getTokens").map(function(t){ return t.value}); |
|
|
|
|
|
|
|
$.post('/editor/publish', { |
|
|
|
name: $("#post-name").val(), |
|
|
@ -149,14 +149,6 @@ function reset_page() { |
|
|
|
return localforage.setItem('currentdraft', {}); |
|
|
|
} |
|
|
|
|
|
|
|
function csv_to_array(val) { |
|
|
|
if(val.length > 0) { |
|
|
|
return val.split(/[, ]+/); |
|
|
|
} else { |
|
|
|
return []; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* ************************************************ */ |
|
|
|
/* autosave loop */ |
|
|
|
var autosaveTimeout = false; |
|
|
|
|
|
@ -14,15 +14,10 @@ |
|
|
|
return num; |
|
|
|
} |
|
|
|
|
|
|
|
function csv_to_array(val) { |
|
|
|
if(val.length > 0) { |
|
|
|
return val.split(/[, ]+/); |
|
|
|
} else { |
|
|
|
return []; |
|
|
|
} |
|
|
|
function tokenfieldToArray(sel) { |
|
|
|
return $(sel).tokenfield("getTokens").map(function(t){ return t.value}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$(function(){ |
|
|
|
|
|
|
|
// Set the date from JS
|
|
|
|
|
|
@ -73,7 +73,7 @@ |
|
|
|
name: $("#event_name").val(), |
|
|
|
start: event_start, |
|
|
|
location: $("#event_location").val(), |
|
|
|
category: csv_to_array($("#note_category").val()) |
|
|
|
category: tokenfieldToArray("#note_category") |
|
|
|
}; |
|
|
|
|
|
|
|
if(event_end) { |
|
|
|
|
|
@ -89,7 +89,7 @@ $(function(){ |
|
|
|
'bookmark-of': $("#note_bookmark").val(), |
|
|
|
name: $("#note_name").val(), |
|
|
|
content: $("#note_content").val(), |
|
|
|
category: csv_to_array($("#note_category").val()), |
|
|
|
category: tokenfieldToArray("#note_category"), |
|
|
|
'<?= $this->user->micropub_syndicate_field ?>': syndications |
|
|
|
}, function(response){ |
|
|
|
if(response.location != false) { |
|
|
|
|
|
@ -180,7 +180,7 @@ $(function(){ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
var category = csv_to_array($("#note_category").val()); |
|
|
|
var category = tokenfieldToArray("#note_category"); |
|
|
|
|
|
|
|
properties = { |
|
|
|
itinerary: itinerary |
|
|
|
|
|
@ -689,7 +689,7 @@ $(function(){ |
|
|
|
syndications.push($(btn).data('syndicate-to')); |
|
|
|
}); |
|
|
|
|
|
|
|
var category = csv_to_array($("#note_category").val()); |
|
|
|
var category = tokenfieldToArray("#note_category"); |
|
|
|
|
|
|
|
var formData = new FormData(); |
|
|
|
var entry = {}; |
|
|
|