Fixed #3435 - MultiSelect: mark text with shift+Home does not work

pull/3509/head
mertsincan 2023-01-09 13:06:17 +00:00
parent 61508e656c
commit 705f7e796c
2 changed files with 16 additions and 21 deletions

View File

@ -663,29 +663,19 @@ export default {
this.multiple && event.stopPropagation(); // To prevent onArrowRightKeyOnMultiple method
},
onHomeKey(event) {
const target = event.currentTarget;
const len = target.value.length;
if (event.shiftKey) {
event.currentTarget.setSelectionRange(0, len);
} else {
event.currentTarget.setSelectionRange(0, 0);
}
const { currentTarget } = event;
const len = currentTarget.value.length;
currentTarget.setSelectionRange(0, event.shiftKey ? len : 0);
this.focusedOptionIndex = -1;
event.preventDefault();
},
onEndKey(event) {
const target = event.currentTarget;
const len = target.value.length;
if (event.shiftKey) {
event.currentTarget.setSelectionRange(0, len);
} else {
target.setSelectionRange(len, len);
}
const { currentTarget } = event;
const len = currentTarget.value.length;
currentTarget.setSelectionRange(event.shiftKey ? 0 : len, len);
this.focusedOptionIndex = -1;
event.preventDefault();

View File

@ -660,8 +660,12 @@ export default {
pressedInInputText && (this.focusedOptionIndex = -1);
},
onHomeKey(event, pressedInInputText = false) {
const { currentTarget } = event;
if (pressedInInputText) {
event.currentTarget.setSelectionRange(0, 0);
const len = currentTarget.value.length;
currentTarget.setSelectionRange(0, event.shiftKey ? len : 0);
this.focusedOptionIndex = -1;
} else {
let metaKey = event.metaKey || event.ctrlKey;
@ -679,11 +683,12 @@ export default {
event.preventDefault();
},
onEndKey(event, pressedInInputText = false) {
if (pressedInInputText) {
const target = event.currentTarget;
const len = target.value.length;
const { currentTarget } = event;
target.setSelectionRange(len, len);
if (pressedInInputText) {
const len = currentTarget.value.length;
currentTarget.setSelectionRange(event.shiftKey ? 0 : len, len);
this.focusedOptionIndex = -1;
} else {
let metaKey = event.metaKey || event.ctrlKey;