design-comuni-plone-theme 11.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/RELEASE.md +7 -1
- package/package.json +1 -1
- package/publiccode.yml +2 -2
- package/src/components/ItaliaTheme/Blocks/VideoGallery/Block/ViewBlock.jsx +1 -1
- package/src/components/ItaliaTheme/View/Commons/EmbeddedVideo.jsx +1 -1
- package/src/components/ItaliaTheme/View/ServizioView/ServizioMetatag.jsx +15 -13
- package/src/helpers/videoUrlHelper.js +3 -5
- package/src/helpers/videoUrlHelper.test.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [11.0.1](https://github.com/redturtle/design-comuni-plone-theme/compare/v11.0.0...v11.0.1) (2023-12-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* schema.org serviceUrl construction ([93f0f39](https://github.com/redturtle/design-comuni-plone-theme/commit/93f0f39bc817cf40ad506e7dd4b6d8f2ada41e18))
|
|
9
|
+
* youtube preview image ([#441](https://github.com/redturtle/design-comuni-plone-theme/issues/441)) ([93af45c](https://github.com/redturtle/design-comuni-plone-theme/commit/93af45cd2dce0cd6de83174660b665399096e481))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
* updated publiccode and release log ([13befcb](https://github.com/redturtle/design-comuni-plone-theme/commit/13befcb56bf3a7d527b552369f253efeb5f5cd5a))
|
|
15
|
+
|
|
3
16
|
## [11.0.0](https://github.com/redturtle/design-comuni-plone-theme/compare/v10.6.4...v11.0.0) (2023-12-18)
|
|
4
17
|
|
|
5
18
|
|
package/RELEASE.md
CHANGED
package/package.json
CHANGED
package/publiccode.yml
CHANGED
|
@@ -227,9 +227,9 @@ maintenance:
|
|
|
227
227
|
name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici
|
|
228
228
|
platforms:
|
|
229
229
|
- web
|
|
230
|
-
releaseDate: '2023-12-
|
|
230
|
+
releaseDate: '2023-12-19'
|
|
231
231
|
softwareType: standalone/web
|
|
232
|
-
softwareVersion: 11.0.
|
|
232
|
+
softwareVersion: 11.0.1
|
|
233
233
|
url: 'https://github.com/italia/design-comuni-plone-theme'
|
|
234
234
|
usedBy:
|
|
235
235
|
- ASP Comuni Modenesi Area Nord
|
|
@@ -47,7 +47,7 @@ const ViewBlock = ({ data, index, isEditMode = false }) => {
|
|
|
47
47
|
const videoID = data.url.match(/.be\//)
|
|
48
48
|
? data.url.match(/^.*\.be\/(.*)/)?.[1]
|
|
49
49
|
: data.url.match(/^.*\?v=(.*)$/)?.[1];
|
|
50
|
-
placeholder = 'https://img.youtube.com/vi/' + videoID + '/
|
|
50
|
+
placeholder = 'https://img.youtube.com/vi/' + videoID + '/hqdefault.jpg';
|
|
51
51
|
} else if (data.url.match('vimeo')) {
|
|
52
52
|
const videoID = data.url.match(/^.*\.com\/(.*)/)[1];
|
|
53
53
|
placeholder = 'https://vumbnail.com/' + videoID + '.jpg';
|
|
@@ -56,7 +56,7 @@ const EmbeddedVideo = ({ video_url, title, id }) => {
|
|
|
56
56
|
defaultActive: false,
|
|
57
57
|
autoplay: false,
|
|
58
58
|
aspectRatio: '16:9',
|
|
59
|
-
placeholder: 'https://img.youtube.com/vi/' + video_id + '/
|
|
59
|
+
placeholder: 'https://img.youtube.com/vi/' + video_id + '/hqdefault.jpg',
|
|
60
60
|
tabIndex: 0,
|
|
61
61
|
onKeyPress: onKeyDown,
|
|
62
62
|
ref: ref,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Helmet, toPublicURL } from '@plone/volto/helpers';
|
|
1
|
+
import { Helmet, toPublicURL, isInternalURL } from '@plone/volto/helpers';
|
|
2
2
|
import { getSiteProperty } from 'design-comuni-plone-theme/helpers';
|
|
3
3
|
import { richTextHasContent } from 'design-comuni-plone-theme/components/ItaliaTheme/View';
|
|
4
4
|
|
|
5
|
+
const fieldDataToPlainText = (field) => {
|
|
6
|
+
return field.blocks_layout.items.reduce((accumulator, item, index) => {
|
|
7
|
+
if (field.blocks[item]['@type'] === 'text') {
|
|
8
|
+
if (index > 0) accumulator += ' ';
|
|
9
|
+
accumulator += field.blocks[item].text?.blocks[0].text ?? '';
|
|
10
|
+
}
|
|
11
|
+
return accumulator;
|
|
12
|
+
}, '');
|
|
13
|
+
};
|
|
14
|
+
|
|
5
15
|
const ServizioMetatag = ({ content }) => {
|
|
6
16
|
const siteTitle = getSiteProperty('siteTitle');
|
|
7
17
|
|
|
8
|
-
const fieldDataToPlainText = (field) => {
|
|
9
|
-
return field.blocks_layout.items.reduce((accumulator, item, index) => {
|
|
10
|
-
if (field.blocks[item]['@type'] === 'text') {
|
|
11
|
-
if (index > 0) accumulator += ' ';
|
|
12
|
-
accumulator += field.blocks[item].text?.blocks[0].text ?? '';
|
|
13
|
-
}
|
|
14
|
-
return accumulator;
|
|
15
|
-
}, '');
|
|
16
|
-
};
|
|
17
|
-
|
|
18
18
|
const schemaOrg = {
|
|
19
19
|
'@context': 'https://schema.org',
|
|
20
20
|
'@type': 'GovernmentService',
|
|
@@ -49,9 +49,11 @@ const ServizioMetatag = ({ content }) => {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (content.canale_digitale_link) {
|
|
52
|
-
schemaOrg.availableChannel.serviceUrl =
|
|
52
|
+
schemaOrg.availableChannel.serviceUrl = isInternalURL(
|
|
53
53
|
content.canale_digitale_link,
|
|
54
|
-
)
|
|
54
|
+
)
|
|
55
|
+
? toPublicURL(content.canale_digitale_link)
|
|
56
|
+
: content.canale_digitale_link;
|
|
55
57
|
} else {
|
|
56
58
|
schemaOrg.availableChannel.serviceUrl = toPublicURL(content['@id']);
|
|
57
59
|
}
|
|
@@ -4,13 +4,11 @@ import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
|
|
|
4
4
|
// test against all yt link formats I am aware of, not easy, can't find official docs.
|
|
5
5
|
// Try all possible formats, match an alphanumeric token in the expected position, length should be 10-20 chars, that's the ID.
|
|
6
6
|
// Reference sheet used and improved with support to shorts: https://gist.github.com/rodrigoborgesdeoliveira/987683cfbfcc8d800192da1e73adc486
|
|
7
|
-
const ytReg =
|
|
8
|
-
/^(?:http|https?:)?(?:\/\/)?(?:(?:www\.|m\.)?youtube(?:-nocookie)?\.com\/(?:(?:watch)?\?(?:feature=\w*&)?vi?=|embed\/|vi?\/|e\/|shorts\/)|youtu.be\/)([\w\-]{10,20})/i;
|
|
7
|
+
const ytReg = /^(?:http|https?:)?(?:\/\/)?(?:(?:www\.|m\.)?youtube(?:-nocookie)?\.com\/(?:(?:watch)?\?(?:feature=\w*&)?vi?=|embed\/|vi?\/|e\/|shorts\/)|youtu.be\/)([\w\-]{10,20})/i;
|
|
9
8
|
|
|
10
9
|
// Vimeo IDs should be only digits, let's try to get only a group of digits and suppose that's the video ID, scrap everything after.
|
|
11
10
|
// Docs link, watch for changes https://developer.vimeo.com/api/common-formats
|
|
12
|
-
const vimeoReg =
|
|
13
|
-
/(?:http|https)?:?\/?\/?(?:www\.)?(?:player\.)?vimeo\.com\/(?:(?:channels\/(?:[\w*\/]*\/))|(?:groups\/(?:[\w*\/]*\/))|(?:videos\/|video\/|albums\/))?(\d+)/i;
|
|
11
|
+
const vimeoReg = /(?:http|https)?:?\/?\/?(?:www\.)?(?:player\.)?vimeo\.com\/(?:(?:channels\/(?:[\w*\/]*\/))|(?:groups\/(?:[\w*\/]*\/))|(?:videos\/|video\/|albums\/))?(\d+)/i;
|
|
14
12
|
|
|
15
13
|
// Use regex against url to get video ID, video urls supported are youtube and vimeo.
|
|
16
14
|
// Return videoID and placeholder (if needed), null if no match found.
|
|
@@ -25,7 +23,7 @@ export const videoUrlHelper = (url, previewImage) => {
|
|
|
25
23
|
if (ytVideoMatch) {
|
|
26
24
|
videoID = ytVideoMatch[1];
|
|
27
25
|
if (!placeholder)
|
|
28
|
-
placeholder = 'https://img.youtube.com/vi/' + videoID + '/
|
|
26
|
+
placeholder = 'https://img.youtube.com/vi/' + videoID + '/hqdefault.jpg';
|
|
29
27
|
|
|
30
28
|
return [videoID, placeholder];
|
|
31
29
|
} else {
|
|
@@ -294,7 +294,7 @@ describe('videoUrlHelper', () => {
|
|
|
294
294
|
);
|
|
295
295
|
|
|
296
296
|
expect(placeholder).toBe(
|
|
297
|
-
'https://img.youtube.com/vi/' + YT_TEST_ID + '/
|
|
297
|
+
'https://img.youtube.com/vi/' + YT_TEST_ID + '/hqdefault.jpg',
|
|
298
298
|
);
|
|
299
299
|
});
|
|
300
300
|
it('generates vimeo placeholder correctly', async () => {
|