diff options
author | 2018-04-12 16:41:39 +0100 | |
---|---|---|
committer | 2018-04-12 16:41:39 +0100 | |
commit | 9aaf14c803021f8bcc4292887af42cce92b30a77 (patch) | |
tree | 4994df6778088ae6e1b873f77946eb7709d94dcc /templates | |
parent | [Wiki] TOC divider should be inside conditional (diff) |
[Wiki] Fix pages being wiped when saved without edits
Diffstat (limited to 'templates')
-rw-r--r-- | templates/wiki/page_edit.html | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/templates/wiki/page_edit.html b/templates/wiki/page_edit.html index b797577d..b59a8912 100644 --- a/templates/wiki/page_edit.html +++ b/templates/wiki/page_edit.html @@ -14,7 +14,7 @@ <button class="uk-button uk-button-secondary" type="button" value="Preview" id="preview">Preview</button> </div> <div class="uk-width-auto"> - <input class="uk-button uk-button-primary" type="submit" id="submit" value="Save" /> + <input class="uk-button uk-button-primary" type="submit" id="submit" value="Save" disabled /> </div> <div class="uk-width-1-1"> <div id="editor" class="uk-textarea" style="resize: vertical; min-height: 15rem;">{{ rst }}</div> @@ -61,6 +61,13 @@ } }); + let data = editor.getValue(); + + if (data.replace("\s", "").length < 1) { + document.getElementById("submit").disabled = true; + return false; + } + oReq.open("POST", "/render"); oReq.setRequestHeader("Content-type", "application/json"); |