diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c52680..c4eb030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,10 @@ #### Features - Snippet tag functionalities #### Improvements -- + #### Patches - Debug output +- Search prompt --- diff --git a/lib/icon-helper.js b/lib/icon-helper.js index c0f4ce5..d656d37 100644 --- a/lib/icon-helper.js +++ b/lib/icon-helper.js @@ -101,7 +101,7 @@ export default class IconHelper { * (http://konpa.github.io/devicon/) */ // markdown icon - return ''; + return ''; break; // case 'Go': /** diff --git a/lib/snippet-injector.js b/lib/snippet-injector.js index 564dbaf..1b5f55c 100644 --- a/lib/snippet-injector.js +++ b/lib/snippet-injector.js @@ -180,7 +180,8 @@ export default { var elem = new Snippet(JSON.parse(storage.retrieveFile(currentValue.replace('.json','')))); listitems.push({ title: elem.getTitle(), - uid: elem.getUID() + uid: elem.getUID(), + tags: elem.getTags() }); icons.push(elem.getLang()); }); diff --git a/lib/util.js b/lib/util.js index b1aec35..0458dd9 100644 --- a/lib/util.js +++ b/lib/util.js @@ -140,10 +140,15 @@ export default class Util { var text = edit.getText(); $('#prompt-list').find('.list-item, .notice').remove(); var filteredItems = options.listItems.filter(function(element) { - element = element.toLowerCase(); text = text.toLowerCase(); if(text !== '' && text !== ' ' && text !== null && text !== undefined) { - return (element.indexOf(text) > -1 ? true : false); + var title = element.title.toLowerCase(); + var tags = element.tags.join(' ').toLowerCase(); + if(text.startsWith('#')) { + return (tags.indexOf(text.split('#').join('')) > -1 ? true : false); + } else { + return (title.indexOf(text) > -1 ? true : false); + } } else { return true; } @@ -159,14 +164,17 @@ export default class Util { listDOMstring += IconHelper.getIconTag('default'); } } - listDOMstring += '

'; - listDOMstring += currentValue; + listDOMstring += '

'; + listDOMstring += currentValue.title; listDOMstring += '

'; }); } else { listDOMstring += '
  • '+options.nothingfound+'
  • '; } $('#prompt-list').append(listDOMstring); + if(options.icons.length > 0) { + IconHelper.colorize('colored-svg'); + } }); var handleCancel = function(e) { window.removeEventListener('keyup',handleKey,true);