This topic describes how to configure custom toolbars in the igHtmlEditor
™.
The following topics are prerequisites to understanding this topic:
igHtmlEditor Overview: This topic describes the features of the igHtmlEditor
.
Adding igHtmlEditor: This topic describes how to add an igHtmlEditor to a web page.
Configuring Toolbars and Buttons: This topic explains how to configure igHtmlEditor
toolbars and buttons.
This topic contains the following sections:
The igHtmlEditor control supports adding custom-defined toolbars. Custom toolbars are very similar to the standard toolbars. They can be visible or hidden, expanded or collapsed.
Custom toolbars currently support two types of controls:
The following screenshot shows an igHtmlEditor with a custom toolbar defined. This toolbar contains a button and a combo:
The following table lists the configurable aspects of adding a custom button to the igHtmlEditor
control. Additional details are available after the table.
Configurable aspects | Details | Properties |
---|---|---|
Add custom toolbar | Use the customToolbars array to define a custom toolbar. |
|
Hide custom toolbar | Use autogenerated property show <customToolbarName\> . |
|
Collapse custom toolbar | Use expanded property on the custom toolbar literal. |
|
In order to create a custom toolbar, you should define the customToolbars
option of the igHtmlEditor
. Custom toolbars have all the functionality of the standard toolbars. For example, a custom toolbar can be expanded or collapsed, visible or hidden. Currently custom toolbars can contain button and combo controls. You define these controls in the items
property.
The following table maps the desired configuration to property settings.
In order to: | Use this property: | And set it to: |
---|---|---|
Set the name of the toolbar | name | Custom defined string. For example: "myCustomToolbar". |
Set the initial state of the toolbar to be expanded | expanded | true |
Set the collapse button icon | collapseButtonIcon | "ui-igbutton-collapse" |
Set the expand button icon | expandButtonIcon | "ui-igbutton-expand" |
Add items to the toolbar | items | Array of object literals. For details on each object properties see Adding a Button to a Custom Toolbar and Adding a Combo Box to a Custom Toolbar |
The screenshot below demonstrates how the igHtmlEditor
looks as a result of the following settings:
Property | Value |
---|---|
name | "customToolbar" |
collapseButtonIcon | "ui-igbutton-collapse" |
expandButtonIcon | "ui-igbutton-expand" |
Note: You can see that the toolbar has no controls in it. That’s because there are none defined. See Adding a Button to a Custom Toolbar and Adding a Combo Box to a Custom Toolbar sections..
The code snippet below defines a custom toolbar named "customToolbar" with no items in it.
In JavaScript:
<script type="text/javascript">
$("#htmlEditor").igHtmlEditor({
customToolbars: [
{
name: "customToolbar",
collapseButtonIcon: "ui-igbutton-collapse",
expandButtonIcon: "ui-igbutton-expand",
items: [
//define items here
]
}]
});
<script>
In order to hide a custom toolbar you should use the property which is generated like this:
show< customToolbarName >
where <customToolbarName>
is the name of the custom toolbar.
The following table maps the desired configuration to property settings.
In order to: | Use this property: | And set it to: |
---|---|---|
Hide custom toolbar | show<customToolbarName> |
false |
The screenshot below demonstrates how the igHtmlEditor
looks as a result
of the following settings:
Property | Value |
---|---|
showMyCustomToolbar | false |
customToolbars.name | "myCustomToolbar" |
collapseButtonIcon | "ui-igbutton-collapse" |
expandButtonIcon | "ui-igbutton-expand" |
Note: You cannot see the custom toolbar in the screenshot, because it is hidden.
Here is the code:
In JavaScript:
<script type="text/javascript">
$("#htmlEditor").igHtmlEditor({
showMyCustomToolbar: false,
customToolbars: [
{
name: "myCustomToolbar",
collapseButtonIcon: "ui-igbutton-collapse",
expandButtonIcon: "ui-igbutton-expand"
// toolbar definition here
}]
});
<script>
In order to collapse the custom toolbar you should set the expanded property to false.
The following table maps the desired configuration to property settings.
In order to: | Use this property: | And set it to: |
---|---|---|
Collapse custom toolbar | expanded | false |
The screenshot below demonstrates how the igHtmlEditor
looks as a result
of the following settings:
Property | Value |
---|---|
name | "customToolbar" |
expanded | false |
collapseButtonIcon | "ui-igbutton-collapse" |
expandButtonIcon | "ui-igbutton-expand" |
Here is the code:
In JavaScript:
<script type="text/javascript">
$("#htmlEditor").igHtmlEditor({
customToolbars: [
{
name: "customToolbar",
expanded: false,
collapseButtonIcon: "ui-igbutton-collapse",
expandButtonIcon: "ui-igbutton-expand",
items: [
//define items here
]
}]
});
<script>
The following topics provide additional information related to this topic.
Adding a Button to a Custom Toolbar: This topic describes how to add button to custom toolbar in the igHtmlEditor.
Adding a Combo Box to a Custom Toolbar: This topic describes how to add combo to custom toolbar in the igHtmlEditor.
The following samples provide additional information related to this topic.
View on GitHub