pub struct CodeHighlightNode { /* private fields */ }Expand description
CodeHighlightNode: a text node in a CodeNode, with
the token type a highlighter gave it. It takes no format.
Implementations§
Source§impl CodeHighlightNode
impl CodeHighlightNode
Sourcepub fn highlight_type(&self) -> Option<&str>
pub fn highlight_type(&self) -> Option<&str>
__highlightType.
Trait Implementations§
Source§impl Clone for CodeHighlightNode
impl Clone for CodeHighlightNode
Source§impl Debug for CodeHighlightNode
impl Debug for CodeHighlightNode
Source§impl Default for CodeHighlightNode
impl Default for CodeHighlightNode
Source§impl LexicalNode for CodeHighlightNode
impl LexicalNode for CodeHighlightNode
Source§fn json_schema_chain(&self) -> Vec<NodeSchema>
fn json_schema_chain(&self) -> Vec<NodeSchema>
Its own schema, then TextNode’s as this class resolves it: it
overrides setFormat (a highlight’s format is its theme’s), so the
format the JSON carries is applied through that, which keeps the
node’s.
Source§fn create_dom(
&self,
_this: &NodeRef,
config: &EditorConfig,
_editor: &Editor,
) -> Result<DomNode, LexicalError>
fn create_dom( &self, _this: &NodeRef, config: &EditorConfig, _editor: &Editor, ) -> Result<DomNode, LexicalError>
CodeHighlightNode.createDOM(config): TextNode’s, with the
theme’s codeHighlight[highlightType] class names.
Source§fn set_format(&self, _: &NodeRef, _: f64)
fn set_format(&self, _: &NodeRef, _: f64)
CodeHighlightNode.setFormat(format): does nothing (no bold,
underline…), and doesn’t make the node writable.
Source§fn can_have_format(&self) -> bool
fn can_have_format(&self) -> bool
CodeHighlightNode.canHaveFormat().
Source§fn is_parent_required(&self) -> bool
fn is_parent_required(&self) -> bool
CodeHighlightNode.isParentRequired().
Source§fn create_parent_element_node(&self) -> NodeRef
fn create_parent_element_node(&self) -> NodeRef
CodeHighlightNode.createParentElementNode(): a code block with no
language.
Source§fn generated_export_json(&self, compact: bool) -> Option<Object>
fn generated_export_json(&self, compact: bool) -> Option<Object>
exportCodeHighlightNode and exportCompactCodeHighlightNode.
Source§fn generated_update_from_json(&mut self, json: &Object) -> bool
fn generated_update_from_json(&mut self, json: &Object) -> bool
updateCodeHighlightNode.
fn base(&self) -> &NodeBase
fn base_mut(&mut self) -> &mut NodeBase
fn text_mut(&mut self) -> Option<&mut TextData>
Source§fn element(&self) -> Option<&ElementData>
fn element(&self) -> Option<&ElementData>
ElementNode fields, for a node that extends it.fn element_mut(&mut self) -> Option<&mut ElementData>
Source§fn decorator_block(&self) -> Option<&DecoratorBlockData>
fn decorator_block(&self) -> Option<&DecoratorBlockData>
DecoratorBlockNode fields (@lexical/react), for a node that
extends it: such a node is a decorator that is not inline and can’t
be indented, unless it overrides those hooks.fn decorator_block_mut(&mut self) -> Option<&mut DecoratorBlockData>
Source§fn is_inline(&self) -> bool
fn is_inline(&self) -> bool
isInline(): false for an element, true for text and a decorator
(false for a DecoratorBlockNode). A class whose config chain
declares inline (static_node_config_chain)
returns the nearest declaration, as the isInline() JS synthesizes
for a class that declares it does.Source§fn is_decorator(&self) -> bool
fn is_decorator(&self) -> bool
DecoratorNode ($isDecoratorNode): a leaf
whose content an app renders (decorate), which
the editor moves, selects and deletes as one unit. False by default,
but for a DecoratorBlockNode.Source§fn decorate(&self, editor: &Editor) -> Option<Rc<dyn Any>>
fn decorate(&self, editor: &Editor) -> Option<Rc<dyn Any>>
DecoratorNode.decorate(editor, config): the value an app’s renderer
shows for the decorator, or None (the default). Once the editor has
a root element, the reconciler calls it for each decorator it
creates or reconciles and collects the values in
Editor::get_decorators, which the
decorator listeners hear of when they change. A value is the app’s
own, type-erased (JS’s T, Swift’s Any), and compared by identity:
returning the same Rc again changes nothing.Source§fn is_isolated(&self) -> bool
fn is_isolated(&self) -> bool
DecoratorNode.isIsolated(): whether the decorator is isolated from
caret interaction (not traversed, extended over, selected as a node
or deleted by an adjacent caret operation). False by default.Source§fn is_keyboard_selectable(&self) -> bool
fn is_keyboard_selectable(&self) -> bool
DecoratorNode.isKeyboardSelectable(): whether moving the caret onto
the decorator selects it as a node. True by default.Source§fn is_inline_formattable(&self) -> bool
fn is_inline_formattable(&self) -> bool
$isInlineFormattable(node): whether the node carries a text format
that formatting the selection changes (InlineFormattableNode): text,
and a node with the __isInlineFormattable brand.Source§fn get_inline_format(&self) -> f64
fn get_inline_format(&self) -> f64
InlineFormattableNode.getFormat().Source§fn set_inline_format(
&self,
this: &NodeRef,
format: f64,
) -> Result<(), LexicalError>
fn set_inline_format( &self, this: &NodeRef, format: f64, ) -> Result<(), LexicalError>
Source§fn is_shadow_root(&self) -> bool
fn is_shadow_root(&self) -> bool
ElementNode.isShadowRoot().Source§fn can_be_empty(&self) -> bool
fn can_be_empty(&self) -> bool
ElementNode.canBeEmpty(): whether the element stays when its last
child is removed.Source§fn can_indent(&self) -> bool
fn can_indent(&self) -> bool
ElementNode.canIndent(): whether indenting the selection changes
this block’s indent (DecoratorBlockNode.canIndent() is false).Source§fn can_merge_when_empty(&self) -> bool
fn can_merge_when_empty(&self) -> bool
ElementNode.canMergeWhenEmpty(): whether the element, when empty,
takes the children of the first block insertNodes inserts.Source§fn insert_new_after(
&self,
this: &NodeRef,
selection: &SelectionRef,
restore_selection: bool,
) -> Result<Option<NodeRef>, LexicalError>
fn insert_new_after( &self, this: &NodeRef, selection: &SelectionRef, restore_selection: bool, ) -> Result<Option<NodeRef>, LexicalError>
ElementNode.insertNewAfter(selection, restoreSelection) on the
element this (this node’s handle): inserts the block that splitting
the element creates after it, and returns it. None (the default)
means the element can’t be split.Source§fn collapse_at_start(
&self,
this: &NodeRef,
selection: &SelectionRef,
) -> Result<bool, LexicalError>
fn collapse_at_start( &self, this: &NodeRef, selection: &SelectionRef, ) -> Result<bool, LexicalError>
ElementNode.collapseAtStart(selection) on the element this: what
a backward deletion at the element’s start does instead of merging
it. true means the element handled it. ElementNode returns false.Source§fn append(&self, this: &NodeRef, nodes: &[NodeRef]) -> Result<(), LexicalError>
fn append(&self, this: &NodeRef, nodes: &[NodeRef]) -> Result<(), LexicalError>
ElementNode.append(...nodesToAppend) on the element this: inserts
nodes after its last child, through splice.Source§fn splice(
&self,
this: &NodeRef,
start: usize,
delete_count: usize,
nodes_to_insert: &[NodeRef],
) -> Result<(), LexicalError>
fn splice( &self, this: &NodeRef, start: usize, delete_count: usize, nodes_to_insert: &[NodeRef], ) -> Result<(), LexicalError>
ElementNode.splice(start, deleteCount, nodesToInsert) on the
element this; the default is ElementNode’s
(element::splice).Source§fn replace(
&self,
this: &NodeRef,
replace_with: &NodeRef,
include_children: bool,
) -> Result<NodeRef, LexicalError>
fn replace( &self, this: &NodeRef, replace_with: &NodeRef, include_children: bool, ) -> Result<NodeRef, LexicalError>
replace(replaceWith, includeChildren) on this; the default is
LexicalNode’s (node::replace).Source§fn insert_after(
&self,
this: &NodeRef,
node_to_insert: &NodeRef,
restore_selection: bool,
) -> Result<NodeRef, LexicalError>
fn insert_after( &self, this: &NodeRef, node_to_insert: &NodeRef, restore_selection: bool, ) -> Result<NodeRef, LexicalError>
insertAfter(nodeToInsert, restoreSelection) on this; the default
is LexicalNode’s (node::insert_after).Source§fn remove(
&self,
this: &NodeRef,
preserve_empty_parent: bool,
) -> Result<(), LexicalError>
fn remove( &self, this: &NodeRef, preserve_empty_parent: bool, ) -> Result<(), LexicalError>
remove(preserveEmptyParent) on this; the default is
LexicalNode’s (node::remove).Source§fn get_indent(&self, this: &NodeRef) -> Result<f64, LexicalError>
fn get_indent(&self, this: &NodeRef) -> Result<f64, LexicalError>
ElementNode.getIndent() on the element this: its __indent.Source§fn set_indent(&self, this: &NodeRef, indent: f64) -> Result<(), LexicalError>
fn set_indent(&self, this: &NodeRef, indent: f64) -> Result<(), LexicalError>
ElementNode.setIndent(indentLevel) on the element this: sets its
__indent.Source§fn transform(&self, this: &NodeRef) -> Result<(), LexicalError>
fn transform(&self, this: &NodeRef) -> Result<(), LexicalError>
$transform of the node’s $config, which the editor runs on a
dirty node before the transforms registered for its type (and before
ElementNode’s own, which comes later in the class chain). None by
default.Source§fn state_configs(&self) -> Vec<RequiredNodeStateConfig>
fn state_configs(&self) -> Vec<RequiredNodeStateConfig>
stateConfigs of the node’s $config, its class’s and those it
inherits: the NodeState its type knows before any node reads it.
None by default.Source§fn reset_on_copy_node_from(&self, this: &NodeRef, original: &NodeRef)
fn reset_on_copy_node_from(&self, this: &NodeRef, original: &NodeRef)
resetOnCopyNodeFrom(originalNode) on this, the copy $copyNode
just made of original, beyond LexicalNode’s, which resets the
NodeState that asks for it ($copyNode does that first). Nothing by
default.Source§fn extract_with_child(
&self,
this: &NodeRef,
child: &NodeRef,
selection: Option<&SelectionRef>,
destination: &str,
) -> Result<bool, LexicalError>
fn extract_with_child( &self, this: &NodeRef, child: &NodeRef, selection: Option<&SelectionRef>, destination: &str, ) -> Result<bool, LexicalError>
ElementNode.extractWithChild(child, selection, destination) on the
element this: whether copying child (to "clone" or "html")
takes this element with it. ElementNode returns false. Nothing in
the core calls it; @lexical/html’s copy does, and the overrides of
ParagraphNode and HeadingNode come with it.Source§fn declared_slots(&self) -> &'static [&'static str]
fn declared_slots(&self) -> &'static [&'static str]
slots of the node’s $config() (getDeclaredSlots): the
canonical order of its named slots, before the names it doesn’t
declare. None by default.Source§fn declares_inline_children(&self) -> bool
fn declares_inline_children(&self) -> bool
children the class declares in its $config()
(getDeclaredNodeStructure(klass).children) is 'inline' or a list
that includes 'inline': a block that holds text. By default, what
static_node_config_chain
declares.Source§fn static_node_config_chain(&self) -> Vec<NodeConfigLink>
fn static_node_config_chain(&self) -> Vec<NodeConfigLink>
$config() and of the classes
it extends (iterStaticNodeConfigChain(klass)), most derived first:
inline, children, mergeAdjacent and the values it declares
derived (@experimental node-structure). A class that extends
another returns its own link followed by that class’s chain. None by
default: the class declares nothing.Source§fn internal_after_structure_merge(
&self,
this: &NodeRef,
last: &NodeRef,
first: &NodeRef,
) -> Result<bool, LexicalError>
fn internal_after_structure_merge( &self, this: &NodeRef, last: &NodeRef, first: &NodeRef, ) -> Result<bool, LexicalError>
INTERNAL_$afterStructureMerge(last, first) on the element this
(internal, for the node structure normalization): this has just
merged its next sibling, and last (its last child before) and
first (the sibling’s first child) meet at the seam. Returns whether
the class has the hook (ListNode joins nested lists there). False by
default.Source§fn internal_after_structure_split(
&self,
this: &NodeRef,
original: &NodeRef,
preceding: &[NodeRef],
) -> Result<(), LexicalError>
fn internal_after_structure_split( &self, this: &NodeRef, original: &NodeRef, preceding: &[NodeRef], ) -> Result<(), LexicalError>
INTERNAL_$afterStructureSplit(original, preceding) on this, a
copy of original that the node structure normalization split off
it, after the content preceding (an ordered list continues its
numbering). Nothing by default.Source§fn internal_lifts_from_structure(&self) -> Option<LiftsFromStructure>
fn internal_lifts_from_structure(&self) -> Option<LiftsFromStructure>
INTERNAL_$liftsFromStructure: the holder’s hook for a child its
declared children allow that the node structure normalization must
still lift out, given what else it holds (a list item lifts a nested
list that is not all it holds). None by default.Source§fn is_text_entity(&self) -> bool
fn is_text_entity(&self) -> bool
TextNode.isTextEntity(): whether registerLexicalTextEntity (the
text feature) treats the text node as an entity. False by default.Source§fn exclude_from_copy(&self, destination: &str) -> bool
fn exclude_from_copy(&self, destination: &str) -> bool
ElementNode.excludeFromCopy(destination): whether copying (to
"clone" or "html") leaves this element out and keeps its
children. ElementNode returns false. Nothing in the core calls it;
@lexical/clipboard’s and @lexical/html’s copies do.Source§fn can_replace_with(&self, replacement: &NodeRef) -> bool
fn can_replace_with(&self, replacement: &NodeRef) -> bool
ElementNode.canReplaceWith(replacement) (deprecated and internal
upstream): true by default. Nothing in the core calls it.Source§fn can_insert_after(&self, node: &NodeRef) -> bool
fn can_insert_after(&self, node: &NodeRef) -> bool
ElementNode.canInsertAfter(node) (deprecated and internal
upstream): true by default. Nothing in the core calls it.Source§fn selection_transform(
&self,
this: &NodeRef,
prev_selection: Option<&SelectionRef>,
next_selection: &SelectionRef,
) -> Result<(), LexicalError>
fn selection_transform( &self, this: &NodeRef, prev_selection: Option<&SelectionRef>, next_selection: &SelectionRef, ) -> Result<(), LexicalError>
TextNode.selectionTransform(prevSelection, nextSelection): called
on the text nodes a range selection’s anchor and focus are in at the
end of each update (applySelectionTransforms), before the
transforms run, with the committed state’s selection and the
update’s. Does nothing by default.Source§fn can_insert_text_before(&self) -> bool
fn can_insert_text_before(&self) -> bool
canInsertTextBefore() (TextNode and ElementNode): whether text
typed at the node’s start goes into it.Source§fn can_insert_text_after(&self) -> bool
fn can_insert_text_after(&self) -> bool
canInsertTextAfter() (TextNode and ElementNode): whether text
typed at the node’s end goes into it.Source§fn get_text_content(&self) -> String
fn get_text_content(&self) -> String
getTextContent().Source§fn get_text_content_size(&self) -> usize
fn get_text_content_size(&self) -> usize
getTextContentSize(): the text content’s length in UTF-16 code
units, which an element sums from its children
(ElementNode.getTextContentSize). JS gives a class that overrides
getTextContent but not this method LexicalNode’s, the length of
its text content; Rust can’t tell an override, so a class that
overrides get_text_content overrides this
too, as Swift’s do.Source§fn should_serialize_text_styles(&self) -> bool
fn should_serialize_text_styles(&self) -> bool
ElementNode.shouldSerializeTextStyles().Source§fn export_dom(
&self,
this: &NodeRef,
editor: &Editor,
) -> Result<DomExportOutput, LexicalError>
fn export_dom( &self, this: &NodeRef, editor: &Editor, ) -> Result<DomExportOutput, LexicalError>
exportDOM(editor) (the html feature): the DOM the node exports
to HTML. LexicalNode exports the element $createDOM makes, which
ElementNode gives the indent and direction and TextNode its
formats.Source§fn super_types(&self) -> Vec<&'static str>
fn super_types(&self) -> Vec<&'static str>
ElementNode, DecoratorNode): JS’s class chain, which matches
DOMRenderExtension’s overrides of a class to the nodes of the
classes that extend it (the html feature). ["text"] for a node
with TextNode fields that isn’t a TextNode itself, and none for
any other; a class that extends another typed class overrides it.
It also stands for instanceof in $applyNodeReplacement and
createEditor’s check of a replacement’s withKlass.Source§fn import_dom(&self) -> Option<DomConversionMap>
fn import_dom(&self) -> Option<DomConversionMap>
importDOM() (the html feature): the
conversions it offers by DOM node name, or None.Source§fn export_json(&self, compact: bool) -> Object
fn export_json(&self, compact: bool) -> Object
exportJSON(compact): the node’s own properties, with an empty
children array for an element (the export walk fills it), without
its NodeState. By default $exportNodeJSONOnce: the class’s
generated code, or the walk of its
schema (crate::schema::walk_export_json). A class that adds to
its JSON overrides it, calling crate::schema::export_node_json_once
for what JS’s super.exportJSON returns.Source§fn update_from_json(&mut self, json: &Object)
fn update_from_json(&mut self, json: &Object)
updateFromJSON(json) on a writable node: applies every property the
node’s schema declares, a missing one as its default
($applyJSONSetters, the class’s
generated code or the walk); the
caller applies the NodeState first.Source§fn update_dom(&self, prev_node: &dyn LexicalNode) -> bool
fn update_dom(&self, prev_node: &dyn LexicalNode) -> bool
updateDOM(prevNode, dom, config): whether the
reconciler makes the node’s DOM again (what JS’s returns), which
reports the node’s children as created. By default a text node
compares its tags (TextNode.updateDOM) and any other node keeps
its DOM.Auto Trait Implementations§
impl !Freeze for CodeHighlightNode
impl !RefUnwindSafe for CodeHighlightNode
impl !Send for CodeHighlightNode
impl !Sync for CodeHighlightNode
impl !UnwindSafe for CodeHighlightNode
impl Forget for CodeHighlightNode
impl Move for CodeHighlightNode
impl Unpin for CodeHighlightNode
impl UnsafeUnpin for CodeHighlightNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> NodeClone for Twhere
T: LexicalNode + Clone,
impl<T> NodeClone for Twhere
T: LexicalNode + Clone,
fn clone_node(&self) -> Box<dyn LexicalNode>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_node(&self) -> &(dyn LexicalNode + 'static)
fn as_node_mut(&mut self) -> &mut (dyn LexicalNode + 'static)
Source§fn class_name(&self) -> &'static str
fn class_name(&self) -> &'static str
node.constructor.name, which messages name a node’s class by: the
Rust type’s name, without its path.