For now, I've made only one change: exposing the current selection from the control (I hope it's gonna be readable), the purpose is to allow to play with HTML directly, for inserting content that the control doesn't do by default (img with CSS style for instance). Maybe there are better ways?
[Browsable(false)]
public String SelectedText
{
get
{
try
{
if (HtmlDocument2 != null)
{
IHTMLTxtRange range = HtmlDocument2.GetSelection().createRange() as IHTMLTxtRange;
return range.htmlText;
}
return null;
}
catch
{
return "";
}
}
set
{
if (value != null && HtmlDocument2 != null)
{
IHTMLSelectionObject selection = HtmlDocument2.GetSelection();
if (selection != null)
{
IHTMLTxtRange range = HtmlDocument2.GetSelection().createRange() as IHTMLTxtRange;
if (range != null) range.pasteHTML(value);
}
}
}
}
I'm mostly implementing on top of the current control a control that contains enough UI in order to do things correctly, basically: [
members.chello.be]
It's up to you, either you decide that your lib as to stay low-level mshtml, and people have to build GUI on top of that, or you want your lib to evolve to a more high-level editor. I'll understand both.
I will also have to add some code to manage image and linked content (as a mail client I need to put image as attachment, not let them client side), but I'm not sure how it will impact the html editor (probably some helper method to get a list of image, and be able to change their url to a CID).
ps: and no matter what, I'm open to share the source, on your subversion, or on the myoe one.