pub fn bind_to(wrapper: Element, log_level: Option<String>) -> Self {
        utils::set_panic_hook();

        // Set log level
        if let Some(level) = log_level {
            match &*level {
                "trace" => utils::init_log(Level::Trace),
                "debug" => utils::init_log(Level::Debug),
                "info" => utils::init_log(Level::Info),
                "warn" => utils::init_log(Level::Warn),
                "error" => utils::init_log(Level::Error),
                other => web_sys::console::warn_1(
                    &format!("bind_to: Invalid log level: {}", other).into(),
                ),
            }
        }
        trace!("[compose_area] bind_to");

        let window = web_sys::window().expect("No global `window` exists");
        let document = window.document().expect("Should have a document on window");

        // Initialize the wrapper element
        wrapper
            .class_list()
            .add_2("cawrapper", "initialized")
            .expect("Could not add wrapper classes");
        wrapper
            .set_attribute("contenteditable", "true")
            .expect("Could not set contenteditable attr");

        info!("[compose_area] Initialized");

        Self {
            window,
            document,
            wrapper,
            selection_range: None,
            counter: 0,
        }
    }
/// Initialize a new compose area wrapper.
///
/// If the `log_level` argument is supplied, the console logger is
/// initialized. Valid log levels: `trace`, `debug`, `info`, `warn` or
/// `error`.
Initialize a new compose area wrapper.
If the `log_level` argument is supplied, the console logger is
initialized.
Initialize a new compose area wrapper . If the ` log_level ` argument is supplied the console logger is initialized .
pub fn bind_to(wrapper: Element, log_level: Option<String>) -> Self {
        utils::set_panic_hook();
        // Set log level
        if let Some(level) = log_level {
            match &*level {
                "trace" => utils::init_log(Level::Trace),
                "debug" => utils::init_log(Level::Debug),
                "info" => utils::init_log(Level::Info),
                "warn" => utils::init_log(Level::Warn),
                "error" => utils::init_log(Level::Error),
                other => web_sys::console::warn_1(
                    &format!("bind_to: Invalid log level: {}", other).into(),
                ),
            }
        }
        trace!("[compose_area] bind_to");
        let window = web_sys::window().expect("No global `window` exists");
        let document = window.document().expect("Should have a document on window");
        // Initialize the wrapper element
        wrapper
            .class_list()
            .add_2("cawrapper", "initialized")
            .expect("Could not add wrapper classes");
        wrapper
            .set_attribute("contenteditable", "true")
            .expect("Could not set contenteditable attr");
        info!("[compose_area] Initialized");
        Self {
            window,
            document,
            wrapper,
            selection_range: None,
            counter: 0,
        }
    }
pub fn bind_to ( wrapper : Element , log_level : Option < String > ) -> Self { utils :: set_panic_hook ( ) ; // Set log level if let Some ( level ) = log_level { match & * level { " " => utils :: init_log ( Level :: Trace ) , " " => utils :: init_log ( Level :: Debug ) , " " => utils :: init_log ( Level :: Info ) , " " => utils :: init_log ( Level :: Warn ) , " " => utils :: init_log ( Level :: Error ) , other => web_sys :: console :: warn_1 ( & format ! ( " " other ) . into ( ) , ) , } } trace ! ( " " ) ; let window = web_sys :: window ( ) . expect ( " " ) ; let document = window . document ( ) . expect ( " " ) ; // Initialize the wrapper element wrapper . class_list ( ) . add_2 ( " " , " " ) . expect ( " " ) ; wrapper . set_attribute ( " " , " " ) . expect ( " " ) ; info ! ( " " ) ; Self { window , document , wrapper , selection_range : None , counter : 0 , } }
Initialize a new compose area wrapper.
Initialize a new compose area wrapper .
wrapper
Element
log_level
Option<String>
wrapper
Element
log_level
Option<String>