From b1464920030313bef2c35aef1600f9a9a4a4d96c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 13 Jan 2017 14:18:11 +0100 Subject: [PATCH] Added proper support for button images --- .../js/3rdParty/redactor2/plugins/WoltLabButton.js | 11 +++++++++-- wcfsetup/install/files/style/ui/redactor.scss | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js index 2622325489..41370b0a07 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js @@ -17,7 +17,7 @@ $.Redactor.prototype.WoltLabButton = function() { } // set button icons and labels - var buttonData; + var buttonData, icon, iconIsImage; for (i = 0, length = this.opts.buttons.length; i < length; i++) { buttonName = this.opts.buttons[i]; @@ -58,8 +58,15 @@ $.Redactor.prototype.WoltLabButton = function() { break; } + icon = buttonData.icon; + iconIsImage = false; + if (!icon.match(/^fa-/) && icon.match(/\.(gif|jpe?g|png|svg)$/)) { + iconIsImage = true; + } + // set icon - this.button.setIcon(button, ''); + //noinspection CssUnknownTarget + this.button.setIcon(button, ''); if (!button[0]) { throw new Error("Missing button element for '" + buttonName + "'."); } diff --git a/wcfsetup/install/files/style/ui/redactor.scss b/wcfsetup/install/files/style/ui/redactor.scss index 39ebb68365..2384b5adf6 100644 --- a/wcfsetup/install/files/style/ui/redactor.scss +++ b/wcfsetup/install/files/style/ui/redactor.scss @@ -183,6 +183,11 @@ .icon { color: inherit; cursor: inherit !important; + + &.redactorButtonImage { + background: no-repeat center center; + background-size: contain; + } } @include screen-lg { -- 2.20.1