Fix cannot copy & paste base64 image as inline image in composer web
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import 'dart:convert' as convert;
|
||||
import 'dart:typed_data' as type_data;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:html_editor_enhanced/utils/file_upload_model.dart';
|
||||
import 'package:model/upload/file_info.dart';
|
||||
|
||||
@@ -23,22 +20,17 @@ extension FileUploadExtension on FileUpload {
|
||||
return base64;
|
||||
}
|
||||
|
||||
Future<FileInfo?> toFileInfo() async {
|
||||
FileInfo? toFileInfo() {
|
||||
if (base64Data != null) {
|
||||
final bytes = await compute(convertBase64ToBytes, base64Data!);
|
||||
return FileInfo.fromBytes(
|
||||
bytes: bytes,
|
||||
bytes: convert.base64Decode(base64Data!),
|
||||
name: name,
|
||||
size: size,
|
||||
type: type,
|
||||
isInline: true
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static Uint8List convertBase64ToBytes(String base64) {
|
||||
type_data.Uint8List decodeBytes = convert.base64Decode(base64);
|
||||
return decodeBytes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user