2022-08-18 17:49:20 +08:00
|
|
|
use crate::core::{NodeAttributes, TextDelta};
|
2022-08-16 16:25:52 +08:00
|
|
|
|
2022-08-22 18:33:02 +08:00
|
|
|
#[derive(Clone, serde::Serialize, serde::Deserialize)]
|
2022-08-16 16:25:52 +08:00
|
|
|
pub struct NodeData {
|
|
|
|
pub node_type: String,
|
2022-08-22 16:46:24 +08:00
|
|
|
pub attributes: NodeAttributes,
|
|
|
|
pub delta: 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-22 16:46:24 +08:00
|
|
|
attributes: NodeAttributes::new(),
|
|
|
|
delta: None,
|
2022-08-16 16:25:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|