Closed heaven closed 8 years ago
Great idea, thank you.
Btw, for those who look how to add tinymce to rails admin, here's an example of my tinymce.js.erb:
$(document).ready(function() {
function load_tinymce() {
<%= TinyMCE::Rails::Helper.tinymce_javascript(:default, :content_css => asset_path("tinymce/contents.css")) %>
}
function unload_tinymce(evt) {
var $container = $(evt.target);
$container.find("textarea.tinymce").each(function(i, element) {
var editor = tinyMCE.editors.find(function(editor) { return editor.targetElm === element });
editor && editor.destroy();
});
}
$("body").on("pjax:start", unload_tinymce)
$(document).on('pjax:complete nested:fieldAdded', load_tinymce);
load_tinymce();
});
@heaven this code for you still working? For me with rails 6.0 and tinymce-rails 4.6.4, the "tinymce/contents.css" was not loaded. Had to define it in tinymce.yml file like: content_css: 'tinymce/contents.css'
This is sometimes useful. For example my use case was while integrating with rails_admin. Had to define rails_admin/custom/ui.js.erb: