2amigos / yii2-tinymce-widget

TinyMCE WYSIWYG widget for Yii2
http://yiiwheels.com
Other
100 stars 48 forks source link

Why only first run display editor with ajax? #36

Closed lgXenos closed 7 years ago

lgXenos commented 7 years ago

Use ActiveForm on CRUD in Yii2 $form->field($model, 'main_text_promo')->widget(\dosamigos\tinymce\TinyMce::className());

TinyMce configured at bootstrap.php

Yii::$container->set('dosamigos\tinymce\TinyMce', [
    'language' => 'ru',
    'options' => ['rows' => 10],
    'clientOptions' => [
        'plugins' => [
            'advlist autolink lists link charmap hr preview pagebreak',
            'searchreplace wordcount textcolor visualblocks visualchars code fullscreen nonbreaking',
            'save insertdatetime media table contextmenu template paste image responsivefilemanager filemanager',
        ],
        'toolbar' => 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | responsivefilemanager link image media',
        'external_filemanager_path' => '/plugins/responsivefilemanager/filemanager/',
        'filemanager_title' => 'Responsive Filemanager',
        'external_plugins' => [
            'filemanager' => '/plugins/responsivefilemanager/filemanager/plugin.min.js',
            'responsivefilemanager' => '/plugins/responsivefilemanager/tinymce/plugins/responsivefilemanager/plugin.min.js',
        ],
        'relative_urls' => 0,
    ]
]);
lgXenos commented 7 years ago

Sorry. Problem in JavaScript :) Editor already init on this element and not run again

        if(window.tinyMCE !== undefined && tinyMCE.editors.length){
            for(e in tinyMCE.editors){
                tinyMCE.editors[e].destroy();
            }
        }