Skip to content

Commit 11d3391

Browse files
author
Rich Harris
committed
tweak
1 parent d2478bf commit 11d3391

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

content/tutorial/01-svelte/07-lifecycle/04-tick/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ You can see that behaviour in this example. Select a range of text and hit the t
1010

1111
```js
1212
/// 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`;
1416
```
1517

1618
...and running it immediately before we set `this.selectionStart` and `this.selectionEnd` at the end of `handleKeydown`:
1719

1820
```js
1921
/// file: App.svelte
20-
await tick();
22+
+++await tick();+++
2123
this.selectionStart = selectionStart;
2224
this.selectionEnd = selectionEnd;
2325
```

content/tutorial/01-svelte/07-lifecycle/04-tick/app-a/src/lib/App.svelte

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,8 @@
66
77
event.preventDefault();
88
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);
1811
1912
const replacement = /[a-z]/.test(selection)
2013
? selection.toUpperCase()
@@ -39,6 +32,7 @@
3932
<style>
4033
textarea {
4134
width: 100%;
42-
height: 200px;
35+
height: 100%;
36+
resize: none;
4337
}
4438
</style>

content/tutorial/01-svelte/07-lifecycle/04-tick/app-b/src/lib/App.svelte

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,8 @@
88
99
event.preventDefault();
1010
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);
2013
2114
const replacement = /[a-z]/.test(selection)
2215
? selection.toUpperCase()
@@ -41,6 +34,7 @@
4134
<style>
4235
textarea {
4336
width: 100%;
44-
height: 200px;
37+
height: 100%;
38+
resize: none;
4539
}
4640
</style>

0 commit comments

Comments
 (0)