Commit daf415e
fix: syntax highlighting lost when toggling
When the `Editable` parameter changes, syntax highlighting is lost
until the text is modified.
This happens because no parameter scope is registered for `Editable`,
so `ParameterChanged` is never invoked on change. As a result, the
`MudCode.highlight` JS function isn't called after the DOM updates,
leaving the code unhighlighted.
I ran into this in my project; it's also reported in #628.
The fix registers `Editable` in the parameter scope, the same way as
`Code`, `ShowLineNumbers`, etc. This ensures `ParameterChanged` fires
when `Editable` changes, triggering `MudCode.highlight` to re-highlight
the code after the DOM update.Editable on MudCodeViewer
1 parent 6051e0e commit daf415e
1 file changed
Lines changed: 7 additions & 3 deletions
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
174 | 178 | | |
175 | 179 | | |
176 | 180 | | |
177 | | - | |
| 181 | + | |
178 | 182 | | |
179 | 183 | | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
183 | | - | |
| 187 | + | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
| |||
0 commit comments