From c2dd2a43d84cc8589a564b983ae5a5897880ebd3 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 10 May 2023 15:34:39 +0200 Subject: [PATCH] Add support for floating images See WoltLab/editor#51 --- .../input/filter/MessageHtmlInputFilter.class.php | 5 +++++ .../input/node/HtmlInputNodeProcessor.class.php | 1 + wcfsetup/install/files/style/layout/global.scss | 13 +++++++++++++ 3 files changed, 19 insertions(+) diff --git a/wcfsetup/install/files/lib/system/html/input/filter/MessageHtmlInputFilter.class.php b/wcfsetup/install/files/lib/system/html/input/filter/MessageHtmlInputFilter.class.php index 4c69a26999..0cd44304f0 100644 --- a/wcfsetup/install/files/lib/system/html/input/filter/MessageHtmlInputFilter.class.php +++ b/wcfsetup/install/files/lib/system/html/input/filter/MessageHtmlInputFilter.class.php @@ -126,6 +126,11 @@ class MessageHtmlInputFilter implements IHtmlInputFilter $definition->addAttribute('img', 'data-attachment-id', 'Number'); $definition->addAttribute('img', 'srcset', 'Text'); + //
element for images + $definition->addElement('figure', 'Block', 'Flow', '', [ + 'class' => 'Text', + ]); + $parameters = [ 'config' => $config, 'definition' => $definition, diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php index 0e9c6a9d02..7e730ab150 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php @@ -27,6 +27,7 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor * @var array */ public static $allowedClassNames = [ + 'figure' => ['image', 'image-style-side'], 'h2' => ['text-center', 'text-justify', 'text-right'], 'h3' => ['text-center', 'text-justify', 'text-right'], 'h4' => ['text-center', 'text-justify', 'text-right'], diff --git a/wcfsetup/install/files/style/layout/global.scss b/wcfsetup/install/files/style/layout/global.scss index 088e9f0438..81462e6d83 100644 --- a/wcfsetup/install/files/style/layout/global.scss +++ b/wcfsetup/install/files/style/layout/global.scss @@ -176,6 +176,19 @@ ol.nativeList { margin-bottom: 0 !important; } } + + figure.image { + clear: both; + display: table; + margin: 1em auto; + min-width: 50px; + text-align: center; + + &.image-style-side { + float: right; + margin: 0 0 20px 20px; + } + } } .containerContent, -- 2.20.1