Support for custom block level tag names
authorAlexander Ebert <ebert@woltlab.com>
Sat, 1 Aug 2020 17:33:53 +0000 (19:33 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 1 Aug 2020 17:33:53 +0000 (19:33 +0200)
Closes #3270

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

index 39b0fbf4567db2d2ef1dc8616c2f9e91633e6d81..b62c854dbf8b2858f0dae169491b6323fc5beecc 100644 (file)
@@ -17,6 +17,12 @@ use wcf\util\DOMUtil;
  * @since      3.0
  */
 class HtmlInputNodeWoltlabMetacodeMarker extends AbstractHtmlInputNode {
+       /**
+        * list of tag names that should be considered as block level elements
+        * @var string[]
+        */
+       public static $customBlockElementTagNames = [];
+       
        /**
         * list of bbcodes that represent block elements
         * @var string[]
@@ -508,17 +514,14 @@ class HtmlInputNodeWoltlabMetacodeMarker extends AbstractHtmlInputNode {
                        case 'woltlab-quote':
                        case 'woltlab-spoiler':
                                return true;
-                               break;
                        
                        case 'woltlab-metacode':
                                /** @var \DOMElement $node */
-                               if (in_array($node->getAttribute('data-name'), $this->blockElements)) {
-                                       return true;
-                               }
-                               break;
+                               return in_array($node->getAttribute('data-name'), $this->blockElements)
+                               
+                       default:
+                               return in_array($node->nodeName, self::$customBlockElementTagNames)
                }
-               
-               return false;
        }
        
        /**