mirror of
https://github.com/directus/directus.git
synced 2026-01-29 15:47:57 -05:00
Fix slug input (#8888)
* allow arrow keys in slug input * enable preserveTrailingDash for slug input
This commit is contained in:
@@ -179,7 +179,17 @@ export default defineComponent({
|
||||
function processValue(event: KeyboardEvent) {
|
||||
if (!event.key) return;
|
||||
const key = event.key.toLowerCase();
|
||||
const systemKeys = ['meta', 'shift', 'alt', 'backspace', 'tab'];
|
||||
const systemKeys = [
|
||||
'meta',
|
||||
'shift',
|
||||
'alt',
|
||||
'backspace',
|
||||
'tab',
|
||||
'arrowup',
|
||||
'arrowdown',
|
||||
'arrowleft',
|
||||
'arrowright',
|
||||
];
|
||||
const value = (event.target as HTMLInputElement).value;
|
||||
|
||||
if (props.slug === true) {
|
||||
@@ -233,7 +243,7 @@ export default defineComponent({
|
||||
} else {
|
||||
if (props.slug === true) {
|
||||
const endsWithSpace = value.endsWith(' ');
|
||||
value = slugify(value, { separator: props.slugSeparator });
|
||||
value = slugify(value, { separator: props.slugSeparator, preserveTrailingDash: true });
|
||||
if (endsWithSpace) value += props.slugSeparator;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user