addPropertyBarHandler
void oBXEditorUtils.addPropertyBarHandler( string tagname, function handler );
The method adds a new handler which will be called when the editor creates a toolbar for a tag specified by tagname.
The toolbar is activated automatically when a user clicks a tag or right upon insertion of an element from a user's taskbar. You can supply, if needed, a function to create the element parameters (passed as the second parameter).
The parameter creation function can also implement element parameter editing. The use of anonymous functions as handler is undesirable.
Parameter | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
tagname | The tag name. | ||||||||
handler | Function or method to handle the event of property bar initialisation.
The following three parameters are passed to this function when an event fires:
|
Example of creating the property bar handler
<script>
function CustomTaskbar()
{
var oTaskbar = this;
CustomTaskbar.prototype.OnTaskbarCreate = function ()
{
//...
//Add the property bar handler for the "_customtag" element
oBXEditorUtils.addPropertyBarHandler('_customtag',this.ShowProperties);
//...
}
//...
CustomTaskbar.prototype.ShowProperties = function(_bNew, _pTaskbar, _pElement)
{
// _pTaskbar.pCellProps - scrolled area of the property bar
// Read the element properies
var arParams = oBXEditorUtils.getCustomNodeParams(_pElement);
//...
// Do some operations over the properties
//...
//Save the element properties
oBXEditorUtils.setCustomNodeParams(_pElement,arParams);
}
}
</script>
© «Bitrix24», 2001-2024