PHP code example of besnovatyj / yii2-cms-jodit

1. Go to this page and download the library: Download besnovatyj/yii2-cms-jodit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

besnovatyj / yii2-cms-jodit example snippets


use Besnovatyj\Jodit\JoditWidget;

<?= $form->field($model, 'content')->widget(JoditWidget::class, [
    'height' => 500,
    'fmDefaultPath' => '/static',
    // 'enableFileManager' => false, // выключить кнопку файлового менеджера
    // 'config' => [ ... ],          // любые прочие переопределения опций Jodit
]) 

<?= $form->field($model, 'content')->widget(JoditWidget::class, [
    // Свой основной тулбар (имена кнопок, сепараторы '|' '---' "\n" или группы
    // ['group' => 'font-style', 'buttons' => []]):
    'buttons' => ['bold', 'italic', '|', 'ul', 'ol', '|', 'link', 'image', 'fileManager', 'source'],

    // Адаптив: Jodit меняет набор по ширине. buttonsMD/SM/XS = null → наследуют $buttons
    // (полный набор на любой ширине). Задайте, если для узких мест нужен усечённый список:
    // 'buttonsMD' => [...], 'buttonsSM' => [...], 'buttonsXS' => ['bold', 'italic', 'dots'],
    // 'toolbarAdaptive' => false,           // отключить адаптив (всегда только $buttons)
    // 'sizeLG' => 900, 'sizeMD' => 700, 'sizeSM' => 400, // брейкпоинты (px)

    // Точечно убрать кнопки из полного набора, не переписывая список:
    'removeButtons' => ['ai-commands', 'ai-assistant'],
]) 

<?= JoditWidget::widget([
    'name' => 'content',
    'value' => $html,
])