DITA Storm browser-based DITA XML Editor
by Inmedius Inc.
 

Read-Only (Locked) Elements

Description: This section describes actions necessary to disable editing of certain XML elements and attributes within the editor.

Making Elements Read-Only

There are three scenarios when XML editor might need to prevent user from modifying certain elements of XML:

  • Prevent editing of certain attribute
  • Prevent element from being removed from its parent
  • Prevent editing of element and all child nodes contained in it

All three scenarios could be enforced for certain class of elements (see lock attribute in model.xml) as well as only for specific element within provided XML.

To enforce one of these rules on specific elements within XML, developer could use special _lock attribute. Its value will identify how the element should be handled. Here is the list of available values:
_lock attribute value Description
attribute:<attribute_name> Prohibits editing of the specified attribute. For example:
<section product="UV Scanner"
        _lock="attribute:product">
    ...
</section> 
content Prohibits editing of element along with attributes and child nodes. For example:
<section _lock="content">
    ...
</section> 
inparent Prevents any action that could remove element from its parent. For example:
<section _lock="inparent">
    ...
</section> 
any combination of values above Combines effect of multiple settings. Values should be coma or space separated. For example:
<section
      _lock="inparent,attribute:product">
    ...
</section> 

Restriction: At the moment editor would only enforce read-only policy for WYSIWYG and Outline editing modes. Using raw XML editing mode user can overwrite read-only customizations. This issue will be addressed in the future versions of the editor.

You can find examples of the _lock attribute effect in the Sample Documents section.

top

CSS Styling for Read-only Elements

To indicate that certain element and all of its child nodes can not be edited, DITA Storm uses CSS style called readonly. In the initial configuration it turns background light gray, letters dark gray and italic:
.readonly {
	background-color: #F5F5F5;
	color: #A0A0A0;
	font-style: italic;
}
User can customize styling by updating definition in CSS file styles.css located in DITAStorm directory.
top
Copyright © 2007
Inmedius Inc.