diff options
author | Vitaly Takmazov | 2017-08-31 17:56:53 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-08-31 17:56:53 +0300 |
commit | 7459263dda42ef363693021a71bd0603a23f1e92 (patch) | |
tree | 232220314af90ccf7c28e3a135ee3edae43908d5 /juick-www/src/main | |
parent | 5d09fa9c43543b1c6605d85cb50c925ff77563c7 (diff) |
www: message draft
Diffstat (limited to 'juick-www/src/main')
-rw-r--r-- | juick-www/src/main/static/scripts.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js index 48c99287..a12ec709 100644 --- a/juick-www/src/main/static/scripts.js +++ b/juick-www/src/main/static/scripts.js @@ -531,6 +531,10 @@ function openDialog(html) { } function closeDialog() { + let draft = document.querySelector('#newmessage textarea'); + if (draft) { + window.draft = draft.value; + } document.querySelector('#dialogb').remove(); document.querySelector('#dialogt').remove(); } @@ -629,7 +633,7 @@ function getTags() { credentials: 'same-origin' }) .then(response => { - return response.json() + return response.json(); }) .then(json => { let tags = json.map(t => t.tag); @@ -822,6 +826,9 @@ ready(function () { if (newMessageBlock) { newMessageBlock.addEventListener('submit', newMessage); let ta = newMessageBlock.querySelector('textarea'); + if (window.draft) { + ta.innerHTML = window.draft; + } ta.addEventListener('keypress', function (e) { postformListener(e.target, e); }); |