Skip to content

Commit

Permalink
Textarea: improve selection after insert command
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Oct 21, 2023
1 parent b9e1ccc commit 07233c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion panel/src/components/Forms/Input/TextareaInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ export default {
setTimeout(() => {
input.focus();
input.setRangeText(text, input.selectionStart, input.selectionEnd);
const start = input.selectionStart;
const end = input.selectionEnd;
const mode = start === end ? "end" : "select";
input.setRangeText(text, start, end, mode);
this.$emit("input", input.value);
});
},
Expand Down

0 comments on commit 07233c4

Please sign in to comment.