Feed Icon  

Contact

  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics

Tags

Open Source Projects

Archives

Ads

Clipboard Paste Live Writer Plugin

Posted in .NET | Live Writer at Thursday, 17 August 2006 11:55 Pacific Daylight Time

If you copy source as html (or have any html in the clipboard), hitting paste in Windows Live Writer pastes the text without the markup. So since there is an SDK and some great samples, I went ahead and wrote a simple plugin to paste the clipboard contents as html (in about 10 minutes).

public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)
        {
            DialogResult result = DialogResult.OK;
            if (Clipboard.ContainsText() == true)
            {
                newContent = Clipboard.GetText();
            }
            else
            {
                result = MessageBox.Show(dialogOwner, "Copy your HTML to the clipboard.", "Paste as Html", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK && Clipboard.ContainsText() == true)
                {
                    newContent = Clipboard.GetText();
                }
            }
 
            return result;
        }

I've applied to join the CodePlex project so maybe my humble contribution will get added, but for now you can download it here.

Technorati Tags: -

Thursday, 17 August 2006 18:21:39 (Pacific Daylight Time, UTC-07:00)
Nice :)
I planned to do it, but if it si done :)
Great.

Regards
Laurent
Sunday, 27 August 2006 12:06:05 (Pacific Daylight Time, UTC-07:00)
Nice! Can I keep it in Live Writer Plugins website so that other Live Writer users can use it ? Thanks!
Monday, 28 August 2006 05:14:01 (Pacific Daylight Time, UTC-07:00)
Sure!
Monday, 28 August 2006 08:37:40 (Pacific Daylight Time, UTC-07:00)
Humble it may be, but also quite useful. The way Writer handles pastes from VS is one of the top complaints we get from MS developers. I'm glad to see you found a clever workaround to take some heat off of us ;-)

I hope you'll consider posting it to the Windows Live Writer plugin gallery.

http://writerdevzone.spaces.live.com/blog/cns!FF912D98C958E9D3!106.entry
Thursday, 31 August 2006 06:10:32 (Pacific Daylight Time, UTC-07:00)
Thanks Brain. Just what I needed. I do get some funky spaceing however as shown here:
http://staceyw.spaces.live.com/blog/cns!F4A38E96E598161E!933.entry

It looks fine when posted into LW and in LW Preview, but when seen on the real site, it adds spaces. Any ideas? TIA!
William
Friday, 01 September 2006 03:33:47 (Pacific Daylight Time, UTC-07:00)
Thanks for your post on my blog. I am still having the same issue. Maybe it is because I am using CopyAsHtml 2.0? If you ever upgrade and see this issue yourself, please drop me a comment. Thanks again Bryant!
William
Comments are closed.