Files
pipelines/app/lib/features/chat/domain/chat_clipboard_paste_stub.dart
T
alan f8ea50fd70 Paste files and images into the chat composer on macOS
Native hosts reported clipboard-file paste as unsupported, and Flutter's
Clipboard carries text only, so Cmd+V of a Finder file or a screenshot in the
macOS app pasted nothing (or the file name). The macOS Runner now answers a
pipelines/clipboard_files channel with the pasteboard's file URLs, else its
image as PNG; the composer's Cmd+V reads it and attaches the files, falling
back to the pasteboard text when there are none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 20:42:05 +00:00

21 lines
785 B
Dart

import 'package:flutter/foundation.dart';
import 'chat_clipboard_paste.dart';
import 'chat_clipboard_paste_native.dart';
/// Native clipboard-file paste.
///
/// macOS reads the pasteboard through its Runner
/// ([nativeChatClipboardPaste]). Other native hosts have no pasteboard reader
/// yet: they report that missing capability rather than pretending no paste
/// happened, and the composer keeps the host field's own text paste.
const String chatClipboardPasteUnsupportedMessage =
'Pasting files is not supported on this platform yet.';
ChatClipboardPaste get hostChatClipboardPaste =>
chatHostReadsClipboardFiles(defaultTargetPlatform)
? nativeChatClipboardPaste()
: const ChatClipboardPaste.unsupported(
chatClipboardPasteUnsupportedMessage,
);