From: Alexander Ebert Date: Fri, 29 Jul 2016 14:19:48 +0000 (+0200) Subject: Auto clear on form submit X-Git-Tag: 3.0.0_Beta_1~915 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=830500a2bb969d9b8ce8e02afda89c5b3699f79b;p=GitHub%2FWoltLab%2FWCF.git Auto clear on form submit --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Autosave.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Autosave.js index 94fffd21a9..2871bbc58f 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Autosave.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Autosave.js @@ -7,7 +7,7 @@ * @license GNU Lesser General Public License * @module WoltLab/WCF/Ui/Redactor/Autosave */ -define([], function() { +define(['Dom/Traverse'], function(DomTraverse) { "use strict"; // time between save requests in seconds @@ -38,6 +38,11 @@ define([], function() { // remove attribute to prevent Redactor's built-in autosave to kick in this._element.removeAttribute('data-autosave'); + + var form = DomTraverse.parentByTag(this._element, 'FORM'); + if (form !== null) { + form.addEventListener('submit', this.destroy.bind(this)); + } }, /** @@ -46,7 +51,7 @@ define([], function() { * * @return {string} message content */ - getInitialValue: function () { + getInitialValue: function() { var value = ''; try { value = window.localStorage.getItem(this._key);