admin管理员组

文章数量:1290418

When I navigate to a page with TinyMCE it displays regular textareas until I refresh the page because of turbolinks. This is a pretty well-documented issue and people generally remend some form of the following:

$(document).on('page:change', function () {
    <code here>
}); 

I've tried every variation on this to no avail.

When I navigate to a page with TinyMCE it displays regular textareas until I refresh the page because of turbolinks. This is a pretty well-documented issue and people generally remend some form of the following:

$(document).on('page:change', function () {
    <code here>
}); 

I've tried every variation on this to no avail.

Share Improve this question asked Nov 11, 2016 at 14:21 Danny SantosDanny Santos 1,1602 gold badges11 silver badges33 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 13

The problem was that a lot of the discussion around this issue is quite outdated and doesn't take into account that turbolinks events have changed as of 5.0.0.

I was able to solve the problem with the following:

$(document).on('turbolinks:load', function () {
   tinymce.remove();
   tinymce.init({selector:'.tinymce'});
});

A full list of turbolinks events can be found here

本文标签: javascriptTinyMCEhave to refresh the pageStack Overflow