Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

allow pasting attachments from keyboard

Closes #55
This commit is contained in:
Henry Hiles 2026-10-15 13:40:24 -04:00
commit 36f61a62d8
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
12 changed files with 154 additions and 15 deletions

View 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);
}
}