design-comuni-plone-theme 11.29.2 → 12.0.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.
Files changed (227) hide show
  1. package/.github/workflows/main.yml +16 -16
  2. package/.github/workflows/npm.yml +1 -1
  3. package/.github/workflows/withnewsletter.yml +47 -0
  4. package/.release-it.json +1 -0
  5. package/.yarn/cache/@babel-helper-module-imports-npm-7.24.3-edb733448b-c23492189b.zip +0 -0
  6. package/.yarn/cache/@babel-types-npm-7.24.0-a0508cb308-4b574a37d4.zip +0 -0
  7. package/.yarn/cache/babel-plugin-lodash-npm-3.3.4-c7161075b6-044a4261e6.zip +0 -0
  8. package/.yarn/cache/braces-npm-3.0.3-582c14023c-b95aa0b3bd.zip +0 -0
  9. package/.yarn/cache/fill-range-npm-7.1.1-bf491486db-b4abfbca38.zip +0 -0
  10. package/.yarn/cache/micromatch-npm-4.0.8-c9570e4aca-79920eb634.zip +0 -0
  11. package/.yarn/cache/require-package-name-npm-2.0.1-ac9a206b63-00f4e9e467.zip +0 -0
  12. package/.yarn/install-state.gz +0 -0
  13. package/CHANGELOG.md +1728 -1659
  14. package/RELEASE.md +6 -0
  15. package/locales/de/LC_MESSAGES/volto.po +86 -19
  16. package/locales/en/LC_MESSAGES/volto.po +86 -19
  17. package/locales/es/LC_MESSAGES/volto.po +86 -19
  18. package/locales/fr/LC_MESSAGES/volto.po +86 -19
  19. package/locales/it/LC_MESSAGES/volto.po +87 -20
  20. package/locales/volto.pot +87 -20
  21. package/package.json +3 -1
  22. package/publiccode.yml +2 -2
  23. package/src/components/Collapse.jsx +1 -0
  24. package/src/components/ItaliaTheme/AppExtras/SiteSettingsExtras.jsx +0 -6
  25. package/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx +29 -24
  26. package/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx +4 -12
  27. package/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx +118 -42
  28. package/src/components/ItaliaTheme/Blocks/Accordion/View.jsx +4 -18
  29. package/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx +60 -113
  30. package/src/components/ItaliaTheme/Blocks/Alert/Sidebar.jsx +1 -0
  31. package/src/components/ItaliaTheme/Blocks/Alert/View.jsx +5 -14
  32. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx +16 -11
  33. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx +2 -1
  34. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Edit.jsx +39 -1
  35. package/src/components/ItaliaTheme/Blocks/CTABlock/Block.jsx +35 -95
  36. package/src/components/ItaliaTheme/Blocks/Callout/Edit.jsx +108 -0
  37. package/src/components/ItaliaTheme/Blocks/Callout/Sidebar.jsx +173 -0
  38. package/src/components/ItaliaTheme/Blocks/Callout/View.jsx +45 -0
  39. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx +86 -63
  40. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/ViewBlock.jsx +19 -39
  41. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx +101 -22
  42. package/src/components/ItaliaTheme/Blocks/ContactsBlock/View.jsx +13 -21
  43. package/src/components/ItaliaTheme/Blocks/CountDown/Edit.jsx +21 -25
  44. package/src/components/ItaliaTheme/Blocks/CountDown/View.jsx +6 -15
  45. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx +52 -22
  46. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx +9 -29
  47. package/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx +108 -21
  48. package/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx +1 -9
  49. package/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx +6 -14
  50. package/src/components/ItaliaTheme/Blocks/Listing/CardWithSlideUpTextTemplate.jsx +0 -1
  51. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx +45 -15
  52. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/ViewBlock.jsx +2 -18
  53. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx +98 -11
  54. package/src/components/ItaliaTheme/Blocks/NumbersBlock/View.jsx +2 -7
  55. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx +35 -67
  56. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Edit.jsx +2 -8
  57. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/BodyWrapper.jsx +2 -1
  58. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx +98 -84
  59. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/View.jsx +20 -3
  60. package/src/components/ItaliaTheme/Blocks/UOSearch/Sidebar.jsx +11 -11
  61. package/src/components/ItaliaTheme/Blocks/__tests__/Accordion.test.jsx +11 -28
  62. package/src/components/ItaliaTheme/Blocks/__tests__/Alert.test.jsx +10 -14
  63. package/src/components/ItaliaTheme/Blocks/__tests__/ArgumentsInEvidence.test.jsx +20 -28
  64. package/src/components/ItaliaTheme/Blocks/__tests__/CTABlock.test.jsx +14 -29
  65. package/src/components/ItaliaTheme/Blocks/__tests__/CardWithImage.test.jsx +11 -28
  66. package/src/components/ItaliaTheme/Blocks/__tests__/ContactsBlock.test.jsx +75 -140
  67. package/src/components/ItaliaTheme/Blocks/__tests__/Countdown.test.jsx +20 -28
  68. package/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx +22 -56
  69. package/src/components/ItaliaTheme/Blocks/__tests__/NumbersBlock.test.jsx +14 -43
  70. package/src/components/ItaliaTheme/Blocks/__tests__/SimpleCard.test.jsx +14 -30
  71. package/src/components/ItaliaTheme/BrandText/BrandText.jsx +8 -14
  72. package/src/components/ItaliaTheme/BrandTextFooter/BrandTextFooter.jsx +31 -2
  73. package/src/components/ItaliaTheme/Footer/FooterInfos.jsx +21 -8
  74. package/src/components/ItaliaTheme/Footer/FooterNavigation.jsx +3 -3
  75. package/src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlim.jsx +0 -7
  76. package/src/components/ItaliaTheme/Icons/Icon.jsx +0 -1
  77. package/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx +5 -1
  78. package/src/components/ItaliaTheme/View/BandoView/BandoApprofondimenti.jsx +1 -2
  79. package/src/components/ItaliaTheme/View/CartellaModulisticaView/DocRow.jsx +14 -5
  80. package/src/components/ItaliaTheme/View/Commons/Attachment.jsx +19 -3
  81. package/src/components/ItaliaTheme/View/Commons/Attachments.jsx +0 -1
  82. package/src/components/ItaliaTheme/View/Commons/DownloadFileFormat.jsx +11 -7
  83. package/src/components/ItaliaTheme/View/Commons/Gallery.jsx +1 -0
  84. package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderEventDates.jsx +0 -1
  85. package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderLinkServizio.jsx +6 -2
  86. package/src/components/ItaliaTheme/View/Commons/RichTextRender.jsx +8 -6
  87. package/src/components/ItaliaTheme/View/Commons/__tests__/RichText.test.jsx +14 -17
  88. package/src/components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreEsterno.jsx +1 -1
  89. package/src/components/ItaliaTheme/View/EventoView/EventoUlterioriInformazioni.jsx +0 -4
  90. package/src/components/ItaliaTheme/View/ServizioView/ServizioAccedi.jsx +10 -7
  91. package/src/components/ItaliaTheme/View/ServizioView/ServizioMetatag.jsx +4 -3
  92. package/src/components/ItaliaTheme/View/__disabled_tests__/IncaricoView.test__disabled.jsx +24 -30
  93. package/src/components/ItaliaTheme/View/__tests__/CartellaModulisticaView.test.jsx +12 -1
  94. package/src/components/ItaliaTheme/View/__tests__/PageView.test.jsx +24 -2
  95. package/src/components/ItaliaTheme/View/__tests__/PersonaView.test.jsx +96 -92
  96. package/src/components/ItaliaTheme/View/__tests__/ServizioAChiSiRivolge.test.jsx +240 -286
  97. package/src/components/ItaliaTheme/View/__tests__/ServizioAccedi.test.jsx +240 -286
  98. package/src/components/ItaliaTheme/View/__tests__/ServizioCasiParticolari.test.jsx +240 -286
  99. package/src/components/ItaliaTheme/View/__tests__/ServizioComeFare.test.jsx +240 -286
  100. package/src/components/ItaliaTheme/View/__tests__/ServizioCondizioni.test.jsx +240 -286
  101. package/src/components/ItaliaTheme/View/__tests__/ServizioContatti.test.jsx +240 -286
  102. package/src/components/ItaliaTheme/View/__tests__/ServizioCosE.test.jsx +240 -286
  103. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaServe.test.jsx +240 -286
  104. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaSiOttiene.test.jsx +240 -286
  105. package/src/components/ItaliaTheme/View/__tests__/ServizioCostiVincoli.test.jsx +240 -286
  106. package/src/components/ItaliaTheme/View/__tests__/ServizioMetadati.test.jsx +240 -286
  107. package/src/components/ItaliaTheme/View/__tests__/ServizioModulistica.test.jsx +240 -286
  108. package/src/components/ItaliaTheme/View/__tests__/ServizioProcedure.test.jsx +240 -286
  109. package/src/components/ItaliaTheme/View/__tests__/ServizioSitiEsterni.test.jsx +240 -286
  110. package/src/components/ItaliaTheme/View/__tests__/ServizioTempiScadenze.test.jsx +240 -286
  111. package/src/components/ItaliaTheme/View/__tests__/ServizioUlterioriInformazioni.test.jsx +240 -286
  112. package/src/components/ItaliaTheme/View/__tests__/ServizioView.test.jsx +470 -560
  113. package/src/components/ItaliaTheme/View/__tests__/TrasparenzaView.test.jsx +12 -1
  114. package/src/components/ItaliaTheme/index.js +0 -1
  115. package/src/components/ItaliaTheme/manage/Widgets/ColorListWidget.jsx +11 -2
  116. package/src/components/ItaliaTheme/manage/Widgets/HtmlSlateWidget.jsx +156 -0
  117. package/src/components/ItaliaTheme/manage/Widgets/RichTextWidget.jsx +88 -0
  118. package/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx +158 -0
  119. package/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx +167 -270
  120. package/src/config/Blocks/ListingOptions/index.js +0 -1
  121. package/src/config/Blocks/ListingOptions/utils.js +0 -7
  122. package/src/config/Blocks/blocks.js +29 -8
  123. package/src/config/Blocks/listingVariations.js +1 -1
  124. package/src/config/Slate/Alignment/AlignMenu.jsx +169 -0
  125. package/src/config/Slate/Alignment/index.js +42 -0
  126. package/src/config/Slate/Blockquote/BlockquoteMenu.jsx +151 -0
  127. package/src/config/Slate/Blockquote/index.js +19 -0
  128. package/src/config/Slate/Headings/HeadingsMenu.jsx +139 -0
  129. package/src/config/Slate/Headings/headingsMenu.scss +44 -0
  130. package/src/config/Slate/Headings/index.js +62 -0
  131. package/src/config/Slate/Link/deserializer.js +25 -0
  132. package/src/config/Slate/Link/index.js +126 -0
  133. package/src/config/Slate/Link/renderer.jsx +99 -0
  134. package/src/config/Slate/LinkButton/index.js +47 -0
  135. package/src/config/Slate/TextLarger/index.js +51 -0
  136. package/src/config/Slate/Underline/index.js +10 -0
  137. package/src/config/Slate/config.js +43 -0
  138. package/src/config/Slate/deserializers.js +66 -0
  139. package/src/config/Slate/dropdownStyle.scss +14 -0
  140. package/src/config/Slate/dropdownUtils.js +422 -0
  141. package/src/config/Slate/extensions/breakList.js +91 -0
  142. package/src/config/Slate/handlers.js +243 -0
  143. package/src/config/Slate/utils.js +73 -0
  144. package/src/config/Widgets/widgets.js +1 -2
  145. package/src/config/italiaConfig.js +5 -53
  146. package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +361 -0
  147. package/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx +75 -200
  148. package/src/customizations/volto/components/manage/Blocks/Video/Body.jsx +0 -1
  149. package/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx +1 -1
  150. package/src/customizations/volto/components/manage/Form/BlocksToolbar.jsx +1 -1
  151. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +76 -18
  152. package/src/customizations/volto/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +4 -0
  153. package/src/customizations/volto-form-block/components/Field.jsx +45 -22
  154. package/src/helpers/EnhanceLink.js +44 -0
  155. package/src/helpers/FormValidation/FormValidationHelpers.js +3 -0
  156. package/src/helpers/blocks.js +80 -0
  157. package/src/helpers/files.js +13 -13
  158. package/src/helpers/index.js +4 -3
  159. package/src/helpers/richTextHelper.js +10 -0
  160. package/src/icons/Group.svg +1 -0
  161. package/src/icons/blocco-icone.svg +0 -3
  162. package/src/icons/blockquote-card-dark.svg +1 -0
  163. package/src/icons/blockquote-card.svg +1 -0
  164. package/src/icons/blockquote-simple.svg +1 -0
  165. package/src/icons/text-larger.svg +1 -0
  166. package/src/theme/ItaliaTheme/Blocks/_accordion.scss +2 -22
  167. package/src/theme/ItaliaTheme/Blocks/_alert.scss +51 -4
  168. package/src/theme/ItaliaTheme/Blocks/_bandiInEvidenceTemplate.scss +1 -0
  169. package/src/theme/ItaliaTheme/Blocks/_callout.scss +32 -0
  170. package/src/theme/ItaliaTheme/Blocks/_contacts.scss +17 -51
  171. package/src/theme/ItaliaTheme/Blocks/_countdown.scss +10 -1
  172. package/src/theme/ItaliaTheme/Blocks/_ctaBlock.scss +7 -23
  173. package/src/theme/ItaliaTheme/Blocks/_gridBlock.scss +1 -1
  174. package/src/theme/ItaliaTheme/Blocks/_hero.scss +1 -8
  175. package/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss +6 -77
  176. package/src/theme/ItaliaTheme/Blocks/_imageCardTextBlock.scss +3 -2
  177. package/src/theme/ItaliaTheme/Blocks/_numbers.scss +6 -20
  178. package/src/theme/ItaliaTheme/Blocks/_simpleCardTextBlock.scss +8 -2
  179. package/src/theme/ItaliaTheme/Blocks/_subblocks-edit.scss +3 -1
  180. package/src/theme/ItaliaTheme/Blocks/_tableOfContents.scss +1 -0
  181. package/src/theme/ItaliaTheme/Components/_megamenu.scss +0 -4
  182. package/src/theme/ItaliaTheme/Components/_mobileMenu.scss +12 -16
  183. package/src/theme/ItaliaTheme/Print/_page.scss +1 -1
  184. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_contacts.scss +3 -0
  185. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_cta.scss +1 -0
  186. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_searchSections.scss +1 -0
  187. package/src/theme/ItaliaTheme/Subsites/bootstrap-italia/custom/_headercenter.scss +1 -0
  188. package/src/theme/ItaliaTheme/Views/_cartellaModulistica.scss +11 -2
  189. package/src/theme/ItaliaTheme/Views/_servizio.scss +2 -2
  190. package/src/theme/ItaliaTheme/Views/_slider.scss +3 -0
  191. package/src/theme/ItaliaTheme/Widgets/_iconWidget.scss +4 -0
  192. package/src/theme/ItaliaTheme/_common.scss +1 -0
  193. package/src/theme/ItaliaTheme/_home.scss +0 -4
  194. package/src/theme/ItaliaTheme/_main.scss +78 -84
  195. package/src/theme/_cms-ui.scss +63 -160
  196. package/src/theme/_mixins.scss +13 -0
  197. package/src/theme/bootstrap-override/_bootstrap-italia-site.scss +1 -0
  198. package/src/theme/bootstrap-override/bootstrap-italia/_footer.scss +1 -1
  199. package/src/theme/bootstrap-override/bootstrap-italia/_forms.scss +7 -0
  200. package/src/theme/bootstrap-override/bootstrap-italia/_headercenter.scss +8 -3
  201. package/src/theme/extras/_forms.scss +2 -14
  202. package/src/theme/site.scss +1 -1
  203. package/test-setup-config.js +58 -0
  204. package/.yarn/cache/braces-npm-3.0.2-782240b28a-e2a8e769a8.zip +0 -0
  205. package/.yarn/cache/fill-range-npm-7.0.1-b8b1817caa-cc283f4e65.zip +0 -0
  206. package/.yarn/cache/micromatch-npm-4.0.5-cfab5d7669-02a17b671c.zip +0 -0
  207. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Block.jsx +0 -151
  208. package/src/components/ItaliaTheme/RemoveBodyClass/RemoveBodyClass.jsx +0 -84
  209. package/src/config/RichTextEditor/LinkEntity.jsx +0 -27
  210. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/Link/index.jsx +0 -44
  211. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +0 -349
  212. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/index.js +0 -150
  213. package/src/config/RichTextEditor/Plugins/AnchorPlugin/index.js +0 -88
  214. package/src/config/RichTextEditor/ToolbarButtons/AlignButton.jsx +0 -61
  215. package/src/config/RichTextEditor/ToolbarButtons/ButtonsButton.jsx +0 -14
  216. package/src/config/RichTextEditor/ToolbarButtons/CalloutsButton.jsx +0 -38
  217. package/src/config/RichTextEditor/ToolbarButtons/DraftJsDropdownButton.jsx +0 -106
  218. package/src/config/RichTextEditor/ToolbarButtons/HeadingsButton.jsx +0 -57
  219. package/src/config/RichTextEditor/ToolbarButtons/TextSizeButton.jsx +0 -65
  220. package/src/config/RichTextEditor/ToolbarButtons/UnderlineButton.jsx +0 -14
  221. package/src/config/RichTextEditor/config.js +0 -253
  222. package/src/config/volto-gdpr-privacy-defaultPanelConfig.js +0 -292
  223. package/src/customizations/volto/components/manage/Blocks/ToC/View.jsx +0 -134
  224. package/src/customizations/volto/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +0 -99
  225. package/src/customizations/volto/config/RichTextEditor/Plugins.jsx +0 -63
  226. package/src/helpers/redraftHelper.js +0 -9
  227. package/src/theme/ItaliaTheme/Components/_logo.scss +0 -10
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import redraft from 'redraft';
4
- import { checkRedraftHasContent } from 'design-comuni-plone-theme/helpers';
3
+ import { checkRichTextHasContent } from 'design-comuni-plone-theme/helpers';
5
4
  import { Container, Row, Col } from 'design-react-kit';
6
5
  import { addAppURL, flattenToAppURL } from '@plone/volto/helpers';
7
6
  import cx from 'classnames';
8
7
  import CountDown from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/CountDown/CountDown';
9
- import config from '@plone/volto/registry';
8
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
10
9
 
11
10
  const View = ({ data, id }) => {
12
11
  return (
@@ -37,7 +36,7 @@ const View = ({ data, id }) => {
37
36
  )}
38
37
  <Container className="px-md-4">
39
38
  <Row>
40
- {checkRedraftHasContent(data.text) && (
39
+ {checkRichTextHasContent(data.text) && (
41
40
  <Col
42
41
  xs={{
43
42
  size: 12,
@@ -48,11 +47,7 @@ const View = ({ data, id }) => {
48
47
  }}
49
48
  className="text"
50
49
  >
51
- {redraft(
52
- data.text,
53
- config.settings.richtextViewSettings.ToHTMLRenderers,
54
- config.settings.richtextViewSettings.ToHTMLOptions,
55
- )}
50
+ <TextBlockView data={{ value: data.text }} />
56
51
  </Col>
57
52
  )}
58
53
  <Col
@@ -71,13 +66,9 @@ const View = ({ data, id }) => {
71
66
  showMinutes={data.showMinutes}
72
67
  showSeconds={data.showSeconds}
73
68
  />
74
- {checkRedraftHasContent(data.countdown_text) && (
69
+ {checkRichTextHasContent(data.countdown_text) && (
75
70
  <div className="countdown_text">
76
- {redraft(
77
- data.countdown_text,
78
- config.settings.richtextViewSettings.ToHTMLRenderers,
79
- config.settings.richtextViewSettings.ToHTMLOptions,
80
- )}
71
+ <TextBlockView data={{ value: data.countdown_text }} />
81
72
  </div>
82
73
  )}
83
74
  </Col>
@@ -42,7 +42,7 @@ class EditBlock extends SubblockEdit {
42
42
  * Constructor
43
43
  * @method constructor
44
44
  * @param {Object} props Component properties
45
- * @constructs WysiwygEditor
45
+ * @constructs Icons Blocks edit
46
46
  */
47
47
  constructor(props) {
48
48
  super(props);
@@ -54,13 +54,13 @@ class EditBlock extends SubblockEdit {
54
54
 
55
55
  componentDidMount() {
56
56
  // eslint-disable-next-line no-unused-expressions
57
- this.subblock_ref?.current?.addEventListener('keydown', (e) => {
58
- if (e.keyCode === 13) {
59
- if (!(this.state.focusOn === 'text')) {
60
- this.setState({ focusOn: 'text' });
61
- }
62
- }
63
- });
57
+ // this.subblock_ref?.current?.addEventListener('keydown', (e) => {
58
+ // if (e.keyCode === 13) {
59
+ // if (!(this.state.focusOn === 'text')) {
60
+ // this.setState({ focusOn: 'text' });
61
+ // }
62
+ // }
63
+ // });
64
64
  }
65
65
  /**
66
66
  * Render method.
@@ -101,23 +101,36 @@ class EditBlock extends SubblockEdit {
101
101
  }}
102
102
  >
103
103
  <TextEditorWidget
104
+ {...this.props}
105
+ showToolbar={false}
104
106
  data={this.props.data}
105
107
  fieldName="title"
106
108
  selected={
107
109
  this.props.selected && this.state.focusOn === 'title'
108
110
  }
111
+ setSelected={(f) => {
112
+ this.setState({ focusOn: f });
113
+ }}
109
114
  block={this.props.block}
110
- onChangeBlock={this.onChange}
115
+ index={this.props.blockIndex}
116
+ onChangeBlock={(block, _data) => {
117
+ this.props.onChangeBlock(this.props.index, _data);
118
+ }}
111
119
  placeholder={this.props.intl.formatMessage(
112
120
  messages.titlePlaceholder,
113
121
  )}
114
- prevFocus="text"
115
- nextFocus="text"
116
- disableMoveToNearest={true}
117
- setFocus={(f) => {
118
- this.setState({ focusOn: f });
122
+ focusPrevField={
123
+ this.props.isFirst
124
+ ? this.props.onFocusPreviousBlock
125
+ : () => {
126
+ this.props.onSubblockChangeFocus(
127
+ this.props.index - 1,
128
+ );
129
+ }
130
+ }
131
+ focusNextField={() => {
132
+ this.setState({ focusOn: 'text' });
119
133
  }}
120
- showToolbar={false}
121
134
  key="title"
122
135
  />
123
136
  </div>
@@ -130,21 +143,38 @@ class EditBlock extends SubblockEdit {
130
143
  }}
131
144
  >
132
145
  <TextEditorWidget
146
+ {...this.props}
133
147
  data={this.props.data}
148
+ key="text"
134
149
  fieldName="text"
135
150
  selected={this.props.selected && this.state.focusOn === 'text'}
151
+ setSelected={(f) => {
152
+ if (!this.props.selected) {
153
+ //a11y - per il focus del blocco da tastiera con navigazione inversa
154
+ this.props.onSubblockChangeFocus(this.props.index);
155
+ this.props.onSelectBlock(this.props.block);
156
+ }
157
+ this.setState({ focusOn: f });
158
+ }}
159
+ onChangeBlock={(block, _data) => {
160
+ this.props.onChangeBlock(this.props.index, _data);
161
+ }}
136
162
  block={this.props.block}
137
- onChangeBlock={this.onChange}
163
+ index={this.props.blockIndex}
138
164
  placeholder={this.props.intl.formatMessage(
139
165
  messages.textPlaceholder,
140
166
  )}
141
- disableMoveToNearest={true}
142
- prevFocus="title"
143
- nextFocus="title"
144
- setFocus={(f) => {
145
- this.setState({ focusOn: f });
167
+ focusNextField={
168
+ !this.props.isLast
169
+ ? () => {
170
+ this.setState({ focusOn: null });
171
+ this.props.onSubblockChangeFocus(this.props.index + 1);
172
+ }
173
+ : null //default go to next block
174
+ }
175
+ focusPrevField={() => {
176
+ this.setState({ focusOn: 'title' });
146
177
  }}
147
- key="text"
148
178
  />
149
179
  </div>
150
180
 
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * ViewBlock.
3
- * @module components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock
3
+ * @module components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock
4
4
  */
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import redraft from 'redraft';
9
8
  import { useIntl, defineMessages } from 'react-intl';
10
9
  import { UniversalLink } from '@plone/volto/components';
11
10
 
12
11
  import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
13
12
  import { Card, CardBody, CardReadMore } from 'design-react-kit';
14
- import config from '@plone/volto/registry';
13
+
14
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
15
15
 
16
16
  const messages = defineMessages({
17
17
  vedi: {
@@ -25,21 +25,9 @@ const messages = defineMessages({
25
25
  * @class ViewBlock
26
26
  * @extends Component
27
27
  */
28
- const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
29
- const rawStringRenderer = {
30
- blocks: {
31
- unstyled: (children) => {
32
- const text = children.map((child) => child[1]).join(''); // Join the text elements
33
- return text.trim(); // Remove leading/trailing whitespace
34
- },
35
- },
36
- };
37
-
38
- const cardTitle = redraft(data.title, rawStringRenderer, {
39
- cleanup: false,
40
- });
41
-
28
+ const ViewBlock = ({ data, isOpen, toggle, id, index, blockHasTitle }) => {
42
29
  const intl = useIntl();
30
+
43
31
  return (
44
32
  <Card
45
33
  className="card-bg rounded subblock-view"
@@ -50,26 +38,18 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
50
38
  <CardBody tag="div">
51
39
  {data.icon?.length > 0 && (
52
40
  <div className="iconblock-icon">
53
- <Icon icon={data.icon} aria-hidden={true} title={cardTitle} />
41
+ <Icon icon={data.icon} aria-hidden={true} title={data.title} />
54
42
  </div>
55
43
  )}
56
44
 
57
45
  {data.title && (
58
46
  <div className="iconblock-title">
59
- {redraft(
60
- data.title,
61
- config.settings.richtextViewSettings.ToHTMLRenderers,
62
- config.settings.richtextViewSettings.ToHTMLOptions,
63
- )}
47
+ {blockHasTitle ? <h3>{data.title}</h3> : data.title}
64
48
  </div>
65
49
  )}
66
50
  {data.text && (
67
51
  <div className="iconblock-text">
68
- {redraft(
69
- data.text,
70
- config.settings.richtextViewSettings.ToHTMLRenderers,
71
- config.settings.richtextViewSettings.ToHTMLOptions,
72
- )}
52
+ <TextBlockView data={{ value: data.text }} />
73
53
  </div>
74
54
  )}
75
55
  {data.href && (
@@ -80,7 +60,7 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
80
60
  text={data.linkMoreTitle || intl.formatMessage(messages.vedi)}
81
61
  aria-label={`${
82
62
  data.linkMoreTitle || intl.formatMessage(messages.vedi)
83
- } ${data.title ? cardTitle[0] : ''}`}
63
+ } ${data.title ?? ''}`}
84
64
  />
85
65
  )}
86
66
  </CardBody>
@@ -10,7 +10,7 @@ import { Container, Row, Col } from 'design-react-kit';
10
10
  import { SidebarPortal } from '@plone/volto/components';
11
11
  import { flattenToAppURL } from '@plone/volto/helpers';
12
12
  import { UniversalLink } from '@plone/volto/components';
13
-
13
+ import { handleKeyDownOwnFocusManagement } from 'design-comuni-plone-theme/helpers/blocks';
14
14
  import {
15
15
  withDNDContext,
16
16
  SubblocksEdit,
@@ -46,7 +46,71 @@ class Edit extends SubblocksEdit {
46
46
  constructor(props) {
47
47
  super(props);
48
48
  this.state.selectedField = 'title';
49
+ this.nodeF = React.createRef();
50
+ }
51
+
52
+ UNSAFE_componentWillReceiveProps(newProps) {
53
+ if (newProps.selected) {
54
+ if (!this.props.selected) {
55
+ if (!this.state.selectedField && this.state.subIndexSelected < 0) {
56
+ //a11y - test subIndexSelected<0 per gestire il focus con navigazione da tastiera al contrario (dal blocco successivo a questo blocco)
57
+ this.setState({ selectedField: 'title' });
58
+ }
59
+ }
60
+ } else {
61
+ this.setState({ selectedField: null });
62
+ }
63
+ }
64
+
65
+ handleEnter = (e) => {
66
+ if (
67
+ this.props.selected &&
68
+ this.state.subIndexSelected < 0 &&
69
+ !this.state.selectedField
70
+ ) {
71
+ handleKeyDownOwnFocusManagement(e, this.props);
72
+ }
73
+ };
74
+
75
+ handleClick = (e) => {
76
+ const hasParent = (element, className) => {
77
+ if (!element.parentNode) {
78
+ return false;
79
+ }
80
+
81
+ if (element.classList.contains(className)) {
82
+ return true;
83
+ }
84
+
85
+ return hasParent(element.parentNode, className);
86
+ };
87
+ const clickOutsideSubblocks =
88
+ !e.target.classList.contains('volto-subblocks-wrapper') &&
89
+ !hasParent(e.target, 'volto-subblocks-wrapper');
90
+
91
+ if (clickOutsideSubblocks) {
92
+ this.setState({ subIndexSelected: -1 });
93
+ }
94
+ };
95
+
96
+ componentDidMount() {
97
+ if (this.props.selected && this.node) {
98
+ this.node.focus();
99
+ }
100
+ if (this.props.selected && this.nodeF.current) {
101
+ this.nodeF.current.focus();
102
+ }
103
+
104
+ if (this.state.subblocks.length === 0) {
105
+ this.addSubblock();
106
+ }
107
+
108
+ if (this.nodeF && this.nodeF.current) {
109
+ this.nodeF.current.addEventListener('keydown', this.handleEnter, false);
110
+ this.nodeF.current.addEventListener('click', this.handleClick, false);
111
+ }
49
112
  }
113
+
50
114
  /**
51
115
  * Render method.
52
116
  * @method render
@@ -59,8 +123,12 @@ class Edit extends SubblocksEdit {
59
123
  const Image = config.getComponent({ name: 'Image' }).component;
60
124
 
61
125
  return (
62
- <div className="public-ui">
63
- <div className="full-width section py-5">
126
+ <div className="public-ui" tabIndex="-1" ref={this.nodeF}>
127
+ <div
128
+ className="full-width section py-5"
129
+ role="form"
130
+ aria-label={this.props.blocksConfig[this.props.type].title}
131
+ >
64
132
  {this.props.data.background?.[0] ? (
65
133
  <div className="background-image">
66
134
  <Image
@@ -79,19 +147,24 @@ class Edit extends SubblocksEdit {
79
147
  <div className="block-header">
80
148
  <div className="title">
81
149
  <TextEditorWidget
150
+ {...this.props}
151
+ showToolbar={false}
82
152
  data={this.props.data}
153
+ key={'title'}
83
154
  fieldName="title"
84
155
  selected={this.state.selectedField === 'title'}
85
- block={this.props.block}
86
- onChangeBlock={(data) => {
87
- this.props.onChangeBlock(this.props.block, {
88
- ...data,
156
+ setSelected={(f) => {
157
+ this.setState({
158
+ selectedField: f,
159
+ subIndexSelected: -1,
89
160
  });
161
+ if (!this.props.selected) {
162
+ //a11y - per il focus del blocco da tastiera
163
+ this.props.onSelectBlock(this.props.block);
164
+ }
90
165
  }}
91
166
  placeholder={this.props.intl.formatMessage(messages.title)}
92
- showToolbar={false}
93
- onSelectBlock={() => {}}
94
- onAddBlock={() => {
167
+ focusNextField={() => {
95
168
  this.setState({ selectedField: 'description' });
96
169
  }}
97
170
  />
@@ -99,35 +172,50 @@ class Edit extends SubblocksEdit {
99
172
 
100
173
  <div className="description">
101
174
  <TextEditorWidget
175
+ {...this.props}
176
+ showToolbar={true}
102
177
  data={this.props.data}
103
178
  fieldName="description"
104
179
  selected={this.state.selectedField === 'description'}
105
- block={this.props.block}
106
- onChangeBlock={(data) =>
107
- this.props.onChangeBlock(this.props.block, {
108
- ...data,
109
- })
110
- }
180
+ setSelected={(f) => {
181
+ this.setState({
182
+ selectedField: f,
183
+ subIndexSelected: -1,
184
+ });
185
+ }}
111
186
  placeholder={this.props.intl.formatMessage(
112
187
  messages.description,
113
188
  )}
114
- showToolbar={true}
115
- onSelectBlock={() => {}}
116
- onAddBlock={() => {}}
189
+ focusPrevField={() => {
190
+ this.setState({ selectedField: 'title' });
191
+ }}
192
+ focusNextField={() => {
193
+ this.setState({ selectedField: null, subIndexSelected: 0 });
194
+ }}
117
195
  />
118
196
  </div>
119
197
  </div>
120
-
121
198
  <SubblocksWrapper node={this.node}>
122
199
  <Row>
123
200
  {this.state.subblocks.map((subblock, subindex) => (
124
201
  <Col lg="4" xl="3" key={subblock.id}>
125
202
  <EditBlock
203
+ {...this.props}
126
204
  data={subblock}
127
205
  index={subindex}
206
+ blockIndex={this.props.index}
128
207
  selected={this.isSubblockSelected(subindex)}
129
208
  {...this.subblockProps}
209
+ onChangeFocus={this.onSubblockChangeFocus}
210
+ isFirst={subindex === 0}
211
+ isLast={subindex === this.state.subblocks?.length - 1}
130
212
  openObjectBrowser={this.props.openObjectBrowser}
213
+ onFocusPreviousBlock={() => {
214
+ this.setState({
215
+ selectedField: 'description',
216
+ subIndexSelected: -1,
217
+ });
218
+ }}
131
219
  />
132
220
  </Col>
133
221
  ))}
@@ -141,7 +229,6 @@ class Edit extends SubblocksEdit {
141
229
  )}
142
230
  </Row>
143
231
  </SubblocksWrapper>
144
-
145
232
  {this.props.data.href && this.props.data.linkMoreTitle && (
146
233
  <div className="link-button text-center my-4">
147
234
  <UniversalLink
@@ -3,8 +3,6 @@ import PropTypes from 'prop-types';
3
3
  import { defineMessages, useIntl } from 'react-intl';
4
4
  import { Segment, Accordion } from 'semantic-ui-react';
5
5
  import { FormattedMessage, injectIntl } from 'react-intl';
6
- import redraft from 'redraft';
7
-
8
6
  import { TextWidget, Icon, ObjectBrowserWidget } from '@plone/volto/components';
9
7
  import upSVG from '@plone/volto/icons/up-key.svg';
10
8
  import downSVG from '@plone/volto/icons/down-key.svg';
@@ -104,13 +102,7 @@ const Sidebar = ({
104
102
  index={index}
105
103
  onClick={() => setSelected(selected === index ? null : index)}
106
104
  >
107
- {subblock.title
108
- ? redraft(
109
- subblock.title,
110
- config.settings.richtextViewSettings.ToHTMLRenderers,
111
- config.settings.richtextViewSettings.ToHTMLOptions,
112
- )
113
- : `Blocco ${index + 1}`}
105
+ {subblock.title ?? `Blocco ${index + 1}`}
114
106
  {selected === index ? (
115
107
  <Icon name={upSVG} size="20px" />
116
108
  ) : (
@@ -5,13 +5,12 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import redraft from 'redraft';
9
8
  import ViewBlock from './Block/ViewBlock';
10
9
  import { Container, Row, Col } from 'design-react-kit';
11
10
  import { flattenToAppURL } from '@plone/volto/helpers';
12
11
  import { UniversalLink } from '@plone/volto/components';
12
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
13
13
  import config from '@plone/volto/registry';
14
- import { checkRedraftHasContent } from 'design-comuni-plone-theme/helpers';
15
14
 
16
15
  /**
17
16
  * View IconsBlock block class.
@@ -41,22 +40,14 @@ const IconsBlockView = ({ data, block }) => {
41
40
  )}
42
41
  <Container className="px-md-4">
43
42
  <div className="block-header">
44
- {checkRedraftHasContent(data.title) && (
43
+ {data.title && (
45
44
  <div className="title">
46
- {redraft(
47
- data.title,
48
- config.settings.richtextViewSettings.ToHTMLRenderers,
49
- config.settings.richtextViewSettings.ToHTMLOptions,
50
- )}
45
+ <h2>{data.title}</h2>
51
46
  </div>
52
47
  )}
53
- {checkRedraftHasContent(data.description) && (
48
+ {data.description && (
54
49
  <div className="description">
55
- {redraft(
56
- data.description,
57
- config.settings.richtextViewSettings.ToHTMLRenderers,
58
- config.settings.richtextViewSettings.ToHTMLOptions,
59
- )}
50
+ <TextBlockView data={{ value: data.description }} />
60
51
  </div>
61
52
  )}
62
53
  </div>
@@ -68,6 +59,7 @@ const IconsBlockView = ({ data, block }) => {
68
59
  key={index}
69
60
  id={id}
70
61
  index={index}
62
+ blockHasTitle={!!data.title}
71
63
  />
72
64
  </Col>
73
65
  ))}
@@ -103,7 +103,6 @@ const CardWithSlideUpTextTemplate = (props) => {
103
103
  {title.substring(0, 50)}
104
104
  </h3>
105
105
  </UniversalLink>
106
-
107
106
  <div className="box-slide-up">
108
107
  {show_description && item.description && (
109
108
  <p>{item.description}</p>
@@ -31,7 +31,7 @@ class EditBlock extends SubblockEdit {
31
31
  * Constructor
32
32
  * @method constructor
33
33
  * @param {Object} props Component properties
34
- * @constructs WysiwygEditor
34
+ * @constructs Numbers Block edit
35
35
  */
36
36
  constructor(props) {
37
37
  super(props);
@@ -51,6 +51,7 @@ class EditBlock extends SubblockEdit {
51
51
  // }
52
52
  // });
53
53
  }
54
+
54
55
  /**
55
56
  * Render method.
56
57
  * @method render
@@ -72,25 +73,36 @@ class EditBlock extends SubblockEdit {
72
73
  }}
73
74
  >
74
75
  <TextEditorWidget
76
+ {...this.props}
77
+ showToolbar={false}
75
78
  data={this.props.data}
76
79
  fieldName="title"
77
80
  selected={this.props.selected && this.state.focusOn === 'title'}
81
+ setSelected={(f) => {
82
+ this.setState({ focusOn: f });
83
+ }}
78
84
  block={this.props.block}
79
- onChangeBlock={this.onChange}
85
+ index={this.props.blockIndex}
86
+ onChangeBlock={(block, _data) => {
87
+ this.props.onChangeBlock(this.props.index, _data);
88
+ }}
80
89
  placeholder={this.props.intl.formatMessage(
81
90
  messages.numberPlaceholder,
82
91
  )}
83
- prevFocus="text"
84
- nextFocus="text"
85
- setFocus={(f) => {
86
- this.setState({ focusOn: f });
92
+ focusPrevField={
93
+ this.props.isFirst
94
+ ? this.props.onFocusPreviousBlock
95
+ : () => {
96
+ this.props.onSubblockChangeFocus(this.props.index - 1);
97
+ }
98
+ }
99
+ focusNextField={() => {
100
+ this.setState({ focusOn: 'text' });
87
101
  }}
88
- showToolbar={false}
89
102
  key="title"
90
103
  />
91
104
  </div>
92
105
  </div>
93
-
94
106
  <div
95
107
  className="subblock-text"
96
108
  onClick={() => {
@@ -98,21 +110,39 @@ class EditBlock extends SubblockEdit {
98
110
  }}
99
111
  >
100
112
  <TextEditorWidget
113
+ {...this.props}
114
+ showToolbar={false}
101
115
  data={this.props.data}
116
+ key="text"
102
117
  fieldName="text"
103
118
  selected={this.props.selected && this.state.focusOn === 'text'}
119
+ setSelected={(f) => {
120
+ if (!this.props.selected) {
121
+ //a11y - per il focus del blocco da tastiera con navigazione inversa
122
+ this.props.onSubblockChangeFocus(this.props.index);
123
+ this.props.onSelectBlock(this.props.block);
124
+ }
125
+ this.setState({ focusOn: f });
126
+ }}
104
127
  block={this.props.block}
105
- onChangeBlock={this.onChange}
128
+ index={this.props.blockIndex}
129
+ onChangeBlock={(block, _data) => {
130
+ this.props.onChangeBlock(this.props.index, _data);
131
+ }}
106
132
  placeholder={this.props.intl.formatMessage(
107
133
  messages.descriptionPlaceholder,
108
134
  )}
109
- prevFocus="title"
110
- nextFocus="title"
111
- setFocus={(f) => {
112
- this.setState({ focusOn: f });
135
+ focusNextField={
136
+ !this.props.isLast
137
+ ? () => {
138
+ this.setState({ focusOn: null });
139
+ this.props.onSubblockChangeFocus(this.props.index + 1);
140
+ }
141
+ : null //default go to next block
142
+ }
143
+ focusPrevField={() => {
144
+ this.setState({ focusOn: 'title' });
113
145
  }}
114
- showToolbar={false}
115
- key="text"
116
146
  />
117
147
  </div>
118
148
  </div>
@@ -5,8 +5,6 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import redraft from 'redraft';
9
- import config from '@plone/volto/registry';
10
8
 
11
9
  /**
12
10
  * ViewBlock class.
@@ -17,23 +15,9 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
17
15
  return (
18
16
  <div className="block-number">
19
17
  {data.title && (
20
- <div className="subblock-title font-monospace">
21
- {redraft(
22
- data.title,
23
- config.settings.richtextViewSettings.ToHTMLRenderers,
24
- config.settings.richtextViewSettings.ToHTMLOptions,
25
- )}
26
- </div>
27
- )}
28
- {data.text && (
29
- <div className="subblock-text">
30
- {redraft(
31
- data.text,
32
- config.settings.richtextViewSettings.ToHTMLRenderers,
33
- config.settings.richtextViewSettings.ToHTMLOptions,
34
- )}
35
- </div>
18
+ <div className="subblock-title font-monospace">{data.title}</div>
36
19
  )}
20
+ {data.text && <div className="subblock-text">{data.text}</div>}
37
21
  </div>
38
22
  );
39
23
  };