From 41be92d8207d14a5ad24dd7bffa7c8a861646775 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 30 Dec 2014 01:54:35 +0100 Subject: [PATCH] Auto-discard autosave notice 3 seconds after first keystroke --- .../install/files/js/3rdParty/redactor/plugins/wutil.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js index 2a87d6e61c..f781a92524 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js @@ -438,6 +438,15 @@ RedactorPlugins.wutil = function() { $message = WCF.Language.get('wcf.message.autosave.restored'); $autosaveNotice.addClass('redactorAutosaveNoticeRestore'); + + var $uuid = ''; + $uuid = WCF.System.Event.addListener('com.woltlab.wcf.redactor', 'keydown_' + this.$textarea.wcfIdentify(), (function(data) { + WCF.System.Event.removeListener('com.woltlab.wcf.redactor', 'keydown_' + this.$textarea.wcfIdentify(), $uuid); + + setTimeout((function() { + $accept.trigger('click'); + }).bind(this), 3000); + }).bind(this)); break; case 'saved': -- 2.20.1