pub fn insert_node(&mut self, node_ref: &Node) {
        debug!("[compose_area] insert_node");

        // Insert the node
        if let Some(ref range) = self.selection_range {
            range
                .delete_contents()
                .expect("Could not remove selection contents");
            range.insert_node(node_ref).expect("Could not insert node");
        } else {
            // No current selection. Append at end, unless the last element in
            // the area is a `<br>` node. This is needed because Firefox always
            // adds a trailing newline that isn't rendered.
            let last_child_node = utils::get_last_child(&self.wrapper);
            match last_child_node.and_then(|n| n.dyn_into::<Element>().ok()) {
                Some(ref element) if element.tag_name() == "BR" => {
                    self.wrapper
                        .insert_before(node_ref, Some(element))
                        .expect("Could not insert child");
                }
                Some(_) | None => {
                    self.wrapper
                        .append_child(node_ref)
                        .expect("Could not append child");
                }
            };
        }

        // Update selection
        self.selection_range =
            set_selection_range(&Position::After(node_ref), None).map(|range| range.clone_range());

        // Normalize elements
        self.normalize();
    }
/// Insert the specified node at the previously stored selection range.
/// Set the caret position to right after the newly inserted node.
///
/// **NOTE:** Due to browser limitations, this will not result in a new
/// entry in the browser's internal undo stack. This means that the node
/// insertion cannot be undone using Ctrl+Z.
Insert the specified node at the previously stored selection range.
Set the caret position to right after the newly inserted node.

Due to browser limitations, this will not result in a new
entry in the browser's internal undo stack. This means that the node
insertion cannot be undone using Ctrl+Z.
Insert the specified node at the previously stored selection range . Set the caret position to right after the newly inserted node . Due to browser limitations this will not result in a new entry in the browser ' s internal undo stack . This means that the node insertion cannot be undone using Ctrl + Z .
pub fn insert_node(&mut self, node_ref: &Node) {
        debug!("[compose_area] insert_node");
        // Insert the node
        if let Some(ref range) = self.selection_range {
            range
                .delete_contents()
                .expect("Could not remove selection contents");
            range.insert_node(node_ref).expect("Could not insert node");
        } else {
            // No current selection. Append at end, unless the last element in
            // the area is a `<br>` node. This is needed because Firefox always
            // adds a trailing newline that isn't rendered.
            let last_child_node = utils::get_last_child(&self.wrapper);
            match last_child_node.and_then(|n| n.dyn_into::<Element>().ok()) {
                Some(ref element) if element.tag_name() == "BR" => {
                    self.wrapper
                        .insert_before(node_ref, Some(element))
                        .expect("Could not insert child");
                }
                Some(_) | None => {
                    self.wrapper
                        .append_child(node_ref)
                        .expect("Could not append child");
                }
            };
        }
        // Update selection
        self.selection_range =
            set_selection_range(&Position::After(node_ref), None).map(|range| range.clone_range());
        // Normalize elements
        self.normalize();
    }
pub fn insert_node ( & mut self , node_ref : & Node ) { debug ! ( " " ) ; // Insert the node if let Some ( ref range ) = self . selection_range { range . delete_contents ( ) . expect ( " " ) ; range . insert_node ( node_ref ) . expect ( " " ) ; } else { // No current selection. Append at end, unless the last element in // the area is a `<br>` node. This is needed because Firefox always // adds a trailing newline that isn't rendered. let last_child_node = utils :: get_last_child ( & self . wrapper ) ; match last_child_node . and_then ( | n | n . dyn_into :: < Element > ( ) . ok ( ) ) { Some ( ref element ) if element . tag_name ( ) == " " => { self . wrapper . insert_before ( node_ref , Some ( element ) ) . expect ( " " ) ; } Some ( _ ) | None => { self . wrapper . append_child ( node_ref ) . expect ( " " ) ; } } ; } // Update selection self . selection_range = set_selection_range ( & Position :: After ( node_ref ) , None ) . map ( | range | range . clone_range ( ) ) ; // Normalize elements self . normalize ( ) ; }
Insert the specified node at the previously stored selection range.
Insert the specified node at the previously stored selection range .
&mut self
node_ref
&Node
&mut self
node_ref
&Node