@plone/volto 15.5.0 → 15.6.0

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.
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import { Link } from 'react-router-dom';
8
+ import { UniversalLink } from '@plone/volto/components';
9
9
  import { Container, Table } from 'semantic-ui-react';
10
10
  import { FormattedMessage } from 'react-intl';
11
11
 
@@ -49,13 +49,13 @@ const TabularView = ({ content }) => (
49
49
  {content.items.map((item) => (
50
50
  <Table.Row key={item.url}>
51
51
  <Table.Cell>
52
- <Link
53
- to={item.url}
52
+ <UniversalLink
53
+ item={item}
54
54
  className="summary url"
55
55
  title={item['@type']}
56
56
  >
57
57
  {item.title}
58
- </Link>
58
+ </UniversalLink>
59
59
  </Table.Cell>
60
60
  <Table.Cell>{item.description}</Table.Cell>
61
61
  <Table.Cell>{item['@type']}</Table.Cell>
@@ -246,6 +246,33 @@ export function normalizeTelephone(tel) {
246
246
  return `tel:${tel}`;
247
247
  }
248
248
 
249
+ export function checkAndNormalizeUrl(url) {
250
+ let res = {
251
+ isMail: false,
252
+ isTelephone: false,
253
+ url: url,
254
+ isValid: true,
255
+ };
256
+ if (URLUtils.isMail(URLUtils.normaliseMail(url))) {
257
+ //Mail
258
+ res.isMail = true;
259
+ res.url = URLUtils.normaliseMail(url);
260
+ } else if (URLUtils.isTelephone(url)) {
261
+ //Phone
262
+ res.isTelephone = true;
263
+ res.url = URLUtils.normalizeTelephone(url);
264
+ } else {
265
+ //url
266
+ if (!res.url.startsWith('/') && !res.url.startsWith('#')) {
267
+ res.url = URLUtils.normalizeUrl(url);
268
+ if (!URLUtils.isUrl(res.url)) {
269
+ res.isValid = false;
270
+ }
271
+ }
272
+ }
273
+ return res;
274
+ }
275
+
249
276
  export const URLUtils = {
250
277
  normalizeTelephone,
251
278
  normaliseMail,
@@ -253,4 +280,5 @@ export const URLUtils = {
253
280
  isTelephone,
254
281
  isMail,
255
282
  isUrl,
283
+ checkAndNormalizeUrl,
256
284
  };
@@ -574,4 +574,5 @@ body.has-toolbar-collapsed .mobile-menu {
574
574
  @import 'widgets';
575
575
  @import 'login';
576
576
  @import 'language-selector';
577
+ @import 'views';
577
578
  .loadUIOverrides();
@@ -0,0 +1,5 @@
1
+ .summary-view {
2
+ article {
3
+ margin: 2.5rem 0;
4
+ }
5
+ }