From 27283f47160162c8644804974ae2a527bc1735c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Thu, 9 Jan 2025 15:15:11 +0100 Subject: [PATCH] extext actions support --- .../Resources/public/js/scripts/admin.input.text.js | 4 +++- src/bundle/Resources/public/scss/_inputs.scss | 10 ++++++++++ .../themes/admin/ui/component/input_text.html.twig | 2 ++ .../views/themes/admin/ui/form_fields.html.twig | 13 ++++++++++++- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/admin.input.text.js b/src/bundle/Resources/public/js/scripts/admin.input.text.js index 45e240176d..e9480e96b4 100644 --- a/src/bundle/Resources/public/js/scripts/admin.input.text.js +++ b/src/bundle/Resources/public/js/scripts/admin.input.text.js @@ -42,7 +42,9 @@ recalculateStyling(); }; const recalculateInputStyling = (inputActionsContainer) => { - const input = inputActionsContainer.closest('.ibexa-input-text-wrapper').querySelector('input'); + const textWrapper = inputActionsContainer.closest('.ibexa-input-text-wrapper'); + const inputType = textWrapper.classList.contains('ibexa-input-text-wrapper--multiline') ? 'textarea' : 'input'; + const input = textWrapper.querySelector(inputType); if (!input) { return; diff --git a/src/bundle/Resources/public/scss/_inputs.scss b/src/bundle/Resources/public/scss/_inputs.scss index 967d824d04..45e3ecb12f 100644 --- a/src/bundle/Resources/public/scss/_inputs.scss +++ b/src/bundle/Resources/public/scss/_inputs.scss @@ -452,6 +452,16 @@ } } + &--multiline { + .ibexa-input-text-wrapper { + &__actions { + right: calculateRem(24px); + top: calculateRem(16px); + transform: none; + } + } + } + &:hover { .ibexa-input { border-color: var(--ibexa-input-hover-border-color, #{$ibexa-color-primary}); diff --git a/src/bundle/Resources/views/themes/admin/ui/component/input_text.html.twig b/src/bundle/Resources/views/themes/admin/ui/component/input_text.html.twig index bf92a5cde3..4f8df99009 100644 --- a/src/bundle/Resources/views/themes/admin/ui/component/input_text.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/component/input_text.html.twig @@ -3,6 +3,7 @@ {% set is_password_type = type|default('') == 'password' %} {% set is_password_input = is_password_input|default(is_password_type) %} {% set has_search = has_search|default(false) %} +{% set is_multiline = is_multiline|default(false) %} {% set extra_btn = extra_btn|default({})|merge({ label: extra_btn.label|default(''), attr: extra_btn.attr|default({})|merge({ @@ -20,6 +21,7 @@ ~ (is_password_input ? ' ibexa-input-text-wrapper--password') ~ (type is defined ? " ibexa-input-text-wrapper--type-#{type}") ~ (extra_btn.label ? ' ibexa-input-text-wrapper--extra-btn') + ~ (is_multiline ? ' ibexa-input-text-wrapper--multiline') )|trim }) %} diff --git a/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig b/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig index 073a8ead4b..fd28922ea6 100644 --- a/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig @@ -268,7 +268,18 @@ {% block textarea_widget -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' ibexa-input ibexa-input--textarea')|trim}) %} - {{- parent() -}} + {%- set input_html -%} + {{- parent() -}} + {%- endset -%} + {%- embed '@ibexadesign/ui/component/input_text.html.twig' with { is_multiline: true } -%} + {% block content %} + {{ input_html }} + {% endblock %} + + {% block actions %} + {{ extra_actions_after|default(null)}} + {% endblock %} + {%- endembed -%} {%- endblock textarea_widget %} {%- block richtext_widget -%}