improve generation of slugs

This commit is contained in:
Herbert Maschke 2019-11-25 15:16:21 +01:00 committed by David Große
parent 1048cbc5c9
commit 3efe3a7f61
2 changed files with 11 additions and 7 deletions

3
.gitignore vendored
View File

@ -5,7 +5,6 @@
/public/js /public/js
/public/vendor /public/vendor
/public/themes /public/themes
/storage/*.key
/vendor /vendor
/.idea /.idea
/.vscode /.vscode
@ -21,3 +20,5 @@ yarn.lock
package-lock.json package-lock.json
yarn.lock yarn.lock
.php_cs.cache .php_cs.cache
storage/
storage/*.key

View File

@ -1,12 +1,15 @@
<script> <script>
export default { export default {
bind(el, binding, vnode) { bind(el, binding, vnode) {
let handler = function(e) { let handler = function (e) {
setTimeout(function() { setTimeout(function () {
e.target.value = e.target.value.toString().toLowerCase() e.target.value = e.target.value
.replace(/[^\w- ]+/g,'') .toString()
.trim() .toLowerCase()
.replace(/ +/g,'-'); .replace(/[^\w- ]+/g, '')
.replace(/ +/g, '-')
.replace('![-\s]+!u', '-')
.trim();
}, 100); }, 100);
} }