Skip to content

Commit 9ef0c2a

Browse files
committed
Merge remote-tracking branch 'origin/6.0' into image-center
# Conflicts: # com.woltlab.wcf/templates/mediaBBCodeTag.tpl # wcfsetup/install/files/acp/templates/mediaBBCodeTag.tpl # wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php
2 parents 818bec7 + 09400e1 commit 9ef0c2a

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

com.woltlab.wcf/bbcode.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@
192192
<attribute name="2">
193193
<validationpattern><![CDATA[^(left|right|center|none)$]]></validationpattern>
194194
</attribute>
195+
<attribute name="3">
196+
<validationpattern><![CDATA[^\d+$]]></validationpattern>
197+
</attribute>
195198
</attributes>
196199
</bbcode>
197200
<bbcode name="wsp">

com.woltlab.wcf/templates/mediaBBCodeTag.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{if !$removeLinks|isset}{assign var='removeLinks' value=false}{/if}
22
{if $float === 'center'}<p class="text-center">{/if}
3-
<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}">
3+
<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}"{if $width !== 'auto'} style="width: {$width}px; display: inline-flex"{/if}>
44
{if $media->isImage}
55
{if $thumbnailSize != 'original'}
66
{if !$removeLinks}

wcfsetup/install/files/acp/templates/mediaBBCodeTag.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{if !$removeLinks|isset}{assign var='removeLinks' value=false}{/if}
22
{if $float === 'center'}<p class="text-center">{/if}
3-
<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}">
3+
<span class="mediaBBCode{if $float != 'none'} messageFloatObject{$float|ucfirst}{/if}"{if $width !== 'auto'} style="width: {$width}px; display: inline-flex"{/if}>
44
{if $media->isImage}
55
{if $thumbnailSize != 'original'}
66
{if !$removeLinks}

wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private function showImage(Attachment $attachment, string $outputType, array $at
109109
);
110110
} else {
111111
$result = \sprintf(
112-
'<span title="%s" class="%s" style="width: %s">%s</span>',
112+
'<span title="%s" class="%s" style="width: %s; display: inline-flex;">%s</span>',
113113
$title,
114114
$class,
115115
$width,
@@ -174,7 +174,7 @@ private function showImageAsThumbnail(Attachment $attachment, string $alignment,
174174
);
175175
} else {
176176
$result = \sprintf(
177-
'<span class="%s" stlye="width: %s">%s%s</span>',
177+
'<span class="%s" style="width: %s; display: inline-flex">%s%s</span>',
178178
$class,
179179
$width,
180180
$imageElement,

wcfsetup/install/files/lib/system/bbcode/WoltLabSuiteMediaBBCode.class.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function getParsedTag(array $openingTag, $content, array $closingTag, BBC
6060
if ($media->isImage) {
6161
$thumbnailSize = (!empty($openingTag['attributes'][1])) ? $openingTag['attributes'][1] : 'original';
6262
$float = (!empty($openingTag['attributes'][2])) ? $openingTag['attributes'][2] : 'none';
63+
$width = (!empty($openingTag['attributes'][3])) ? $openingTag['attributes'][3] : 'auto';
6364

6465
return WCF::getTPL()->fetch('mediaBBCodeTag', 'wcf', [
6566
'mediaLink' => $this->getLink($media),
@@ -71,6 +72,7 @@ public function getParsedTag(array $openingTag, $content, array $closingTag, BBC
7172
'float' => $float,
7273
'media' => $media->getLocalizedVersion(MessageEmbeddedObjectManager::getInstance()->getActiveMessageLanguageID()),
7374
'thumbnailSize' => $thumbnailSize,
75+
'width' => $width,
7476
]);
7577
} elseif ($media->isVideo() || $media->isAudio()) {
7678
return WCF::getTPL()->fetch('mediaBBCodeTag', 'wcf', [

wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ protected function handleMedium(\DOMElement $element, $class)
164164

165165
$float = 'none';
166166
$thumbnail = 'original';
167+
$width = $element->getAttribute("data-width");
168+
if (\preg_match('~(?<width>\d+)px$~', $width, $matches)) {
169+
$width = (int)$matches['width'];
170+
} else {
171+
$width = "auto";
172+
}
167173

168174
if (
169175
\preg_match(
@@ -192,6 +198,7 @@ protected function handleMedium(\DOMElement $element, $class)
192198
$mediumID,
193199
$thumbnail,
194200
$float,
201+
$width,
195202
];
196203

197204
$newElement = $element->ownerDocument->createElement('woltlab-metacode');

0 commit comments

Comments
 (0)