From 6ee1c5ea1683adb93e233eba706c9ed179626611 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Tue, 14 Mar 2023 17:58:42 -0500 Subject: [PATCH] fix custom renderer imports --- docs/guide/Cargo.toml | 3 +++ docs/guide/examples/custom_renderer.rs | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/guide/Cargo.toml b/docs/guide/Cargo.toml index c9707e0d7..227bdfa35 100644 --- a/docs/guide/Cargo.toml +++ b/docs/guide/Cargo.toml @@ -11,10 +11,13 @@ dioxus = { path = "../../packages/dioxus" } dioxus-desktop = { path = "../../packages/desktop" } dioxus-web = { path = "../../packages/web" } dioxus-ssr = { path = "../../packages/ssr" } +dioxus-native-core = { path = "../../packages/native-core" } +dioxus-native-core-macro = { path = "../../packages/native-core-macro" } dioxus-router = { path = "../../packages/router" } dioxus-liveview = { path = "../../packages/liveview", features = ["axum"] } dioxus-tui = { path = "../../packages/dioxus-tui" } fermi = { path = "../../packages/fermi" } +shipyard = "0.6.2" # dioxus = { path = "../../packages/dioxus", features = ["desktop", "web", "ssr", "router", "fermi", "tui"] } diff --git a/docs/guide/examples/custom_renderer.rs b/docs/guide/examples/custom_renderer.rs index 17590f18c..13993fe7b 100644 --- a/docs/guide/examples/custom_renderer.rs +++ b/docs/guide/examples/custom_renderer.rs @@ -1,7 +1,9 @@ +use dioxus::html::input_data::keyboard_types::{Code, Key, Modifiers}; use dioxus::prelude::*; use dioxus_native_core::exports::shipyard::Component; use dioxus_native_core::node_ref::*; use dioxus_native_core::prelude::*; +use dioxus_native_core::utils::cursor::{Cursor, Pos}; use dioxus_native_core_macro::partial_derive_state; // ANCHOR: state_impl @@ -284,20 +286,20 @@ impl State for MyState { } // ANCHOR_END: derive_state +#[allow(unused)] // ANCHOR: cursor fn text_editing() { let mut cursor = Cursor::default(); let mut text = String::new(); - let keyboard_data = dioxus_html::KeyboardData::new( - dioxus_html::input_data::keyboard_types::Key::ArrowRight, - dioxus_html::input_data::keyboard_types::Code::ArrowRight, - dioxus_html::input_data::keyboard_types::Location::Standard, - false, - Modifiers::empty(), - ); // handle keyboard input with a max text length of 10 - cursor.handle_input(&keyboard_data, &mut text, 10); + cursor.handle_input( + &Code::ArrowRight, + &Key::ArrowRight, + &Modifiers::empty(), + &mut text, + 10, + ); // mannually select text between characters 0-5 on the first line (this could be from dragging with a mouse) cursor.start = Pos::new(0, 0);