wbraganca / yii2-dynamicform

It is widget to yii2 framework to clone form elements in a nested manner, maintaining accessibility.
Other
433 stars 433 forks source link

How to add text editor widget (e.g. CKEditor) to dynamicform? #248

Open kavasey opened 6 years ago

kavasey commented 6 years ago

Hi. Thank you for your excellent extention. I have tried to integrate text editor using yii2-dynamicform but to no avail. I tried tinyMce(https://github.com/2amigos/yii2-tinymce-widget) but no success (first item does not get initialized thus display a textarea).

Then I tried https://github.com/2amigos/yii2-ckeditor-widget which had the first row initialized. subsequent rows don't get initialized.

I have the following as the snippet inside the widget foreach loop.

<?= $form->field($modelBlock, "[{$i}]description")->widget(CKEditor::className(), [ 'options' => ['rows' => 3], 'preset' => 'basic' ]); ?>

Any help or pointers would be appreciated.

Thank you.

mtangoo commented 6 years ago

I have found a better maintained fork here. Since this repo looks like abandoned, then I suggest you try asking the same question there.

kavasey commented 6 years ago

@mtangoo Thanks for the mention. I'll check it out.

moysoft commented 5 years ago

@mtangoo Thankyou

mtangoo commented 5 years ago

@moysoft you are welcome!

fakname8 commented 4 years ago

Hello,

Try this solution

jQuery(".dynamicform_wrapper").on("afterInsert", function(e, item) {
    tinyMCE.init({selector: 'textarea'});
});
jQuery(".dynamicform_wrapper").on("afterDelete", function(e) {
    tinyMCE.remove();
    tinyMCE.init({selector: 'textarea'});
});
poonga commented 1 year ago

@kavasey Is it working in the suggested repo?