Text Area Form Control
oxy_textArea
built-in form control is used for entering multiple
lines of text in a graphical user interface box. A text area may include optional
syntax
highlight capabilities to present the form control.
The oxy_textArea
form control supports the following properties:
edit
- Lets you edit the value of an attribute, the text content of an element, or Processing Instructions (PI). This property can have the following values:- @attribute_name - The name of the attribute whose value is being edited. If the attribute is in a namespace, the value of the property must be a QName and the CSS must have a namespace declaration for the prefix.
- #text - Specifies that the presented/edited value is the simple
text value of an element.
Note
You can set the value of thevisibility
property to-oxy-collapse-text
to render the text only in the form control that theoxy_editor
function specifies. - #content - This parameter is useful when an element has mixed or element-only
content and you want to edit its content inside a text area form control.
For example, if you have the following XML content:
<codeblock outputclass="language-xml">START_TEXT<ph>phase</ph> <apiname><text>API</text></apiname></codeblock>
and your CSS includes the following snippet:
codeblock:before{ content: oxy_textArea( edit, '#content', contentType, 'text/xml'); }
then the text area form control will edit the following fragment:
START_TEXT<ph>phase</ph><apiname><text>API</text></apiname>
Note
When the value of theedit
property is#content
, the text area form control will also offer content completion proposals.
- #content - This parameter is useful when an element has mixed or element-only
content and you want to edit its content inside a text area form control.
For example, if you have the following XML content:
<codeblock outputclass="language-xml">START_TEXT<ph>phase</ph> <apiname><text>API</text></apiname></codeblock>
and your CSS includes the following snippet:
codeblock:before{ content: oxy_textArea( edit, '#content', contentType, 'text/xml'); }
then the text area form control will edit the following fragment:
START_TEXT<ph>phase</ph><apiname><text>API</text></apiname>
Note
When the value of theedit
property is#content
, the text area form control will also offer content completion proposals. columns
- Controls the width of the form control. The unit size is the width of the w character.width
- Specifies the width of the content area using relative (em
,ex
), absolute (in
,cm
,mm
,pt
,pc
,px
), and percentage (followed by the%
character) length units. Thewidth
property takes precedence over thecolumns
property (if the two are used together).fontInherit
- This value specifies whether or not the form control inherits its font from its parent element. The values of this property can betrue
orfalse
(default value). To make the form control inherit its font from its parent element, set thefontInherit
property totrue
.visible
- Specifies whether or not the form control is visible. The possible values of this property aretrue
(default value) andfalse
.rows
- This property specifies the number of rows that the form control presents. If the form control has more lines, you can scroll and see them all.-
contentType
- Specifies the type of content for which the form control offers syntax highlighting. The following values are supported:text/css; text/shell; text/cc; text/xquery; text/xml; text/python; text/xsd; text/c; text/xpath; text/javascript; text/xsl; text/wsdl; text/html; text/xproc; text/properties; text/sql; text/rng; text/sch; text/json; text/perl; text/php; text/java; text/batch; text/rnc; text/dtd; text/nvdl; text/plain.
indentOnTab
- Specifies the behavior of the Tab key. If the value of this property is set totrue
(default value), the Tab key inserts characters. If it is set tofalse
, Tab is used for navigation, jumping to the next editable position in the document.- The
white-space
CSS property influences the value that you edit, as well as the from control size:pre
- The whitespaces and new lines of the value are preserved and edited. If therows
andcolumns
properties are not specifies, the form control calculates its size on its own so that all the text is visible.pre-wrap
- The long lines are wrapped to avoid horizontal scrolling.Note
Therows
andcolumns
properties must be specified. If these are not specified, the form control considers the value to bepre
.normal
- The white spaces and new lines are normalized.
hoverPseudoclassName
- Allows you to change the way an element is rendered when you hover over a form control. The value is the name of a CSS pseudo-class. When you hover over the form control, the specified pseudo-class will be set on the element that contains the form control.p:before { content: oxy_textArea(hoverPseudoclassName, 'showBorder') } p:showBorder { border: 1px solid red; }
Text Area Form Control
The following example presents a text area with CSS syntax highlighting that calculates its own dimension, and a second one with XML syntax highlighting with defined dimension.
textArea { visibility: -oxy-collapse-text; white-space: pre; } textArea[language="CSS"]:before { content: oxy_textArea( edit, '#text', contentType, 'text/css'); } textArea[language="XML"]:before { content: oxy_textArea( edit, '#text', contentType, 'text/xml', rows, 10, columns, 30); }
Tip
oxy_textArea
form control in a CSS
file , invoke the Content
Completion Assistant by pressing Ctrl + Space (Command + Space on OS
X) and select the
oxy_textArea
code template.
To see more detailed examples and more information about how form
controls work in Oxygen XML Editor plugin, see the sample files in the following directory:
[OXYGEN_INSTALL_DIR]/samples/form-controls
.