From 79cbaf47a5210b9af20bd23414827709f458809d Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Tue, 28 Apr 2020 00:10:56 -0700 Subject: [PATCH] Fix some quirks in editor loading --- amanuensis/lexicon/gameloop.py | 4 +++- amanuensis/resources/editor.js | 7 +++++-- amanuensis/server/session/session.editor.jinja | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/amanuensis/lexicon/gameloop.py b/amanuensis/lexicon/gameloop.py index 9c2feda..15b4972 100644 --- a/amanuensis/lexicon/gameloop.py +++ b/amanuensis/lexicon/gameloop.py @@ -46,7 +46,9 @@ def get_player_drafts( return drafts -def get_draft(lexicon: LexiconModel, aid: str) -> Optional[ReadOnlyOrderedDict]: +def get_draft( + lexicon: LexiconModel, + aid: str) -> Optional[ReadOnlyOrderedDict]: """ Loads an article from its id """ diff --git a/amanuensis/resources/editor.js b/amanuensis/resources/editor.js index 4862d8a..2205561 100644 --- a/amanuensis/resources/editor.js +++ b/amanuensis/resources/editor.js @@ -18,7 +18,9 @@ window.onload = function() { // Kill noscript message first document.getElementById("preview").innerHTML = "

 

"; - onContentChange(0); + if (document.body.contains(document.getElementById("editor-content"))) { + onContentChange(0); + } }; function buildArticleObject() { @@ -77,7 +79,8 @@ function updatePreview(response) { } var warning = ""; for (var i = 0; i < response.warning.length; i++) { - warning += "" + response.warning[i] + "
"; + warning += "" + + response.warning[i] + "
"; } var error = ""; for (var i = 0; i < response.error.length; i++) { diff --git a/amanuensis/server/session/session.editor.jinja b/amanuensis/server/session/session.editor.jinja index 3bc713b..c94f181 100644 --- a/amanuensis/server/session/session.editor.jinja +++ b/amanuensis/server/session/session.editor.jinja @@ -99,7 +99,9 @@ - + {% endif %}