File tree 3 files changed +12
-22
lines changed
content/tutorial/01-svelte/07-lifecycle/04-tick
3 files changed +12
-22
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,16 @@ You can see that behaviour in this example. Select a range of text and hit the t
10
10
11
11
``` js
12
12
// / file: App.svelte
13
- import { tick } from ' svelte' ;
13
+ ++ + import { tick } from ' svelte' ;++ +
14
+
15
+ let text = ` Select some text and hit the tab key to toggle uppercase` ;
14
16
```
15
17
16
18
...and running it immediately before we set ` this.selectionStart ` and ` this.selectionEnd ` at the end of ` handleKeydown ` :
17
19
18
20
``` js
19
21
// / file: App.svelte
20
- await tick ();
22
+ ++ + await tick ();++ +
21
23
this .selectionStart = selectionStart;
22
24
this .selectionEnd = selectionEnd;
23
25
```
Original file line number Diff line number Diff line change 6
6
7
7
event .preventDefault ();
8
8
9
- const {
10
- selectionStart ,
11
- selectionEnd ,
12
- value
13
- } = this ;
14
- const selection = value .slice (
15
- selectionStart,
16
- selectionEnd
17
- );
9
+ const { selectionStart , selectionEnd , value } = this ;
10
+ const selection = value .slice (selectionStart, selectionEnd);
18
11
19
12
const replacement = / [a-z ] / .test (selection)
20
13
? selection .toUpperCase ()
39
32
<style >
40
33
textarea {
41
34
width : 100% ;
42
- height : 200px ;
35
+ height : 100% ;
36
+ resize : none ;
43
37
}
44
38
</style >
Original file line number Diff line number Diff line change 8
8
9
9
event .preventDefault ();
10
10
11
- const {
12
- selectionStart ,
13
- selectionEnd ,
14
- value
15
- } = this ;
16
- const selection = value .slice (
17
- selectionStart,
18
- selectionEnd
19
- );
11
+ const { selectionStart , selectionEnd , value } = this ;
12
+ const selection = value .slice (selectionStart, selectionEnd);
20
13
21
14
const replacement = / [a-z ] / .test (selection)
22
15
? selection .toUpperCase ()
41
34
<style >
42
35
textarea {
43
36
width : 100% ;
44
- height : 200px ;
37
+ height : 100% ;
38
+ resize : none ;
45
39
}
46
40
</style >
You can’t perform that action at this time.
0 commit comments