- Модуль: fileman
- Путь к файлу: ~/bitrix/modules/fileman/lib/block/editor.php
- Класс: BitrixFilemanBlockEditor
- Вызов: Editor::show
public function show()
{
CJSCore::RegisterExt('block_editor', array(
'js' => array(
'/bitrix/js/main/core/core_dragdrop.js',
'/bitrix/js/fileman/block_editor/dialog.js',
'/bitrix/js/fileman/block_editor/helper.js',
'/bitrix/js/fileman/block_editor/editor.js',
),
'css' => '/bitrix/js/fileman/block_editor/dialog.css',
'rel' => ['ui.design-tokens', 'ui.fonts.opensans'],
'lang' => '/bitrix/modules/fileman/lang/' . LANGUAGE_ID . '/js_block_editor.php',
));
CJSCore::Init(array("block_editor", "color_picker", "clipboard"));
static $isBlockEditorManagerInited = false;
$editorBlockTypeListByCode = array();
if(!$isBlockEditorManagerInited)
{
foreach($this->blocks as $block)
{
$editorBlockTypeListByCode[$block['CODE']] = $block;
}
}
$jsCreateParams = array(
'id' => $this->id,
'url' => $this->url,
'previewUrl' => $this->previewUrl,
'saveFileUrl' => $this->saveFileUrl,
'templateType' => $this->templateType,
'templateId' => $this->templateId,
'isTemplateMode' => $this->isTemplateMode,
'site' => $this->site,
'charset' => $this->charset
);
$result = '';
if(!$isBlockEditorManagerInited)
{
$result .= 'BX.BlockEditorManager.setBlockList(' . CUtil::PhpToJSObject($editorBlockTypeListByCode) . ");n";
}
$result .= "var blockEditorParams = " . CUtil::PhpToJSObject($jsCreateParams) . ";n";
$result .= "blockEditorParams['context'] = BX('bx-block-editor-container-" . htmlspecialcharsbx($this->id) . "');n";
$result .= "blockEditorParams['iframe'] = BX('bx-block-editor-iframe-" . htmlspecialcharsbx($this->id) . "');n";
$result .= "blockEditorParams['resultNode'] = BX('" . htmlspecialcharsbx($this->ownResultId) . "');n";
$result .= "BX.BlockEditorManager.create(blockEditorParams);n";
$result = "n" . '' . "n";
$result = $this->showEditor() . $result;
$isBlockEditorManagerInited = true;
return $result;
}