]> BookStack Code Mirror - bookstack/commitdiff
Removed some old front-end md rendering elements
authorDan Brown <redacted>
Sat, 6 Feb 2021 23:09:49 +0000 (23:09 +0000)
committerDan Brown <redacted>
Sat, 6 Feb 2021 23:11:20 +0000 (23:11 +0000)
Also ensured revisions were not created more often than expected.
Summary field null check was triggering revision save even when empty
since it was still in request.

Related to #1846

app/Entities/Repos/PageRepo.php
resources/js/components/markdown-editor.js
resources/views/pages/markdown-editor.blade.php

index bc6476824bee48932325e214c00c1486fa2ea981..6a4eaeb1553f834ccafdd3e6b642d160e96d81d3 100644 (file)
@@ -190,11 +190,11 @@ class PageRepo
         $this->getUserDraftQuery($page)->delete();
 
         // Save a revision after updating
-        $summary = $input['summary'] ?? null;
+        $summary = trim($input['summary'] ?? "");
         $htmlChanged = isset($input['html']) && $input['html'] !== $oldHtml;
         $nameChanged = isset($input['name']) && $input['name'] !== $oldName;
         $markdownChanged = isset($input['markdown']) && $input['markdown'] !== $oldMarkdown;
-        if ($htmlChanged || $nameChanged || $markdownChanged || $summary !== null) {
+        if ($htmlChanged || $nameChanged || $markdownChanged || $summary) {
             $this->savePageRevision($page, $summary);
         }
 
index bd107f2bf7a00f53ed3404a27c95bcf3c1c7d1c3..78581ec447f5cf099d64d681c976295d3c6875af 100644 (file)
@@ -22,7 +22,6 @@ class MarkdownEditor {
 
         this.displayStylesLoaded = false;
         this.input = this.elem.querySelector('textarea');
-        this.htmlInput = this.elem.querySelector('input[name=html]');
         this.cm = code.markdownEditor(this.input);
 
         this.onMarkdownScroll = this.onMarkdownScroll.bind(this);
@@ -125,7 +124,6 @@ class MarkdownEditor {
         // Set body content
         this.displayDoc.body.className = 'page-content';
         this.displayDoc.body.innerHTML = html;
-        this.htmlInput.value = html;
 
         // Copy styles from page head and set custom styles for editor
         this.loadStylesIntoDisplay();
index a9d1f1174bbbabf9f3266f09a6e59a4694beed33..017a971ff1769ab6c57c33e511477f2e3e55d1fc 100644 (file)
@@ -35,8 +35,6 @@
         </div>
         <iframe src="about:blank" class="markdown-display" sandbox="allow-same-origin"></iframe>
     </div>
-    <input type="hidden" name="html"/>
-
 </div>
 
 
Morty Proxy This is a proxified and sanitized view of the page, visit original site.