From f4653c076616cb54d0ba3a63505edc82f6655ae3 Mon Sep 17 00:00:00 2001 From: Markus Sommer <markussom@posteo.de> Date: Fri, 24 Mar 2017 15:56:50 +0100 Subject: [PATCH] [BUGFIX] Improve rendering of long text Resolves: #79670 Release: master Change-Id: I63e0edc5785b1bb81fcaeb9009b0844056c922f0 Reviewed-on: https://review.typo3.org/52144 Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../Classes/Form/Element/InputLinkElement.php | 15 +++++++++++++-- .../Resources/Public/JavaScript/FormEngine.js | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php b/typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php index f1442d9779fc..5594610f3538 100644 --- a/typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php @@ -210,7 +210,7 @@ class InputLinkElement extends AbstractFormElement $expansionHtml[] = '<div class="form-wizards-element">'; $expansionHtml[] = '<div class="input-group t3js-form-field-inputlink">'; $expansionHtml[] = '<span class="input-group-addon">' . $linkExplanation['icon'] . '</span>'; - $expansionHtml[] = '<div class="form-control form-field-inputlink-explanation t3js-form-field-inputlink-explanation" data-toggle="tooltip" data-title="' . $explanation . '">' . $explanation . '</div>'; + $expansionHtml[] = '<input class="form-control form-field-inputlink-explanation t3js-form-field-inputlink-explanation" data-toggle="tooltip" data-title="' . $explanation . '" value="' . $explanation . '" readonly>'; $expansionHtml[] = '<input type="text"' . GeneralUtility::implodeAttributes($attributes, true) . ' />'; $expansionHtml[] = '<span class="input-group-btn">'; $expansionHtml[] = '<button class="btn btn-default t3js-form-field-inputlink-explanation-toggle" type="button" title="' . htmlspecialchars($toggleButtonTitle) . '">'; @@ -339,7 +339,7 @@ class InputLinkElement extends AbstractFormElement break; case LinkService::TYPE_URL: $data = [ - 'text' => $linkData['url'], + 'text' => $this->getDomainByUrl($linkData['url']), 'icon' => $this->iconFactory->getIcon('apps-pagetree-page-shortcut-external', Icon::SIZE_SMALL)->render() ]; @@ -408,6 +408,17 @@ class InputLinkElement extends AbstractFormElement return $data; } + /** + * @param string $uriString + * + * @return string + */ + protected function getDomainByUrl(string $uriString): string + { + $data = parse_url($uriString); + return $data['host'] ?? ''; + } + /** * @return LanguageService */ diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js index 0923267dcc9d..2c622e03db6c 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js @@ -1007,7 +1007,7 @@ define(['jquery', // if empty, show input field $(explanationClass).filter(function () { - return !$.trim($(this).html()); + return !$.trim($(this).val()); }).each(function () { var $group = $(this).closest('.t3js-form-field-inputlink'), $inputField = $group.find(inputFieldClass), -- GitLab