Insert some docs
authorCyperghost <olaf_schmitz_1@t-online.de>
Thu, 1 Feb 2024 12:47:25 +0000 (13:47 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Thu, 1 Feb 2024 12:47:25 +0000 (13:47 +0100)
wcfsetup/install/files/lib/system/html/metacode/upcast/AttachMetacodeUpcast.class.php
wcfsetup/install/files/lib/system/html/metacode/upcast/IMetacodeUpcast.class.php

index 284a451d19cdd17c4f318ffe532418e2261b87b4..c6e45387c6b40a48d4a49c623f3632fcd48088a0 100644 (file)
@@ -56,12 +56,12 @@ final class AttachMetacodeUpcast implements IMetacodeUpcast
         } else {
             $figure->setAttribute('class', 'image');
         }
-        if ($width !== 'auto' && \is_numeric($width) && $width > 0) {
-            $figure->setAttribute(
-                'style',
-                $this->getStyle($attachment, $width)
-            );
-        }
+
+        $figure->setAttribute(
+            'style',
+            $this->getStyle($attachment, $width)
+        );
+
         $figure->appendChild($element);
         return $figure;
     }
index 9e75d74ceac630e34d983f3e110abe657709c752..604ce94b0b71c61c74e814b44b2c0bbd9143a41a 100644 (file)
@@ -13,6 +13,9 @@ namespace wcf\system\html\metacode\upcast;
 interface IMetacodeUpcast
 {
     /**
+     * Converts a known metacode into the HTML representation for use by CKEditor5.
+     *
+     * The fragment must be inserted into your returned DOM element.
      *
      * @param \DOMDocumentFragment $fragment fragment containing all child nodes, must be appended to returned element
      * @param array $attributes list of attributes
@@ -20,6 +23,19 @@ interface IMetacodeUpcast
      */
     public function upcast(\DOMDocumentFragment $fragment, array $attributes): ?\DOMElement;
 
+    /**
+     * Returns true if the given attributes are valid for this upcast.
+     * If not, the metacode is converted to a text node with the bbcode output.
+     *
+     * @param array $attributes
+     * @return bool
+     */
     public function hasValidAttributes(array $attributes): bool;
+
+    /**
+     * Caches the object for the given attributes.
+     *
+     * @param array $attributes
+     */
     public function cacheObject(array $attributes): void;
 }