design-comuni-plone-theme 11.10.1 → 12.0.0-alpha.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.
Files changed (194) hide show
  1. package/.github/workflows/slate.yml +47 -0
  2. package/.yarn/cache/@babel-helper-module-imports-npm-7.24.3-edb733448b-c23492189b.zip +0 -0
  3. package/.yarn/cache/@babel-types-npm-7.24.0-a0508cb308-4b574a37d4.zip +0 -0
  4. package/.yarn/cache/babel-plugin-lodash-npm-3.3.4-c7161075b6-044a4261e6.zip +0 -0
  5. package/.yarn/cache/require-package-name-npm-2.0.1-ac9a206b63-00f4e9e467.zip +0 -0
  6. package/.yarn/cache/{volto-form-block-npm-3.7.2-f24953a510-7387a1b85a.zip → volto-form-block-npm-3.8.2-e49cbe07d5-5b72a06a5e.zip} +0 -0
  7. package/.yarn/install-state.gz +0 -0
  8. package/CHANGELOG.md +878 -904
  9. package/RELEASE.md +8 -0
  10. package/locales/de/LC_MESSAGES/volto.po +86 -18
  11. package/locales/en/LC_MESSAGES/volto.po +86 -18
  12. package/locales/es/LC_MESSAGES/volto.po +86 -18
  13. package/locales/fr/LC_MESSAGES/volto.po +86 -18
  14. package/locales/it/LC_MESSAGES/volto.po +86 -18
  15. package/locales/volto.pot +87 -19
  16. package/package.json +4 -2
  17. package/publiccode.yml +2 -2
  18. package/src/components/Collapse.jsx +1 -0
  19. package/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx +29 -24
  20. package/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx +4 -12
  21. package/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx +67 -6
  22. package/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx +60 -113
  23. package/src/components/ItaliaTheme/Blocks/Alert/Sidebar.jsx +1 -0
  24. package/src/components/ItaliaTheme/Blocks/Alert/View.jsx +5 -14
  25. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx +16 -11
  26. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx +2 -1
  27. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Edit.jsx +39 -1
  28. package/src/components/ItaliaTheme/Blocks/CTABlock/Block.jsx +35 -95
  29. package/src/components/ItaliaTheme/Blocks/Callout/Edit.jsx +108 -0
  30. package/src/components/ItaliaTheme/Blocks/Callout/Sidebar.jsx +173 -0
  31. package/src/components/ItaliaTheme/Blocks/Callout/View.jsx +45 -0
  32. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx +84 -63
  33. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/ViewBlock.jsx +19 -39
  34. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx +92 -19
  35. package/src/components/ItaliaTheme/Blocks/ContactsBlock/View.jsx +13 -21
  36. package/src/components/ItaliaTheme/Blocks/CountDown/Edit.jsx +21 -25
  37. package/src/components/ItaliaTheme/Blocks/CountDown/View.jsx +6 -15
  38. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx +40 -15
  39. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx +6 -21
  40. package/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx +93 -20
  41. package/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx +1 -9
  42. package/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx +4 -17
  43. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx +46 -15
  44. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/ViewBlock.jsx +2 -18
  45. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx +84 -11
  46. package/src/components/ItaliaTheme/Blocks/NumbersBlock/View.jsx +2 -11
  47. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx +33 -67
  48. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Edit.jsx +2 -8
  49. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/BodyWrapper.jsx +2 -1
  50. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx +98 -84
  51. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/View.jsx +20 -3
  52. package/src/components/ItaliaTheme/Blocks/__tests__/Accordion.test.jsx +11 -28
  53. package/src/components/ItaliaTheme/Blocks/__tests__/Alert.test.jsx +10 -14
  54. package/src/components/ItaliaTheme/Blocks/__tests__/ArgumentsInEvidence.test.jsx +20 -28
  55. package/src/components/ItaliaTheme/Blocks/__tests__/CTABlock.test.jsx +14 -29
  56. package/src/components/ItaliaTheme/Blocks/__tests__/CardWithImage.test.jsx +11 -28
  57. package/src/components/ItaliaTheme/Blocks/__tests__/ContactsBlock.test.jsx +75 -140
  58. package/src/components/ItaliaTheme/Blocks/__tests__/Countdown.test.jsx +20 -28
  59. package/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx +22 -56
  60. package/src/components/ItaliaTheme/Blocks/__tests__/NumbersBlock.test.jsx +14 -43
  61. package/src/components/ItaliaTheme/Blocks/__tests__/SimpleCard.test.jsx +14 -30
  62. package/src/components/ItaliaTheme/Footer/FooterInfos.jsx +22 -8
  63. package/src/components/ItaliaTheme/Footer/FooterNavigation.jsx +3 -3
  64. package/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx +5 -1
  65. package/src/components/ItaliaTheme/Slider/SingleSlideWrapper.jsx +2 -3
  66. package/src/components/ItaliaTheme/View/BandoView/BandoApprofondimenti.jsx +1 -2
  67. package/src/components/ItaliaTheme/View/CartellaModulisticaView/DocRow.jsx +14 -5
  68. package/src/components/ItaliaTheme/View/Commons/Attachment.jsx +19 -3
  69. package/src/components/ItaliaTheme/View/Commons/Attachments.jsx +0 -1
  70. package/src/components/ItaliaTheme/View/Commons/DownloadFileFormat.jsx +11 -7
  71. package/src/components/ItaliaTheme/View/Commons/Module.jsx +7 -6
  72. package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderLinkServizio.jsx +6 -2
  73. package/src/components/ItaliaTheme/View/Commons/RichTextRender.jsx +8 -6
  74. package/src/components/ItaliaTheme/View/Commons/__tests__/RichText.test.jsx +14 -17
  75. package/src/components/ItaliaTheme/View/ServizioView/ServizioAccedi.jsx +5 -6
  76. package/src/components/ItaliaTheme/View/ServizioView/ServizioMetatag.jsx +4 -0
  77. package/src/components/ItaliaTheme/View/__tests__/CartellaModulisticaView.test.jsx +12 -1
  78. package/src/components/ItaliaTheme/View/__tests__/IncaricoView.test.jsx +24 -30
  79. package/src/components/ItaliaTheme/View/__tests__/PageView.test.jsx +24 -2
  80. package/src/components/ItaliaTheme/View/__tests__/PersonaView.test.jsx +96 -92
  81. package/src/components/ItaliaTheme/View/__tests__/ServizioAChiSiRivolge.test.jsx +240 -286
  82. package/src/components/ItaliaTheme/View/__tests__/ServizioAccedi.test.jsx +240 -286
  83. package/src/components/ItaliaTheme/View/__tests__/ServizioCasiParticolari.test.jsx +240 -286
  84. package/src/components/ItaliaTheme/View/__tests__/ServizioComeFare.test.jsx +240 -286
  85. package/src/components/ItaliaTheme/View/__tests__/ServizioCondizioni.test.jsx +240 -286
  86. package/src/components/ItaliaTheme/View/__tests__/ServizioContatti.test.jsx +240 -286
  87. package/src/components/ItaliaTheme/View/__tests__/ServizioCosE.test.jsx +240 -286
  88. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaServe.test.jsx +240 -286
  89. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaSiOttiene.test.jsx +240 -286
  90. package/src/components/ItaliaTheme/View/__tests__/ServizioCostiVincoli.test.jsx +240 -286
  91. package/src/components/ItaliaTheme/View/__tests__/ServizioMetadati.test.jsx +240 -286
  92. package/src/components/ItaliaTheme/View/__tests__/ServizioModulistica.test.jsx +240 -286
  93. package/src/components/ItaliaTheme/View/__tests__/ServizioProcedure.test.jsx +240 -286
  94. package/src/components/ItaliaTheme/View/__tests__/ServizioSitiEsterni.test.jsx +240 -286
  95. package/src/components/ItaliaTheme/View/__tests__/ServizioTempiScadenze.test.jsx +240 -286
  96. package/src/components/ItaliaTheme/View/__tests__/ServizioUlterioriInformazioni.test.jsx +240 -286
  97. package/src/components/ItaliaTheme/View/__tests__/ServizioView.test.jsx +470 -560
  98. package/src/components/ItaliaTheme/View/__tests__/TrasparenzaView.test.jsx +12 -1
  99. package/src/components/ItaliaTheme/manage/Widgets/ColorListWidget.jsx +11 -2
  100. package/src/components/ItaliaTheme/manage/Widgets/HtmlSlateWidget.jsx +154 -0
  101. package/src/components/ItaliaTheme/manage/Widgets/RichTextWidget.jsx +88 -0
  102. package/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx +158 -0
  103. package/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx +167 -270
  104. package/src/config/Blocks/ListingOptions/index.js +0 -1
  105. package/src/config/Blocks/ListingOptions/utils.js +0 -7
  106. package/src/config/Blocks/blocks.js +29 -8
  107. package/src/config/Blocks/listingVariations.js +1 -1
  108. package/src/config/Slate/Alignment/AlignMenu.jsx +169 -0
  109. package/src/config/Slate/Alignment/index.js +42 -0
  110. package/src/config/Slate/Blockquote/BlockquoteMenu.jsx +151 -0
  111. package/src/config/Slate/Blockquote/index.js +12 -0
  112. package/src/config/Slate/Headings/HeadingsMenu.jsx +139 -0
  113. package/src/config/Slate/Headings/headingsMenu.scss +44 -0
  114. package/src/config/Slate/Headings/index.js +62 -0
  115. package/src/config/Slate/Link/deserializer.js +25 -0
  116. package/src/config/Slate/Link/index.js +126 -0
  117. package/src/config/Slate/Link/renderer.jsx +99 -0
  118. package/src/config/Slate/LinkButton/index.js +47 -0
  119. package/src/config/Slate/TextLarger/index.js +51 -0
  120. package/src/config/Slate/Underline/index.js +10 -0
  121. package/src/config/Slate/config.js +43 -0
  122. package/src/config/Slate/deserializers.js +66 -0
  123. package/src/config/Slate/dropdownStyle.scss +14 -0
  124. package/src/config/Slate/dropdownUtils.js +422 -0
  125. package/src/config/Slate/extensions/breakList.js +91 -0
  126. package/src/config/Slate/handlers.js +243 -0
  127. package/src/config/Slate/utils.js +73 -0
  128. package/src/config/Widgets/widgets.js +1 -2
  129. package/src/config/italiaConfig.js +7 -54
  130. package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +360 -0
  131. package/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx +75 -200
  132. package/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx +1 -1
  133. package/src/customizations/volto/components/manage/Form/BlocksToolbar.jsx +1 -1
  134. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +59 -6
  135. package/src/customizations/volto-form-block/components/Field.jsx +45 -22
  136. package/src/customizations/volto-form-block/components/FormResult.jsx +74 -0
  137. package/src/customizations/volto-form-block/components/FormView.jsx +79 -66
  138. package/src/customizations/volto-form-block/components/Widget/Button.jsx +50 -0
  139. package/src/helpers/EnhanceLink.js +44 -0
  140. package/src/helpers/FormValidation/FormValidationHelpers.js +3 -0
  141. package/src/helpers/blocks.js +86 -0
  142. package/src/helpers/files.js +14 -14
  143. package/src/helpers/index.js +4 -3
  144. package/src/helpers/richTextHelper.js +10 -0
  145. package/src/icons/Group.svg +1 -0
  146. package/src/icons/blocco-icone.svg +0 -3
  147. package/src/icons/blockquote-card-dark.svg +1 -0
  148. package/src/icons/blockquote-card.svg +1 -0
  149. package/src/icons/blockquote-simple.svg +1 -0
  150. package/src/icons/text-larger.svg +1 -0
  151. package/src/theme/ItaliaTheme/Blocks/_accordion.scss +1 -10
  152. package/src/theme/ItaliaTheme/Blocks/_alert.scss +53 -1
  153. package/src/theme/ItaliaTheme/Blocks/_bandiInEvidenceTemplate.scss +1 -0
  154. package/src/theme/ItaliaTheme/Blocks/_callout.scss +32 -0
  155. package/src/theme/ItaliaTheme/Blocks/_contacts.scss +15 -32
  156. package/src/theme/ItaliaTheme/Blocks/_ctaBlock.scss +0 -14
  157. package/src/theme/ItaliaTheme/Blocks/_gridBlock.scss +1 -1
  158. package/src/theme/ItaliaTheme/Blocks/_hero.scss +1 -8
  159. package/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss +0 -30
  160. package/src/theme/ItaliaTheme/Blocks/_imageCardTextBlock.scss +3 -2
  161. package/src/theme/ItaliaTheme/Blocks/_numbers.scss +1 -5
  162. package/src/theme/ItaliaTheme/Blocks/_simpleCardTextBlock.scss +8 -2
  163. package/src/theme/ItaliaTheme/Blocks/_tableOfContents.scss +1 -0
  164. package/src/theme/ItaliaTheme/Components/_megamenu.scss +0 -4
  165. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_cta.scss +1 -0
  166. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_searchSections.scss +1 -0
  167. package/src/theme/ItaliaTheme/Subsites/bootstrap-italia/custom/_headercenter.scss +1 -0
  168. package/src/theme/ItaliaTheme/Views/_cartellaModulistica.scss +11 -2
  169. package/src/theme/ItaliaTheme/Views/_slider.scss +3 -3
  170. package/src/theme/ItaliaTheme/Widgets/_iconWidget.scss +4 -0
  171. package/src/theme/ItaliaTheme/_main.scss +42 -54
  172. package/src/theme/_cms-ui.scss +59 -161
  173. package/src/theme/extras/_forms.scss +2 -14
  174. package/src/theme/site.scss +1 -0
  175. package/test-setup-config.js +58 -0
  176. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Block.jsx +0 -151
  177. package/src/config/RichTextEditor/LinkEntity.jsx +0 -27
  178. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/Link/index.jsx +0 -44
  179. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +0 -349
  180. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/index.js +0 -150
  181. package/src/config/RichTextEditor/Plugins/AnchorPlugin/index.js +0 -88
  182. package/src/config/RichTextEditor/ToolbarButtons/AlignButton.jsx +0 -61
  183. package/src/config/RichTextEditor/ToolbarButtons/ButtonsButton.jsx +0 -14
  184. package/src/config/RichTextEditor/ToolbarButtons/CalloutsButton.jsx +0 -38
  185. package/src/config/RichTextEditor/ToolbarButtons/DraftJsDropdownButton.jsx +0 -106
  186. package/src/config/RichTextEditor/ToolbarButtons/HeadingsButton.jsx +0 -57
  187. package/src/config/RichTextEditor/ToolbarButtons/TextSizeButton.jsx +0 -65
  188. package/src/config/RichTextEditor/ToolbarButtons/UnderlineButton.jsx +0 -14
  189. package/src/config/RichTextEditor/config.js +0 -253
  190. package/src/config/volto-gdpr-privacy-defaultPanelConfig.js +0 -292
  191. package/src/customizations/volto/components/manage/Blocks/ToC/View.jsx +0 -134
  192. package/src/customizations/volto/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +0 -99
  193. package/src/customizations/volto/config/RichTextEditor/Plugins.jsx +0 -63
  194. package/src/helpers/redraftHelper.js +0 -9
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import React, { useEffect } from 'react';
7
+
7
8
  import { useDispatch, useSelector } from 'react-redux';
8
9
  import { useLocation } from 'react-router-dom';
9
10
 
@@ -17,6 +18,9 @@ import {
17
18
  FooterSocials,
18
19
  } from 'design-comuni-plone-theme/components/ItaliaTheme';
19
20
 
21
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
22
+ import { fromHtml } from 'design-comuni-plone-theme/config/Slate/utils';
23
+
20
24
  const messages = defineMessages({
21
25
  goToPage: {
22
26
  id: 'Vai alla pagina',
@@ -39,10 +43,15 @@ const FooterInfos = () => {
39
43
  }, [dispatch, location]);
40
44
 
41
45
  //filter rootpaths
42
- const footerColumns = getItemsByPath(
46
+ let footerColumns = getItemsByPath(
43
47
  footerConfiguration,
44
48
  location?.pathname?.length ? location.pathname : '/',
45
49
  );
50
+ footerColumns.forEach((column) => {
51
+ if (__CLIENT__) {
52
+ column.slateText = fromHtml(column.text);
53
+ }
54
+ });
46
55
 
47
56
  const colWidth =
48
57
  12 / (footerColumns.length < N_COLUMNS ? footerColumns.length : N_COLUMNS);
@@ -75,13 +84,18 @@ const FooterInfos = () => {
75
84
  )}
76
85
  </h4>
77
86
  {column.showSocial && <FooterSocials />}
78
-
79
- <div
80
- dangerouslySetInnerHTML={{
81
- __html: flattenHTMLToAppURL(column.text.data),
82
- }}
83
- />
84
-
87
+ {column.slateText ? (
88
+ <TextBlockView data={{ value: column.slateText }} />
89
+ ) : (
90
+ column.text && (
91
+ <div
92
+ dangerouslySetInnerHTML={{
93
+ __html: flattenHTMLToAppURL(column.text.data),
94
+ }}
95
+ />
96
+ )
97
+ )}
98
+ {/* <TextBlockView id={index} data={{ value: data.text }} /> */}
85
99
  {column.newsletterSubscribe && <FooterNewsletterSubscribe />}
86
100
  </Col>
87
101
  ))}
@@ -60,15 +60,15 @@ const FooterNavigation = () => {
60
60
  title: item.title,
61
61
  }}
62
62
  />
63
- <Link
64
- to={item.url}
63
+ <UniversalLink
64
+ href={item.url}
65
65
  title={
66
66
  intl.formatMessage(messages.goToPage) + ': ' + item.title
67
67
  }
68
68
  className={markFooterLinks ? 'underlined' : ''}
69
69
  >
70
70
  {item.title}
71
- </Link>
71
+ </UniversalLink>
72
72
  </h4>
73
73
  {/* DEPRECATED: isFooterCollapsed to be removed in version 12 */}
74
74
  {!config.settings.isFooterCollapsed &&
@@ -134,7 +134,6 @@ const MegaMenu = ({ item, pathname }) => {
134
134
  } else {
135
135
  //megamenu
136
136
  let hasBlocks = hasBlocksData(item);
137
-
138
137
  if (item?.blocks && Object.keys(item.blocks).length === 1) {
139
138
  let b = item.blocks[Object.keys(item.blocks)[0]];
140
139
 
@@ -153,6 +152,11 @@ const MegaMenu = ({ item, pathname }) => {
153
152
  }
154
153
  }
155
154
  }
155
+ if (b['@type'] === 'slate') {
156
+ if (b.plaintext?.length === 0) {
157
+ hasBlocks = false;
158
+ }
159
+ }
156
160
  }
157
161
 
158
162
  const childrenGroups = [];
@@ -26,9 +26,8 @@ const SingleSlideWrapper = (props) => {
26
26
  }
27
27
  onKeyDown={onKeyDown}
28
28
  onClick={(e) => {
29
- //commentato perchè i link esterni non si aprivano
30
- //e.preventDefault();
31
- //e.stopPropagation();
29
+ e.preventDefault();
30
+ e.stopPropagation();
32
31
  }}
33
32
  tabIndex={0}
34
33
  >
@@ -30,9 +30,8 @@ const BandoApprofondimenti = ({ content }) => {
30
30
  title={item.title}
31
31
  description={item.description}
32
32
  download_url={item.url}
33
- item={item}
33
+ item={item} //viene utilizzato nelle customizzazioni per ottenere altre proprietà
34
34
  />
35
- // item={item} viene utilizzato nelle customizzazioni per ottenere altre proprietà
36
35
  );
37
36
  } else if (item.type === 'Link') {
38
37
  return (
@@ -27,9 +27,15 @@ const Downloads = ({ item, titleDoc }) => {
27
27
  titleDoc !== item.title && <div className="title">{item.title}</div>
28
28
  )}
29
29
  <div className="downloads">
30
- <DownloadFileFormat file={item?.file_principale} />
31
- <DownloadFileFormat file={item?.formato_alternativo_1} />
32
- <DownloadFileFormat file={item?.formato_alternativo_2} />
30
+ <DownloadFileFormat file={item?.file_principale} title={item.title} />
31
+ <DownloadFileFormat
32
+ file={item?.formato_alternativo_1}
33
+ title={item.title}
34
+ />
35
+ <DownloadFileFormat
36
+ file={item?.formato_alternativo_2}
37
+ title={item.title}
38
+ />
33
39
  </div>
34
40
  </React.Fragment>
35
41
  ) : (
@@ -37,6 +43,7 @@ const Downloads = ({ item, titleDoc }) => {
37
43
  href={item.remoteUrl || flattenToAppURL(item['@id'])}
38
44
  title={item.title}
39
45
  className="modulistica-link"
46
+ item={item}
40
47
  >
41
48
  <div className="title">{item.title}</div>
42
49
  <FontAwesomeIcon
@@ -51,7 +58,6 @@ const Downloads = ({ item, titleDoc }) => {
51
58
 
52
59
  const DocRow = ({ doc }) => {
53
60
  const [itemOpen, setItemOpen] = useState(false);
54
-
55
61
  const titleWrapper = (
56
62
  <div
57
63
  className={cx('title-wrap', {
@@ -59,7 +65,10 @@ const DocRow = ({ doc }) => {
59
65
  })}
60
66
  >
61
67
  <div id={`title-${doc.id}`} className="title">
62
- <UniversalLink href={doc.remoteUrl || flattenToAppURL(doc['@id'])}>
68
+ <UniversalLink
69
+ href={doc.remoteUrl || flattenToAppURL(doc['@id'])}
70
+ item={doc}
71
+ >
63
72
  {doc.title}
64
73
  </UniversalLink>
65
74
  {doc?.description && (
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { defineMessages, useIntl } from 'react-intl';
4
4
  import { Card, CardBody, CardTitle } from 'design-react-kit';
5
- import { flattenToAppURL } from '@plone/volto/helpers';
5
+ import { UniversalLink } from '@plone/volto/components';
6
6
  import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
7
7
 
8
8
  const messages = defineMessages({
@@ -12,8 +12,15 @@ const messages = defineMessages({
12
12
  },
13
13
  });
14
14
 
15
- const Attachment = ({ title, description, download_url }) => {
15
+ const Attachment = ({ title, description, download_url, item = {} }) => {
16
16
  const intl = useIntl();
17
+ let _item = { ...item };
18
+ if (item['@type'] === 'File') {
19
+ _item = item.file;
20
+ }
21
+ if (item['@type'] === 'Image') {
22
+ _item = item.image;
23
+ }
17
24
  return (
18
25
  <Card
19
26
  className="card card-teaser shadow p-4 mt-3 rounded attachment"
@@ -27,7 +34,16 @@ const Attachment = ({ title, description, download_url }) => {
27
34
  />
28
35
  <CardBody tag="div">
29
36
  <CardTitle className="h5">
30
- <a href={flattenToAppURL(download_url)}>{title}</a>
37
+ <UniversalLink
38
+ item={{
39
+ ..._item,
40
+ '@id': download_url,
41
+ }}
42
+ title={title}
43
+ aria-label={title}
44
+ >
45
+ {title}
46
+ </UniversalLink>
31
47
  </CardTitle>
32
48
  {description && <p>{description}</p>}
33
49
  </CardBody>
@@ -52,7 +52,6 @@ const Attachments = ({
52
52
  {
53
53
  'path.depth': 1,
54
54
  sort_on: 'getObjPositionInParent',
55
- metadata_fields: '_all',
56
55
  fullobjects: 1,
57
56
  // the default maximum b_size allowed in redturtle.volto is 500
58
57
  b_size: 499,
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { flattenToAppURL } from '@plone/volto/helpers';
5
5
  import { FontAwesomeIcon as IconFA } from 'design-comuni-plone-theme/components/ItaliaTheme';
6
6
  import { defineMessages, useIntl } from 'react-intl';
7
- import { Icon } from '@plone/volto/components';
7
+ import { Icon, UniversalLink } from '@plone/volto/components';
8
8
  import { getFileViewFormat } from 'design-comuni-plone-theme/helpers';
9
9
 
10
10
  const messages = defineMessages({
@@ -23,6 +23,8 @@ const DownloadFileFormat = ({
23
23
  formatsize = '2x',
24
24
  className,
25
25
  showLabel = false,
26
+ title,
27
+ hideFileFormatLabel = false,
26
28
  }) => {
27
29
  const intl = useIntl();
28
30
  const defaultIcon = { lib: 'far', name: 'file', svg_format: false };
@@ -40,15 +42,17 @@ const DownloadFileFormat = ({
40
42
 
41
43
  icon = viewFormat?.icon ?? defaultIcon;
42
44
  }
43
- const pdfFile = file?.download?.includes('@@display-file');
44
45
 
45
46
  return file ? (
46
- <a
47
- href={flattenToAppURL(file.download)}
47
+ <UniversalLink
48
+ item={{
49
+ ...file,
50
+ ['@id']: file.download,
51
+ }}
48
52
  title={file.filename}
49
53
  className={className}
50
- target={pdfFile ? '_blank' : '_self'}
51
- rel={pdfFile ? 'noopener noreferrer' : ''}
54
+ aria-label={(title ?? file.filename) + ': ' + label}
55
+ hideFileFormat={hideFileFormatLabel}
52
56
  >
53
57
  {!icon.svg_format ? (
54
58
  <IconFA
@@ -61,7 +65,7 @@ const DownloadFileFormat = ({
61
65
  <Icon className="icon-svg-custom" name={icon.name} />
62
66
  )}
63
67
  {showLabel && <span className="ms-4">{label}</span>}
64
- </a>
68
+ </UniversalLink>
65
69
  ) : null;
66
70
  };
67
71
 
@@ -43,12 +43,7 @@ const Module = ({ item }) => {
43
43
  <CardBody tag="div">
44
44
  <CardTitle className="h5">
45
45
  {modulo.file_principale ? (
46
- <a
47
- href={flattenToAppURL(modulo.file_principale.download)}
48
- title={modulo.title ?? modulo.file_principale.filename}
49
- >
50
- {modulo.title ?? modulo.file_principale.filename}
51
- </a>
46
+ modulo.title ?? modulo.file_principale.filename
52
47
  ) : modulo['@type'] === 'Link' ? (
53
48
  <UniversalLink item={modulo} title={modulo.title}>
54
49
  {modulo.title}
@@ -63,16 +58,22 @@ const Module = ({ item }) => {
63
58
  <DownloadFileFormat
64
59
  file={modulo.file_principale}
65
60
  showLabel={true}
61
+ title={modulo.title ?? modulo.file_principale.filename}
62
+ hideFileFormatLabel={true}
66
63
  className="mb-4"
67
64
  />
68
65
  <DownloadFileFormat
69
66
  file={modulo.formato_alternativo_1}
70
67
  showLabel={true}
68
+ title={modulo.title ?? modulo.formato_alternativo_1.filename}
69
+ hideFileFormatLabel={true}
71
70
  className="mb-4"
72
71
  />
73
72
  <DownloadFileFormat
74
73
  file={modulo.formato_alternativo_2}
75
74
  showLabel={true}
75
+ title={modulo.title ?? modulo.formato_alternativo_2.filename}
76
+ hideFileFormatLabel={true}
76
77
  />
77
78
  </div>
78
79
  </CardBody>
@@ -8,8 +8,12 @@ const PageHeaderLinkServizio = ({ content }) => {
8
8
  content.canale_digitale_link &&
9
9
  !content.stato_servizio ? (
10
10
  <div className="mb-4">
11
- <p className="draftjs-buttons">
12
- <UniversalLink href={content.canale_digitale_link}>
11
+ <p className="canale-digitale">
12
+ <UniversalLink
13
+ className="btn btn-primary btn-lg"
14
+ href={content.canale_digitale_link}
15
+ data-element="service-online-access"
16
+ >
13
17
  {intl.formatMessage(messages.canale_digitale_link)}
14
18
  </UniversalLink>
15
19
  </p>
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import cx from 'classnames';
4
- import { flattenDeep, values } from 'lodash';
4
+ import { values } from 'lodash';
5
5
  import { flattenHTMLToAppURL } from '@plone/volto/helpers';
6
6
  import { hasBlocksData } from '@plone/volto/helpers';
7
7
  import { RenderBlocks } from 'design-comuni-plone-theme/components/ItaliaTheme/View';
@@ -11,14 +11,16 @@ const richTextHasContent = (data) => {
11
11
  //ReactDOMServer.renderToStaticMarkup(RenderBlocks({ data: data })),
12
12
  const renderedBlocks = RenderBlocks({ data: data });
13
13
 
14
- const textBlocks = values(data.blocks).filter((b) => b['@type'] === 'text');
14
+ const textBlocks = values(data.blocks).filter(
15
+ (b) => b['@type'] === 'slate',
16
+ );
15
17
  const noTextBlocks = values(data.blocks).filter(
16
- (b) => b['@type'] !== 'text',
18
+ (b) => b['@type'] !== 'slate',
17
19
  );
18
20
 
19
- const textContent = flattenDeep(
20
- textBlocks?.map((block) => block.text?.blocks?.map((b) => b.text) ?? []),
21
- )?.filter((b) => b != null && b.trim().length > 0)?.[0];
21
+ const textContent = textBlocks?.filter(
22
+ (b) => b.plaintext != null && b.plaintext?.trim().length > 0,
23
+ )?.[0];
22
24
 
23
25
  return (
24
26
  renderedBlocks !== null &&
@@ -22,26 +22,23 @@ it('renders content', () => {
22
22
  <RichText
23
23
  data={{
24
24
  blocks: {
25
- 'c3aac6c5-b8d9-48b7-bc01-a7211248548b': {
26
- '@type': 'text',
27
- text: {
28
- blocks: [
29
- {
30
- data: {},
31
- depth: 0,
32
- entityRanges: [],
33
- inlineStyleRanges: [],
34
- key: 'e0m83',
35
- text: 'Un mega evento con delle mega iniziative',
36
- type: 'unstyled',
37
- },
38
- ],
39
- entityMap: {},
40
- },
25
+ '77317d1d-92a1-4e94-946c-f00647c71f32': {
26
+ '@type': 'slate',
27
+ plaintext: 'Un mega evento con delle mega iniziative',
28
+ value: [
29
+ {
30
+ children: [
31
+ {
32
+ text: 'Un mega evento con delle mega iniziative',
33
+ },
34
+ ],
35
+ type: 'p',
36
+ },
37
+ ],
41
38
  },
42
39
  },
43
40
  blocks_layout: {
44
- items: ['c3aac6c5-b8d9-48b7-bc01-a7211248548b'],
41
+ items: ['77317d1d-92a1-4e94-946c-f00647c71f32'],
45
42
  },
46
43
  }}
47
44
  />
@@ -27,12 +27,11 @@ const ServizioAccedi = ({ content }) => {
27
27
  >
28
28
  {content.canale_digitale_link && (
29
29
  <div className="mb-4">
30
- {/* TODO */}
31
- <p
32
- className="draftjs-buttons"
33
- data-element="service-online-access"
34
- >
35
- <UniversalLink href={content.canale_digitale_link}>
30
+ <p data-element="service-online-access">
31
+ <UniversalLink
32
+ href={content.canale_digitale_link}
33
+ className="btn btn-primary mobile-full"
34
+ >
36
35
  {intl.formatMessage(messages.canale_digitale_link)}
37
36
  </UniversalLink>
38
37
  </p>
@@ -8,6 +8,10 @@ const fieldDataToPlainText = (field) => {
8
8
  if (index > 0) accumulator += ' ';
9
9
  accumulator += field.blocks[item].text?.blocks[0].text ?? '';
10
10
  }
11
+ if (field.blocks[item]['@type'] === 'slate') {
12
+ if (index > 0) accumulator += ' ';
13
+ accumulator += field.blocks[item].plaintext ?? '';
14
+ }
11
15
  return accumulator;
12
16
  }, '');
13
17
  };
@@ -116,7 +116,18 @@ const mock_allfields = {
116
116
  '@type': 'title',
117
117
  },
118
118
  'd2043aa9-157f-4393-a51c-05811f6e760e': {
119
- '@type': 'text',
119
+ '@type': 'slate',
120
+ plaintext: '',
121
+ value: [
122
+ {
123
+ children: [
124
+ {
125
+ text: '',
126
+ },
127
+ ],
128
+ type: 'p',
129
+ },
130
+ ],
120
131
  },
121
132
  },
122
133
  blocks_layout: {
@@ -116,21 +116,18 @@ const mock_allfields = {
116
116
  compensi: {
117
117
  blocks: {
118
118
  'f943ce1c-cc67-4568-8526-1281f01a9202': {
119
- '@type': 'text',
120
- text: {
121
- blocks: [
122
- {
123
- data: {},
124
- depth: 0,
125
- entityRanges: [],
126
- inlineStyleRanges: [],
127
- key: '4ruln',
128
- text: "You don't ever say too much",
129
- type: 'unstyled',
130
- },
131
- ],
132
- entityMap: {},
133
- },
119
+ '@type': 'slate',
120
+ plaintext: "You don't ever say too much",
121
+ value: [
122
+ {
123
+ children: [
124
+ {
125
+ text: "You don't ever say too much",
126
+ },
127
+ ],
128
+ type: 'p',
129
+ },
130
+ ],
134
131
  },
135
132
  },
136
133
  blocks_layout: {
@@ -151,21 +148,18 @@ const mock_allfields = {
151
148
  importi_viaggio_servizio: {
152
149
  blocks: {
153
150
  '2d2dd70c-3af5-4ff8-816b-46b34ea186b7': {
154
- '@type': 'text',
155
- text: {
156
- blocks: [
157
- {
158
- data: {},
159
- depth: 0,
160
- entityRanges: [],
161
- inlineStyleRanges: [],
162
- key: '3v7r',
163
- text: "You don't really read into",
164
- type: 'unstyled',
165
- },
166
- ],
167
- entityMap: {},
168
- },
151
+ '@type': 'slate',
152
+ plaintext: "You don't really read into",
153
+ value: [
154
+ {
155
+ children: [
156
+ {
157
+ text: "You don't really read into",
158
+ },
159
+ ],
160
+ type: 'p',
161
+ },
162
+ ],
169
163
  },
170
164
  },
171
165
  blocks_layout: {
@@ -77,7 +77,18 @@ const mock_allfields = {
77
77
  variation: 'simpleCard',
78
78
  },
79
79
  'e274abbd-0239-46ac-b3a8-dad1dee0691c': {
80
- '@type': 'text',
80
+ '@type': 'slate',
81
+ plaintext: '',
82
+ value: [
83
+ {
84
+ children: [
85
+ {
86
+ text: '',
87
+ },
88
+ ],
89
+ type: 'p',
90
+ },
91
+ ],
81
92
  },
82
93
  'fcfde1bb-0d46-4678-bb6a-2f64fc0084b9': {
83
94
  '@type': 'title',
@@ -756,7 +767,18 @@ const store = mockStore({
756
767
  variation: 'simpleCard',
757
768
  },
758
769
  'e274abbd-0239-46ac-b3a8-dad1dee0691c': {
759
- '@type': 'text',
770
+ '@type': 'slate',
771
+ plaintext: '',
772
+ value: [
773
+ {
774
+ children: [
775
+ {
776
+ text: '',
777
+ },
778
+ ],
779
+ type: 'p',
780
+ },
781
+ ],
760
782
  },
761
783
  'fcfde1bb-0d46-4678-bb6a-2f64fc0084b9': {
762
784
  '@type': 'title',