client/tag-input: add 'add' button

This commit is contained in:
rr- 2016-08-22 00:20:35 +02:00
parent 81f14e154e
commit 0a326972c3
3 changed files with 20 additions and 1 deletions

View file

@ -2,6 +2,15 @@
div.tag-input
position: relative
.main-control
display: flex
input
flex: 5
button
flex: 1
margin: 0 0 0 0.5em
ul
margin-top: 0.2em
li

View file

@ -1,5 +1,8 @@
<div class='tag-input'>
<div class='main-control'>
<input type='text' placeholder='type to add…'/>
<button>Add</button>
</div>
<div class='tag-suggestions'>
<div class='wrapper'>

View file

@ -118,6 +118,8 @@ class TagInputControl extends events.EventTarget {
'click', e => this._evtToggleSuggestionsPopupOpacityClick(e));
this._editAreaNode.querySelector('a.close').addEventListener(
'click', e => this._evtCloseSuggestionsPopupClick(e));
this._editAreaNode.querySelector('button').addEventListener(
'click', e => this._evtAddTagButtonClick(e));
// show
this._hostNode.style.display = 'none';
@ -248,6 +250,11 @@ class TagInputControl extends events.EventTarget {
this._closeSuggestionsPopup();
}
_evtAddTagButtonClick(e) {
this.addTag(this._tagInputNode.value, SOURCE_USER_INPUT);
this._tagInputNode.value = '';
}
_evtToggleSuggestionsPopupOpacityClick(e) {
e.preventDefault();
this._toggleSuggestionsPopupOpacity();