|
1 | | -use leptos::logging; |
2 | | -use wasm_bindgen::prelude::*; |
| 1 | +use leptos::prelude::*; |
3 | 2 |
|
4 | | -#[wasm_bindgen(module = "/slate.js")] |
5 | | -extern "C" { |
6 | | - fn createEditor() -> String; |
| 3 | +#[component] |
| 4 | +pub fn Editable() -> impl IntoView { |
| 5 | + view! { |
| 6 | + <div contenteditable=true |
| 7 | + on:beforeinput=|_| {} |
| 8 | + on:input=|_| {} |
| 9 | + on:blur=|_| {} |
| 10 | + on:click=|_| {} |
| 11 | + on:compositionend=|_| {} |
| 12 | + on:compositionupdate=|_| {} |
| 13 | + on:compositionstart=|_| {} |
| 14 | + on:copy=|_| {} |
| 15 | + on:cut=|_| {} |
| 16 | + on:dragover=|_| {} |
| 17 | + on:dragstart=|_| {} |
| 18 | + on:drop=|_| {} |
| 19 | + on:dragend=|_| {} |
| 20 | + on:focus=|_| {} |
| 21 | + on:keydown=|_| {} |
| 22 | + on:paste=|_| {} |
| 23 | + >test</div> |
| 24 | + } |
| 25 | +} |
7 | 26 |
|
8 | | - // type MyClass; |
| 27 | +// use leptos::logging; |
| 28 | +// use wasm_bindgen::prelude::*; |
9 | 29 |
|
10 | | - // #[wasm_bindgen(constructor)] |
11 | | - // fn new() -> MyClass; |
| 30 | +// #[wasm_bindgen(module = "/slate.js")] |
| 31 | +// extern "C" { |
| 32 | +// fn createEditor() -> String; |
12 | 33 |
|
13 | | - // #[wasm_bindgen(method, getter)] |
14 | | - // fn number(this: &MyClass) -> u32; |
15 | | - // #[wasm_bindgen(method, setter)] |
16 | | - // fn set_number(this: &MyClass, number: u32) -> MyClass; |
17 | | - // #[wasm_bindgen(method)] |
18 | | - // fn render(this: &MyClass) -> String; |
19 | | -} |
| 34 | +// // type MyClass; |
20 | 35 |
|
21 | | -// // lifted from the `console_log` example |
22 | | -// #[wasm_bindgen] |
23 | | -// extern "C" { |
24 | | -// #[wasm_bindgen(js_namespace = console)] |
25 | | -// fn log(s: &str); |
| 36 | +// // #[wasm_bindgen(constructor)] |
| 37 | +// // fn new() -> MyClass; |
| 38 | + |
| 39 | +// // #[wasm_bindgen(method, getter)] |
| 40 | +// // fn number(this: &MyClass) -> u32; |
| 41 | +// // #[wasm_bindgen(method, setter)] |
| 42 | +// // fn set_number(this: &MyClass, number: u32) -> MyClass; |
| 43 | +// // #[wasm_bindgen(method)] |
| 44 | +// // fn render(this: &MyClass) -> String; |
26 | 45 | // } |
27 | 46 |
|
28 | | -#[wasm_bindgen(start)] |
29 | | -pub fn create_editor() { |
30 | | - logging::log!("{:?}", createEditor()); |
31 | | - // log(&format!("Hello from {}!", name())); // should output "Hello from Rust!" |
| 47 | +// // // lifted from the `console_log` example |
| 48 | +// // #[wasm_bindgen] |
| 49 | +// // extern "C" { |
| 50 | +// // #[wasm_bindgen(js_namespace = console)] |
| 51 | +// // fn log(s: &str); |
| 52 | +// // } |
32 | 53 |
|
33 | | - // let x = MyClass::new(); |
34 | | - // assert_eq!(x.number(), 42); |
35 | | - // x.set_number(10); |
36 | | - // log(&x.render()); |
37 | | -} |
| 54 | +// #[wasm_bindgen(start)] |
| 55 | +// pub fn create_editor() { |
| 56 | +// logging::log!("{:?}", createEditor()); |
| 57 | +// // log(&format!("Hello from {}!", name())); // should output "Hello from Rust!" |
| 58 | + |
| 59 | +// // let x = MyClass::new(); |
| 60 | +// // assert_eq!(x.number(), 42); |
| 61 | +// // x.set_number(10); |
| 62 | +// // log(&x.render()); |
| 63 | +// } |
0 commit comments