2amigos / yii2-tinymce-widget

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

Suggestion for reinit tinymce #33

Open farhansyakir opened 7 years ago

farhansyakir commented 7 years ago

when you combine tabular form and widget tinymce like this <attribute> => [ 'type' => TabularForm::INPUT_WIDGET, 'widgetClass'=>\dosamigos\tinymce\TinyMce::classname(), ],

the old tinymce will not appear when you click add, so I suggest to add this code to reinit the tinymce $js[] = "tinymce.EditorManager.execCommand('mceRemoveEditor',true, '$id');";

in dosamigos\tinymce\TinyMce

right above the $js[] = "tinymce.init($options);";

thank you

tonydspaniard commented 7 years ago

@farhansyakir do you have time for a PR?¿

Deele commented 7 years ago

This would be my solution (untested) https://gist.github.com/Deele/bf7837fb8bdaf5213d06c81a40ec04e9

tonydspaniard commented 7 years ago

Checking @Deele Thanks for this

Eseperio commented 5 years ago

I´ve made a similar PR to fix this issue. #45

ebuzzz commented 4 years ago

@Eseperio with the fix, I'm still experiencing wierd behavior in Firefox (latest). Without the fix, TinyMCE does not initialize the 2nd time. But with the fix, the TinyMCE stays empty on 2nd initialisations. Only by adding a setTimeout around the init, it will fill up with the actual content. Chrome does not experience this behavior. Are you seeing the same behavior in your application?