

<div class="row">
  <%= bootstrap_form_for(@doc) do |f| %>
  <div class="col-md-12">
    <h2 class="form-subhead"><%= t(:new_content, default: 'New Content') %></h2>
      <%= f.alert_message "Please fix the errors below." %>
      <%= render :partial => 'form', :object => @doc, :locals => {:f => f} %>
  </div>
  <% end %>
</div>



<div class="row">
  <%= bootstrap_form_for(@doc) do |f| %>
  <div class="col-md-12">
    <h2 class="form-subhead"><%= t(:new_content, default: 'New Content') %></h2>
      <%= f.alert_message "Please fix the errors below." %>
      <%= render :partial => 'form', :object => @doc, :locals => {:f => f} %>
  </div>
  <% end %>
</div>

<script>
var element = document.querySelector("trix-editor");
element.editor.setSelectedRange([0, 0]);
<% if @post.nil? %>
element.editor.insertHTML('<%= @doc.body.html_safe if @doc.body? %>');
<% else %>
element.editor.insertHTML('<%= @post.body.html_safe unless @post.nil? %>');
<% end %>
</script>

Fix bug where converting a post/reply to a doc was not working since upgrade to Trix editor
Fix bug where converting a post/reply to a doc was not working since upgrade to Trix editor

Signed-off-by: Scott Miller <ee4be419d3f845eb9ce4e4ef3aeee8bd8acd07cf@gmail.com>
