mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix compact bugs & update unit tests
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use crate::core::{trim, Attributes, Delta, PlainTextAttributes};
|
||||
use crate::core::{trim, Attributes, Delta, PlainAttributes};
|
||||
|
||||
pub type PlainDeltaBuilder = DeltaBuilder<PlainTextAttributes>;
|
||||
pub type PlainDeltaBuilder = DeltaBuilder<PlainAttributes>;
|
||||
|
||||
pub struct DeltaBuilder<T: Attributes> {
|
||||
delta: Delta<T>,
|
||||
|
@ -13,7 +13,7 @@ use std::{
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
pub type PlainDelta = Delta<PlainTextAttributes>;
|
||||
pub type PlainDelta = Delta<PlainAttributes>;
|
||||
|
||||
// TODO: optimize the memory usage with Arc::make_mut or Cow
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::{
|
||||
core::{Attributes, Operation, PlainTextAttributes},
|
||||
core::{Attributes, Operation, PlainAttributes},
|
||||
rich_text::RichTextAttributes,
|
||||
};
|
||||
|
||||
pub type RichTextOpBuilder = OpBuilder<RichTextAttributes>;
|
||||
pub type PlainTextOpBuilder = OpBuilder<PlainTextAttributes>;
|
||||
pub type PlainTextOpBuilder = OpBuilder<PlainAttributes>;
|
||||
|
||||
pub struct OpBuilder<T: Attributes> {
|
||||
ty: Operation<T>,
|
||||
|
@ -339,14 +339,14 @@ where
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct PlainTextAttributes();
|
||||
impl fmt::Display for PlainTextAttributes {
|
||||
pub struct PlainAttributes();
|
||||
impl fmt::Display for PlainAttributes {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str("PlainTextAttributes")
|
||||
f.write_str("PlainAttributes")
|
||||
}
|
||||
}
|
||||
|
||||
impl Attributes for PlainTextAttributes {
|
||||
impl Attributes for PlainAttributes {
|
||||
fn is_empty(&self) -> bool {
|
||||
true
|
||||
}
|
||||
@ -356,7 +356,7 @@ impl Attributes for PlainTextAttributes {
|
||||
fn extend_other(&mut self, _other: Self) {}
|
||||
}
|
||||
|
||||
impl OperationTransformable for PlainTextAttributes {
|
||||
impl OperationTransformable for PlainAttributes {
|
||||
fn compose(&self, _other: &Self) -> Result<Self, OTError> {
|
||||
Ok(self.clone())
|
||||
}
|
||||
|
Reference in New Issue
Block a user