addInlineScript( 'CKEDITOR_BASEPATH', 'window.CKEDITOR_BASEPATH = "' . $ckeditorBasePath . '"', ['beforeScripts' => true] ); $doc->addScript('js/ckeditor/ckeditor.js'); $doc->addScript('js/lib/form-element-ckeditor.js'); $doc->addInitObject('Qs_Form_Element_CkEditor', [$this->_getScriptOptions()]); return $this; } protected function _getEditorConfig() { /** @var $element Qs_Form_Element_HtmlEditor */ $element = $this->getElement(); $config = $element->getScriptOptions(); $editorAreaCss = 'css'; if (Qs_Constant::get('SITE_REVISION')) { $editorAreaCss .= '-' . Qs_Constant::get('SITE_REVISION'); } $editorAreaCss = Qs_Constant::get('WWW_PATH') . '/' . $editorAreaCss . '/ckeditor.css'; if (file_exists($editorAreaCss)) { $editorAreaCss = ltrim($editorAreaCss, '/'); $documentRoot = trim($_SERVER['DOCUMENT_ROOT'], '/'); $config['contentsCss'] = str_replace($documentRoot, '', $editorAreaCss); } return $config; } protected function _getScriptOptions() { /** @var $element Qs_Form_Element_HtmlEditor */ $element = $this->getElement(); $options['id'] = $element->getId(); $options['mode'] = $element->getMode(); $options['config'] = $this->_getEditorConfig(); return $options; } public function render($content) { /** @var $element Qs_Form_Element_HtmlEditor */ $element = $this->getElement(); $height = $element->getHeight(); $editAction = 'Qs_CkEditor.getElementInstance(\'' . $element->getId() . '\').setEditMode(); return false;'; $content = '
' . 'We strongly recommend to use this button ' . ' ' . '(see above in the toolbar) to insert the text from MS Word documents.
'; $content .= $note; } return $content; } }