On Tue, Jun 3, 2014 at 3:49 PM, Georg Baum <georg.b...@post.rwth-aachen.de> wrote: > Scott Kostyshak wrote: > >> On Mon, Jun 2, 2014 at 2:52 PM, Georg Baum >> <georg.b...@post.rwth-aachen.de> wrote: >> >> You are correct. What I listed was the difference between Chromium >> (which does not work) and Firefox (which does work). If you want me to >> list all the MIME types, let me know. > > No, I don't need that, it is enough to know that image/png is also on the > clipboard. > >>> I think it is sensible to try to detect pure image contents on the >>> clipboard, however I don't think we should hard code any browser specific >>> stuff. What I could imagine is to inspect the text/HTML further: If >>> (after cleaning) the only tag in the body is <img>, and if the clipboard >>> contains image contents as well, then ignore the HTML for pasting without >>> argument and prefer the image. >> >> I like this idea. Where should this be done? The place where Qt is >> used to get the text is inGuiClipboard::getAsText at >> >> case PlainTextType: >> str = qApp->clipboard()->text(QClipboard::Clipboard) >> .normalized(QString::NormalizationForm_C); >> >> I guess the idea is we should never get to this point? > > I think it needs to be done in two places: In GuiClipboard and in > Text::dispatch() (or a new service routine called from there). The reason > for this is that I don't want to change the behaviour of the special pasting > methods: If somebody explicitly says he wants to paste text, then he should > get the image link. > Attached is a sketch of the idea, without the actual HTML parsing part to > find out whether the whole body conatins only an <img> tag, and without any > documentation.
Thanks for taking a look, Georg. From what I understand, the only missing piece to the patch is the XML parser. But I added a line lyxerr << "str is: " << str << std::endl; right before the "Now use some XML parser" comment, and it is only triggered when pasting from Firefox, not from Chromium. Scott