client/tag-input: add 'add' button
This commit is contained in:
parent
81f14e154e
commit
0a326972c3
3 changed files with 20 additions and 1 deletions
|
@ -2,6 +2,15 @@
|
||||||
|
|
||||||
div.tag-input
|
div.tag-input
|
||||||
position: relative
|
position: relative
|
||||||
|
|
||||||
|
.main-control
|
||||||
|
display: flex
|
||||||
|
input
|
||||||
|
flex: 5
|
||||||
|
button
|
||||||
|
flex: 1
|
||||||
|
margin: 0 0 0 0.5em
|
||||||
|
|
||||||
ul
|
ul
|
||||||
margin-top: 0.2em
|
margin-top: 0.2em
|
||||||
li
|
li
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<div class='tag-input'>
|
<div class='tag-input'>
|
||||||
|
<div class='main-control'>
|
||||||
<input type='text' placeholder='type to add…'/>
|
<input type='text' placeholder='type to add…'/>
|
||||||
|
<button>Add</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class='tag-suggestions'>
|
<div class='tag-suggestions'>
|
||||||
<div class='wrapper'>
|
<div class='wrapper'>
|
||||||
|
|
|
@ -118,6 +118,8 @@ class TagInputControl extends events.EventTarget {
|
||||||
'click', e => this._evtToggleSuggestionsPopupOpacityClick(e));
|
'click', e => this._evtToggleSuggestionsPopupOpacityClick(e));
|
||||||
this._editAreaNode.querySelector('a.close').addEventListener(
|
this._editAreaNode.querySelector('a.close').addEventListener(
|
||||||
'click', e => this._evtCloseSuggestionsPopupClick(e));
|
'click', e => this._evtCloseSuggestionsPopupClick(e));
|
||||||
|
this._editAreaNode.querySelector('button').addEventListener(
|
||||||
|
'click', e => this._evtAddTagButtonClick(e));
|
||||||
|
|
||||||
// show
|
// show
|
||||||
this._hostNode.style.display = 'none';
|
this._hostNode.style.display = 'none';
|
||||||
|
@ -248,6 +250,11 @@ class TagInputControl extends events.EventTarget {
|
||||||
this._closeSuggestionsPopup();
|
this._closeSuggestionsPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_evtAddTagButtonClick(e) {
|
||||||
|
this.addTag(this._tagInputNode.value, SOURCE_USER_INPUT);
|
||||||
|
this._tagInputNode.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
_evtToggleSuggestionsPopupOpacityClick(e) {
|
_evtToggleSuggestionsPopupOpacityClick(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this._toggleSuggestionsPopupOpacity();
|
this._toggleSuggestionsPopupOpacity();
|
||||||
|
|
Loading…
Reference in a new issue