protected function initEditor(): void
    {
        $view = $this->getView();

        CKEditorAsset::register($view);
        CKEditorAssetAddition::register($view);

        $id = $this->options['id'];

        $clientOptions = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '{}';

        $js = [];

        $js[] = "CKEDITOR.replace('$id', $clientOptions);";
        $js[] = "initItstructureOnChangeHandler('$id');";

        if (array_key_exists('filebrowserUploadUrl', $this->clientOptions) ||
            array_key_exists('filebrowserImageUploadUrl', $this->clientOptions)) {
            $js[] = "initItstructureCsrfHandler();";
        }

        $view->registerJs(implode("\n", $js));
    }