Merge pull request #1826 from Haendlerbund/18062-feature/improve-sluggable-logic
improve sluggable logic
This commit is contained in:
commit
1b026bc913
|
|
@ -5,7 +5,6 @@
|
|||
/public/js
|
||||
/public/vendor
|
||||
/public/themes
|
||||
/storage/*.key
|
||||
/vendor
|
||||
/.idea
|
||||
/.vscode
|
||||
|
|
@ -21,3 +20,5 @@ yarn.lock
|
|||
package-lock.json
|
||||
yarn.lock
|
||||
.php_cs.cache
|
||||
storage/
|
||||
storage/*.key
|
||||
|
|
|
|||
|
|
@ -1,14 +1,21 @@
|
|||
<script>
|
||||
export default {
|
||||
bind(el, binding, vnode) {
|
||||
let handler = function(e) {
|
||||
setTimeout(function() {
|
||||
e.target.value = e.target.value.toString().toLowerCase()
|
||||
.replace(/[^\w- ]+/g,'')
|
||||
.trim()
|
||||
.replace(/ +/g,'-');
|
||||
let handler = function (e) {
|
||||
setTimeout(function () {
|
||||
e.target.value = e.target.value
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.replace(/[^\w- ]+/g, '')
|
||||
|
||||
// replace whitespaces with dashes
|
||||
.replace(/ +/g, '-')
|
||||
|
||||
// avoid having multiple dashes (---- translates into -)
|
||||
.replace('![-\s]+!u', '-')
|
||||
.trim();
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
el.addEventListener('input', handler);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue