2022-08-18 17:49:20 +08:00
|
|
|
use crate::core::{NodeAttributes, TextDelta};
|
2022-08-18 16:19:50 +08:00
|
|
|
use std::cell::RefCell;
|
2022-08-16 16:25:52 +08:00
|
|
|
|
2022-08-18 17:49:20 +08:00
|
|
|
#[derive(Clone)]
|
2022-08-16 16:25:52 +08:00
|
|
|
pub struct NodeData {
|
|
|
|
pub node_type: String,
|
2022-08-18 16:19:50 +08:00
|
|
|
pub attributes: RefCell<NodeAttributes>,
|
|
|
|
pub delta: RefCell<Option<TextDelta>>,
|
2022-08-16 16:25:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
impl NodeData {
|
|
|
|
pub fn new(node_type: &str) -> NodeData {
|
|
|
|
NodeData {
|
|
|
|
node_type: node_type.into(),
|
2022-08-18 16:19:50 +08:00
|
|
|
attributes: RefCell::new(NodeAttributes::new()),
|
|
|
|
delta: RefCell::new(None),
|
2022-08-16 16:25:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|