Features not shown on the toolbar

82 views
Skip to first unread message

Doogal

unread,
Jan 28, 2011, 9:53:48 AM1/28/11
to ModelText
Hi

We have a need for a simple HTML editor control. We've been using one
that uses IE as its underlying editor and it has some problems. And
what we keep hearing back from the developer is that the bugs are in
the IE editor itself. Which suggests that any of the controls based on
IE aren't going to be any use to us.

Which has led us here. Your control looks like just the kind of thing
we need, but looking at the demo there are few items that I'd expect
to see that aren't there, like bold, italic, underline, alignment etc.
Are these available through the API? And if they are could you provide
an example of how we'd implement them?

Chris Bell

Christopher Wells

unread,
Feb 4, 2011, 10:26:41 AM2/4/11
to ModelText, doog...@gmail.com
Hi Chris,

> looking at the demo there are few items that I'd expect to see that aren't there

Yes: the control is meant more for editing the structure of a document
than its appearance. Its focus is especially to edit block-level
elements, like paragraphs, headings, lists, and tables, whose style
can be defined by CSS.

> bold, italic, underline, alignment

Given that bold, italic, and underline are font styles associated with
various inline elements (for example <strong>, <em>, and <ins>), then
you could apply these styles to text by inserting the corresponding
elements into the DOM.

You can also apply a style to text by inserting a span element with a
style attribute, for example <span style="text-decoration: underline;
font-style: italic; font-weight: bold">

> alignment

As mentioned in the table at http://www.modeltext.com/html/html-and-css.aspx#css_properties
the renderer has partial support for the text-align property: it
supports left, right, and center alignment, but does not implement
'justify'.

> Are these available through the API? And if they are could you provide an example of how we'd implement them?

The API lets you edit the DOM: you can insert new elements, and/or
change the attributes (including the style attribute) of elements.

The FileOpenAndSave sample program includes an example of how to
insert a new inline element: see the Form1.onInsertHyperlink method
which is used to edit hyperlinks i.e. <a> tags; code to edit other
tags such as <strong> would be similar (but simpler because they have
no href attribute).

This sample code show how to support the simplest case: how to insert
an inline element, and move some text into the element.

It doesn't support more complicated case (for example, adding bold to
text that's already partially bold and partially not bold, or adding
bold to several paragraphs at once).

Also, there's no public API to edit the buttons on the toolbar. Your
new application-level code would have to be triggered via a key event
handler (a hot key like <Ctrl>-B), and/or via a toolbar or menu
created by your application.

Regards,
Christopher Wells.
Reply all
Reply to author
Forward
0 new messages