pub struct NodeClass { /* private fields */ }Expand description
A node class an editor registers: its type and how it imports JSON (the
static importJSON). As an editor’s registration (RegisteredNode) it
also holds the class’s node replacement, if any: what
LexicalNodeReplacement makes of the class.
Implementations§
Source§impl NodeClass
impl NodeClass
Sourcepub fn of<T: LexicalNode + Default>() -> Self
pub fn of<T: LexicalNode + Default>() -> Self
The class of T, which imports a node as T::default() with the
JSON applied.
Sourcepub fn with_import_json(
node_type: &'static str,
import_json: fn(&Object) -> Result<NodeRef, LexicalError>,
) -> Self
pub fn with_import_json( node_type: &'static str, import_json: fn(&Object) -> Result<NodeRef, LexicalError>, ) -> Self
A class with its own importJSON, which declares no NodeState and
is not an inline element.
pub fn node_type(&self) -> &'static str
Sourcepub fn get_declared_node_structure(&self) -> DeclaredNodeStructure
pub fn get_declared_node_structure(&self) -> DeclaredNodeStructure
getDeclaredNodeStructure(klass) (@experimental node-structure):
the structure the class declares. A class made with
with_import_json declares none.
Trait Implementations§
Source§impl From<LexicalNodeReplacement> for NodeClass
impl From<LexicalNodeReplacement> for NodeClass
Source§fn from(replacement: LexicalNodeReplacement) -> Self
fn from(replacement: LexicalNodeReplacement) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for NodeClass
impl !Send for NodeClass
impl !Sync for NodeClass
impl !UnwindSafe for NodeClass
impl Forget for NodeClass
impl Freeze for NodeClass
impl Move for NodeClass
impl Unpin for NodeClass
impl UnsafeUnpin for NodeClass
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
Mutably borrows from an owned value. Read more