Ruby on rails 在RubyonRails上使用Redactor作为WSIWYG编辑器

Ruby on rails 在RubyonRails上使用Redactor作为WSIWYG编辑器,ruby-on-rails,redactor,Ruby On Rails,Redactor,我试图在表单中添加几个简单的所见即所得字段。起初,redactor工作得很好,但在这一过程中,我丢失了工具栏。我认为团队中的其他成员不知何故掩盖了原始代码,但我不知道,而且我对Git不太满意,无法回头检查 这在edit_content.html.erb中 <div id="edit_form"> <fieldset> <span><legend><%= @category.title.capitalize %&g

我试图在表单中添加几个简单的所见即所得字段。起初,redactor工作得很好,但在这一过程中,我丢失了工具栏。我认为团队中的其他成员不知何故掩盖了原始代码,但我不知道,而且我对Git不太满意,无法回头检查

这在edit_content.html.erb中

<div id="edit_form">

     <fieldset>
         <span><legend><%= @category.title.capitalize %> Content</legend></span>
             <div class="field">
                 <%= f.label :statement %> <br />
                 <%= f.text_area :statement, rows: 10, cols: 80, :class=>'redactor_text' %>
             </div>

             <div class="field">
                  <%= f.label :quote %> <br />
                  <%= f.text_area :quote, row: 10, cols: 80, :class=>'redactor_text' %>
             </div>

    </fieldset>
</div>
我最初选择redactor是因为我听说它可以和回形针一起使用,我想以后再使用这个功能,所以在这个问题上的任何帮助都将不胜感激

也许你能做到

var buttons = ["html", "|", "formatting", "|", "bold", "italic", "underline", "deleted", "|",
   "unorderedlist", "orderedlist", "outdent", "indent", "|", "image", "video", "file", "link", "table", "|",
   "fontcolor", "backcolor", "|", "alignment", "|", "horizontalrule"];

 $('.redactor').redactor(
   { "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": buttons

  });

你怎么想?

如果你想让redactor正确显示,你的类应该是redactor,而不是redactor文本

... :class=>' redactor redactor_text' %>

我目前正在努力用自定义按钮自定义工具栏。但我希望我的回答能帮助你再次显示工具栏

@Nich我添加了这个函数。redactor\u text
... :class=>' redactor redactor_text' %>