Rich text editors not working?

I’m trying to use a rich text editor in Yii2 with ActiveForm. I’ve installed marqu3s/yii2-summernote and yiidoc/yii-redactor but neither seem to be working.

View file:
<?php

//use marqu3s\summernote\Summernote;
use yii\bootstrap\ActiveForm;
use yii\web\User;
use yii\helpers\Url;
use yii\helpers\Html;
use common\models\MessageContent;
use yii\redactor\widgets\Redactor;

$this->title = ‘Create Message’;
$this->params[‘breadcrumbs’][] = $this->title;

?>

<?php $form = ActiveForm::begin(['id' => 'create-message-form']); ?>
<?= $form->field($model, 'receiver_username')->textInput(['autofocus' => true]) ?>

<?= $form->field($model, 'msg_title') ?>

<?= $form->field($model, 'msg_content')->widget(\yii\redactor\widgets\Redactor::className()) ?>

<?//= $form->field($model, 'msg_content')->widget(Summernote::className()); ?>

<?//= $form->field($model, 'msg_content')->textarea(['rows' => 6, 'class' => 'summernote form-control border-radius-0 p-3', 'width' => '100%']) ?>

<div class="form-group">
    <?= Html::submitButton('Send Message', ['class' => 'btn btn-dark text-white', 'name' => 'message-button']) ?>
 </div>
<?php ActiveForm::end(); ?>

composer.json require looks like this:
“require”: {
“php”: “>=5.4.0”,
“yiisoft/yii2”: “~2.0.6”,
“yiisoft/yii2-bootstrap”: “dev-master”,
“yiisoft/yii2-swiftmailer”: “~2.0.0 || ~2.1.0”,
“bower-asset/codemirror”: “@stable”,
“bower-asset/summernote”: “v0.8.11”,
“marqu3s/yii2-summernote”: “dev-master”,
“yiidoc/yii2-redactor”: “dev-master”
},

I can’t figure out what’s wrong…

Do you see javascript errors in the console?

Yes, they’re telling me that “redactor” and “summernote” are not jQuery functions…

    jQuery.Deferred exception: jQuery(...).summernote is not a function TypeError: 
    jQuery(...).summernote is not a function
    at HTMLDocument.<anonymous>

Nevermind, I got it working without using the widgets.

2 Likes