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-win-control="Highlighter"
data-win-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
Set "true" whenever the field should get deleted if form is copied.
doNotCopy: true
boolean
mark
Set the mark type for the highlighter.
mark: 'highlight'
'highlight' | 'bold' | 'strikethrough'
highlight
onChanged
Call a pre-defined JS-method to do something when the status of the control changes
onChanged: HFFormdefinition.Namespace.Method
function
function(value: string) => void
tooltip
Write a comment to provide further information about the field. A question mark will then be shown within the label and with a click/tap on it, the information will occur.
tooltip: 'sample tooltip'
string
tooltipTemplate
Write an id of a html container to provide further information about the field. A question mark will then be shown within the label and with a click/tap on it, the content of the container will occur.
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.
Stored data
<div id="text_highlighter"
data-win-control="Highlighter"
data-win-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 a 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>"
}