mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: create the default group for grid
This commit is contained in:
@ -221,8 +221,9 @@ impl DefaultFolderBuilder {
|
||||
initial_quill_delta_string()
|
||||
};
|
||||
let _ = view_controller.set_latest_view(&view.id);
|
||||
let layout_type = ViewLayoutTypePB::from(view.layout.clone());
|
||||
let _ = view_controller
|
||||
.create_view(&view.id, ViewDataTypePB::Text, Bytes::from(view_data))
|
||||
.create_view(&view.id, ViewDataTypePB::Text, layout_type, Bytes::from(view_data))
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
@ -249,7 +250,13 @@ impl FolderManager {
|
||||
pub trait ViewDataProcessor {
|
||||
fn initialize(&self) -> FutureResult<(), FlowyError>;
|
||||
|
||||
fn create_container(&self, user_id: &str, view_id: &str, delta_data: Bytes) -> FutureResult<(), FlowyError>;
|
||||
fn create_container(
|
||||
&self,
|
||||
user_id: &str,
|
||||
view_id: &str,
|
||||
layout: ViewLayoutTypePB,
|
||||
delta_data: Bytes,
|
||||
) -> FutureResult<(), FlowyError>;
|
||||
|
||||
fn close_container(&self, view_id: &str) -> FutureResult<(), FlowyError>;
|
||||
|
||||
@ -267,6 +274,7 @@ pub trait ViewDataProcessor {
|
||||
user_id: &str,
|
||||
view_id: &str,
|
||||
data: Vec<u8>,
|
||||
layout: ViewLayoutTypePB,
|
||||
) -> FutureResult<Bytes, FlowyError>;
|
||||
|
||||
fn data_type(&self) -> ViewDataTypePB;
|
||||
|
@ -1,5 +1,5 @@
|
||||
pub use crate::entities::view::ViewDataTypePB;
|
||||
use crate::entities::ViewInfoPB;
|
||||
use crate::entities::{ViewInfoPB, ViewLayoutTypePB};
|
||||
use crate::manager::{ViewDataProcessor, ViewDataProcessorMap};
|
||||
use crate::{
|
||||
dart_notification::{send_dart_notification, FolderNotification},
|
||||
@ -67,10 +67,20 @@ impl ViewController {
|
||||
params.view_content_data = view_data.to_vec();
|
||||
} else {
|
||||
let delta_data = processor
|
||||
.create_view_from_delta_data(&user_id, ¶ms.view_id, params.view_content_data.clone())
|
||||
.create_view_from_delta_data(
|
||||
&user_id,
|
||||
¶ms.view_id,
|
||||
params.view_content_data.clone(),
|
||||
params.layout.clone(),
|
||||
)
|
||||
.await?;
|
||||
let _ = self
|
||||
.create_view(¶ms.view_id, params.data_type.clone(), delta_data)
|
||||
.create_view(
|
||||
¶ms.view_id,
|
||||
params.data_type.clone(),
|
||||
params.layout.clone(),
|
||||
delta_data,
|
||||
)
|
||||
.await?;
|
||||
};
|
||||
|
||||
@ -84,6 +94,7 @@ impl ViewController {
|
||||
&self,
|
||||
view_id: &str,
|
||||
data_type: ViewDataTypePB,
|
||||
layout_type: ViewLayoutTypePB,
|
||||
delta_data: Bytes,
|
||||
) -> Result<(), FlowyError> {
|
||||
if delta_data.is_empty() {
|
||||
@ -91,7 +102,9 @@ impl ViewController {
|
||||
}
|
||||
let user_id = self.user.user_id()?;
|
||||
let processor = self.get_data_processor(data_type)?;
|
||||
let _ = processor.create_container(&user_id, view_id, delta_data).await?;
|
||||
let _ = processor
|
||||
.create_container(&user_id, view_id, layout_type, delta_data)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user