Skip to content

Commit

Permalink
pass tag directly to removeTag function
Browse files Browse the repository at this point in the history
  • Loading branch information
petaded committed Nov 18, 2022
1 parent 0cecc9e commit 09553c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions src/renderer/components/ft-input-tags/ft-input-tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,9 @@ export default Vue.extend({
// clear input box
this.$refs.childinput.handleClearTextClick()
},
removeTag: function (e) {
removeTag: function (tag) {
// Remove tag from list
let parent = e.srcElement.parentElement
if (parent.nodeName === 'svg') {
// for when user clicked the "path" rather than "svg"
parent = parent.parentElement
}
const tagName = parent.firstChild.outerText.trim()
const tagName = tag.trim()
if (this.tagList.includes(tagName)) {
const newList = this.tagList.slice(0)
const index = newList.indexOf(tagName)
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/ft-input-tags/ft-input-tags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
class="removeTagButton"
tabindex="0"
role="button"
@click="removeTag"
@keydown.enter.prevent="removeTag"
@click="removeTag(tag)"
@keydown.enter.prevent="removeTag(tag)"
/>
</li>
</ul>
Expand Down

0 comments on commit 09553c5

Please sign in to comment.