diff --git a/doc/BBCode.md b/doc/BBCode.md
index 753bc6942..d23225658 100644
--- a/doc/BBCode.md
+++ b/doc/BBCode.md
@@ -644,11 +644,17 @@ On Mastodon this field is used for the content warning.
;-) :-O |
+
+ Custom block styles
+
+[style=text-shadow: 0 0 4px #CC0000;]You can change all the CSS properties of this block.[/style] |
+ You can change all the CSS properties of this block. |
+
Custom inline styles
[style=text-shadow: 0 0 4px #CC0000;]You can change all the CSS properties of this block.[/style] |
- You can change all the CSS properties of this block. |
+ You can change all the CSS properties of this inline text. |
Custom class block
diff --git a/doc/de/BBCode.md b/doc/de/BBCode.md
index ded52cdb7..7af0861a7 100644
--- a/doc/de/BBCode.md
+++ b/doc/de/BBCode.md
@@ -603,11 +603,17 @@ Dieses Feld wird von Mastodon für die Inhaltswarnung (content warning) verw
|
;-) :-O |
+
+ Benutzerdefinierte Block-Styles
+
+[style=text-shadow: 0 0 4px #CC0000;]Du kannst alle CSS-Eigenschaften eines Blocks ändern-[/style] |
+ Du kannst alle CSS-Eigenschaften eines Blocks ändern. |
+
Benutzerdefinierte Inline-Styles
[style=text-shadow: 0 0 4px #CC0000;]Du kannst alle CSS-Eigenschaften eines Blocks ändern-[/style] |
- Du kannst alle CSS-Eigenschaften eines Blocks ändern- |
+ Du kannst alle CSS-Eigenschaften dieses Inline-Textes ändern- |
Benutzerdefinierte CSS Klassen
diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index 7328328e2..76bb9bb3f 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -1560,9 +1560,6 @@ class BBCode
$text = self::convertAttachment($text, $simple_html, $try_oembed, [], $uriid);
}
- // Add HTML new lines
- $text = str_replace("\n", ' ', $text);
-
$nosmile = strpos($text, '[nosmile]') !== false;
$text = str_replace('[nosmile]', '', $text);
@@ -1645,11 +1642,16 @@ class BBCode
// Check for list text
$text = str_replace("[*]", "", $text);
- // Check for style sheet commands
+ // Check for block-level custom CSS
+ $text = preg_replace('#(?<=^|\n)\[style=(.*?)](.*?)\[/style](?:\n|$)#ism', '$2 ', $text);
+
+ // Check for inline custom CSS
$text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism", '$2', $text);
// Check for CSS classes
$text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism", '$2', $text);
+ // Add HTML new lines
+ $text = str_replace("\n", ' ', $text);
// handle nested lists
$endlessloop = 0;
|