Feat: add appflowy editor in backend (#1320)

* chore: remove update attributes

* chore: format code

* chore: extension for transaction

* refactor: add document editor trait

* chore: add appflowy_document editor

* chore: add document serde

* chore: add new document editor

* chore: add tests

* chore: add more test

* chore: add test

Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
Nathan.fooo
2022-10-20 11:35:11 +08:00
committed by GitHub
parent 833a6cd95f
commit f1a5726fcb
81 changed files with 2367 additions and 902 deletions

View File

@ -10,6 +10,7 @@ flowy-sdk = { path = "../flowy-sdk", default-features = false }
flowy-user = { path = "../flowy-user"}
flowy-net = { path = "../flowy-net"}
flowy-folder = { path = "../flowy-folder", default-features = false}
flowy-document= { path = "../flowy-document", default-features = false}
lib-dispatch = { path = "../lib-dispatch" }
flowy-sync = { path = "../../../shared-lib/flowy-sync" }

View File

@ -46,7 +46,7 @@ impl ViewTest {
Self::new(sdk, ViewDataTypePB::Database, ViewLayoutTypePB::Board, data).await
}
pub async fn new_text_block_view(sdk: &FlowySDKTest) -> Self {
pub async fn new_document_view(sdk: &FlowySDKTest) -> Self {
Self::new(sdk, ViewDataTypePB::Text, ViewLayoutTypePB::Document, vec![]).await
}
}

View File

@ -2,7 +2,8 @@ pub mod event_builder;
pub mod helper;
use crate::helper::*;
use flowy_net::{get_client_server_configuration, ClientServerConfiguration};
use flowy_net::get_client_server_configuration;
use flowy_sdk::{FlowySDK, FlowySDKConfig};
use flowy_user::entities::UserProfilePB;
use nanoid::nanoid;
@ -27,16 +28,14 @@ impl std::ops::Deref for FlowySDKTest {
impl std::default::Default for FlowySDKTest {
fn default() -> Self {
let server_config = get_client_server_configuration().unwrap();
let sdk = Self::new(server_config);
std::mem::forget(sdk.dispatcher());
sdk
Self::new(false)
}
}
impl FlowySDKTest {
pub fn new(server_config: ClientServerConfiguration) -> Self {
let config = FlowySDKConfig::new(&root_dir(), server_config, &nanoid!(6)).log_filter("info");
pub fn new(use_new_editor: bool) -> Self {
let server_config = get_client_server_configuration().unwrap();
let config = FlowySDKConfig::new(&root_dir(), &nanoid!(6), server_config, use_new_editor).log_filter("info");
let sdk = std::thread::spawn(|| FlowySDK::new(config)).join().unwrap();
std::mem::forget(sdk.dispatcher());
Self { inner: sdk }