Skip to content
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

TinyMCE not working after form submission in rails #5268

Closed
ruthvikg opened this issue Nov 19, 2019 · 2 comments
Closed

TinyMCE not working after form submission in rails #5268

ruthvikg opened this issue Nov 19, 2019 · 2 comments

Comments

@ruthvikg
Copy link

ruthvikg commented Nov 19, 2019

I have a form in rails.In that i have a tinymce text_area which is working correctly on page reload.But when i make changes in the form and submit it ,after the turbolink:load,tinymce is not working.

Expected to work normally
tinymce gem -5.1.1
browzer-Chrome latest
os-ubuntu

@lnewson
Copy link
Contributor

lnewson commented Nov 19, 2019

@ruthvikg can you please provide a replication case, as the details you've provided really aren't enough for us to be able to help here.

@ruthvikg
Copy link
Author

ruthvikg commented Nov 20, 2019

Here is my rails form:

`

<%= form.label :content %>

<%= form.text_area :content, class:" tinymce appearance-none border border-gray-400 rounded w-full py-2 px-4 text-gray-700 leading-tight bg-white focus:outline-none focus:border-primary", placeholder: "Content*", required: true, data: { editor: 'tinymce' } %>
`

Here is my tinyMce controller:

`
$(document).ready(function() {
let my_toolbar = "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify |
outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | image media
link | fullscreen code |"
if (tinyMCE) {
tinyMCE.remove();
} else {
tinymce.EditorManager.execCommand('mceAddControl', true, editor_id);
}
tinymce.init({
theme: 'silver',
skin: false,
content_style: contentStyle.toString(),
selector: '.tinymce',
plugins: ['table', 'lists', 'image', 'media', 'advlist', 'link', 'code', 'imagetools', 'fullscreen', advcode'],
toolbar: my_toolbar,
});

`

When the above form is first loaded the tinymce works perfectly fine.But,after the form submission and when the form page reloads the tinymce doesn't work.
The buttons and the menu bar is getting disabled.
Screenshot from 2019-11-20 10-25-36

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

No branches or pull requests

2 participants