diff --git a/app/Libraries/BBCodeForDB.php b/app/Libraries/BBCodeForDB.php index 6d738275f30..9ae927b3b6d 100644 --- a/app/Libraries/BBCodeForDB.php +++ b/app/Libraries/BBCodeForDB.php @@ -62,10 +62,11 @@ public function parseAudio($text) /** * Handles: * - Centre (centre). + * - Right (right). */ public function parseBlockSimple($text) { - foreach (['centre'] as $tag) { + foreach (['centre', 'right'] as $tag) { $text = preg_replace( "#\[{$tag}](.*?)\[/{$tag}\]#s", "[{$tag}:{$this->uid}]\\1[/{$tag}:{$this->uid}]", diff --git a/app/Libraries/BBCodeFromDB.php b/app/Libraries/BBCodeFromDB.php index b93d8b661bf..da5c22a3586 100644 --- a/app/Libraries/BBCodeFromDB.php +++ b/app/Libraries/BBCodeFromDB.php @@ -91,6 +91,14 @@ public function parseCentre($text) return $text; } + public function parseRight($text) + { + $text = str_replace("[right:{$this->uid}]", "
", $text); + $text = str_replace("[/right:{$this->uid}]", '
', $text); + + return $text; + } + public function parseCode($text) { return preg_replace( @@ -372,6 +380,7 @@ public function toHTML() $text = $this->parseAudio($text); $text = $this->parseBold($text); $text = $this->parseCentre($text); + $text = $this->parseRight($text); $text = $this->parseInlineCode($text); $text = $this->parseColour($text); $text = $this->parseEmail($text); diff --git a/resources/css/bbcode.less b/resources/css/bbcode.less index ee58610d866..11d58616cd5 100644 --- a/resources/css/bbcode.less +++ b/resources/css/bbcode.less @@ -92,6 +92,26 @@ font-size: inherit; } + .right { + text-align: right; + + img, + iframe, + audio, + video, + .audio-player, + .imagemap, + .bbcode-spoilerbox, + .bbcode-spoilerbox__link { + margin-left: auto; + margin-right: 0; + } + + .bbcode-spoilerbox__link { + width: fit-content; + } + } + .unordered { list-style-type: disc; }