Rename `ImageMetacodeUpcast` to `AbstractImageMetacodeUpcast` to avoid confusion...
authorCyperghost <olaf_schmitz_1@t-online.de>
Tue, 5 Nov 2024 09:39:47 +0000 (10:39 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Tue, 5 Nov 2024 09:39:47 +0000 (10:39 +0100)
com.woltlab.wcf/fileDelete.xml
wcfsetup/install/files/lib/system/html/metacode/upcast/AbstractImageMetacodeUpcast.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/html/metacode/upcast/AttachMetacodeUpcast.class.php
wcfsetup/install/files/lib/system/html/metacode/upcast/ImageMetacodeUpcast.class.php [deleted file]
wcfsetup/install/files/lib/system/html/metacode/upcast/WsmMetacodeUpcast.class.php

index 4ee7773d99da4637db6994dc8f704748617578a3..22e224e2b33fca8a77ca51e1424499a8fd79c48c 100644 (file)
                <file>lib/system/html/input/node/HtmlInputNodeWoltlabColor.class.php</file>
                <file>lib/system/html/input/node/HtmlInputNodeWoltlabMention.class.php</file>
                <file>lib/system/html/input/node/IHtmlInputNodeProcessor.class.php</file>
+               <file>lib/system/html/metacode/upcast/ImageMetacodeUpcast.class.php</file>
                <file>lib/system/html/node/HtmlNodeProcessor.class.php</file>
                <file>lib/system/html/output/AmpHtmlOutputProcessor.class.php</file>
                <file>lib/system/html/output/HtmlOutputNodeProcessor.class.php</file>
diff --git a/wcfsetup/install/files/lib/system/html/metacode/upcast/AbstractImageMetacodeUpcast.class.php b/wcfsetup/install/files/lib/system/html/metacode/upcast/AbstractImageMetacodeUpcast.class.php
new file mode 100644 (file)
index 0000000..1897cb4
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+
+namespace wcf\system\html\metacode\upcast;
+
+use wcf\util\DOMUtil;
+
+/**
+ * Default implementation for image elements for CKEditor 5.
+ *
+ * @author      Olaf Braun
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ */
+abstract class AbstractImageMetacodeUpcast implements IMetacodeUpcast
+{
+    /**
+     * Create the figure element for the image.
+     *
+     * @param \DOMElement $element
+     * @param \DOMElement $imgElement
+     * @param string $alignment
+     * @param \DOMElement|null $parentLink
+     */
+    protected function createFigure(
+        \DOMElement $element,
+        \DOMElement $imgElement,
+        string $alignment,
+        ?\DOMElement $parentLink
+    ): void {
+        $figure = $element->ownerDocument->createElement('figure');
+        if ($alignment === 'left') {
+            $figure->setAttribute('class', 'image image-style-side-left');
+        } elseif ($alignment === 'right') {
+            $figure->setAttribute('class', 'image image-style-side');
+        } else {
+            $figure->setAttribute('class', 'image');
+        }
+        if ($parentLink !== null) {
+            DOMUtil::replaceElement($parentLink, $figure, false);
+            $figure->appendChild($parentLink);
+            foreach (DomUtil::getChildNodes($parentLink) as $child) {
+                $parentLink->removeChild($child);
+            }
+            $parentLink->appendChild($imgElement);
+        } else {
+            $figure->appendChild($imgElement);
+            DOMUtil::replaceElement($element, $figure, false);
+        }
+    }
+}
index ad26b002f91a0153982dbd8483ed8a45f47b08ca..b48b98ab1c724a2790343935a1d8134438a50a32 100644 (file)
@@ -15,7 +15,7 @@ use wcf\util\StringUtil;
  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @since       6.1
  */
-final class AttachMetacodeUpcast extends ImageMetacodeUpcast
+final class AttachMetacodeUpcast extends AbstractImageMetacodeUpcast
 {
     #[\Override]
     public function upcast(\DOMElement $element, array $attributes): void
diff --git a/wcfsetup/install/files/lib/system/html/metacode/upcast/ImageMetacodeUpcast.class.php b/wcfsetup/install/files/lib/system/html/metacode/upcast/ImageMetacodeUpcast.class.php
deleted file mode 100644 (file)
index f5ce346..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-namespace wcf\system\html\metacode\upcast;
-
-use wcf\util\DOMUtil;
-
-/**
- * Default implementation for image elements for CKEditor 5.
- *
- * @author      Olaf Braun
- * @copyright   2001-2024 WoltLab GmbH
- * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @since       6.1
- */
-abstract class ImageMetacodeUpcast implements IMetacodeUpcast
-{
-    /**
-     * Create the figure element for the image.
-     *
-     * @param \DOMElement $element
-     * @param \DOMElement $imgElement
-     * @param string $alignment
-     * @param \DOMElement|null $parentLink
-     */
-    protected function createFigure(
-        \DOMElement $element,
-        \DOMElement $imgElement,
-        string $alignment,
-        ?\DOMElement $parentLink
-    ): void {
-        $figure = $element->ownerDocument->createElement('figure');
-        if ($alignment === 'left') {
-            $figure->setAttribute('class', 'image image-style-side-left');
-        } elseif ($alignment === 'right') {
-            $figure->setAttribute('class', 'image image-style-side');
-        } else {
-            $figure->setAttribute('class', 'image');
-        }
-        if ($parentLink !== null) {
-            DOMUtil::replaceElement($parentLink, $figure, false);
-            $figure->appendChild($parentLink);
-            foreach (DomUtil::getChildNodes($parentLink) as $child) {
-                $parentLink->removeChild($child);
-            }
-            $parentLink->appendChild($imgElement);
-        } else {
-            $figure->appendChild($imgElement);
-            DOMUtil::replaceElement($element, $figure, false);
-        }
-    }
-}
index 3b1e4c950e137f929a8f23e4ab5d83a4d809c7fb..0239c94db4df15f83bc7952d36a55081e302795f 100644 (file)
@@ -15,7 +15,7 @@ use wcf\util\StringUtil;
  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @since       6.1
  */
-final class WsmMetacodeUpcast extends ImageMetacodeUpcast
+final class WsmMetacodeUpcast extends AbstractImageMetacodeUpcast
 {
     #[\Override]
     public function upcast(\DOMElement $element, array $attributes): void