From a36ccd57414d035da8230a1048cf55227ae44ff3 Mon Sep 17 00:00:00 2001 From: DaPa Date: Wed, 5 Jul 2023 19:19:46 +0300 Subject: [PATCH] In Windows, images copied from browser (Chrome, Firefox) can be pasted immediately - no need to parse HTML and download them again --- src/ct/ct_clipboard.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ct/ct_clipboard.cc b/src/ct/ct_clipboard.cc index c76db7b05..2723004a5 100644 --- a/src/ct/ct_clipboard.cc +++ b/src/ct/ct_clipboard.cc @@ -170,6 +170,10 @@ void CtClipboard::_paste_clipboard(Gtk::TextView* pTextView, CtCodebox* /*pCodeb if (vec::exists(targets, CtConst::TARGET_CTD_TABLE)) return std::make_tuple(CtConst::TARGET_CTD_TABLE, received_table, false); #if defined(_WIN32) + // on Windows, if the web clipboard is an image then paste it immediately (no html download needed) + for (auto& target : CtConst::TARGETS_IMAGES) + if (vec::exists(targets, target)) + return std::make_tuple(target, received_image, false); if (vec::exists(targets, CtConst::TARGET_WIN_HTML)) return std::make_tuple(CtConst::TARGET_WIN_HTML, received_html, false); #endif // _WIN32