From 862936acc0efb9e4a0082152e12b061216a33367 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 8 Jun 2016 11:52:00 +0200 Subject: [PATCH] Added missing phrases for image editing --- .../templates/headIncludeJavaScript.tpl | 2 ++ com.woltlab.wcf/templates/wysiwyg.tpl | 14 ++++++++++- .../redactor2/plugins/WoltLabImage.js | 25 +++++++++---------- wcfsetup/install/lang/de.xml | 12 +++++++++ wcfsetup/install/lang/en.xml | 11 ++++++++ 5 files changed, 50 insertions(+), 14 deletions(-) diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index d116a23805..148c700d93 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -50,6 +50,7 @@ requirejs.config({ 'wcf.global.button.edit': '{lang}wcf.global.button.edit{/lang}', 'wcf.global.button.enable': '{lang}wcf.global.button.enable{/lang}', 'wcf.global.button.hide': '{lang}wcf.global.button.hide{/lang}', + 'wcf.global.button.insert': '{lang}wcf.global.button.insert{/lang}', 'wcf.global.button.next': '{lang}wcf.global.button.next{/lang}', 'wcf.global.button.preview': '{lang}wcf.global.button.preview{/lang}', 'wcf.global.button.reset': '{lang}wcf.global.button.reset{/lang}', @@ -69,6 +70,7 @@ requirejs.config({ 'wcf.global.form.error.multilingual': '{lang}wcf.global.form.error.multilingual{/lang}', 'wcf.global.language.noSelection': '{lang}wcf.global.language.noSelection{/lang}', 'wcf.global.loading': '{lang}wcf.global.loading{/lang}', + 'wcf.global.noSelection': '{lang}wcf.global.noSelection{/lang}', 'wcf.global.page.jumpTo': '{lang}wcf.global.page.jumpTo{/lang}', 'wcf.global.page.jumpTo.description': '{lang}wcf.global.page.jumpTo.description{/lang}', 'wcf.global.page.pagination': '{lang}wcf.global.page.pagination{/lang}', diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index d7fbcb59fb..9b58e60cfc 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -36,7 +36,19 @@ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/combined.min.js?v={@LAST_UPDATE_TIME}' {/if} ], function () { - require(['WoltLab/WCF/Ui/Redactor/Metacode'], function(UiRedactorMetacode) { + require(['Language', 'WoltLab/WCF/Ui/Redactor/Metacode'], function(Language, UiRedactorMetacode) { + Language.addObject({ + 'wcf.editor.image.edit': '{lang}wcf.editor.image.edit{/lang}', + 'wcf.editor.image.insert': '{lang}wcf.editor.image.insert{/lang}', + 'wcf.editor.image.link': '{lang}wcf.editor.image.link{/lang}', + 'wcf.editor.image.link.error.invalid': '{lang}wcf.editor.image.link.error.invalid{/lang}', + 'wcf.editor.image.float': '{lang}wcf.editor.image.float{/lang}', + 'wcf.editor.image.float.left': '{lang}wcf.editor.image.float.left{/lang}', + 'wcf.editor.image.float.right': '{lang}wcf.editor.image.float.right{/lang}', + 'wcf.editor.image.source': '{lang}wcf.editor.image.source{/lang}', + 'wcf.editor.image.source.error.invalid': '{lang}wcf.editor.image.source.error.invalid{/lang}' + }); + var buttons = [], buttonOptions = []; {include file='wysiwygToolbar'} diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabImage.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabImage.js index c9001d31bb..1e537f65fd 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabImage.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabImage.js @@ -9,7 +9,7 @@ $.Redactor.prototype.WoltLabImage = function() { // add support for image source when editing // TODO: float var mpShowEdit = this.image.showEdit; - this.image.showEdit = function($image) { + this.image.showEdit = (function($image) { var image = $image[0]; if (image.classList.contains('smiley')) { // smilies cannot be edited @@ -18,6 +18,11 @@ $.Redactor.prototype.WoltLabImage = function() { mpShowEdit($image); + // enforce title and button labels + this.modal.setTitle(WCF.Language.get('wcf.editor.image.edit')); + this.modal.getActionButton().text(WCF.Language.get('wcf.global.button.save')); + this.modal.getDeleteButton().text(WCF.Language.get('wcf.global.button.delete')); + elById('redactor-image-source').value = image.src; var float = elById('redactor-image-float'); @@ -28,7 +33,7 @@ $.Redactor.prototype.WoltLabImage = function() { if (image.classList.contains('woltlabAttachment')) { elRemove(elById('redactor-image-source-container')); } - }; + }).bind(this); var mpUpdate = this.image.update; this.image.update = (function() { @@ -74,17 +79,11 @@ $.Redactor.prototype.WoltLabImage = function() { this.opts.modal['image-edit'] = '
' + '
' + '
' - + '
' - + '' - + '' + WCF.Language.get('wcf.editor.image.source.description') + '' - + '
' + + '
' + '
' + '
' + '
' - + '
' - + '' - + '' + WCF.Language.get('wcf.editor.image.link.description') + '' - + '
' + + '
' + '
' + '
' + '
' @@ -94,7 +93,6 @@ $.Redactor.prototype.WoltLabImage = function() { + '' + '' + '' - + '' + WCF.Language.get('wcf.editor.image.float.description') + '' + '' + '
' + '' /* dummy because redactor expects it to be present */ @@ -111,8 +109,9 @@ $.Redactor.prototype.WoltLabImage = function() { this.modal.show(); this.modal.getDeleteButton().hide(); - var button = this.modal.getActionButton(); - button[0].addEventListener(WCF_CLICK_EVENT, this.WoltLabImage.insert); + var button = this.modal.getActionButton()[0]; + button.addEventListener(WCF_CLICK_EVENT, this.WoltLabImage.insert); + button.textContent = WCF.Language.get('wcf.global.button.insert'); }, insert: function(event) { diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 8b1f50a184..149a616568 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2116,6 +2116,7 @@ Fehler sind beispielsweise: + @@ -2127,6 +2128,16 @@ Fehler sind beispielsweise: + + + + + + + + + + @@ -2143,6 +2154,7 @@ Fehler sind beispielsweise: + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index a95ecf5d85..c6dd700b31 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2127,6 +2127,7 @@ Errors are: + @@ -2138,6 +2139,16 @@ Errors are: + + + + + + + + + + -- 2.20.1