Commit ce2ef45
Marcell Toth
feat(code-viewer): animated transition from plain to highlighted (#193)
* feat(code-viewer): animate syntax highlighting
When first rendering the CodeViewer it does not perform syntax highlighting.
To optimize performance highlighting happens after rendering in a `useEffect` hook. This causes a flicker when the coloring is finally applied to the text.
This fix smoothens out the process using a short (0.3s) animation to introduce the color.
* fix: remove invalid cast
* fix: only animate CodeViewer
CodeEditor is probably missing some keys, which makes every token remounted on change (which happens quite often) in an editor1 parent ea21887 commit ce2ef45
2 files changed
Lines changed: 12 additions & 1 deletion
File tree
- src
- CodeViewer/components/BlockCodeViewer
- styles/components/Code
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
| |||
216 | 223 | | |
217 | 224 | | |
218 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
219 | 230 | | |
220 | 231 | | |
221 | 232 | | |
| |||
0 commit comments