mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: create doc with Delta requirement to fix Document load error
This commit is contained in:
parent
64b8f37470
commit
0ec02c1ac0
@ -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));
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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()?;CreateDocRequest
|
||||
let path = manager
|
||||
.write()
|
||||
.await
|
||||
|
Loading…
Reference in New Issue
Block a user