Closed saiqulhaq closed 9 years ago
Could you type your code here? I would like to know the code of form and js calls ( with application.js as well )
Yes. I got the same problem. When I include to my activeadmin redactor-rails: config.register_javascript 'redactor-rails.js' It's already included config.js And when I do custom include (next line): config.register_javascript 'redactor-rails/config.js' I will have 2 configs running and 2 window.init_redactor - as a result I have 2 redactor instances :(
this is my redactor-rails/config.js file
window.init_redactor = function(){
var csrf_token = $('meta[name=csrf-token]').attr('content');
var csrf_param = $('meta[name=csrf-param]').attr('content');
var params;
if (csrf_param !== undefined && csrf_token !== undefined) {
params = csrf_param + "=" + encodeURIComponent(csrf_token);
}
$('.redactor').redactor({
// You can specify, which ones plugins you need.
// If you want to use plugins, you have add plugins to your
// application.js and application.css files and uncomment the line below:
// "plugins": ['fontsize', 'fontcolor', 'fontfamily', 'fullscreen', 'textdirection', 'clips'],
"imageUpload":"/redactor_rails/pictures?" + params,
"imageGetJson":"/redactor_rails/pictures",
"fileUpload":"/redactor_rails/documents?" + params,
"fileGetJson":"/redactor_rails/documents",
"path":"/assets/redactor-rails",
"css":"style.css",
buttons: ['html', 'formatting', 'bold', 'italic', 'unorderedlist',
'orderedlist', 'outdent', 'indent', 'link', 'alignment', 'horizontalrule'],
source: true,
lang:'ko',
linkNofollow: true,
convertVideoLinks: true,
convertImageLinks: true,
toolbarFixed: false
});
};
$(document).on( 'ready page:load', window.init_redactor );
and I don't have redactor rails related code in application.js file
I solved this issue by following this referrence https://github.com/SammyLin/redactor-rails/issues/16
my rails version is 4.2.0
I found the problem of this issue is because rails load 2 config.js files from this gem and from our rails app, the working config file is config.js from this gem, so my config.js in app/assets folder is useless and there are 2 redactor instances (thanks @leolukin )
currently this is my new application.js file
//= require redactor-rails/redactor.min
//= require redactor-rails/plugins
//= require redactor-rails/config
//= require redactor-rails/langs/ko
Thank you! This worked great.
Thank you!
Awesome, that solved it for me!
Hi, I have some textarea in one form in the development environment, redactor working perfectly but today I deployed my apps to production, and the redactor editor is rendered like below
there are 2 redactor editor for each textarea could you help me how to trace this issue? I checked browser console, and there are no errors log