1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 12:50:04 -04:00

Add syntax highlighting in egui web fetch example

This commit is contained in:
Emil Ernerfeldt
2020-12-28 19:50:48 +01:00
parent 2870001544
commit 07e96ca17f
8 changed files with 435 additions and 181 deletions

View File

@@ -67,7 +67,9 @@ async fn fetch_jsvalue(method: &str, url: &str) -> Result<Response, JsValue> {
.flatten()
.unwrap_or_default();
let text = if header_content_type.starts_with("text") {
let text = if header_content_type.starts_with("text")
|| header_content_type == "application/javascript"
{
String::from_utf8(bytes.clone()).ok()
} else {
None