OnBeforeHTMLEditorScriptsGet
array handler function( string editorName array arEditorParams );
The "OnBeforeHTMLEditorScriptsGet" event is called before the loading of JavaScript and CSS files of the editor and allows to add user files, which will be additionally uploaded after the files of visual editor. Creation of this handler offers the simplest way to modify in-built visual editor via extension and re-defining of the current functionality.
Attention. Event is triggered only within the framework of the old visual editor.
Parameters
Parameter | Description |
---|---|
editorName | Name of the connected editor. |
arEditorParams | Array of parameters of the connected editor. |
Structure of the result
The result of the called handler function shall be an associative array, which can contain "JS" and "CSS" fields, each of which can be a linear array of names for connected files, with corresponding extension.
Files, names of which are returned as array elements in the "JS" and "CSS" fields must be located in the /bitrix/admin/htmleditor2 folder
See also
Example of handler funtion:
<? // файл /bitrix/php_interface/init.php // register the handler AddEventHandler("fileman", "OnBeforeHTMLEditorScriptsGet", "addEditorScriptsHandler"); function addEditorScriptsHandler($editorName,$arEditorParams) { // Check, if the editor for static pages is connected if ($editor_name == 'filesrc') return array( "JS" => array('my_scripts.js'), "CSS" => array('my_styles.css') ); return array(); } ?> <? // file /bitrix/admin/htmleditor2/my_scripts.js // Re-define standard tool bar, by deleting "Settings", "Select all" and "Spell check" buttons from it arToolbars['standart'] = [ BX_MESS.TBSStandart, [ arButtons['Fullscreen'], 'separator', arButtons['Cut'], arButtons['Copy'], arButtons['Paste'], arButtons['pasteword'], arButtons['pastetext'], arButtons['separator'], arButtons['Undo'], arButtons['Redo'], arButtons['separator'], arButtons['borders'], 'separator', arButtons['table'], arButtons['anchor'], arButtons['CreateLink'], arButtons['deletelink'], arButtons['image'], 'separator', arButtons['SpecialChar'], arButtons['spellcheck'] ] ]; ?> /* file /bitrix/admin/htmleditor2/my_styles.css re-define the editor background color (only for Mozilla Firefox) */ .bxedmainframe IFRAME{ background-color: #CCCCCC; }
© «Bitrix24», 2001-2024