From 957494f4831af27c17ff30f0852b442dee9f83c4 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 10 Apr 2022 16:29:31 +1000 Subject: [PATCH] Custom headings --- InvenTree/part/templates/part/detail.html | 31 ++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index d08297dc83..75d6c17960 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -149,9 +149,6 @@
- {% if part.notes %} - {{ part.notes | markdownify }} - {% endif %}
@@ -424,6 +421,8 @@ var notes = null; + var readOnly = false; + inventreeGet( '{% url "api-part-detail" part.pk %}', {}, @@ -435,11 +434,37 @@ } ); + var toolbar_icons = ['preview']; + + if (!readOnly) { + + // Heading icons + toolbar_icons.push('heading-1', 'heading-2', 'heading-3', '|'); + + // Font style + toolbar_icons.push('bold', 'italic', 'strikethrough', '|'); + + // Text formatting + toolbar_icons.push('unordered-list', 'ordered-list', 'code', 'quote', '|'); + + // Elements + toolbar_icons.push('table', 'link', 'image'); + } + const mde = new EasyMDE({ element: document.getElementById('part-notes'), initialValue: notes, + toolbar: toolbar_icons, + shortcuts: [], }); + mde.togglePreview(); + + if (readOnly) { + mde.codemirror.setOption('readOnly', true); + $('#editor-toolbar').hide(); + } + $('#save-notes').click(function() { inventreePut(