diff --git a/e107_web/js/core/mediaManager.js b/e107_web/js/core/mediaManager.js index 7a120e2fa..6e7b72a06 100644 --- a/e107_web/js/core/mediaManager.js +++ b/e107_web/js/core/mediaManager.js @@ -143,6 +143,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; { var $this = $(that); var style = ''; + var css = ''; var bb = ''; var src = $('#src').attr('value'); // working old @@ -159,6 +160,8 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; var _float = $('#float').val(); var alt = $('#alt').val(); + + var target = $this.attr('data-target'); var $htmlHolder = $('#html_holder'); @@ -186,7 +189,12 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; if(_float == 'left' || _float == 'right') { - style = style + 'float:' + _float + ';'; + // style = style + 'float:' + _float + ';'; + } + + if(_float == 'left' || _float == 'right') + { + css = 'bbcode-img-' + _float; } if(width === undefined) @@ -201,11 +209,33 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; // Set the Html / Wysiwyg Value. var $img = $(''); - $img.attr('style', style); + + if(css != '') + { + $img.attr('class', css); + } + + if(style != '') + { + $img.attr('style', style); + } + $img.attr('src', src); - $img.attr('alt', alt); - $img.attr('width', width); - $img.attr('height', height); + + if(alt != '') + { + $img.attr('alt', alt); + } + + if(width > 0) + { + $img.attr('width', width); + } + + if(height > 0) + { + $img.attr('height', height); + } if($htmlHolder.length > 0) { @@ -218,7 +248,6 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; // Only Do width/height styling on bbcodes -- if(width != '' && width != 0 && width !== undefined) { - console.log('Width: '+ width); style = style + 'width:' + width + 'px;'; } @@ -231,16 +260,30 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; { bb = '[img'; + var bparm = {}; + + if(css != '') + { + // bb = bb + '&class=' + css; + bparm['class'] = css; + } + if(style != '') { - bb = bb + ' style=' + style; + // bb = bb + ' style=' + style; + bparm['style'] = style; } if(alt != '') { - bb = bb + '&alt=' + alt; + // bb = bb + '&alt=' + alt; + bparm['alt'] = alt; } + var bbquery = decodeURIComponent(jQuery.param(bparm, true)); + console.log(bbquery); + bb = bb + ' ' + bbquery; + bb = bb + ']'; bb = bb + path; bb = bb + '[/img]';