SammyLin / redactor-rails

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

Not able to insert table #143

Open suramai opened 9 years ago

suramai commented 9 years ago

Hi,

I am not able to add tables.

When I Click Insert in the Insert table dialog box, I get the following error in the developer tools console.

Uncaught TypeError: this.clean.cleanEmptyParagraph is not a functioninsert @ 
table-adf5bb1b75d1a60881de57550cc6686f.js?body=1:59jQuery.event.dispatch @ 
jquery-6a50177757f6c64493882fb7aae952c3.js?body=1:4642elemData.handle @ 
jquery-6a50177757f6c64493882fb7aae952c3.js?body=1:4310

The insert table dialog box remains open and nothing happens. Why isn't the table getting inserted? Kindly help.

This is my config.js

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'],
        focus: true,
        "buttons": ['html', 'formatting', 'bold', 'italic', 'deleted',
        'unorderedlist', 'orderedlist','alignment', 'outdent', 'indent', 'image',
        'video', 'link', 'table', 'horizontalrule'],
        "formatting": ['p', 'h1', 'h2', 'h3', 'h4', 'h5'],
        "plugins": ['fullscreen','video','table'],
        "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"
      });
}

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

My application.js

//= require jquery
//= require jquery.turbolinks
//= require chosen-jquery
//= require jquery_ujs
//= require jquery.image-select
//= require users
//= require masonry/jquery.masonry
//= require bootstrap
//= require redactor-rails/redactor.min
//= require redactor-rails/config
//= require redactor-rails/video
//= require redactor-rails/table
//= require redactor-rails/plugins
//= require fitvids.js

I have the following files in the redactor-rails folder config.js table.js video.js

Downloaded table.js , video.js from http://imperavi.com/redactor/plugins/

nfriend21 commented 8 years ago

I have the same problem. Cant get a single non-default plugin to work.

morgan-blondellet commented 8 years ago

Which version of redactor are you using ? I tried to add the table plugin on a redactor 10.2.3 and i was able to do so by modifiying the plugin a bit. If you want me to give you my js file just say so ;)

morgan-blondellet commented 8 years ago

See my answer to this other issue. It may help !

https://github.com/SammyLin/redactor-rails/issues/156