mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
allow delete key in v-input (#10264)
This commit is contained in:
@@ -182,23 +182,13 @@ export default defineComponent({
|
||||
function processValue(event: KeyboardEvent) {
|
||||
if (!event.key) return;
|
||||
const key = event.key.toLowerCase();
|
||||
const systemKeys = [
|
||||
'meta',
|
||||
'shift',
|
||||
'alt',
|
||||
'backspace',
|
||||
'tab',
|
||||
'arrowup',
|
||||
'arrowdown',
|
||||
'arrowleft',
|
||||
'arrowright',
|
||||
];
|
||||
const systemKeys = ['meta', 'shift', 'alt', 'backspace', 'delete', 'tab'];
|
||||
const value = (event.target as HTMLInputElement).value;
|
||||
|
||||
if (props.slug === true) {
|
||||
const slugSafeCharacters = 'abcdefghijklmnopqrstuvwxyz01234567890-_~ '.split('');
|
||||
|
||||
const isAllowed = slugSafeCharacters.includes(key) || systemKeys.includes(key);
|
||||
const isAllowed = slugSafeCharacters.includes(key) || systemKeys.includes(key) || key.startsWith('arrow');
|
||||
|
||||
if (isAllowed === false) {
|
||||
event.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user