Highlighter
A Highlighter is used to highlight text. It is possible to place an initial value as children to the control but it is very limited which tags can be placed.
<div
id="text_highlighter"
data-hf-control="Highlighter"
data-hf-options="{
label: 'Text Highlighter',
tooltip: '',
mark: 'highlight'
}"
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Eleifend porttitor vehicula facilisi urna euismod litora
diam viverra primis accumsan ultrices mi suscipit. Mus ad quam conubia
<strong>hendrerit torquent ullamcorper</strong>
elementum consequat eu amet velit consequat condimentum.
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
FormControl Options​
doNotCopy​
doNotCopy: true
boolean
mark​
mark: 'highlight'
'highlight' | 'bold' | 'strikethrough'
highlight
onChanged​
onChanged: HFFormdefinition.Namespace.Method
function
function(value: string) => void
tooltip​
tooltip: 'sample tooltip'
string
tooltipTemplate​
tooltipTemplate: 'example_control_tooltip'
string
Usage
​The following describes which tags are allowed and how the control is used.
DefaultValue
​The dafault value of the Highlighter is simple HTML code which describes the children of the FormControl.
To highlight text initiallly, the text has to be wrapped in a <span>
tag with the class highlight
and a data attribute data-highlighted="true"
.
<span data-highlighted="true" class="highlight">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Eleifend porttitor vehicula facilisi
</span>
Allowed tags
​-
Container:
<div>
,<span>
,<blockquote>
,<label>
-
Text & Formatting:
<h1>
,<h2>
,<h3>
,<h4>
,<h5>
,<p>
,<a>
,<b>
,<i>
,<u>
,<s>
,<em>
,<strong>
,<sub>
,<sup>
,<br>
-
Lists:
<ul>
,<ol>
,<li>
-
Tables:
<table>
,<thead>
,<tbody>
,<tfoot>
,<tr>
,<th>
,<td>
Images
​To prevent XSS (Cross-Site-Scripting) images have their own syntax. Normal image tags are forbidden!
<hf-img
id="img01"
hf-type="formdefinition"
hf-src="form-logo.png"
class="test-class img-responsive"
alt="form logo"
></hf-img>
There are three types of image sources which can be defined with hf-type:
-
hf-type="formdefinition": Is used to include an image from the Form Definition. hf-src has to be the image filename.
- e.g.: hf-src="form-logo.png"
-
hf-type="form": Is used to include an image from the Form attachments. hf-src has to be the attachment filename.
- e.g.: hf-src="sketch-6ec3a4a2-d384-186e-68c6-3b827df4cba4.png"
-
hf-type="extern": Is used to include an image from an extern source. hf-src has to be a valid URL to an image. CORS problems can occur!
- e.g.: hf-src="https://www.example.com/something/example.png"
If no class is assigned, the Bootstrap class img-responsive is automatically assigned to limit the size of the image.
copyValueFrom​
Define a FormControl that synchronizes its value with the current field. This synchronization process occurs upon navigating to the page where the current control is situated. It only occurs if the field is empty or the mode is set to "overwrite".
<div
id="html_container_1"
data-hf-control="Highlighter"
data-hf-options="{
label: 'Text Highlighter',
copyValueFrom: 'html_container_2'
}"
></div>
interface ICopyValueFromObject {
sourceId: string;
mode: 'overwrite' | null;
callback: (value: string) => string;
}
type CopyValueFromType = string | ICopyValueFromObject;
callback​
callback: HFFormDefinition.Namespace.processValue
function
function(value: string) => string
mode​
mode: 'overwrite'
string
Stored data
​<div
id="text_highlighter"
data-hf-control="Highlighter"
data-hf-options="{
label: 'Text Highlighter',
tooltip: '',
mark: 'highlight'
}"
>
<span data-highlighted="true" data-timestamp="1717412668684" class="highlight"
>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Eleifend porttitor vehicula facilisi </span
>urna euismod litora diam viverra primis accumsan ultrices mi suscipit. Mus ad quam conubia
<strong>hendrerit torquent ullamcorper</strong> elementum consequat eu amet velit consequat condimentum.
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
For each HtmlContainer inside your Forms there is one value pair of stored data:
It is an HTML string which describes the children of the FormControl.
{
"id": "html_container_1",
"value": "<span data-highlighted=\"true\" data-timestamp=\"1717412668684\" class=\"highlight\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.Eleifend porttitor vehicula facilisi </span>urna euismod litora diam viverra primis accumsan ultrices mi suscipit.Mus ad quam conubia <strong>hendrerit torquent ullamcorper</strong> elementum consequat eu amet velit consequat condimentum.<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>"
}