Merge from BRANCH: Workaround for HTML paste problems, reported as Bug #3031672

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@794 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2010-08-07 15:12:37 +00:00
commit 3f2826cb0e

View file

@ -650,10 +650,22 @@ namespace Greenshot.Drawing {
}
}
} else if ( ClipboardHelper.GetFormats().Contains("HTML Format")) {
HtmlFragment htmlFragment = HtmlFragment.FromClipboard();
DeselectAllElements();
HtmlContainer htmlContainer = AddHtmlContainer(htmlFragment.Fragment, 0, 0);
SelectElement(htmlContainer);
try {
HtmlFragment htmlFragment = HtmlFragment.FromClipboard();
DeselectAllElements();
HtmlContainer htmlContainer = AddHtmlContainer(htmlFragment.Fragment, 0, 0);
SelectElement(htmlContainer);
} catch (Exception e) {
LOG.Warn("Problem pasting HTML from the clipboard: ", e);
// Switch to plain text
string text = Clipboard.GetText();
if (text != null) {
DeselectAllElements();
ITextContainer textContainer = AddTextContainer(text, HorizontalAlignment.Center, VerticalAlignment.CENTER,
FontFamily.GenericSansSerif, 12f, false, false, false, 2, Color.Black, Color.Transparent);
SelectElement(textContainer);
}
}
} else if (Clipboard.ContainsText()) {
string text = Clipboard.GetText();
if (text != null) {