Skip to content

Commit d28396b

Browse files
sneridaghWagner3UBmamicoichim-davidrobgietema
authored
Backports for 17.5.1 (#5441)
Co-authored-by: Wagner Trezub <60133113+Wagner3UB@users.noreply.github.com> Co-authored-by: Mauro Amico <mauro.amico@gmail.com> Co-authored-by: ichim-david <ichim.david@gmail.com> Co-authored-by: Rob Gietema <rob.gietema@gmail.com> Co-authored-by: iRohitSingh <61353484+iRohitSingh@users.noreply.github.com>
1 parent e4dc412 commit d28396b

File tree

28 files changed

+192
-116
lines changed

28 files changed

+192
-116
lines changed

locales/ca/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,11 @@ msgstr "Clar"
632632
msgid "Clear filters"
633633
msgstr "Esborra filtres"
634634

635+
#: components/manage/BlockChooser/BlockChooserSearch
636+
# defaultMessage: Clear search
637+
msgid "Clear search"
638+
msgstr ""
639+
635640
#: components/theme/View/ImageView
636641
# defaultMessage: Click to download full sized image
637642
msgid "Click to download full sized image"

locales/de/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,11 @@ msgstr "Löschen"
629629
msgid "Clear filters"
630630
msgstr "Filter entfernen"
631631

632+
#: components/manage/BlockChooser/BlockChooserSearch
633+
# defaultMessage: Clear search
634+
msgid "Clear search"
635+
msgstr ""
636+
632637
#: components/theme/View/ImageView
633638
# defaultMessage: Click to download full sized image
634639
msgid "Click to download full sized image"

locales/en/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,11 @@ msgstr ""
623623
msgid "Clear filters"
624624
msgstr ""
625625

626+
#: components/manage/BlockChooser/BlockChooserSearch
627+
# defaultMessage: Clear search
628+
msgid "Clear search"
629+
msgstr ""
630+
626631
#: components/theme/View/ImageView
627632
# defaultMessage: Click to download full sized image
628633
msgid "Click to download full sized image"

locales/es/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,11 @@ msgstr "Limpiar"
634634
msgid "Clear filters"
635635
msgstr "Limpiar filtros"
636636

637+
#: components/manage/BlockChooser/BlockChooserSearch
638+
# defaultMessage: Clear search
639+
msgid "Clear search"
640+
msgstr ""
641+
637642
#: components/theme/View/ImageView
638643
# defaultMessage: Click to download full sized image
639644
msgid "Click to download full sized image"

locales/eu/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,11 @@ msgstr "Garbitu"
630630
msgid "Clear filters"
631631
msgstr "Garbitu filtroak"
632632

633+
#: components/manage/BlockChooser/BlockChooserSearch
634+
# defaultMessage: Clear search
635+
msgid "Clear search"
636+
msgstr ""
637+
633638
#: components/theme/View/ImageView
634639
# defaultMessage: Click to download full sized image
635640
msgid "Click to download full sized image"

locales/fi/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,11 @@ msgstr "Tyhjennä"
634634
msgid "Clear filters"
635635
msgstr "Tyhjennä suodattimet"
636636

637+
#: components/manage/BlockChooser/BlockChooserSearch
638+
# defaultMessage: Clear search
639+
msgid "Clear search"
640+
msgstr ""
641+
637642
#: components/theme/View/ImageView
638643
# defaultMessage: Click to download full sized image
639644
msgid "Click to download full sized image"

locales/fr/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,11 @@ msgstr "Effacer"
640640
msgid "Clear filters"
641641
msgstr "Effacer les filtres"
642642

643+
#: components/manage/BlockChooser/BlockChooserSearch
644+
# defaultMessage: Clear search
645+
msgid "Clear search"
646+
msgstr ""
647+
643648
#: components/theme/View/ImageView
644649
# defaultMessage: Click to download full sized image
645650
msgid "Click to download full sized image"

locales/it/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,11 @@ msgstr "Annulla"
623623
msgid "Clear filters"
624624
msgstr "Azzera filtri"
625625

626+
#: components/manage/BlockChooser/BlockChooserSearch
627+
# defaultMessage: Clear search
628+
msgid "Clear search"
629+
msgstr "Cancella ricerca"
630+
626631
#: components/theme/View/ImageView
627632
# defaultMessage: Click to download full sized image
628633
msgid "Click to download full sized image"

locales/ja/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,11 @@ msgstr "クリア"
631631
msgid "Clear filters"
632632
msgstr ""
633633

634+
#: components/manage/BlockChooser/BlockChooserSearch
635+
# defaultMessage: Clear search
636+
msgid "Clear search"
637+
msgstr ""
638+
634639
#: components/theme/View/ImageView
635640
# defaultMessage: Click to download full sized image
636641
msgid "Click to download full sized image"

locales/nl/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,11 @@ msgstr ""
642642
msgid "Clear filters"
643643
msgstr ""
644644

645+
#: components/manage/BlockChooser/BlockChooserSearch
646+
# defaultMessage: Clear search
647+
msgid "Clear search"
648+
msgstr ""
649+
645650
#: components/theme/View/ImageView
646651
# defaultMessage: Click to download full sized image
647652
msgid "Click to download full sized image"

locales/pt/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,11 @@ msgstr ""
631631
msgid "Clear filters"
632632
msgstr ""
633633

634+
#: components/manage/BlockChooser/BlockChooserSearch
635+
# defaultMessage: Clear search
636+
msgid "Clear search"
637+
msgstr ""
638+
634639
#: components/theme/View/ImageView
635640
# defaultMessage: Click to download full sized image
636641
msgid "Click to download full sized image"

locales/pt_BR/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,11 @@ msgstr "Limpar"
633633
msgid "Clear filters"
634634
msgstr "Limpar filtros"
635635

636+
#: components/manage/BlockChooser/BlockChooserSearch
637+
# defaultMessage: Clear search
638+
msgid "Clear search"
639+
msgstr "Limpar pesquisa"
640+
636641
#: components/theme/View/ImageView
637642
# defaultMessage: Click to download full sized image
638643
msgid "Click to download full sized image"

locales/ro/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,11 @@ msgstr "Curațați"
623623
msgid "Clear filters"
624624
msgstr "Curațați filtrele"
625625

626+
#: components/manage/BlockChooser/BlockChooserSearch
627+
# defaultMessage: Clear search
628+
msgid "Clear search"
629+
msgstr ""
630+
626631
#: components/theme/View/ImageView
627632
# defaultMessage: Click to download full sized image
628633
msgid "Click to download full sized image"

locales/volto.pot

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
msgid ""
22
msgstr ""
33
"Project-Id-Version: Plone\n"
4-
"POT-Creation-Date: 2023-10-09T09:36:27.737Z\n"
4+
5+
"POT-Creation-Date: 2023-10-20T14:42:17.848Z\n"
6+
57
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
68
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
79
"MIME-Version: 1.0\n"
@@ -625,6 +627,11 @@ msgstr ""
625627
msgid "Clear filters"
626628
msgstr ""
627629

630+
#: components/manage/BlockChooser/BlockChooserSearch
631+
# defaultMessage: Clear search
632+
msgid "Clear search"
633+
msgstr ""
634+
628635
#: components/theme/View/ImageView
629636
# defaultMessage: Click to download full sized image
630637
msgid "Click to download full sized image"

locales/zh_CN/LC_MESSAGES/volto.po

+5
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,11 @@ msgstr "清除"
629629
msgid "Clear filters"
630630
msgstr "清除过滤器"
631631

632+
#: components/manage/BlockChooser/BlockChooserSearch
633+
# defaultMessage: Clear search
634+
msgid "Clear search"
635+
msgstr ""
636+
632637
#: components/theme/View/ImageView
633638
# defaultMessage: Click to download full sized image
634639
msgid "Click to download full sized image"

news/5335.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Searchbox and clear button inside blocks-chooser with visible focus and fixed the clear button label - @Wagner3UB

news/5418.feature

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Use container from component registry in sitemap component and also refactor the class
2+
to functional component. @iRohitSingh

news/5429.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix image paths in development mode. @robgietema

news/5433.feature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improvements and completeness of the ContentMetadataTags component @ericof @sneridagh

src/components/manage/BlockChooser/BlockChooserSearch.jsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ const messages = defineMessages({
99
id: 'Search',
1010
defaultMessage: 'Search',
1111
},
12+
clear: {
13+
id: 'Clear search',
14+
defaultMessage: 'Clear search',
15+
},
1216
});
1317

1418
const BlockChooserSearch = ({ onChange, searchValue }) => {
@@ -27,7 +31,6 @@ const BlockChooserSearch = ({ onChange, searchValue }) => {
2731
onChange={(event) => onChange(event.target.value)}
2832
name="SearchableText"
2933
value={searchValue}
30-
transparent
3134
autoComplete="off"
3235
placeholder={intl.formatMessage(messages.search)}
3336
title={intl.formatMessage(messages.search)}
@@ -36,7 +39,7 @@ const BlockChooserSearch = ({ onChange, searchValue }) => {
3639
{searchValue && (
3740
<Button
3841
className="clear-search-button"
39-
aria-label={intl.formatMessage(messages.search)}
42+
aria-label={intl.formatMessage(messages.clear)}
4043
onClick={() => {
4144
onChange('');
4245
searchInput.current.focus();

src/components/manage/BlockChooser/__snapshots__/BlockChooser.test.jsx.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
1414
style="border-left: 0; height: 2em; padding: 0px;"
1515
>
1616
<div
17-
class="ui transparent input"
17+
class="ui input"
1818
>
1919
<input
2020
aria-label="Search"
@@ -353,7 +353,7 @@ exports[`BlocksChooser renders a BlockChooser component 1`] = `
353353
style="border-left: 0; height: 2em; padding: 0px;"
354354
>
355355
<div
356-
class="ui transparent input"
356+
class="ui input"
357357
>
358358
<input
359359
aria-label="Search"

src/components/manage/BlockChooser/__snapshots__/BlockChooserSearch.test.jsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports[`BlocksChooserSearch renders a BlockChooserSearch component 1`] = `
1111
style="border-left: 0; height: 2em; padding: 0px;"
1212
>
1313
<div
14-
class="ui transparent input"
14+
class="ui input"
1515
>
1616
<input
1717
aria-label="Search"

src/components/theme/ContentMetadataTags/ContentMetadataTags.jsx

+39-46
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
import React, { useEffect } from 'react';
2-
import {
3-
toPublicURL,
4-
Helmet,
5-
hasApiExpander,
6-
getBaseUrl,
7-
} from '@plone/volto/helpers';
8-
import { getNavroot } from '@plone/volto/actions';
1+
import { toPublicURL, Helmet } from '@plone/volto/helpers';
92
import config from '@plone/volto/registry';
10-
import { useDispatch, useSelector } from 'react-redux';
113

124
const ContentMetadataTags = (props) => {
135
const {
@@ -21,32 +13,31 @@ const ContentMetadataTags = (props) => {
2113
description,
2214
} = props.content;
2315

24-
const dispatch = useDispatch();
25-
const pathname = useSelector((state) => state.router.location.pathname);
26-
const navroot = useSelector((state) => state.navroot?.data?.navroot);
27-
const site = useSelector((state) => state.site?.data);
28-
29-
useEffect(() => {
30-
if (pathname && !hasApiExpander('navroot', getBaseUrl(pathname))) {
31-
dispatch(getNavroot(getBaseUrl(pathname)));
32-
}
33-
}, [dispatch, pathname]);
34-
3516
const getContentImageInfo = () => {
3617
const { contentMetadataTagsImageField } = config.settings;
37-
const image = props.content[contentMetadataTagsImageField];
18+
const image_field = props.content[contentMetadataTagsImageField];
19+
const preview_image = props.content.preview_image;
20+
const preview_image_link = props.content.preview_image_link;
3821
const { opengraph_image } = props.content;
22+
let image = undefined;
23+
24+
if (opengraph_image !== undefined && opengraph_image) {
25+
image = opengraph_image;
26+
} else if (preview_image_link !== undefined && preview_image_link) {
27+
image = preview_image_link[contentMetadataTagsImageField];
28+
} else if (preview_image !== undefined && preview_image) {
29+
image = preview_image;
30+
} else if (image_field !== undefined && image_field) {
31+
image = image_field;
32+
}
3933

4034
const contentImageInfo = {
4135
contentHasImage: false,
4236
url: null,
4337
height: null,
4438
width: null,
4539
};
46-
contentImageInfo.contentHasImage =
47-
opengraph_image?.scales?.large?.download ||
48-
image?.scales?.large?.download ||
49-
false;
40+
contentImageInfo.contentHasImage = image?.scales?.large?.download || false;
5041

5142
if (contentImageInfo.contentHasImage && opengraph_image?.scales?.large) {
5243
contentImageInfo.url = opengraph_image.scales.large.download;
@@ -63,35 +54,16 @@ const ContentMetadataTags = (props) => {
6354

6455
const contentImageInfo = getContentImageInfo();
6556

66-
const getTitle = () => {
67-
const includeSiteTitle =
68-
config?.settings?.siteTitleFormat?.includeSiteTitle || false;
69-
const titleAndSiteTitleSeparator =
70-
config?.settings?.titleAndSiteTitleSeparator || '-';
71-
const navRootTitle = navroot?.title;
72-
const siteRootTitle = site?.['plone.site_title'];
73-
const titlePart = navRootTitle || siteRootTitle;
74-
75-
if (includeSiteTitle && titlePart && titlePart !== title) {
76-
return seo_title || `${title} ${titleAndSiteTitleSeparator} ${titlePart}`;
77-
} else {
78-
return seo_title || title;
79-
}
80-
};
81-
8257
return (
8358
<>
8459
<Helmet>
85-
<title>{getTitle()?.replace(/\u00AD/g, '')}</title>
86-
<link
87-
rel="canonical"
88-
href={seo_canonical_url || toPublicURL(props.content['@id'])}
89-
/>
60+
<title>{(seo_title || title)?.replace(/\u00AD/g, '')}</title>
9061
<meta name="description" content={seo_description || description} />
9162
<meta
9263
property="og:title"
9364
content={opengraph_title || seo_title || title}
9465
/>
66+
<meta property="og:type" content={'website'} />
9567
<meta
9668
property="og:url"
9769
content={seo_canonical_url || toPublicURL(props.content['@id'])}
@@ -103,6 +75,12 @@ const ContentMetadataTags = (props) => {
10375
content={toPublicURL(contentImageInfo.url)}
10476
/>
10577
)}
78+
{contentImageInfo.contentHasImage && (
79+
<meta
80+
property="twitter:image"
81+
content={toPublicURL(contentImageInfo.url)}
82+
/>
83+
)}
10684
{contentImageInfo.contentHasImage && (
10785
<meta property="og:image:width" content={contentImageInfo.width} />
10886
)}
@@ -116,6 +94,21 @@ const ContentMetadataTags = (props) => {
11694
/>
11795
)}
11896
<meta name="twitter:card" content="summary_large_image" />
97+
<meta
98+
property="twitter:url"
99+
content={seo_canonical_url || toPublicURL(props.content['@id'])}
100+
/>
101+
{/* TODO: Improve SEO backend metadata providers by adding the twitter handler */}
102+
{/* <meta property="twitter:site" content={'@my_twitter_handler'} /> */}
103+
<meta
104+
property="twitter:title"
105+
content={opengraph_title || seo_title || title}
106+
/>
107+
<meta
108+
property="twitter:description"
109+
content={seo_description || description}
110+
/>
111+
<meta property="twitter:domain" content={config.settings.publicURL} />
119112
</Helmet>
120113
</>
121114
);

0 commit comments

Comments
 (0)