app/views/documents/edit.html.erb
<%#
We're using the medium-editor CDN here instead of the rails-medium-editor gem because it broke in the latest
version of Chrome, and has been archived for no more changes. Ergo, we gotta move off of it. :)
%>
<script src="https://cdnjs.cloudflare.com/ajax/libs/medium-editor/5.23.3/js/medium-editor.min.js" integrity="sha512-5D/0tAVbq1D3ZAzbxOnvpLt7Jl/n8m/YGASscHTNYsBvTcJnrYNiDIJm6We0RPJCpFJWowOPNz9ZJx7Ei+yFiA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/medium-editor/5.23.3/css/medium-editor.min.css" integrity="sha512-zYqhQjtcNMt8/h4RJallhYRev/et7+k/HDyry20li5fWSJYSExP9O07Ung28MUuXDneIFg0f2/U3HJZWsTNAiw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/medium-editor/5.23.3/css/themes/beagle.min.css" integrity="sha512-Dp5+M9xB0mzENcNK7ReLOvz/cKvhshdJDb3bEKRAz9lKggT/BtVlthhvusC+IoQQ5lazItTaSDQSeyBa0T5LWA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<% set_meta_tags title: "Editing: " + @document.title, description: truncate(@document.body) %>
<%= content_for :full_width_page_header do %>
<%= render partial: 'documents/components/autosave_bar', locals: { document: @document } %>
<div class="container" style="max-width: 50em;">
<%= form_for @document do |f| %>
<%= render partial: 'documents/components/document_name_bar', locals: { document: @document, f: f } %>
<% end %>
</div>
<div id="editor" class="editable js-can-mention-pages" data-save-url="<%= document_url(@document) %>"><%= @document.body.try(:html_safe) %></div>
<% end %>
<div style="clear: both"></div>
<%= render partial: 'javascripts/content_linking' %>
<div id="document-notes-modal" class="modal modal-fixed-footer">
<%= form_for(@document, remote: true, html: { id: 'document-notes-form' }) do |f| %>
<div class="modal-content">
<h4>
<i class="material-icons medium <%= Document.text_color %> left">
<%= Document.icon %>
</i>
Document notes
</h4>
<p class="grey-text">This field will automatically expand as you write.</p>
<%= f.text_area :notes_text, class: 'materialize-textarea', placeholder: "Write as little or as much as you'd like!", style: 'min-height: 400px; border: 1px solid #ccc; padding: 10px;' %>
<p class="grey-text">
<strong>To save your notes, please click "Save Changes" below.</strong>
Closing this dialog will preserve your unsaved changes until you refresh the page, but to keep your notes you must save them!
</p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Ignore changes</a>
<%= link_to 'Save changes', "#", onclick: '$("form#document-notes-form").submit()', class: 'modal-close waves-effect waves-green btn-flat lighten-3 ' + Document.color %>
</div>
<% end %>
</div>