getEditableAreas
A logic command that scans through an HTML document, finds elements that are typically editable in Dynamo document templates and stores their contents into the variable context as a set of variables, one for each element, or as a single variable with a Map value.
The elements that this command considers editable are:
Any
<div>
element with theclass
"editable-area". The contents of the element are stored as a HTML value.Any
<span>
element with theclass
"editable-area". The text content of the element is stored as a String.
The variable or Map entry holding the contents of an element receives its name or key from the id
attribute of the element, but if that is not defined the value of the name
attribute is used. If neither is defined for the element, its variable or Map entry will not be created.
Attributes
value | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | File, String | Yes |
Defines the HTML content this command will be inspecting. |
mapVar | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | No |
This attribute can be used to define that this command produces a single variable with a Map instead of a separate variable for each editable element. The value of this attribute is the variable name of the Map, whose entries then contain the editable element values. If not defined, no Map is created and each element produces its own variable. |
Examples
To illustrate the output of this command, if the content given to getEditableAreas
is like this:
<div class="document"><div><span>Not editable stuff.</span></div><div class="editable-area" name="editDiv"><span>Editable stuff.</span></div><div class="editable-area"><span>An editable <span name="editSpan" class="dyn-model-inline-input">word</span>.</span></div></div>
The variables it will create are these two:
"editDiv", a HTML Value "<span>Editable stuff.</span>"
"editSpan", a String "word"
Alternatively, if the attribute mapVar
is defined, the created variable would be a Map with entries as above.