Skip to content

Commit

Permalink
update editor to display markdown and debug information
Browse files Browse the repository at this point in the history
  • Loading branch information
rambip committed Oct 3, 2023
1 parent c7ff987 commit d283f21
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 32 deletions.
46 changes: 19 additions & 27 deletions examples/editor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,24 @@ fn RenderZone(
};

view!{
{move || if debug_mode() {
view!{
<ul>{debug_info_view}</ul>
}.into_view()
}
else {
view!{
<Markdown src=content
wikilinks=wikilinks_enabled
hard_line_breaks=hard_breaks_enabled
/>
}
}}
<div style="border: 1px solid black; margin: 10px; width: 50%">
<Markdown src=content
wikilinks=wikilinks_enabled
hard_line_breaks=hard_breaks_enabled
/>
</div>
{move || debug_mode().then_some(
view!{
<ul>{debug_info_view()}</ul>
})
}
}
}


#[component]
fn App() -> impl IntoView {
let (content, set_content) = create_signal("**bold**".into());
let (content, set_content) = create_signal("**bold**".to_string());
let (wikilinks_enabled, set_wikilinks) = create_signal(false);
let (hard_breaks_enabled, set_hard_breaks) = create_signal(false);
let (debug_mode, set_debug_mode) = create_signal(false);
Expand Down Expand Up @@ -67,23 +65,17 @@ fn App() -> impl IntoView {
/>
</div>
<div>
<input type="radio" name="debug-switch" id="html-on" checked=""
on:input=move |_| set_debug_mode(false)/>
<label for="html-on" style="padding-right:15px">html mode</label>
<input type="radio" name="debug-switch" id="debug-on"
<span>debug mode</span>
<input type="checkbox" name="debug-switch"
on:input=move |_| set_debug_mode(true)
/>
<label for="debug-on">debug mode</label>
</div>
</div>

<div style="border: 1px solid black; margin: 10px; width: 50%">
<RenderZone content=content
wikilinks_enabled=wikilinks_enabled
hard_breaks_enabled=hard_breaks_enabled
debug_mode=debug_mode
/>
</div>
<RenderZone content=content
wikilinks_enabled=wikilinks_enabled
hard_breaks_enabled=hard_breaks_enabled
debug_mode=debug_mode
/>
</div>
}
}
Expand Down
12 changes: 7 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d283f21

Please sign in to comment.