From 127b95d00efaa8f75a43f9c238b235401aaf69d4 Mon Sep 17 00:00:00 2001
From: Robin Tissot <tissotrobin@gmail.com>
Date: Tue, 4 May 2021 11:52:59 +0200
Subject: [PATCH] Fixes quote in document name crashing the editor UI.

---
 .../templates/core/document_part_edit.html           | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/app/escriptorium/templates/core/document_part_edit.html b/app/escriptorium/templates/core/document_part_edit.html
index cb47e1a4..0cb1a712 100644
--- a/app/escriptorium/templates/core/document_part_edit.html
+++ b/app/escriptorium/templates/core/document_part_edit.html
@@ -4,12 +4,12 @@
 
 {% block body %}
 <div id="editor">
-  <editor :document-id="'{{document.id}}'"
-          :document-name="'{{document.name}}'"
-          :part-id="'{{part.id}}'"
-          :default-text-direction="'{{ document.default_text_direction }}'"
-          :main-text-direction="'{{ document.main_script.text_direction }}'"
-          :read-direction="'{{ document.read_direction }}'">
+    <editor :document-id="'{{document.id}}'"
+            :document-name="'{{ document.name|escapejs }}'"
+            :part-id="'{{part.id}}'"
+            :default-text-direction="'{{ document.default_text_direction }}'"
+            :main-text-direction="'{{ document.main_script.text_direction }}'"
+            :read-direction="'{{ document.read_direction }}'">
     <a href="{% if object %}{% url 'document-update' pk=document.pk %}{% endif %}" class="nav-item nav-link {% block nav-doc-active %}{% endblock %}" id="nav-doc-tab" role="tab" aria-controls="nav-doc" aria-selected="true">{% trans "Description" %}</a>
     <a href="{% if object %}{% url 'document-images' pk=document.pk %}{% else %}#{% endif %}" class="nav-item nav-link {% if not object %}disabled{% endif %} {% block nav-images-active %}{% endblock %}" id="nav-img-tab" role="tab" aria-controls="nav-img" aria-selected="true">{% trans "Images" %}</a>
     <a href="{% if document  %}{% url 'document-part-edit' pk=document.pk %}{% else %}#{% endif %}" class="nav-item nav-link active {% if not object or not document.parts.count %}disabled{% endif %}" id="nav-edit-tab" role="tab" aria-controls="nav-doc" aria-selected="true">{% trans "Edit" %}</a>
-- 
GitLab