Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: create doc with Delta requirement to fix Document load error
appflowy0ec02c1ac0c2
diff --git a/app_flowy/lib/workspace/infrastructure/i_app_impl.dart b/app_flowy/lib/workspace/infrastructure/i_app_impl.dartindex 1d88ed19ad..ac19453819 100644--- a/app_flowy/lib/workspace/infrastructure/i_app_impl.dart+++ b/app_flowy/lib/workspace/infrastructure/i_app_impl.dart@@ -32,7 +32,8 @@ class IAppImpl extends IApp {switch (view.viewType) {case ViewType.Doc:final docRepo = DocRepository(docId: view.id);- final result = await docRepo.createDoc(name: view.name, desc: "");+ final result = await docRepo.createDoc(+ name: view.name, desc: "", text: "[{\"insert\":\"\\n\"}]");return result.fold((l) => left(view), (r) {return right(WorkspaceError(code: WorkspaceErrorCode.Unknown, msg: r.msg));diff --git a/app_flowy/lib/workspace/infrastructure/repos/doc_repo.dart b/app_flowy/lib/workspace/infrastructure/repos/doc_repo.dartindex a74a35f7e1..1e1a6c0e32 100644--- a/app_flowy/lib/workspace/infrastructure/repos/doc_repo.dart+++ b/app_flowy/lib/workspace/infrastructure/repos/doc_repo.dart@@ -12,8 +12,9 @@ class DocRepository {});Future<Either<DocInfo, EditorError>> createDoc(- {required String name, String? desc}) {- final request = CreateDocRequest(id: docId, name: name, desc: desc);+ {required String name, String? desc, String? text}) {+ final request =+ CreateDocRequest(id: docId, name: name, desc: desc, text: text);return EditorEventCreateDoc(request).send();}diff --git a/rust-lib/flowy-editor/src/handlers/doc_handler.rs b/rust-lib/flowy-editor/src/handlers/doc_handler.rsindex 13ea1d641c..ca8900e0ca 100644--- a/rust-lib/flowy-editor/src/handlers/doc_handler.rs+++ b/rust-lib/flowy-editor/src/handlers/doc_handler.rs@@ -14,7 +14,7 @@ pub async fn create_doc(manager: Unit<RwLock<FileManager>>,) -> ResponseResult<DocInfo, EditorError> {let params: CreateDocParams = data.into_inner().try_into()?;- let dir = manager.read().await.user.user_doc_dir()?;+ let dir = manager.read().await.user.user_doc_dir()?;CreateDocRequestlet path = manager.write().await