From 1c3b6f50df9c1106bd44dbb201f265f144c1fb3c Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sun, 27 May 2018 08:48:37 -0700 Subject: 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 --- public/editor-files/editor.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'public/editor-files') diff --git a/public/editor-files/editor.js b/public/editor-files/editor.js index 158b34f..06dc3e1 100644 --- a/public/editor-files/editor.js +++ b/public/editor-files/editor.js @@ -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; -- cgit v1.2.3