Skip to content

Commit

Permalink
cancel link creation experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
rambip committed Jul 4, 2024
1 parent 9a6b8cd commit 10d122d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
dioxus = "0.4.0"
dioxus-web = "0.4.0"
rust-web-markdown = { git = "https://github.com/rambip/rust-web-markdown/" }
rust-web-markdown = { git = "https://github.com/rambip/rust-web-markdown/", default-features=false }

[features]
debug = ["rust-web-markdown/debug"]
Expand Down
52 changes: 26 additions & 26 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,32 +221,32 @@ impl<'a> Context<'a, 'a> for MdContext<'a> {
}

fn mount_dynamic_link(self, rel: &str, href: &str, integrity: &str, crossorigin: &str) {
let create_eval = use_eval(self.0);

let eval = create_eval(
r#"
// https://stackoverflow.com/a/18510577
let rel = await dioxus.recv();
let href = await dioxus.recv();
let integrity = await dioxus.recv();
let crossorigin = await dioxus.recv();
var newstyle = document.createElement("link"); // Create a new link Tag
newstyle.setAttribute("rel", rel);
newstyle.setAttribute("type", "text/css");
newstyle.setAttribute("href", href);
newstyle.setAttribute("crossorigin", crossorigin);
newstyle.setAttribute("integrity", integrity);
document.getElementsByTagName("head")[0].appendChild(newstyle);
"#,
)
.unwrap();

// You can send messages to JavaScript with the send method
eval.send(rel.into()).unwrap();
eval.send(href.into()).unwrap();
eval.send(integrity.into()).unwrap();
eval.send(crossorigin.into()).unwrap();
// let create_eval = use_eval(self.0);

// let eval = create_eval(
// r#"
// // https://stackoverflow.com/a/18510577
// let rel = await dioxus.recv();
// let href = await dioxus.recv();
// let integrity = await dioxus.recv();
// let crossorigin = await dioxus.recv();
// var newstyle = document.createElement("link"); // Create a new link Tag

// newstyle.setAttribute("rel", rel);
// newstyle.setAttribute("type", "text/css");
// newstyle.setAttribute("href", href);
// newstyle.setAttribute("crossorigin", crossorigin);
// newstyle.setAttribute("integrity", integrity);
// document.getElementsByTagName("head")[0].appendChild(newstyle);
// "#,
// )
// .unwrap();

// // You can send messages to JavaScript with the send method
// eval.send(rel.into()).unwrap();
// eval.send(href.into()).unwrap();
// eval.send(integrity.into()).unwrap();
// eval.send(crossorigin.into()).unwrap();
}


Expand Down

0 comments on commit 10d122d

Please sign in to comment.