Fix some quirks in editor loading

This commit is contained in:
Tim Van Baak 2020-04-28 00:10:56 -07:00
parent 8f58c04db1
commit 79cbaf47a5
3 changed files with 11 additions and 4 deletions

View File

@ -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
"""

View File

@ -18,7 +18,9 @@ window.onload = function() {
// Kill noscript message first
document.getElementById("preview").innerHTML = "<p>&nbsp;</p>";
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 += "<span class=\"message-warning\">" + response.warning[i] + "</span><br>";
warning += "<span class=\"message-warning\">" +
response.warning[i] + "</span><br>";
}
var error = "";
for (var i = 0; i < response.error.length; i++) {

View File

@ -99,7 +99,9 @@
<button>~</button>
</div>
<input id="editor-title" placeholder="Title" oninput="onContentChange()" disabled value="{{ article.title }}">
<textarea id="editor-content" class="fullwidth" oninput="onContentChange()" disabled>{{ article.contents }}</textarea>
<textarea id="editor-content" class="fullwidth" oninput="onContentChange()" disabled>
{# #}{{ article.contents }}{#
#}</textarea>
{% endif %}
</div>
</div>