The most functional, managed
HTML edit control for Windows Forms
The control is fast, well tested, extensible, inexpensive, and intuitive to use.
The following sections of this page describe how the ModelText edit control meets its various "non-functional requirements" or "quality goals":
There are three performance metrics, as follows:
The HTML used for performance testing includes 30 KB of text, with over 1000 HTML elements: it's 16 pages long if it's printed, so it's bigger than any typical web page.
Testing on an older laptop, with a dual-core 1.9 GHz CPU, the edit control loads and renders the test document in three quarters of a second:
This "less than a second" responsiveness is measured in a "warm" performance test, which excludes any one-time startup costs e.g. for the just-in-time compiler.
The control's responsiveness to the end user appears to be instantaneous.
Most (about 75%) of the time required to load a document is spent measuring the size in pixels of each rendered word, in order to layout words on the page. Because the control caches the measured size of each word, this cost is incurred only once: when the document is loaded, and not subsequently while the document is being edited.
Furthermore, every other measurement is cached as well: for example the way in which words are line-breaked into lines; the height of each paragraph; etc.
When the DOM is edited (via the UI or via the API) the control only recalculates what it must recalculate (for example the word being edited, and the length of the line which contains that word), and only repaints what it must repaint. Because there's no unnecessary repainting, there's no noticeable screen flicker when the user is typing.
The performance is good even in forms which contain many form controls: because to avoid performance problems it avoids instantiating an O/S control for each web control.
The control's reliability has three causes: it uses the managed run-time, it's carefully coded, and it's well tested. Testing is crucial.
The control has a suite of functional tests, which exercise the control's functionality:
There are also some Coding Techniques which improve the control's reliability.
The test suite is created and run within a testing framework, which works as follows.
The advantages of this test strategy, instead of for example writing unit test code to exercise internal APIs of the various implementation components, are as follows:
The following is a list of the test case filenames, to give you an idea of the scope and coverage of the test suite. Each test case file contains several tests, to test the regular case and all the 'corner cases': for example "Edit table delete row" tests deleting the top row, bottom row, middle row, several rows, and all rows of a table.
Backspace after space Backspace around edges of inline textrun Backspace at beginning of paragraph Backspace near end of line Backspace normalize within paragraph Backspace selected word and both spaces Backspace selected word and space Backspace selected word Backspace selection spans two paragraphs Backspace several words Backspace space and selected word Backspace to far edge of other block Change heading level Changed crosslinked heading level Clone selected document fragment Copy and paste entire table Copy and paste more than entire table Copy and paste table cells Copy and paste table into table Copy and paste table plus text Copy and paste text plus table Create list in new document Cursor control left and control right with table Cursor left and right near readonly block Cursor left and right Cut and copy while nothing is selected Delete at end of paragraph Edit list items Edit table delete column Edit table delete row Edit table delete table Edit table insert column Edit table insert row Enter at end of document Enter at start of paragraph Enter in inline text run Enter in mid paragraph Enter on new paragraph Form control resize screen Form hot and pressed on mouse move Form input radio and checkbox Form input text cut copy and paste Form input text loses focus Form input text maxlength Form input text paste Russian form label used to focus Form move captured mouse beyond control Form select and edit input text Form select Form textarea changes height Insert erases selected inline element Insert hyperlinks and crosslinks Insert inline hyperlink Insert into empty list item Insert into list item Insert new attribute type Join paragraphs with flattening required Join paragraphs Keypress with hyperlink at edge of block Line break at end of paragraph Line break delete line breaks Line break in heading for which allowInline is false Line break in list item Line break in table cell Line break inside inline text run Line break select empty lines Line break selection in middle of paragraph Load complicated list Load document from disk Load empty fragment with whitespace Load empty fragment Load entities and whitespace Minimum width of form control New document No exception if user code leaks a IDomRange instance Paste blocks into div Paste blocks into list items Paste duplicate id attribute Paste inline text runs Paste into end of block before table Paste into end of block within table cell Paste into middle of block within table cell Paste into start of block within table cell Paste list items into div Paste text into list paragraph Paste text into simple blocks Resize simple table Resize Right caret of multiple selections Script changes a style attribute at run-time Script undo a style attribute change Scroll Select control home and control end with shift key Select control left and control right with shift key Select readonly with cursor and shift key Select readonly with mouse and cursor Select readonly with mouse and shift key Select table cells with shift key Select with double click at end of line Select with mouse and double click Selection changing and repainting Selection moved over readonly fragment SelectionMemento around save SelectionMemento supports removed whitespace on save Style with inline-block and text-align and style Table anonymous text block with inline element Table caret location Table carriage return to insert new row Table cell and row height on insert and delete Table column width on insert and delete Table insert char Table Insert tables Table press Enter at start of text cell Table single caret backspace Table single caret delete Table split first block containing multiple nodes Toggle list collapse final list paragraph Toggle list collapse two list paragraphs Toggle list empty list item Toggle list final empty paragraph Toggle list in multiple table cells Toggle list in table cells Toggle list merge lists Toggle list simple cases Toggle list split anonymous block Toggle list two items Type at boundaries of inline text runs
There a few coding techniques which help to improve or guarantee the reliability of the control:
The usual WYSIWYG editors consist of a standard browser, in
If a .NET application embeds an editor like this, the application will find it difficult to extend
the editor's functionality, because:
In contrast, the ModelText edit control is designed to be extensible, to make it easy to implement additional, application-specific features:
See the Support and Licensing topic for an explanation of the license costs. Note that there is no per-developer, per-user, or per-server cost.
This requirement is simply to do what the user expects. It's achieved by having a standard, simple user interface; and by creating standard, WYSIWYM output.
© 2009-2012, Christopher Wells. All rights reserved.