Auto-discard autosave notice 3 seconds after first keystroke
authorAlexander Ebert <ebert@woltlab.com>
Tue, 30 Dec 2014 00:54:35 +0000 (01:54 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 30 Dec 2014 00:54:35 +0000 (01:54 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js

index 2a87d6e61cb4c128cea342ccbf8b29298cb730f9..f781a92524d3d4ae731e9b85aed4b253077603ca 100644 (file)
@@ -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':