Fixed image scaling in message preview
authorMarcel Werk <burntime@woltlab.com>
Mon, 16 Feb 2015 15:52:31 +0000 (16:52 +0100)
committerMarcel Werk <burntime@woltlab.com>
Mon, 16 Feb 2015 15:52:31 +0000 (16:52 +0100)
wcfsetup/install/files/js/WCF.ImageViewer.js
wcfsetup/install/files/js/WCF.Message.js
wcfsetup/install/files/style/message.less

index 1e70006f079b2f2a936a32b9137479d429bcd317..0fab5801bfa9de535cb7f26938f3e9ebb4125d3c 100644 (file)
@@ -92,7 +92,7 @@ WCF.ImageViewer = Class.extend({
                var $imageObject = new Image();
                $imageObject.src = $image.attr('src');
                
-               var $maxWidth = $image.closest('div.messageText').width();
+               var $maxWidth = $image.closest('div.messageText, div.messageTextPreview').width();
                if ($maxWidth < $imageObject.width) {
                        if (!$image.parents('a').length) {
                                $image.wrap('<a href="' + $image.attr('src') + '" class="jsImageViewerEnabled embeddedImageLink" />');
index 29aaaa699a5c6581badf5b1e4212d9b20e3a1ce4..bbfb755a8f227ffaf3f838ec720f52afe93815ff 100644 (file)
@@ -477,7 +477,7 @@ WCF.Message.DefaultPreview = WCF.Message.Preview.extend({
        _handleResponse: function(data) {
                var $preview = $('#previewContainer');
                if (!$preview.length) {
-                       $preview = $('<div class="container containerPadding marginTop" id="previewContainer"><fieldset><legend>' + WCF.Language.get('wcf.global.preview') + '</legend><div></div></fieldset>').prependTo($('#messageContainer')).wcfFadeIn();
+                       $preview = $('<div class="container containerPadding marginTop" id="previewContainer"><fieldset><legend>' + WCF.Language.get('wcf.global.preview') + '</legend><div class="messageTextPreview"></div></fieldset>').prependTo($('#messageContainer')).wcfFadeIn();
                }
                
                $preview.find('div:eq(0)').html(data.returnValues.message);
index 6c3f33d5058d1496ddf08c138400a8722e258df2..99cc2c47b758610a428da3635971fa5dc541540e 100644 (file)
        }
 }
 
+.messageTextPreview {
+       img {
+               max-width: 100%;
+       }
+       
+       table img {
+               max-width: none;
+       }
+}
+
 @messageFooterNoteGradientColor: fade(@wcfContainerBorderColor, 20%);
 @messageFooterNoteGradientColor2: fade(@messageFooterNoteGradientColor, 0%);
 .messageFooterNote {