mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
* fix: #1290 [Bug] 300ms delay on buttons in titlebar * fix: #1802 Math Equation would be null * fix: retain as a attribute value --------- Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
parent
cc9bd30356
commit
a41894a5ec
@ -775,7 +775,7 @@ fn delta_compose() {
|
|||||||
}
|
}
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
delta.json_str(),
|
delta.json_str(),
|
||||||
r#"[{"insert":"a"},{"insert":"\n","attributes":{"list":"unchecked"}},{"insert":"\n"}]"#
|
r#"[{"insert":"a"},{"insert":"\n","attributes":{"list":"unchecked"}},{"insert":"\n","attributes":{"list":""}}]"#
|
||||||
);
|
);
|
||||||
|
|
||||||
let ops = vec![
|
let ops = vec![
|
||||||
|
@ -214,6 +214,7 @@ impl AttributeValue {
|
|||||||
pub fn none() -> Self {
|
pub fn none() -> Self {
|
||||||
Self { ty: None, value: None }
|
Self { ty: None, value: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_int(val: i64) -> Self {
|
pub fn from_int(val: i64) -> Self {
|
||||||
Self {
|
Self {
|
||||||
ty: Some(ValueType::IntType),
|
ty: Some(ValueType::IntType),
|
||||||
@ -235,8 +236,9 @@ impl AttributeValue {
|
|||||||
value: Some(val.to_string()),
|
value: Some(val.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn from_string(s: &str) -> Self {
|
|
||||||
let value = if s.is_empty() { None } else { Some(s.to_string()) };
|
pub fn from_string<T: ToString>(s: T) -> Self {
|
||||||
|
let value = Some(s.to_string());
|
||||||
Self {
|
Self {
|
||||||
ty: Some(ValueType::StrType),
|
ty: Some(ValueType::StrType),
|
||||||
value,
|
value,
|
||||||
@ -283,7 +285,7 @@ impl std::convert::From<&str> for AttributeValue {
|
|||||||
|
|
||||||
impl std::convert::From<String> for AttributeValue {
|
impl std::convert::From<String> for AttributeValue {
|
||||||
fn from(value: String) -> Self {
|
fn from(value: String) -> Self {
|
||||||
AttributeValue::from_string(&value)
|
AttributeValue::from_string(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
use crate::core::{AttributeEntry, AttributeHashMap, AttributeKey};
|
use crate::core::{AttributeEntry, AttributeHashMap, AttributeKey, AttributeValue};
|
||||||
use crate::text_delta::DeltaTextOperation;
|
use crate::text_delta::DeltaTextOperation;
|
||||||
use crate::{inline_attribute_entry, inline_list_attribute_entry};
|
use crate::{inline_attribute_entry, inline_list_attribute_entry};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
@ -21,13 +21,13 @@ macro_rules! inline_list_attribute_entry {
|
|||||||
) => {
|
) => {
|
||||||
pub fn $key(b: bool) -> $crate::core::AttributeEntry {
|
pub fn $key(b: bool) -> $crate::core::AttributeEntry {
|
||||||
let value = match b {
|
let value = match b {
|
||||||
true => $value,
|
true => $value.into(),
|
||||||
false => "",
|
false => AttributeValue::none(),
|
||||||
};
|
};
|
||||||
|
|
||||||
AttributeEntry {
|
AttributeEntry {
|
||||||
key: BuildInTextAttributeKey::List.as_ref().to_string(),
|
key: BuildInTextAttributeKey::List.as_ref().to_string(),
|
||||||
value: value.into(),
|
value,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user