pub struct NodeRef { /* private fields */ }Expand description
A node by its key, resolved in the active editor state on every call, so
it always reads the latest version, as JS node methods do through
getLatest(). Like a JS node reference, it can only be used inside
Editor::read or
EditorState::read, and panics elsewhere.
Implementations§
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_highlight_type(&self) -> Option<String>
pub fn get_highlight_type(&self) -> Option<String>
CodeHighlightNode.getHighlightType(); None when it is
undefined, or for any other node (a class that extends it keeps no
highlight type of its own here).
Sourcepub fn set_highlight_type(&self, highlight_type: Option<&str>)
pub fn set_highlight_type(&self, highlight_type: Option<&str>)
CodeHighlightNode.setHighlightType(highlightType): an empty one is
undefined. Does nothing to any other node.
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_language(&self) -> Option<String>
pub fn get_language(&self) -> Option<String>
CodeNode.getLanguage(); None when it is undefined, or for any
other node.
Sourcepub fn set_language(&self, language: Option<&str>)
pub fn set_language(&self, language: Option<&str>)
CodeNode.setLanguage(language): an empty one is undefined. Does
nothing to any other node.
Sourcepub fn get_theme(&self) -> Option<String>
pub fn get_theme(&self) -> Option<String>
CodeNode.getTheme(); None when it is undefined, or for any
other node.
Sourcepub fn set_theme(&self, theme: Option<&str>)
pub fn set_theme(&self, theme: Option<&str>)
CodeNode.setTheme(theme): an empty one is undefined. Does nothing
to any other node.
Sourcepub fn get_is_syntax_highlight_supported(&self) -> bool
pub fn get_is_syntax_highlight_supported(&self) -> bool
CodeNode.getIsSyntaxHighlightSupported(); false for any other node.
Sourcepub fn set_is_syntax_highlight_supported(&self, is_supported: bool)
pub fn set_is_syntax_highlight_supported(&self, is_supported: bool)
CodeNode.setIsSyntaxHighlightSupported(isSupported). Does nothing
to any other node.
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_decorator_block_format(&self) -> Option<&'static str>
pub fn get_decorator_block_format(&self) -> Option<&'static str>
DecoratorBlockNode.getFormat(); None for any other node.
Sourcepub fn set_decorator_block_format(&self, format: &str)
pub fn set_decorator_block_format(&self, format: &str)
DecoratorBlockNode.setFormat(format): '' for a string that names
no format. Does nothing to any other node.
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_target(&self) -> Option<String>
pub fn get_target(&self) -> Option<String>
LinkNode.getTarget(); None when it is null, or for any other
node.
Sourcepub fn set_target(&self, target: Option<&str>)
pub fn set_target(&self, target: Option<&str>)
LinkNode.setTarget(target). Does nothing to any other node.
Sourcepub fn get_rel(&self) -> Option<String>
pub fn get_rel(&self) -> Option<String>
LinkNode.getRel(); None when it is null, or for any other node.
Sourcepub fn get_title(&self) -> Option<String>
pub fn get_title(&self) -> Option<String>
LinkNode.getTitle(); None when it is null, or for any other
node.
Sourcepub fn set_title(&self, title: Option<&str>)
pub fn set_title(&self, title: Option<&str>)
LinkNode.setTitle(title). Does nothing to any other node.
Sourcepub fn get_is_unlinked(&self) -> Option<bool>
pub fn get_is_unlinked(&self) -> Option<bool>
AutoLinkNode.getIsUnlinked(); None for any other node.
Sourcepub fn set_is_unlinked(&self, value: bool)
pub fn set_is_unlinked(&self, value: bool)
AutoLinkNode.setIsUnlinked(value). Does nothing to any other node.
Sourcepub fn is_email_uri(&self) -> bool
pub fn is_email_uri(&self) -> bool
LinkNode.isEmailURI(): whether the URL starts with mailto:;
false for any other node.
Sourcepub fn is_web_site_uri(&self) -> bool
pub fn is_web_site_uri(&self) -> bool
LinkNode.isWebSiteURI(): whether the URL starts with https:// or
http://; false for any other node.
Sourcepub fn should_merge_adjacent_link(&self, other_link: &NodeRef) -> bool
pub fn should_merge_adjacent_link(&self, other_link: &NodeRef) -> bool
LinkNode.shouldMergeAdjacentLink(otherLink): whether two links of
the same type have the same URL and attributes. AutoLinkNode’s is
always false, so adjacent autolinks never merge.
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_list_item_value(&self) -> Option<f64>
pub fn get_list_item_value(&self) -> Option<f64>
ListItemNode.getValue(); None for any other node.
Sourcepub fn set_list_item_value(&self, value: f64)
pub fn set_list_item_value(&self, value: f64)
ListItemNode.setValue(value). Does nothing to any other node.
Sourcepub fn get_checked(&self) -> Option<bool>
pub fn get_checked(&self) -> Option<bool>
ListItemNode.getChecked(): whether the item is checked when its
list is a check list, None otherwise (and for any other node).
Sourcepub fn set_checked(&self, checked: Option<bool>)
pub fn set_checked(&self, checked: Option<bool>)
ListItemNode.setChecked(checked). Does nothing to any other node.
Sourcepub fn toggle_checked(&self)
pub fn toggle_checked(&self)
ListItemNode.toggleChecked(). Does nothing to any other node.
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_list_type(&self) -> Option<ListType>
pub fn get_list_type(&self) -> Option<ListType>
ListNode.getListType(); None for any other node.
Sourcepub fn set_list_type(&self, list_type: ListType)
pub fn set_list_type(&self, list_type: ListType)
ListNode.setListType(type). Does nothing to any other node.
Sourcepub fn get_list_tag(&self) -> Option<&'static str>
pub fn get_list_tag(&self) -> Option<&'static str>
ListNode.getTag(); None for any other node.
Sourcepub fn get_list_start(&self) -> Option<f64>
pub fn get_list_start(&self) -> Option<f64>
ListNode.getStart(); None for any other node.
Sourcepub fn set_list_start(&self, start: f64)
pub fn set_list_start(&self, start: f64)
ListNode.setStart(start). Does nothing to any other node.
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_ids(&self) -> Option<Vec<String>>
pub fn get_ids(&self) -> Option<Vec<String>>
MarkNode.getIDs(): a copy of the ids; None for any other node.
Sourcepub fn set_ids(&self, ids: &[String])
pub fn set_ids(&self, ids: &[String])
MarkNode.setIDs(ids), as given (duplicates too). Does nothing to
any other node.
Source§impl NodeRef
impl NodeRef
pub fn get_key(&self) -> &str
Sourcepub fn get_latest(&self) -> Rc<dyn LexicalNode>
pub fn get_latest(&self) -> Rc<dyn LexicalNode>
getLatest(): the node’s version in the active editor state.
pub fn get_type(&self) -> &'static str
Sourcepub fn is_element(&self) -> bool
pub fn is_element(&self) -> bool
$isElementNode(node).
Sourcepub fn is_decorator(&self) -> bool
pub fn is_decorator(&self) -> bool
$isDecoratorNode(node).
Sourcepub fn is_isolated(&self) -> bool
pub fn is_isolated(&self) -> bool
DecoratorNode.isIsolated().
Sourcepub fn is_keyboard_selectable(&self) -> bool
pub fn is_keyboard_selectable(&self) -> bool
DecoratorNode.isKeyboardSelectable().
pub fn is_inline(&self) -> bool
pub fn get_parent(&self) -> Option<NodeRef>
Sourcepub fn get_parents(&self) -> Vec<NodeRef>
pub fn get_parents(&self) -> Vec<NodeRef>
getParents(): the ancestors, nearest first.
pub fn get_previous_sibling(&self) -> Option<NodeRef>
pub fn get_next_sibling(&self) -> Option<NodeRef>
pub fn get_first_child(&self) -> Option<NodeRef>
pub fn get_last_child(&self) -> Option<NodeRef>
pub fn get_children_size(&self) -> usize
Sourcepub fn get_children(&self) -> Vec<NodeRef>
pub fn get_children(&self) -> Vec<NodeRef>
getChildren(); empty for a node that isn’t an element.
pub fn get_text_content(&self) -> String
Sourcepub fn export_json(&self, compact: bool) -> Object
pub fn export_json(&self, compact: bool) -> Object
exportJSON(compact), with the node’s NodeState.
Sourcepub fn update_from_json(&self, json: &Object) -> Result<(), LexicalError>
pub fn update_from_json(&self, json: &Object) -> Result<(), LexicalError>
updateFromJSON(json): the NodeState in the JSON
($updateStateFromJSON), then $applyJSONSetters (the flat states,
then the class’s properties).
Sourcepub fn get_parent_or_throw(&self) -> Result<NodeRef, LexicalError>
pub fn get_parent_or_throw(&self) -> Result<NodeRef, LexicalError>
getParentOrThrow().
Sourcepub fn is_attached(&self) -> bool
pub fn is_attached(&self) -> bool
isAttached(): whether the node’s parents (and slot hosts) lead to
the root.
Sourcepub fn get_index_within_parent(&self) -> Option<usize>
pub fn get_index_within_parent(&self) -> Option<usize>
getIndexWithinParent(); None where JS returns -1.
Sourcepub fn get_text_content_size(&self) -> usize
pub fn get_text_content_size(&self) -> usize
getTextContentSize(): the text content’s length in UTF-16 code
units.
Sourcepub fn can_be_empty(&self) -> bool
pub fn can_be_empty(&self) -> bool
ElementNode.canBeEmpty().
Sourcepub fn can_indent(&self) -> bool
pub fn can_indent(&self) -> bool
ElementNode.canIndent().
Sourcepub fn can_merge_when_empty(&self) -> bool
pub fn can_merge_when_empty(&self) -> bool
ElementNode.canMergeWhenEmpty().
Sourcepub fn is_parent_required(&self) -> bool
pub fn is_parent_required(&self) -> bool
isParentRequired().
Sourcepub fn create_parent_element_node(&self) -> NodeRef
pub fn create_parent_element_node(&self) -> NodeRef
createParentElementNode().
Sourcepub fn insert_new_after(
&self,
selection: &SelectionRef,
restore_selection: bool,
) -> Result<Option<NodeRef>, LexicalError>
pub fn insert_new_after( &self, selection: &SelectionRef, restore_selection: bool, ) -> Result<Option<NodeRef>, LexicalError>
ElementNode.insertNewAfter(selection, restoreSelection).
Sourcepub fn collapse_at_start(
&self,
selection: &SelectionRef,
) -> Result<bool, LexicalError>
pub fn collapse_at_start( &self, selection: &SelectionRef, ) -> Result<bool, LexicalError>
ElementNode.collapseAtStart(selection).
Sourcepub fn extract_with_child(
&self,
child: &NodeRef,
selection: Option<&SelectionRef>,
destination: &str,
) -> Result<bool, LexicalError>
pub fn extract_with_child( &self, child: &NodeRef, selection: Option<&SelectionRef>, destination: &str, ) -> Result<bool, LexicalError>
ElementNode.extractWithChild(child, selection, destination).
Sourcepub fn is_text_entity(&self) -> bool
pub fn is_text_entity(&self) -> bool
TextNode.isTextEntity().
Sourcepub fn can_have_format(&self) -> bool
pub fn can_have_format(&self) -> bool
TextNode.canHaveFormat().
Sourcepub fn exclude_from_copy(&self, destination: &str) -> bool
pub fn exclude_from_copy(&self, destination: &str) -> bool
ElementNode.excludeFromCopy(destination).
Sourcepub fn can_replace_with(&self, replacement: &NodeRef) -> bool
pub fn can_replace_with(&self, replacement: &NodeRef) -> bool
ElementNode.canReplaceWith(replacement) (deprecated upstream).
Sourcepub fn can_insert_after(&self, node: &NodeRef) -> bool
pub fn can_insert_after(&self, node: &NodeRef) -> bool
ElementNode.canInsertAfter(node) (deprecated upstream).
Sourcepub fn get_top_level_element(&self) -> Result<Option<NodeRef>, LexicalError>
pub fn get_top_level_element(&self) -> Result<Option<NodeRef>, LexicalError>
getTopLevelElement(): the highest ancestor of this node (or the
node) below the root or a shadow root, or a slot value (the top of
its isolated scope), or None when there is none (the root, or a
node that isn’t attached). Fails where JS’s invariant does: on a
non-element ancestor of the node, or a text node at the top.
Sourcepub fn get_top_level_element_or_throw(&self) -> Result<NodeRef, LexicalError>
pub fn get_top_level_element_or_throw(&self) -> Result<NodeRef, LexicalError>
getTopLevelElementOrThrow(): get_top_level_element,
failing where it is None (with RootNode’s own message for the
root).
Sourcepub fn get_parent_keys(&self) -> Vec<NodeKey>
pub fn get_parent_keys(&self) -> Vec<NodeKey>
getParentKeys(): the keys of the ancestors, nearest first.
Sourcepub fn get_children_keys(&self) -> Vec<NodeKey>
pub fn get_children_keys(&self) -> Vec<NodeKey>
ElementNode.getChildrenKeys().
Sourcepub fn is_last_child(&self) -> Result<bool, LexicalError>
pub fn is_last_child(&self) -> Result<bool, LexicalError>
ElementNode.isLastChild(): whether this is its parent’s last child.
Fails without a parent.
Sourcepub fn get_first_child_or_throw(&self) -> Result<NodeRef, LexicalError>
pub fn get_first_child_or_throw(&self) -> Result<NodeRef, LexicalError>
ElementNode.getFirstChildOrThrow().
Sourcepub fn get_last_child_or_throw(&self) -> Result<NodeRef, LexicalError>
pub fn get_last_child_or_throw(&self) -> Result<NodeRef, LexicalError>
ElementNode.getLastChildOrThrow().
Sourcepub fn has_text_format(&self, format_type: &str) -> bool
pub fn has_text_format(&self, format_type: &str) -> bool
ElementNode.hasTextFormat(type): whether the element’s text format
(__textFormat) has the format.
Sourcepub fn get_format_flags(
&self,
format_type: &str,
align_with_format: Option<i32>,
) -> i32
pub fn get_format_flags( &self, format_type: &str, align_with_format: Option<i32>, ) -> i32
getFormatFlags(type, alignWithFormat) of a text node (its
__format) or an element (its __textFormat): the format with
type toggled (toggleTextFormatType).
Sourcepub fn is_directionless(&self) -> bool
pub fn is_directionless(&self) -> bool
TextNode.isDirectionless(): whether the text’s detail has
IS_DIRECTIONLESS.
Sourcepub fn is_parent_of(&self, target: &NodeRef) -> bool
pub fn is_parent_of(&self, target: &NodeRef) -> bool
isParentOf(targetNode): whether this node is an ancestor of
target.
Sourcepub fn is_selected(
&self,
selection: Option<&SelectionRef>,
) -> Result<bool, LexicalError>
pub fn is_selected( &self, selection: Option<&SelectionRef>, ) -> Result<bool, LexicalError>
isSelected(selection): whether the node is among the nodes of
selection, or of the current selection when None. An element or
decorator isn’t selected by a collapsed range between children, and
an inline decorator that is its parent’s last child isn’t selected by
an element range starting at the parent’s end.
Sourcepub fn is_before(&self, target: &NodeRef) -> bool
pub fn is_before(&self, target: &NodeRef) -> bool
isBefore(targetNode): whether this node comes before target in
the document.
Sourcepub fn get_nodes_between(&self, target: &NodeRef) -> Vec<NodeRef>
pub fn get_nodes_between(&self, target: &NodeRef) -> Vec<NodeRef>
getNodesBetween(targetNode): the nodes from this one to target,
both included, in document order, with the ancestors the walk
enters or leaves on the way.
Sourcepub fn mark_dirty(&self)
pub fn mark_dirty(&self)
markDirty(): marks the node dirty, so transforms run on it.
Sourcepub fn remove(&self, preserve_empty_parent: bool) -> Result<(), LexicalError>
pub fn remove(&self, preserve_empty_parent: bool) -> Result<(), LexicalError>
remove(preserveEmptyParent).
Sourcepub fn replace(
&self,
replace_with: &NodeRef,
include_children: bool,
) -> Result<NodeRef, LexicalError>
pub fn replace( &self, replace_with: &NodeRef, include_children: bool, ) -> Result<NodeRef, LexicalError>
replace(replaceWith, includeChildren): puts replace_with where
this node is, with this node’s children when include_children.
Sourcepub fn insert_after(
&self,
node_to_insert: &NodeRef,
restore_selection: bool,
) -> Result<NodeRef, LexicalError>
pub fn insert_after( &self, node_to_insert: &NodeRef, restore_selection: bool, ) -> Result<NodeRef, LexicalError>
insertAfter(nodeToInsert, restoreSelection).
Sourcepub fn get_indent(&self) -> Result<f64, LexicalError>
pub fn get_indent(&self) -> Result<f64, LexicalError>
ElementNode.getIndent().
Sourcepub fn set_indent(&self, indent: f64) -> Result<(), LexicalError>
pub fn set_indent(&self, indent: f64) -> Result<(), LexicalError>
ElementNode.setIndent(indentLevel).
Sourcepub fn get_previous_siblings(&self) -> Vec<NodeRef>
pub fn get_previous_siblings(&self) -> Vec<NodeRef>
getPreviousSiblings(): the siblings before this node, in document
order.
Sourcepub fn get_next_siblings(&self) -> Vec<NodeRef>
pub fn get_next_siblings(&self) -> Vec<NodeRef>
getNextSiblings(): the siblings after this node, in document order.
Sourcepub fn insert_before(
&self,
node_to_insert: &NodeRef,
restore_selection: bool,
) -> Result<NodeRef, LexicalError>
pub fn insert_before( &self, node_to_insert: &NodeRef, restore_selection: bool, ) -> Result<NodeRef, LexicalError>
insertBefore(nodeToInsert, restoreSelection).
Sourcepub fn select(
&self,
anchor_offset: Option<usize>,
focus_offset: Option<usize>,
) -> Result<SelectionRef, LexicalError>
pub fn select( &self, anchor_offset: Option<usize>, focus_offset: Option<usize>, ) -> Result<SelectionRef, LexicalError>
select(anchorOffset, focusOffset) of a text node or an element;
None is JS’s undefined (the end).
Sourcepub fn select_start(&self) -> Result<SelectionRef, LexicalError>
pub fn select_start(&self) -> Result<SelectionRef, LexicalError>
selectStart().
Sourcepub fn select_end(&self) -> Result<SelectionRef, LexicalError>
pub fn select_end(&self) -> Result<SelectionRef, LexicalError>
selectEnd().
Sourcepub fn select_previous(
&self,
anchor_offset: Option<usize>,
focus_offset: Option<usize>,
) -> Result<SelectionRef, LexicalError>
pub fn select_previous( &self, anchor_offset: Option<usize>, focus_offset: Option<usize>, ) -> Result<SelectionRef, LexicalError>
selectPrevious(anchorOffset, focusOffset).
Sourcepub fn select_next(
&self,
anchor_offset: Option<usize>,
focus_offset: Option<usize>,
) -> Result<SelectionRef, LexicalError>
pub fn select_next( &self, anchor_offset: Option<usize>, focus_offset: Option<usize>, ) -> Result<SelectionRef, LexicalError>
selectNext(anchorOffset, focusOffset).
Source§impl NodeRef
ElementNode’s methods, for a node that is an element. They panic on
any other node, as calling them on one is a bug.
impl NodeRef
ElementNode’s methods, for a node that is an element. They panic on
any other node, as calling them on one is a bug.
Sourcepub fn element_data(&self) -> ElementData
pub fn element_data(&self) -> ElementData
The element’s fields (getFormat(), getIndent(), …).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
isEmpty(): no children and no slots (a host that holds content in
its slots only is not empty).
Sourcepub fn get_all_text_nodes(&self) -> Vec<NodeRef>
pub fn get_all_text_nodes(&self) -> Vec<NodeRef>
getAllTextNodes(): the text nodes of the slots, then the children’s.
Sourcepub fn get_child_at_index(&self, index: usize) -> Option<NodeRef>
pub fn get_child_at_index(&self, index: usize) -> Option<NodeRef>
getChildAtIndex(index).
Sourcepub fn get_first_descendant(&self) -> Option<NodeRef>
pub fn get_first_descendant(&self) -> Option<NodeRef>
getFirstDescendant().
Sourcepub fn get_last_descendant(&self) -> Option<NodeRef>
pub fn get_last_descendant(&self) -> Option<NodeRef>
getLastDescendant().
Sourcepub fn get_descendant_by_index(&self, index: usize) -> Option<NodeRef>
pub fn get_descendant_by_index(&self, index: usize) -> Option<NodeRef>
getDescendantByIndex(index): the first descendant of the child at
index, or the last descendant of the last child for an index past
the end; the child itself when it is not an element or is empty.
Sourcepub fn select_element(
&self,
anchor_offset: Option<usize>,
focus_offset: Option<usize>,
) -> Result<SelectionRef, LexicalError>
pub fn select_element( &self, anchor_offset: Option<usize>, focus_offset: Option<usize>, ) -> Result<SelectionRef, LexicalError>
ElementNode.select(anchorOffset, focusOffset): an element range at
those child offsets, the end by default.
Sourcepub fn clear(&self) -> Result<(), LexicalError>
pub fn clear(&self) -> Result<(), LexicalError>
clear(): removes every child.
Sourcepub fn set_direction(&self, direction: Option<Direction>)
pub fn set_direction(&self, direction: Option<Direction>)
setDirection(direction).
Sourcepub fn set_element_format(&self, format_type: &str)
pub fn set_element_format(&self, format_type: &str)
setFormat(type): an alignment by name ('center', …); '' and
unknown names clear it.
Sourcepub fn set_element_style(&self, style: &str)
pub fn set_element_style(&self, style: &str)
setStyle(style).
Sourcepub fn set_text_format(&self, text_format: f64)
pub fn set_text_format(&self, text_format: f64)
setTextFormat(type).
Sourcepub fn set_text_style(&self, style: &str)
pub fn set_text_style(&self, style: &str)
setTextStyle(style).
Sourcepub fn splice(
&self,
start: usize,
delete_count: usize,
nodes_to_insert: &[NodeRef],
) -> Result<(), LexicalError>
pub fn splice( &self, start: usize, delete_count: usize, nodes_to_insert: &[NodeRef], ) -> Result<(), LexicalError>
splice(start, deleteCount, nodesToInsert): removes delete_count
children from start and inserts nodes there (moving any that are
in the tree already), repairing the selection when children are
removed.
Source§impl NodeRef
TextNode’s methods, for a node that is a text node (a TextNode or a
subclass such as TabNode). They panic on any other node, as calling
them on one is a bug.
impl NodeRef
TextNode’s methods, for a node that is a text node (a TextNode or a
subclass such as TabNode). They panic on any other node, as calling
them on one is a bug.
Sourcepub fn is_composing(&self) -> bool
pub fn is_composing(&self) -> bool
isComposing(): whether an input method is composing in this node.
Sourcepub fn is_simple_text(&self) -> bool
pub fn is_simple_text(&self) -> bool
isSimpleText(): a plain text node in normal mode.
Sourcepub fn is_unmergeable(&self) -> bool
pub fn is_unmergeable(&self) -> bool
isUnmergeable().
Sourcepub fn is_segmented(&self) -> bool
pub fn is_segmented(&self) -> bool
isSegmented().
Sourcepub fn has_format(&self, format_type: &str) -> bool
pub fn has_format(&self, format_type: &str) -> bool
hasFormat(type).
Sourcepub fn set_format(&self, format: f64)
pub fn set_format(&self, format: f64)
setFormat(format) with a number, which a node class may override
(LexicalNode::set_format).
Sourcepub fn set_format_type(&self, format_type: &str)
pub fn set_format_type(&self, format_type: &str)
setFormat(type) with a name, such as 'bold'.
Sourcepub fn set_detail(&self, detail: f64) -> Result<(), LexicalError>
pub fn set_detail(&self, detail: f64) -> Result<(), LexicalError>
setDetail(detail) with a number. A tab only takes
IS_UNMERGEABLE, which it has.
Sourcepub fn set_detail_type(&self, detail_type: &str) -> Result<(), LexicalError>
pub fn set_detail_type(&self, detail_type: &str) -> Result<(), LexicalError>
setDetail(type) with a name: 'directionless' or 'unmergeable'.
Sourcepub fn toggle_format(&self, format_type: &str)
pub fn toggle_format(&self, format_type: &str)
toggleFormat(type).
Sourcepub fn toggle_directionless(&self)
pub fn toggle_directionless(&self)
toggleDirectionless().
Sourcepub fn toggle_unmergeable(&self)
pub fn toggle_unmergeable(&self)
toggleUnmergeable().
Sourcepub fn set_mode(&self, mode_type: &str) -> Result<(), LexicalError>
pub fn set_mode(&self, mode_type: &str) -> Result<(), LexicalError>
setMode(type): 'normal', 'token' or 'segmented'. A tab is
always normal.
Sourcepub fn set_text_content(&self, text: &str)
pub fn set_text_content(&self, text: &str)
setTextContent(text). A tab keeps its \t.
Sourcepub fn select_text(
&self,
anchor_offset: Option<usize>,
focus_offset: Option<usize>,
) -> Result<SelectionRef, LexicalError>
pub fn select_text( &self, anchor_offset: Option<usize>, focus_offset: Option<usize>, ) -> Result<SelectionRef, LexicalError>
TextNode.select(anchorOffset, focusOffset): a text range at those
UTF-16 offsets, the end by default.
Sourcepub fn splice_text(
&self,
offset: i64,
del_count: i64,
new_text: &str,
move_selection: bool,
) -> Result<NodeRef, LexicalError>
pub fn splice_text( &self, offset: i64, del_count: i64, new_text: &str, move_selection: bool, ) -> Result<NodeRef, LexicalError>
spliceText(offset, delCount, newText, moveSelection): replaces
del_count UTF-16 units at offset with new_text, and moves a
range selection after it when move_selection.
Sourcepub fn split_text(
&self,
split_offsets: &[i64],
) -> Result<Vec<NodeRef>, LexicalError>
pub fn split_text( &self, split_offsets: &[i64], ) -> Result<Vec<NodeRef>, LexicalError>
splitText(...splitOffsets): splits the text at those UTF-16
offsets into this node and new siblings with the same format, style
and detail, and returns the parts. A segmented node is replaced.
Sourcepub fn merge_with_sibling(
&self,
target: &NodeRef,
) -> Result<NodeRef, LexicalError>
pub fn merge_with_sibling( &self, target: &NodeRef, ) -> Result<NodeRef, LexicalError>
mergeWithSibling(target): appends (or prepends) the text of an
adjacent text node and removes it, keeping the selection on the same
text.
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_heading_tag(&self) -> Option<HeadingTagType>
pub fn get_heading_tag(&self) -> Option<HeadingTagType>
HeadingNode.getTag(); None for any other node.
Sourcepub fn set_heading_tag(&self, tag: HeadingTagType)
pub fn set_heading_tag(&self, tag: HeadingTagType)
HeadingNode.setTag(tag). Does nothing to any other node.
Sourcepub fn set_quote_is_shadow_root(
&self,
is_shadow_root: bool,
) -> Result<(), LexicalError>
pub fn set_quote_is_shadow_root( &self, is_shadow_root: bool, ) -> Result<(), LexicalError>
QuoteNode.setIsShadowRoot(isShadowRoot): sets
quote_shadow_root_state. Does nothing to any other node.
Source§impl NodeRef
impl NodeRef
Sourcepub fn can_insert_text_before(&self) -> bool
pub fn can_insert_text_before(&self) -> bool
canInsertTextBefore() of a text node or an element.
Sourcepub fn can_insert_text_after(&self) -> bool
pub fn can_insert_text_after(&self) -> bool
canInsertTextAfter() of a text node or an element.
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_col_span(&self) -> f64
pub fn get_col_span(&self) -> f64
TableCellNode.getColSpan(); 1 for any other node.
Sourcepub fn set_col_span(&self, col_span: f64)
pub fn set_col_span(&self, col_span: f64)
TableCellNode.setColSpan(colSpan).
Sourcepub fn get_row_span(&self) -> f64
pub fn get_row_span(&self) -> f64
TableCellNode.getRowSpan(); 1 for any other node.
Sourcepub fn set_row_span(&self, row_span: f64)
pub fn set_row_span(&self, row_span: f64)
TableCellNode.setRowSpan(rowSpan).
Sourcepub fn get_table_cell_tag(&self) -> Option<&'static str>
pub fn get_table_cell_tag(&self) -> Option<&'static str>
TableCellNode.getTag(); None for any other node.
Sourcepub fn set_header_styles(&self, header_state: i32, mask: i32)
pub fn set_header_styles(&self, header_state: i32, mask: i32)
TableCellNode.setHeaderStyles(headerState, mask): the bits of
mask take those of header_state, the others stay.
Sourcepub fn get_header_styles(&self) -> i32
pub fn get_header_styles(&self) -> i32
TableCellNode.getHeaderStyles(); NO_STATUS for any other node.
Sourcepub fn set_cell_width(&self, width: Option<f64>)
pub fn set_cell_width(&self, width: Option<f64>)
TableCellNode.setWidth(width).
Sourcepub fn get_cell_width(&self) -> Option<f64>
pub fn get_cell_width(&self) -> Option<f64>
TableCellNode.getWidth().
Sourcepub fn get_background_color(&self) -> Option<String>
pub fn get_background_color(&self) -> Option<String>
TableCellNode.getBackgroundColor().
Sourcepub fn set_background_color(&self, background_color: Option<&str>)
pub fn set_background_color(&self, background_color: Option<&str>)
TableCellNode.setBackgroundColor(newBackgroundColor).
Sourcepub fn get_vertical_align(&self) -> Option<String>
pub fn get_vertical_align(&self) -> Option<String>
TableCellNode.getVerticalAlign().
Sourcepub fn set_vertical_align(&self, vertical_align: Option<&str>)
pub fn set_vertical_align(&self, vertical_align: Option<&str>)
TableCellNode.setVerticalAlign(newVerticalAlign): an empty string is
undefined.
Sourcepub fn toggle_header_style(&self, header_state_to_toggle: i32)
pub fn toggle_header_style(&self, header_state_to_toggle: i32)
TableCellNode.toggleHeaderStyle(headerStateToToggle): clears the
bits when the cell has all of them, sets them otherwise.
Sourcepub fn has_header_state(&self, header_state: i32) -> bool
pub fn has_header_state(&self, header_state: i32) -> bool
TableCellNode.hasHeaderState(headerState).
Sourcepub fn has_header(&self) -> bool
pub fn has_header(&self) -> bool
TableCellNode.hasHeader().
Source§impl NodeRef
impl NodeRef
Sourcepub fn get_col_widths(&self) -> Option<Vec<f64>>
pub fn get_col_widths(&self) -> Option<Vec<f64>>
TableNode.getColWidths().
Sourcepub fn set_col_widths(&self, col_widths: Option<Vec<f64>>)
pub fn set_col_widths(&self, col_widths: Option<Vec<f64>>)
TableNode.setColWidths(colWidths).
Sourcepub fn get_row_striping(&self) -> bool
pub fn get_row_striping(&self) -> bool
TableNode.getRowStriping().
Sourcepub fn set_row_striping(&self, row_striping: bool)
pub fn set_row_striping(&self, row_striping: bool)
TableNode.setRowStriping(newRowStriping).
Sourcepub fn set_frozen_columns(&self, column_count: f64)
pub fn set_frozen_columns(&self, column_count: f64)
TableNode.setFrozenColumns(columnCount).
Sourcepub fn get_frozen_columns(&self) -> f64
pub fn get_frozen_columns(&self) -> f64
TableNode.getFrozenColumns().
Sourcepub fn set_frozen_rows(&self, row_count: f64)
pub fn set_frozen_rows(&self, row_count: f64)
TableNode.setFrozenRows(rowCount).
Sourcepub fn get_frozen_rows(&self) -> f64
pub fn get_frozen_rows(&self) -> f64
TableNode.getFrozenRows().
Sourcepub fn get_column_count(&self) -> usize
pub fn get_column_count(&self) -> usize
TableNode.getColumnCount(): the spans of the first row’s cells.