SammyLin / redactor-rails

This repo is deprecated. Please check out official gem for Redactor 2. https://github.com/Redactor2/redactor2_rails
MIT License
389 stars 253 forks source link

Can't add show source ('html') button #140

Closed ErrorSoul closed 9 years ago

ErrorSoul commented 9 years ago

Hi, there. I'm trying use redactor rails gem - all works fine, but i have one problem. I can't add 'html' button.

That's what I tried to do:

  1. .../redactor-rails/config.js add source: false
  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'],
        lang: 'ru',
        source: false,
        plugins : ['fontsize',
                'fontcolor',
                'fontfamily',
                'fullscreen',
                'textdirection',
                'clips']

      });
}

$(document).on( 'ready page:load', window.init_redactor );

2.adding "html' to 'buttons' in config file

3.add 'html' to 'buttons' and 'source: false' together

nicocharlery commented 9 years ago

@ErrorSoul You can add buttonSource: true cf: https://github.com/SammyLin/redactor-rails/blob/master/vendor/assets/javascripts/redactor-rails/redactor.js#L182

swapnilchincholkar commented 9 years ago

Looks like version issue, html source buttons wasn't shown by default on '0.5.0', downgraded to '0.4.5' and it worked without issue for rails only

For angular-redactor I faced issue in "code.set" inside directive for 0.4.5, hence I had to change code in that directive too.

ErrorSoul commented 9 years ago

Thank you all for your help. Downgrade works for me.

satansdeer commented 9 years ago

Wtf, why is it closed? It's still an issue. Downgrade is not a solution! I had this problem, but thanks to @bokay solved it with buttonSource: true.