EditLive! 9 Documentation : Creating Read Only Content

Sections of content to be loaded into EditLive! can be marked as being read-only. EditLive! uses the contenteditable HTML attribute to indicate whether an element and its children are editable within EditLive!. If contenteditable is set to false, then the content of that element and its child elements become read-only. 

The following example demonstrates how to create a read-only section within a document. The DIV with the text <div>This is <b>read only</b> content.</div> will be read-only.

<html>
   <body>
      <div> This content can be edited </div> <div contenteditable="false"> This is <b>read only</b> content. </div> <div> This content is also able to be edited.</div>
   </body>
</html>

Inheritance for Read-Only Content

When an element is marked as read-only, all its child elements are also created as read-only sections. However, the read-only property can be overwritten for specific child elements. This is achieved by explicitly setting the contenteditable attribute to true for that element. The following example demonstrates how to create a read-only parent element (a div) with an editable child element (a paragraph element).

<html>
   <body>
      <div> This content can be edited </div> <div contenteditable="false"> This content is not editable. <p contenteditable="true"> This content is contained within an editable child element</p>.<p> This content is not editable.</p></div><div> This content is also able to be edited. </div>
   </body>
</html>

Setting an Entire HTML Document as Read-Only Using the Load-Time Properties

Using the contendeditable attribute of the <body> Configuration File element, developers can specify whether content is read-only. Developers can also use the setReadOnly Method to define whether the editor's contents are read-only.

See Also