Creating readonly pieces of content in editlive section

We can create the part of content loaded by Editlive instance as readonly. EditLive! for Java uses the contenteditable HTML attribute to indicate whether an element and its children are editable within EditLive! for Java. If contenteditable is set to false then the content of that element and its child elements becomes read-only.

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

<html>
<body>
<p>
This content can be edited
</p>
<p contenteditable="false">
This is <b>read only</b> content.
</p>
<p>
This content is also able to be edited.
</p>
</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 paragraph) with an editable child element (a span element).

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



Creating non editable Editlive Instance 

Above section describes to how make the pieces of content inside the editlive as readonly. But if you want to open the whole editlive as read-only (When you don't have controller over the content or when just want to disable all editing options of editlive ) , set the ready only property on the editlive instance as follows

customEditliveInstance.setReadOnly("true");

once you set instance as read only , applet get initializes when you click on editable section but most of menu items will be in disable mode and you can delete or edit content inside editlive.

No comments:

Post a Comment