mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-06-30 10:43:04 -04:00
fix: support exporting more content to markdown (#7333)
* fix: support exporting to markdown with multiple images * fix: support exporting to markdown with database * fix: support exporting to markdown with date or reminder * fix: support exporting to markdown with subpage and page reference * chore: add some testing for markdown parser * chore: add testing for exporting markdown with databse as csv
This commit is contained in:
parent
04e3246976
commit
552dba5abe
14 changed files with 383 additions and 28 deletions
|
@ -105,7 +105,7 @@ class ExportTab extends StatelessWidget {
|
|||
final viewName = context.read<ShareBloc>().state.viewName;
|
||||
final exportPath = await getIt<FilePickerService>().saveFile(
|
||||
dialogTitle: '',
|
||||
fileName: '${viewName.toFileName()}.md',
|
||||
fileName: '${viewName.toFileName()}.zip',
|
||||
);
|
||||
if (context.mounted && exportPath != null) {
|
||||
context.read<ShareBloc>().add(
|
||||
|
|
|
@ -324,19 +324,21 @@ class ShareBloc extends Bloc<ShareEvent, ShareState> {
|
|||
(f) => FlowyResult.failure(f),
|
||||
);
|
||||
} else {
|
||||
result = await documentExporter.export(type.documentExportType);
|
||||
result =
|
||||
await documentExporter.export(type.documentExportType, path: path);
|
||||
}
|
||||
return result.fold(
|
||||
(s) {
|
||||
if (path != null) {
|
||||
switch (type) {
|
||||
case ShareType.markdown:
|
||||
case ShareType.html:
|
||||
case ShareType.csv:
|
||||
case ShareType.json:
|
||||
case ShareType.rawDatabaseData:
|
||||
File(path).writeAsStringSync(s);
|
||||
return FlowyResult.success(type);
|
||||
case ShareType.markdown:
|
||||
return FlowyResult.success(type);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -387,22 +389,30 @@ enum ShareType {
|
|||
@freezed
|
||||
class ShareEvent with _$ShareEvent {
|
||||
const factory ShareEvent.initial() = _Initial;
|
||||
|
||||
const factory ShareEvent.share(
|
||||
ShareType type,
|
||||
String? path,
|
||||
) = _Share;
|
||||
|
||||
const factory ShareEvent.publish(
|
||||
String nameSpace,
|
||||
String pageId,
|
||||
List<String> selectedViewIds,
|
||||
) = _Publish;
|
||||
|
||||
const factory ShareEvent.unPublish() = _UnPublish;
|
||||
|
||||
const factory ShareEvent.updateViewName(String name, String viewId) =
|
||||
_UpdateViewName;
|
||||
|
||||
const factory ShareEvent.updatePublishStatus() = _UpdatePublishStatus;
|
||||
|
||||
const factory ShareEvent.setPublishStatus(bool isPublished) =
|
||||
_SetPublishStatus;
|
||||
|
||||
const factory ShareEvent.updatePathName(String pathName) = _UpdatePathName;
|
||||
|
||||
const factory ShareEvent.clearPathNameResult() = _ClearPathNameResult;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue