diff --git a/js/qn-dialogs.js b/js/qn-dialogs.js index c1a26c3..40d6e81 100644 --- a/js/qn-dialogs.js +++ b/js/qn-dialogs.js @@ -58,7 +58,7 @@ const QnDialogs = { } }); - input.val(selectedTags.map(function (value) { return value.id; })); + input.val(selectedTags.map(function (value) { return value.id >= 0 ? value.id : value.name; })); input.trigger("change"); $('.select2-input').on("keyup", function (event) { diff --git a/js/script.js b/js/script.js index 84efeb6..5774a86 100644 --- a/js/script.js +++ b/js/script.js @@ -612,11 +612,15 @@ View.prototype = { // handle tags button. $('#modal-note-div #tag-button').click(function (event) { event.stopPropagation(); - var id = $("#modal-note-div .quicknote").data('id'); - self._notes.load(id); + var noteTags = $("#modal-note-div .slim-tag").toArray().map(function (value) { + return { + id: value.getAttribute('tag-id'), + name: value.textContent.trim() + }; + }); QnDialogs.tags( self._notes.getTags(), - self._notes.getActive().tags, + noteTags, function(result, newTags) { if (result === true) { var modalTags = $('#modal-note-div .note-tags');