mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-25 16:19:58 +08:00
Remove Note.addImageSync
We can just always use the async version.
This commit is contained in:
@ -508,23 +508,6 @@ class Note with NotesNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addImageSync(String filePath) async {
|
|
||||||
var file = File(filePath);
|
|
||||||
var absImagePath = _buildImagePath(file);
|
|
||||||
file.copySync(absImagePath);
|
|
||||||
|
|
||||||
var relativeImagePath = p.relative(absImagePath, from: parent.folderPath);
|
|
||||||
if (!relativeImagePath.startsWith('.')) {
|
|
||||||
relativeImagePath = './$relativeImagePath';
|
|
||||||
}
|
|
||||||
var imageMarkdown = "\n";
|
|
||||||
if (body.isEmpty) {
|
|
||||||
body = imageMarkdown;
|
|
||||||
} else {
|
|
||||||
body = "$body\n$imageMarkdown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String _buildImagePath(File file) {
|
String _buildImagePath(File file) {
|
||||||
String baseFolder;
|
String baseFolder;
|
||||||
|
|
||||||
|
@ -124,11 +124,13 @@ class NoteEditorState extends State<NoteEditor> with WidgetsBindingObserver {
|
|||||||
|
|
||||||
if (existingImages.isNotEmpty) {
|
if (existingImages.isNotEmpty) {
|
||||||
for (var imagePath in existingImages) {
|
for (var imagePath in existingImages) {
|
||||||
try {
|
() async {
|
||||||
note!.addImageSync(imagePath);
|
try {
|
||||||
} catch (e, st) {
|
await note!.addImage(imagePath);
|
||||||
Log.e("New Note Existing Image", ex: e, stacktrace: st);
|
} catch (e, st) {
|
||||||
}
|
Log.e("New Note Existing Image", ex: e, stacktrace: st);
|
||||||
|
}
|
||||||
|
}();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user