From 7459263dda42ef363693021a71bd0603a23f1e92 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 31 Aug 2017 17:56:53 +0300 Subject: www: message draft --- juick-www/src/main/static/scripts.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'juick-www/src/main') 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); }); -- cgit v1.2.3