Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
416 views
in Technique[技术] by (71.8m points)

text - Issues with Trix editor in Rails

I'm having this issue with the Trix editor in rails 5.2.4 with webpacker. The only thing I can see is a little box at the left of the 'Save' button.

enter image description here

My Gemfile has this gem installed:

gem'actiontext',github:'kobaltz/actiontext',branch:'archive',require:'action_text'

And installed the trix editor with:

rails action_text:install

And finally, this is the html code:

<div class="row">
 <div class="col-md-3">
   <%= link_to 'Back', posts_path, class:'btn btn-secondary mb-4' %>
   <div class='card'>
     <div class='card-body'>     
       <h4 class='card-title'>Editing post</h4>
       <%= render 'form', post: @post %>
     </div>           
   </div>             
 </div>               
<div class="col-md-9">
  <div class="mb-3">
    <%= form_with(model: [@post, @paragraph]) do |form| %>
      <%= form.hidden_field :element_type, value: 'paragragh' %>
      <%= form.submit 'Paragraph', class: "btn btn-primary" %> 
    <% end %>        
  </div>
  <% @post.elements.each do |element| %>
    <% if element.persisted? %> 
      <%= form_with(model: [@post, element]) do |form| %>
        <%= form.rich_text_area :content %>
        <%= form.submit 'Save', class: "btn btn-primary" %> 
      <% end %>      
    <% end %>        
  <% end %>          
</div>               

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...