33 <label :class =" { lifted: !isEmpty }" >{{ props.label }}</label >
44 <input
55 @focus =" isFocus = true"
6- @blur ="
7- isFocus = false;
8- refreshInput();
9- "
6+ @blur =" isFocus = false"
107 type =" text"
118 v-model =" value"
129 ref =" inputRef"
1512</template >
1613
1714<script setup lang="ts">
18- import { computed , ref } from " vue" ;
15+ import { computed , ref , watch } from " vue" ;
1916
2017const value = defineModel <string >({ required: true });
2118const props = defineProps <{
@@ -29,9 +26,12 @@ function refreshInput() {
2926 // On Chromium browsers, ligatures over 3 characters are not displayed until force refresh
3027 // Manually setting the value won't trigger Vue's reactivity system, no performance issue
3128 if (! inputRef .value ) return ;
29+ const { selectionStart, selectionEnd } = inputRef .value ;
3230 inputRef .value .value = value .value + " \u200B " ;
3331 inputRef .value .value = value .value ;
32+ inputRef .value .setSelectionRange (selectionStart , selectionEnd );
3433}
34+ watch (value , refreshInput );
3535 </script >
3636
3737<style lang="scss">
@@ -45,6 +45,7 @@ function refreshInput() {
4545 border-bottom-color 0.2s ;
4646 padding : 0 ;
4747 display : flex ;
48+ font-family : var (--font-math );
4849 & .focus {
4950 background-color : var (--s-color-surface-container-highest );
5051 border-bottom-color : var (--s-color-primary );
0 commit comments