It uses editing functionality built into all modern desktop browsers, accessed at document level via setting the designMode
property of the document to "on", or at an element level by adding a contenteditable
attribute with value "true" (also triggered by setting the contentEditable
property of an element to the string "true").
A very common strategy for editing a piece of content in a web page is to include an iframe whose document has designMode
turned on.
Coupled with this is document.execCommand
, which in an editable document can be used to apply various kinds of formatting. For example:
document.execCommand("bold", false, null);
... will toggle whether the selected text is bold. There is a pool of common commands between browsers but there are some discrepancies as to exactly how some are implemented. More info can be found here at MSDN for IE and here at MDC for Firefox. Can't seem to find documentation for WebKit.