-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using file_picker_callback causes editor to reload with every change event that is fired #62
Comments
I also am having the problem with this callback. Every time I press enter in the textarea, it submits the editor and reloads the page. When I remove the callback, I can press enter without the textarea submitting. |
I am having exactly the same problem. Did either of you manage to solve this? In my case, the page even reloads when entering text into a different input component on the same page. It seems like react-tinymce is picking up on events that happens elsewhere as well. |
I have found the cause of this issue: The solution is to move the function declaration outside the component, so that the same function object is reused every time:
|
I am using admin-on-rest and react-tinymce. When I include
file_picker_callback
in the tinymce config the editor will reload every time the onchange event fires.This is an issue because users are not able to continually type (editor loses focus after reloading). I have tried manually setting the focus after it reloads, but it does not focus back to the same place the cursor was previously - so this is not a viable workaround.
If I remove the
file_picker_callback
, then everything works as expected.Here is my code:
I have the following in my index.html:
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.5.6/tinymce.min.js"></script>
What I have noticed is that during an onchange event there is a get request issued for:
https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.5.6/skins/lightgray/content.min.css
and the call stack for this request is as follows:
From the call stack, line 66 of TinyMCE.js is:
line 128 is
tinymce.init(config);
I believe this is a bug with react-tinymce (and not admin-on-rest) - but I am not very familiar with react, so I could be wrong.
Any help or insight would be appreciated. I have spent 2 days debugging this and have made no progress
The text was updated successfully, but these errors were encountered: