1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! A Dioxus web component that wraps the [CodeMirror 6] editor.
//!
//! [`CodeMirror`] drives a CodeMirror editor through a single long-lived
//! `document::eval` channel (the script lives in `code_mirror/glue.js`).
//! CodeMirror is vendored as a Dioxus folder asset, so there is no JavaScript
//! build step and no runtime CDN dependency. Typed [`Cmd`]/[`Evt`] messages
//! cross the channel as JSON.
//!
//! It supports:
//!
//! 1. Reacting to edits, via a two-way bound [`CodeMirrorProps::value`].
//! 2. Setting the value when the bound data changes elsewhere on the page.
//! 3. Connecting to an in-page (WASM) language server, via an [`LspBridge`].
//!
//! # Example
//!
//! ```ignore
//! use dioxus::prelude::*;
//! use dioxus_codemirror::CodeMirror;
//!
//! #[component]
//! fn App() -> Element {
//! let value = use_signal(|| "fn main() {}".to_string());
//! rsx! {
//! CodeMirror { value }
//! p { "{value}" }
//! }
//! }
//! ```
//!
//! [CodeMirror 6]: https://codemirror.net/
pub use crate::;