/**
* Registers TinyMce JS
*/
protected function registerClientScript()
{
$view = $this->getView();
if (!isset($this->options['language']) || empty($this->options['language'])) {
$this->options['language'] = strtolower(substr(Yii::$app->language, 0, 2));
}
// Insert plugins in options
if (isset($this->options['plugins'])) {
foreach ($this->options['plugins'] as $pluginLine) {
foreach (explode(' ', $pluginLine) as $plugin) {
//if load elfinder plugin ,load elfinder asserts first
if ($plugin == 'elfinder') {
\mihaildev\elfinder\Assets::register($this->getView());
\mihaildev\elfinder\Assets::addLangFile($this->options['language'], $this->getView());
}
$this->registerPlugin($plugin);
}
}
}
$options = empty($this->options) ? '' : Json::encode($this->options);
$js = "tinymce.init({$options});";
$view->registerJs($js);
}