We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a0e4226 commit e2b4c6eCopy full SHA for e2b4c6e
src/lib/EditableNumber.svelte
@@ -22,7 +22,8 @@
22
if (value > max) value = max
23
})
24
25
- function select(e: FocusEvent) {
+ // Select all the text when the input is focused
26
+ function onfocus(e: FocusEvent) {
27
const range = document.createRange()
28
range.selectNodeContents(e.target as HTMLElement)
29
const sel = window.getSelection()!
@@ -51,8 +52,8 @@
51
52
role="none"
53
contenteditable="true"
54
bind:innerText={serialise, deserialise}
- onfocus={select}
55
onkeypress={e => isNaN(parseInt(e.key)) && e.preventDefault()}
56
+ {onfocus}
57
{onwheel}
58
></div>
59
{#if children}
0 commit comments