Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Suggestion for reinit tinymce #33

Open
farhansyakir opened this issue May 22, 2017 · 5 comments
Open

Suggestion for reinit tinymce #33

farhansyakir opened this issue May 22, 2017 · 5 comments

Comments

@farhansyakir
Copy link

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
Copy link
Member

@farhansyakir do you have time for a PR?¿

@Deele
Copy link

Deele commented Jul 28, 2017

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

@tonydspaniard
Copy link
Member

Checking @Deele Thanks for this

@Eseperio
Copy link
Contributor

Eseperio commented Mar 6, 2019

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

@ebuzzz
Copy link

ebuzzz commented Jan 10, 2020

@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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants