mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-22 08:06:01 +00:00
Worked connection in dioxus
This commit is contained in:
@@ -117,9 +117,11 @@ function apply_muts(
|
||||
var many = edit["m"];
|
||||
|
||||
var target_node = nodes[id];
|
||||
|
||||
let append_nodes = element_stack.splice(element_stack.length - many);
|
||||
|
||||
for (var i = 0; i < many; i++) {
|
||||
var current_element = element_stack.pop();
|
||||
target_node.appendChild(current_element);
|
||||
target_node.appendChild(append_nodes[i]);
|
||||
}
|
||||
} else if (type == "HydrateText") {
|
||||
// var child_path = edit["path"];
|
||||
@@ -155,9 +157,14 @@ function apply_muts(
|
||||
var el = element_stack.pop();
|
||||
els.push(el);
|
||||
}
|
||||
els.reverse();
|
||||
var target_node = load_child(element_stack, child_path);
|
||||
target_node.replaceWith(...els);
|
||||
console.log("")
|
||||
} else if (type == "CreateTextNode") {
|
||||
var text_node : any = document.createTextNode(edit["value"]);
|
||||
nodes[edit["id"]] = text_node;
|
||||
element_stack.push(text_node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +217,15 @@ function recursive_render(
|
||||
new_element.id = element.id.toString();
|
||||
}
|
||||
|
||||
//set attrs
|
||||
if (element.attrs != undefined) {
|
||||
for (const attr of element.attrs) {
|
||||
var name = attr["name"];
|
||||
var value = attr["value"];
|
||||
new_element.setAttribute(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
//parent to root
|
||||
if (root != null) {
|
||||
root.appendChild(new_element);
|
||||
|
||||
Reference in New Issue
Block a user