mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 01:54:37 +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() { |   void initState() { | ||||||
|     super.initState(); |     super.initState(); | ||||||
| 
 | 
 | ||||||
|     _jsonString = Future<String>.value( |     _jsonString = rootBundle.loadString('assets/example.json'); | ||||||
|       jsonEncode(EditorState.empty().document.toJson()), |  | ||||||
|     ); |  | ||||||
|     _widgetBuilder = (context) => SimpleEditor( |     _widgetBuilder = (context) => SimpleEditor( | ||||||
|           jsonString: _jsonString, |           jsonString: _jsonString, | ||||||
|           themeData: _themeData, |           themeData: _themeData, | ||||||
| @ -259,11 +257,21 @@ class _HomePageState extends State<HomePage> { | |||||||
|       allowedExtensions: [fileType.extension], |       allowedExtensions: [fileType.extension], | ||||||
|       type: FileType.custom, |       type: FileType.custom, | ||||||
|     ); |     ); | ||||||
|     final path = result?.files.single.path; |     var plainText = ''; | ||||||
|     if (path == null) { |     if (!kIsWeb) { | ||||||
|       return; |       final path = result?.files.single.path; | ||||||
|  |       if (path == null) { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       plainText = await File(path).readAsString(); | ||||||
|  |     } else { | ||||||
|  |       final bytes = result?.files.first.bytes; | ||||||
|  |       if (bytes == null) { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       plainText = const Utf8Decoder().convert(bytes); | ||||||
|     } |     } | ||||||
|     final plainText = await File(path).readAsString(); | 
 | ||||||
|     var jsonString = ''; |     var jsonString = ''; | ||||||
|     switch (fileType) { |     switch (fileType) { | ||||||
|       case ExportFileType.json: |       case ExportFileType.json: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Lucas.Xu
						Lucas.Xu