forked from Nexus/nexus
parent
27137c488d
commit
36f61a62d8
12 changed files with 154 additions and 15 deletions
12
lib/widgets/composer/paste_files_action.dart
Normal file
12
lib/widgets/composer/paste_files_action.dart
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import "package:material_ui/material_ui.dart";
|
||||
|
||||
/// Overrides a text field's paste, to paste files and images with
|
||||
/// [pasteFiles], falling back to pasting text if it returns false.
|
||||
class PasteFilesAction(final Future<bool> Function() pasteFiles)
|
||||
extends Action<PasteTextIntent> {
|
||||
@override
|
||||
Future<void> invoke(PasteTextIntent intent) async {
|
||||
// callingAction is the text field's own paste action, which this overrides
|
||||
if (!await pasteFiles()) callingAction?.invoke(intent);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue