mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-08-01 05:18:08 +00:00

* feat: support a event for getting encoded collab of document * feat: support publish view and unpublish views * feat: publish page to the web * chore: refacotor share bloc * feat: call the publish event * feat: support publish view and unpublish views * feat: integrate publish api * feat: integrate unpublish api * feat: fetch the publish info to show the publish status * feat: support publish interfaces * fix: lint error * fix: modified web server * fix: some style * fix: some style * fix: some style * fix: some style * fix: some style * fix: some style * fix: some style * fix: some style * fix: some style * fix: update codes * fix: update codes * fix: update codes * fix: update codes * fix: update codes * chore: refactor publish bloc * fix: some style * fix: some style * fix: some style * fix: some style * fix: some style * fix: some style * fix: the name is too long to publish * chore: change color * fix: some style * fix: some style * feat: refacotor share menu UI * fix: some style * fix: lint * fix: some style * feat: refacotor export-as * fix: some style * chore: refactor share menu colors * fix: rust ci * fix: some style * fix: some style * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: bugs * fix: rerelease * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: deploy * fix: og image * fix: support copy button * fix: support copy button * fix: support copy button * chore: add a params * feat: use default publish name * chore: update copy * feat: show a confirm deletion dialog if the deleted page contains published page * feat: add copy toast in publish tab * fix: to 404 fix: to 404 fix: to 404 fix: the error to 404 * feat: unpublish the page auto when moving it to another space * feat: improve confirm deletion dialog * feat: show unpublish error * chore: use beta.appflowy.com * feat: disable publish in non-apppflowy-cloud user mode * fix: modified bullted icon style * fix: the dark mode color * fix: save the dark mode in local storage * fix: text color * chore: make bash script more portable (#5679) * fix: title longer * chore: move the files and modified the en * chore: update deploy.sh * chore: modified Dockerfile * chore: modified server.cjs to server.js * chore: modifed server.js to server.ts * chore: replace publish url * chore: remove todo list hover * chore: show confirm dialog before deleting page * fix: unpublish the pages before deleting * fix: table cell bg color * fix: callout icon * fix: list number * fix: emoji * fix: number icon * fix: callout icon position * fix: add margin bottom * fix: code block * fix: support scroll for breadcrumbs * fix: the breadcrumb doesn't update after moving page * fix: 0705 issues * fix: update publish status afer deleting page * chore: add hover effect for visit site button * fix: remove puiblish url text field enable border color * chore: update delete page copy * chore: enable debug category * fix: only render sidebar if the spaces are ready * fix: the breadcrumb doesn't update after moving page * fix: auto code * fix: add emoji * fix: add emoji * fix: favicon * fix: cypress test * fix: remove deploy ci * fix: default url * chore: revert launch.json * fix: docker ci * fix: change favicon * fix: flutter integration test * feat: add hover effect to share menu * chore: add a checkmark if the page has been published * chore: revert space deletion --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> Co-authored-by: Zack <speed2exe@live.com.sg>
137 lines
3.8 KiB
Rust
137 lines
3.8 KiB
Rust
use std::sync::Weak;
|
|
|
|
use strum_macros::Display;
|
|
|
|
use flowy_derive::{Flowy_Event, ProtoBuf_Enum};
|
|
use lib_dispatch::prelude::AFPlugin;
|
|
use tracing::event;
|
|
|
|
use crate::event_handler::get_snapshot_meta_handler;
|
|
use crate::{event_handler::*, manager::DocumentManager};
|
|
|
|
pub fn init(document_manager: Weak<DocumentManager>) -> AFPlugin {
|
|
AFPlugin::new()
|
|
.name(env!("CARGO_PKG_NAME"))
|
|
.state(document_manager)
|
|
.event(DocumentEvent::CreateDocument, create_document_handler)
|
|
.event(DocumentEvent::OpenDocument, open_document_handler)
|
|
.event(DocumentEvent::CloseDocument, close_document_handler)
|
|
.event(DocumentEvent::ApplyAction, apply_action_handler)
|
|
.event(DocumentEvent::GetDocumentData, get_document_data_handler)
|
|
.event(
|
|
DocumentEvent::GetDocEncodedCollab,
|
|
get_encode_collab_handler,
|
|
)
|
|
.event(
|
|
DocumentEvent::ConvertDataToDocument,
|
|
convert_data_to_document,
|
|
)
|
|
.event(DocumentEvent::Redo, redo_handler)
|
|
.event(DocumentEvent::Undo, undo_handler)
|
|
.event(DocumentEvent::CanUndoRedo, can_undo_redo_handler)
|
|
.event(
|
|
DocumentEvent::GetDocumentSnapshotMeta,
|
|
get_snapshot_meta_handler,
|
|
)
|
|
.event(
|
|
DocumentEvent::GetDocumentSnapshot,
|
|
get_snapshot_data_handler,
|
|
)
|
|
.event(DocumentEvent::CreateText, create_text_handler)
|
|
.event(DocumentEvent::ApplyTextDeltaEvent, apply_text_delta_handler)
|
|
.event(DocumentEvent::ConvertDocument, convert_document_handler)
|
|
.event(
|
|
DocumentEvent::ConvertDataToJSON,
|
|
convert_data_to_json_handler,
|
|
)
|
|
.event(DocumentEvent::UploadFile, upload_file_handler)
|
|
.event(DocumentEvent::DownloadFile, download_file_handler)
|
|
.event(DocumentEvent::DeleteFile, delete_file_handler)
|
|
.event(
|
|
DocumentEvent::SetAwarenessState,
|
|
set_awareness_local_state_handler,
|
|
)
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Display, ProtoBuf_Enum, Flowy_Event)]
|
|
#[event_err = "FlowyError"]
|
|
pub enum DocumentEvent {
|
|
#[event(input = "CreateDocumentPayloadPB")]
|
|
CreateDocument = 0,
|
|
|
|
#[event(input = "OpenDocumentPayloadPB", output = "DocumentDataPB")]
|
|
OpenDocument = 1,
|
|
|
|
#[event(input = "CloseDocumentPayloadPB")]
|
|
CloseDocument = 2,
|
|
|
|
#[event(input = "ApplyActionPayloadPB")]
|
|
ApplyAction = 3,
|
|
|
|
#[event(input = "OpenDocumentPayloadPB", output = "DocumentDataPB")]
|
|
GetDocumentData = 4,
|
|
|
|
#[event(input = "ConvertDataPayloadPB", output = "DocumentDataPB")]
|
|
ConvertDataToDocument = 5,
|
|
|
|
#[event(
|
|
input = "DocumentRedoUndoPayloadPB",
|
|
output = "DocumentRedoUndoResponsePB"
|
|
)]
|
|
Redo = 6,
|
|
|
|
#[event(
|
|
input = "DocumentRedoUndoPayloadPB",
|
|
output = "DocumentRedoUndoResponsePB"
|
|
)]
|
|
Undo = 7,
|
|
|
|
#[event(
|
|
input = "DocumentRedoUndoPayloadPB",
|
|
output = "DocumentRedoUndoResponsePB"
|
|
)]
|
|
CanUndoRedo = 8,
|
|
|
|
#[event(
|
|
input = "OpenDocumentPayloadPB",
|
|
output = "RepeatedDocumentSnapshotMetaPB"
|
|
)]
|
|
GetDocumentSnapshotMeta = 9,
|
|
|
|
#[event(input = "TextDeltaPayloadPB")]
|
|
CreateText = 10,
|
|
|
|
#[event(input = "TextDeltaPayloadPB")]
|
|
ApplyTextDeltaEvent = 11,
|
|
|
|
// document in event_handler.rs -> convert_document
|
|
#[event(
|
|
input = "ConvertDocumentPayloadPB",
|
|
output = "ConvertDocumentResponsePB"
|
|
)]
|
|
ConvertDocument = 12,
|
|
|
|
// document in event_handler.rs -> convert_data_to_json
|
|
#[event(
|
|
input = "ConvertDataToJsonPayloadPB",
|
|
output = "ConvertDataToJsonResponsePB"
|
|
)]
|
|
ConvertDataToJSON = 13,
|
|
|
|
#[event(input = "DocumentSnapshotMetaPB", output = "DocumentSnapshotPB")]
|
|
GetDocumentSnapshot = 14,
|
|
|
|
#[event(input = "UploadFileParamsPB", output = "UploadedFilePB")]
|
|
UploadFile = 15,
|
|
#[event(input = "UploadedFilePB")]
|
|
DownloadFile = 16,
|
|
#[event(input = "UploadedFilePB")]
|
|
DeleteFile = 17,
|
|
|
|
#[event(input = "UpdateDocumentAwarenessStatePB")]
|
|
SetAwarenessState = 18,
|
|
|
|
#[event(input = "OpenDocumentPayloadPB", output = "EncodedCollabPB")]
|
|
GetDocEncodedCollab = 19,
|
|
}
|