From: Alexander Ebert Date: Tue, 20 Sep 2016 14:59:08 +0000 (+0200) Subject: Improved editor autosave controls X-Git-Tag: 3.0.0_Beta_1~71 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2d0b015521fc3a9b3a84a97a6871685bdd155b9f;p=GitHub%2FWoltLab%2FWCF.git Improved editor autosave controls --- diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index 8d0a61da3e..2afb6a18e0 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -54,6 +54,8 @@ 'wcf.attachment.dragAndDrop.dropHere': '{lang}wcf.attachment.dragAndDrop.dropHere{/lang}', 'wcf.attachment.dragAndDrop.dropNow': '{lang}wcf.attachment.dragAndDrop.dropNow{/lang}', + 'wcf.editor.autosave.discard': '{lang}wcf.editor.autosave.discard{/lang}', + 'wcf.editor.autosave.keep': '{lang}wcf.editor.autosave.keep{/lang}', 'wcf.editor.autosave.restored': '{lang}wcf.editor.autosave.restored{/lang}', 'wcf.editor.code.edit': '{lang}wcf.editor.code.edit{/lang}', diff --git a/wcfsetup/install/files/acp/templates/wysiwyg.tpl b/wcfsetup/install/files/acp/templates/wysiwyg.tpl index 8d0a61da3e..2afb6a18e0 100644 --- a/wcfsetup/install/files/acp/templates/wysiwyg.tpl +++ b/wcfsetup/install/files/acp/templates/wysiwyg.tpl @@ -54,6 +54,8 @@ 'wcf.attachment.dragAndDrop.dropHere': '{lang}wcf.attachment.dragAndDrop.dropHere{/lang}', 'wcf.attachment.dragAndDrop.dropNow': '{lang}wcf.attachment.dragAndDrop.dropNow{/lang}', + 'wcf.editor.autosave.discard': '{lang}wcf.editor.autosave.discard{/lang}', + 'wcf.editor.autosave.keep': '{lang}wcf.editor.autosave.keep{/lang}', 'wcf.editor.autosave.restored': '{lang}wcf.editor.autosave.restored{/lang}', 'wcf.editor.code.edit': '{lang}wcf.editor.code.edit{/lang}', diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Autosave.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Autosave.js index fd51448f62..92194d42a5 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Autosave.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Autosave.js @@ -149,7 +149,9 @@ define(['Language', 'Dom/Traverse'], function(Language, DomTraverse) { container.appendChild(title); var button = elCreate('a'); + button.className = 'jsTooltip'; button.href = '#'; + button.title = Language.get('wcf.editor.autosave.keep'); button.innerHTML = ''; button.addEventListener(WCF_CLICK_EVENT, (function (event) { event.preventDefault(); @@ -159,7 +161,9 @@ define(['Language', 'Dom/Traverse'], function(Language, DomTraverse) { container.appendChild(button); button = elCreate('a'); + button.className = 'jsTooltip'; button.href = '#'; + button.title = Language.get('wcf.editor.autosave.discard'); button.innerHTML = ''; button.addEventListener(WCF_CLICK_EVENT, (function (event) { event.preventDefault(); @@ -179,6 +183,13 @@ define(['Language', 'Dom/Traverse'], function(Language, DomTraverse) { this._editor.core.box()[0].appendChild(container); + var callback = (function () { + this._editor.core.editor()[0].removeEventListener(WCF_CLICK_EVENT, callback); + + this.hideOverlay(); + }).bind(this); + this._editor.core.editor()[0].addEventListener(WCF_CLICK_EVENT, callback); + this._container = container; }, @@ -221,8 +232,6 @@ define(['Language', 'Dom/Traverse'], function(Language, DomTraverse) { })); this._lastMessage = content; - - this.hideOverlay(); } catch (e) { window.console.warn("Unable to write to local storage: " + e.message); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index ebf10f99de..05cb04f64b 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2350,6 +2350,8 @@ Fehler sind beispielsweise: + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 6630e0800a..f17d37dddb 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2312,6 +2312,8 @@ Errors are: + +