behavior: htmlarea

HTML WYSIWYG editing behavior.

The behavior supports document container mode similar to <frame>/behavior:frame - it supports loading full <html>...</html> document in it.

Elements

that have this behavior applied by default:

Attributes

that this behavior knows about:

Model

Richtext supports two content models, HTML fragment:

<htmlarea>
   <h2>Some HTML content</h2>
   <p>Line 2</p>
   <p>Line 3</p>
</htmlarea>

and full document. In this case <htmlarea> behaves as a <frame> containing the document:

<htmlarea>
   <html>
      <body>
        <h2>Some HTML content</h2>
        <p>Line 2</p>
        <p>Line 3</p>
      </body>
   </html>
</htmlarea>

Content model is determined by content loaded in it.

Events

Together with the standard set of events (mouse, keyboard, focus) behavior: richtext generates:

Value

string, reflects current status of content DOM - value gets/sets current HTML content.  For the richtext DOM element property value is an alias of property html.

Special key combinations

Commands

The htmlarea.execCommand(command,attributes) method executes undoable editing command. The command string identifies command to execute.

Editing commands common to all editable elements ( <input|text>, <textarea>, <plaintext>, <htmlarea> ):

Commands specific to behavior:richtext ( <htmlarea> ):

Table editing operations. These operations are available only if selection is inside a table:

Methods

loadDocument
(url:string): true|false

loads file from URL into the editor;

saveDocument
(url:string): true|false

saves content to a file;

emptyDocument
(): true|false

initializes the editor by empty document;

sourceToContent
(html:string, url:string, selStart:integer, selEnd:integer): true|false

The method sets content from the html and selection from given selStart and selEnd.

This method does incremental content update - supposed to be used when you need to update content from HTML source code view as it preserves undo/redo operational stack. 

contentToSource
() : [html:string, selStart:integer, selEnd:integer]

returns content and selection as an array of three elements;