mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: export error on Web platform
This commit is contained in:
parent
e20ce9052a
commit
9b56cbb648
@ -52,9 +52,7 @@ class _HomePageState extends State<HomePage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_jsonString = Future<String>.value(
|
||||
jsonEncode(EditorState.empty().document.toJson()),
|
||||
);
|
||||
_jsonString = rootBundle.loadString('assets/example.json');
|
||||
_widgetBuilder = (context) => SimpleEditor(
|
||||
jsonString: _jsonString,
|
||||
themeData: _themeData,
|
||||
@ -259,11 +257,21 @@ class _HomePageState extends State<HomePage> {
|
||||
allowedExtensions: [fileType.extension],
|
||||
type: FileType.custom,
|
||||
);
|
||||
var plainText = '';
|
||||
if (!kIsWeb) {
|
||||
final path = result?.files.single.path;
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
final plainText = await File(path).readAsString();
|
||||
plainText = await File(path).readAsString();
|
||||
} else {
|
||||
final bytes = result?.files.first.bytes;
|
||||
if (bytes == null) {
|
||||
return;
|
||||
}
|
||||
plainText = const Utf8Decoder().convert(bytes);
|
||||
}
|
||||
|
||||
var jsonString = '';
|
||||
switch (fileType) {
|
||||
case ExportFileType.json:
|
||||
|
Loading…
Reference in New Issue
Block a user