Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Erwin Heldy G committed Nov 18, 2021
1 parent bb0e651 commit 88cf883
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
22 changes: 11 additions & 11 deletions dist/css/tagin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/tagin.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tagin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions dist/js/tagin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ function tagin(el, option = {}) {
const classInputHidden = 'tagin-input-hidden'
const defaultSeparator = ','
const defaultDuplicate = 'false'
const defaultEnter = 'false'
const defaultTransform = input => input
const defaultPlaceholder = ''
const separator = el.dataset.separator || option.separator || defaultSeparator
const duplicate = el.dataset.duplicate || option.duplicate || defaultDuplicate
const enter = el.dataset.enter || option.enter || defaultEnter
const transform = eval(el.dataset.transform) || option.transform || defaultTransform
const placeholder = el.dataset.placeholder || option.placeholder || defaultPlaceholder

Expand Down Expand Up @@ -55,6 +57,11 @@ function tagin(el, option = {}) {
wrapper.querySelector('.' + classTag + ':last-of-type').remove()
updateValue()
}
if (input.value !== '' && e.keyCode === 13 && enter === 'true') {
addTag(true)
autowidth()
e.preventDefault()
}
})

// Adding tag
Expand Down Expand Up @@ -107,8 +114,9 @@ function tagin(el, option = {}) {
getValue().trim() !== '' && input.insertAdjacentHTML('beforebegin', getValues().map(templateTag).join(''))
}
}
function escapeRegex(value) {
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
}
el.addEventListener('change', () => updateTag())
}

if (typeof exports === 'object' && typeof module !== 'undefined') {
module.exports = tagin
}
2 changes: 1 addition & 1 deletion dist/js/tagin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 88cf883

Please sign in to comment.