Skip to content

Commit

Permalink
fix: other fields like rich text
Browse files Browse the repository at this point in the history
  • Loading branch information
speed2exe committed Dec 2, 2024
1 parent 7a3edeb commit 6d5e4ed
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/biz/collab/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ pub fn new_cell_from_value(cell_value: serde_json::Value, field: &Field) -> Opti
None
}
},
FieldType::RichText => {
FieldType::RichText | FieldType::URL | FieldType::Summary | FieldType::Translate => {
if let serde_json::Value::String(value_str) = cell_value {
Some(yrs::any::Any::String(value_str.into()))
} else {
Expand Down Expand Up @@ -438,14 +438,12 @@ pub fn new_cell_from_value(cell_value: serde_json::Value, field: &Field) -> Opti
None
},
},
FieldType::Checklist | FieldType::URL | FieldType::Summary | FieldType::Translate => {
match serde_json::to_string(&cell_value) {
Ok(s) => Some(yrs::any::Any::String(s.into())),
Err(err) => {
tracing::error!("Failed to serialize cell value: {:?}", err);
None
},
}
FieldType::Checklist => match serde_json::to_string(&cell_value) {
Ok(s) => Some(yrs::any::Any::String(s.into())),
Err(err) => {
tracing::error!("Failed to serialize cell value: {:?}", err);
None
},
},
FieldType::LastEditedTime | FieldType::CreatedTime | FieldType::Time => {
// should not be possible
Expand Down

0 comments on commit 6d5e4ed

Please sign in to comment.