<attribute name="2">
<validationpattern><![CDATA[^(left|right|none)$]]></validationpattern>
</attribute>
+ <attribute name="3">
+ <validationpattern><![CDATA[^\d+$]]></validationpattern>
+ </attribute>
</attributes>
</bbcode>
<bbcode name="wsp">
{if !$removeLinks|isset}{assign var='removeLinks' value=false}{/if}
-<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}">
+<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}"{if $width !== 'auto'} style="width: {$width}px; display: inline-flex"{/if}>
{if $media->isImage}
{if $thumbnailSize != 'original'}
{if !$removeLinks}
{if !$removeLinks|isset}{assign var='removeLinks' value=false}{/if}
-<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}">
+<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}"{if $width !== 'auto'} style="width: {$width}px; display: inline-flex"{/if}>
{if $media->isImage}
{if $thumbnailSize != 'original'}
{if !$removeLinks}
}
return \sprintf(
- '<span title="%s" class="%s" style="width: %s">%s</span>',
+ '<span title="%s" class="%s" style="width: %s; display: inline-flex;">%s</span>',
$title,
$class,
$width,
}
return \sprintf(
- '<span class="%s" stlye="width: %s">%s%s</span>',
+ '<span class="%s" style="width: %s; display: inline-flex">%s%s</span>',
$class,
$width,
$imageElement,
if ($media->isImage) {
$thumbnailSize = (!empty($openingTag['attributes'][1])) ? $openingTag['attributes'][1] : 'original';
$float = (!empty($openingTag['attributes'][2])) ? $openingTag['attributes'][2] : 'none';
+ $width = (!empty($openingTag['attributes'][3])) ? $openingTag['attributes'][3] : 'auto';
return WCF::getTPL()->fetch('mediaBBCodeTag', 'wcf', [
'mediaLink' => $this->getLink($media),
'float' => $float,
'media' => $media->getLocalizedVersion(MessageEmbeddedObjectManager::getInstance()->getActiveMessageLanguageID()),
'thumbnailSize' => $thumbnailSize,
+ 'width' => $width,
]);
} elseif ($media->isVideo() || $media->isAudio()) {
return WCF::getTPL()->fetch('mediaBBCodeTag', 'wcf', [
$float = 'none';
$thumbnail = 'original';
+ $width = $element->getAttribute("data-width");
+ if (\preg_match('~(?<width>\d+)px$~', $width, $matches)) {
+ $width = (int)$matches['width'];
+ } else {
+ $width = "auto";
+ }
if (
\preg_match(
$mediumID,
$thumbnail,
$float,
+ $width,
];
$newElement = $element->ownerDocument->createElement('woltlab-metacode');