kartik-v / yii2-editors

Yii2 editor widgets Summernote and Codemirror.
Other
21 stars 8 forks source link

Error when first time open Bootstrap4 modal and has Summernote in it. #15

Open biladina opened 2 years ago

biladina commented 2 years ago

Prerequisites

Steps to reproduce the issue

  1. installing yii2 editors from dev-master
  2. set bootstrap 4 param
  3. use summernote with simple form

Expected behavior and actual behavior

I try to use this plugin in bootstrap 4 modal, first time I open the modal, I get this error Uncaught TypeError: $el.summernote is not a function, but when I open the modal second time, its good..

this is the first time I open the modal index1 Screenshot_20220114_160341

and this is the second time I open the modal, summernote working good.. index2

this is my code :

<?php
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
use kartik\editors\Summernote;
?>
<div class="data-form">
    <?php $form = ActiveForm::begin(); ?>
    <?= $form->field($model_sub_kegiatan_base, 'definisi_operasional')->widget(Summernote::class, [
            'useKrajeePresets' => true,
        ]) ?>

    <?php if (!Yii::$app->request->isAjax){ ?>
        <div class="form-group">
            <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
        </div>
    <?php } ?>

    <?php ActiveForm::end(); ?>
</div>

Environment

Browsers

Operating System

Libraries

Isolating the problem

linksblinker commented 2 years ago

I'm running in exact the same issue on Mac OS X, using Boostrap 3.x.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

zmiftah commented 2 years ago

I'm running in exact the same issue on Mac OS X, using Boostrap 3.x.

Same here, other widget seems fine thou. Any workaround for this?

linksblinker commented 2 years ago

I'm running in exact the same issue on Mac OS X, using Boostrap 3.x.

Same here, other widget seems fine thou. Any workaround for this?

Unfortunately not.

For now, I use the Yii2-Pell-Widget (https://github.com/coderius/yii2-pell-widget).

asbragax commented 8 months ago

I just had the same issue, just added

SummernoteAsset::register($this);

to the view which calls the modal and it was fixed!!

Fluit commented 1 month ago

The same here with Bootstrap 4.5. even the suggestion above doesn't work, thx @asbragax thou.