Skip to content

Commit

Permalink
Add the yaml worker for yaml syntax highlighting,
Browse files Browse the repository at this point in the history
  • Loading branch information
clementwanjau committed Nov 7, 2023
1 parent bbc6523 commit c21506d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ yew-components = ["api", "yew"]
js-sys = "0.3"
paste = "1.0"
wasm-bindgen = "0.2"
yew = { version = "0.21", features = ["csr"], optional = true }
yew = { version = "0.21.0", features = ["csr"], optional = true }

[dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 2 additions & 0 deletions src/workers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const EDITOR_WORKER: &str = include_worker!("editor.worker.js");
const CSS_WORKER: &str = include_worker!("css.worker.js");
const HTML_WORKER: &str = include_worker!("html.worker.js");
const JSON_WORKER: &str = include_worker!("json.worker.js");
const YAML_WORKER: &str = include_worker!("yaml.worker.js");

fn create_worker(source: &str) -> Result<Worker, JsValue> {
let array: Array = iter::once(JsValue::from_str(source)).collect();
Expand All @@ -38,6 +39,7 @@ fn get_worker(_id: String, label: String) -> Worker {
"css" => CSS_WORKER,
"html" => HTML_WORKER,
"json" => JSON_WORKER,
"yaml" => YAML_WORKER,
_ => EDITOR_WORKER,
};
create_worker(worker).expect("failed to create worker")
Expand Down

0 comments on commit c21506d

Please sign in to comment.