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
@@ -38,7 +38,7 @@ class EditBlock extends SubblockEdit {
38
38
  * Constructor
39
39
  * @method constructor
40
40
  * @param {Object} props Component properties
41
- * @constructs WysiwygEditor
41
+ * @constructs Contacts Blocks edit
42
42
  */
43
43
  constructor(props) {
44
44
  super(props);
@@ -52,12 +52,13 @@ class EditBlock extends SubblockEdit {
52
52
  // eslint-disable-next-line no-unused-expressions
53
53
  this.contact_item_ref?.current?.addEventListener('keydown', (e) => {
54
54
  if (e.keyCode === 13) {
55
- if (!(this.state.focusOn === 'text')) {
56
- this.setState({ focusOn: 'text' });
55
+ if (!(this.state.focusOn === 'title')) {
56
+ this.setState({ focusOn: 'title' });
57
57
  }
58
58
  }
59
59
  });
60
60
  }
61
+
61
62
  /**
62
63
  * Render method.
63
64
  * @method render
@@ -69,7 +70,7 @@ class EditBlock extends SubblockEdit {
69
70
  }
70
71
 
71
72
  return (
72
- <Subblock subblock={this} className="subblock-edit">
73
+ <Subblock subblock={this} className="subblock-edit" tabIndex="-1">
73
74
  <Card
74
75
  className="card-bg rounded"
75
76
  noWrapper={false}
@@ -81,104 +82,126 @@ class EditBlock extends SubblockEdit {
81
82
  <CardBody tag="div">
82
83
  <div className="contact-title">
83
84
  {/* eslint-disable */}
84
- <div
85
- onClick={() => {
86
- this.setState({ focusOn: 'title' });
85
+ <TextEditorWidget
86
+ {...this.props}
87
+ index={this.props.blockIndex}
88
+ key="title"
89
+ showToolbar={false}
90
+ data={this.props.data}
91
+ fieldName="title"
92
+ onChangeBlock={(block, _data) => {
93
+ this.props.onChangeBlock(this.props.index, _data);
87
94
  }}
88
- >
89
- <TextEditorWidget
90
- data={this.props.data}
91
- fieldName="title"
92
- selected={
93
- this.props.selected && this.state.focusOn === 'title'
94
- }
95
- block={this.props.block}
96
- onChangeBlock={this.onChange}
97
- placeholder={this.props.intl.formatMessage(
98
- messages.titlePlaceholder,
99
- )}
100
- nextFocus="text"
101
- setFocus={(f) => {
102
- this.setState({ focusOn: f });
103
- }}
104
- showToolbar={false}
105
- key="title"
106
- />
107
- </div>
95
+ placeholder={this.props.intl.formatMessage(
96
+ messages.titlePlaceholder,
97
+ )}
98
+ selected={this.props.selected && this.state.focusOn === 'title'}
99
+ setSelected={(f) => {
100
+ this.setState({ focusOn: f });
101
+ }}
102
+ focusNextField={() => {
103
+ this.setState({ focusOn: 'text' });
104
+ }}
105
+ focusPrevField={
106
+ this.props.isFirst
107
+ ? this.props.onFocusPreviousBlock
108
+ : () => {
109
+ this.props.onSubblockChangeFocus(this.props.index - 1);
110
+ }
111
+ }
112
+ />
108
113
  </div>
109
114
 
110
- <div
111
- className="contact-text"
112
- onClick={() => {
113
- this.setState({ focusOn: 'text' });
114
- }}
115
- >
115
+ <div className="contact-text">
116
116
  <TextEditorWidget
117
+ {...this.props}
118
+ index={this.props.blockIndex}
119
+ key="text"
117
120
  data={this.props.data}
118
121
  fieldName="text"
119
- selected={this.props.selected && this.state.focusOn === 'text'}
120
- block={this.props.block}
121
- onChangeBlock={this.onChange}
122
122
  placeholder={this.props.intl.formatMessage(
123
123
  messages.textPlaceholder,
124
124
  )}
125
- prevFocus="title"
126
- nextFocus="tel"
127
- setFocus={(f) => {
125
+ onChangeBlock={(block, _data) => {
126
+ this.props.onChangeBlock(this.props.index, _data);
127
+ }}
128
+ selected={this.props.selected && this.state.focusOn === 'text'}
129
+ setSelected={(f) => {
128
130
  this.setState({ focusOn: f });
129
131
  }}
130
- key="text"
132
+ focusPrevField={() => {
133
+ this.setState({ focusOn: 'title' });
134
+ }}
135
+ focusNextField={() => {
136
+ this.setState({ focusOn: 'tel' });
137
+ }}
131
138
  />
132
139
  </div>
133
140
 
134
- <div
135
- className="contact-info"
136
- onClick={() => {
137
- this.setState({ focusOn: 'tel' });
138
- }}
139
- >
141
+ <div className="contact-info">
140
142
  <div className="icon-wrapper">
141
143
  <Icon icon="phone-alt" />
142
144
  </div>
143
145
  <TextEditorWidget
146
+ {...this.props}
147
+ index={this.props.blockIndex}
148
+ key="tel"
144
149
  data={this.props.data}
145
150
  fieldName="tel"
151
+ wrapClass="tel"
146
152
  selected={this.props.selected && this.state.focusOn === 'tel'}
147
- block={this.props.block}
148
- onChangeBlock={this.onChange}
153
+ onChangeBlock={(block, _data) => {
154
+ this.props.onChangeBlock(this.props.index, _data);
155
+ }}
149
156
  placeholder={this.props.intl.formatMessage(
150
157
  messages.textPlaceholder,
151
158
  )}
152
- prevFocus="text"
153
- setFocus={(f) => {
154
- this.setState({ focusOn: f });
159
+ setSelected={(f) => this.setState({ focusOn: f })}
160
+ focusPrevField={() => {
161
+ this.setState({ focusOn: 'text' });
162
+ }}
163
+ focusNextField={() => {
164
+ this.setState({ focusOn: 'email' });
155
165
  }}
156
- key="tel"
157
166
  />
158
167
  </div>
159
- <div
160
- className="contact-info"
161
- onClick={() => {
162
- this.setState({ focusOn: 'email' });
163
- }}
164
- >
168
+ <div className="contact-info">
165
169
  <div className="icon-wrapper">
166
170
  <Icon icon="envelope" />
167
171
  </div>
168
172
  <TextEditorWidget
173
+ {...this.props}
174
+ index={this.props.blockIndex}
175
+ key="email"
176
+ wrapClass="email"
169
177
  data={this.props.data}
170
178
  fieldName="email"
171
179
  selected={this.props.selected && this.state.focusOn === 'email'}
172
- block={this.props.block}
173
- onChangeBlock={this.onChange}
180
+ onChangeBlock={(block, _data) => {
181
+ this.props.onChangeBlock(this.props.index, _data);
182
+ }}
174
183
  placeholder={this.props.intl.formatMessage(
175
184
  messages.textPlaceholder,
176
185
  )}
177
- prevFocus="email"
178
- setFocus={(f) => {
186
+ setSelected={(f) => {
187
+ if (!this.props.selected) {
188
+ //a11y - per il focus del blocco da tastiera con navigazione inversa
189
+ this.props.onSubblockChangeFocus(this.props.index);
190
+ this.props.onSelectBlock(this.props.block);
191
+ }
179
192
  this.setState({ focusOn: f });
180
193
  }}
181
- key="email"
194
+ focusPrevField={() => {
195
+ this.setState({ focusOn: 'tel' });
196
+ }}
197
+ focusNextField={
198
+ !this.props.isLast
199
+ ? () => {
200
+ this.setState({ focusOn: null });
201
+ this.props.onSubblockChangeFocus(this.props.index + 1);
202
+ }
203
+ : null //default go to next block
204
+ }
182
205
  />
183
206
  </div>
184
207
  </CardBody>
@@ -5,12 +5,10 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import redraft from 'redraft';
9
-
10
- import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
11
8
  import { Card, CardBody } from 'design-react-kit';
12
- import config from '@plone/volto/registry';
13
- import { checkRedraftHasContent } from 'design-comuni-plone-theme/helpers';
9
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
10
+ import { checkRichTextHasContent } from 'design-comuni-plone-theme/helpers';
11
+ import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
14
12
 
15
13
  /**
16
14
  * ViewBlock class.
@@ -18,6 +16,16 @@ import { checkRedraftHasContent } from 'design-comuni-plone-theme/helpers';
18
16
  * @extends Component
19
17
  */
20
18
  const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
19
+ const text = checkRichTextHasContent(data.text) ? (
20
+ <TextBlockView data={{ value: data.text }} />
21
+ ) : null;
22
+ const tel = checkRichTextHasContent(data.tel) ? (
23
+ <TextBlockView data={{ value: data.tel }} />
24
+ ) : null;
25
+ const email = checkRichTextHasContent(data.email) ? (
26
+ <TextBlockView data={{ value: data.email }} />
27
+ ) : null;
28
+
21
29
  return (
22
30
  <Card
23
31
  className="card-bg rounded subblock-view "
@@ -26,52 +34,24 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
26
34
  tag="div"
27
35
  >
28
36
  <CardBody tag="div">
29
- {checkRedraftHasContent(data.title) && (
30
- <div className="contact-title">
31
- {redraft(
32
- data.title,
33
- config.settings.richtextViewSettings.ToHTMLRenderers,
34
- config.settings.richtextViewSettings.ToHTMLOptions,
35
- )}
36
- </div>
37
- )}
38
- {checkRedraftHasContent(data.text) && (
39
- <div className="contact-text">
40
- {redraft(
41
- data.text,
42
- config.settings.richtextViewSettings.ToHTMLRenderers,
43
- config.settings.richtextViewSettings.ToHTMLOptions,
44
- )}
45
- </div>
46
- )}
37
+ {data.title && <div className="contact-title">{data.title}</div>}
38
+ {text && <div className="contact-text">{text}</div>}
47
39
 
48
- {checkRedraftHasContent(data.tel) && (
40
+ {tel && (
49
41
  <div className="contact-info">
50
42
  <div className="icon-wrapper">
51
43
  <Icon icon="phone-alt" />
52
44
  </div>
53
- <div className="tel">
54
- {redraft(
55
- data.tel,
56
- config.settings.richtextViewSettings.ToHTMLRenderers,
57
- config.settings.richtextViewSettings.ToHTMLOptions,
58
- )}
59
- </div>
45
+ <div className="tel">{tel}</div>
60
46
  </div>
61
47
  )}
62
48
 
63
- {checkRedraftHasContent(data.email) && (
49
+ {email && (
64
50
  <div className="contact-info">
65
51
  <div className="icon-wrapper">
66
52
  <Icon icon="envelope" />
67
53
  </div>
68
- <div className="email">
69
- {redraft(
70
- data.email,
71
- config.settings.richtextViewSettings.ToHTMLRenderers,
72
- config.settings.richtextViewSettings.ToHTMLOptions,
73
- )}
74
- </div>
54
+ <div className="email">{email}</div>
75
55
  </div>
76
56
  )}
77
57
  </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,
@@ -44,7 +44,71 @@ class Edit extends SubblocksEdit {
44
44
  constructor(props) {
45
45
  super(props);
46
46
  this.state.selectedField = 'title';
47
+ this.nodeF = React.createRef();
48
+ }
49
+
50
+ UNSAFE_componentWillReceiveProps(newProps) {
51
+ if (newProps.selected) {
52
+ if (!this.props.selected) {
53
+ if (!this.state.selectedField && this.state.subIndexSelected < 0) {
54
+ //a11y - test subIndexSelected<0 per gestire il focus con navigazione da tastiera al contrario (dal blocco successivo a questo blocco)
55
+ this.setState({ selectedField: 'title' });
56
+ }
57
+ }
58
+ } else {
59
+ this.setState({ selectedField: null });
60
+ }
61
+ }
62
+
63
+ handleEnter = (e) => {
64
+ if (
65
+ this.props.selected &&
66
+ this.state.subIndexSelected < 0 &&
67
+ !this.state.selectedField
68
+ ) {
69
+ handleKeyDownOwnFocusManagement(e, this.props);
70
+ }
71
+ };
72
+
73
+ handleClick = (e) => {
74
+ const hasParent = (element, className) => {
75
+ if (!element.parentNode) {
76
+ return false;
77
+ }
78
+
79
+ if (element.classList.contains(className)) {
80
+ return true;
81
+ }
82
+
83
+ return hasParent(element.parentNode, className);
84
+ };
85
+ const clickOutsideSubblocks =
86
+ !e.target.classList.contains('volto-subblocks-wrapper') &&
87
+ !hasParent(e.target, 'volto-subblocks-wrapper');
88
+
89
+ if (clickOutsideSubblocks) {
90
+ this.setState({ subIndexSelected: -1 });
91
+ }
92
+ };
93
+
94
+ componentDidMount() {
95
+ if (this.props.selected && this.node) {
96
+ this.node.focus();
97
+ }
98
+ if (this.props.selected && this.nodeF.current) {
99
+ this.nodeF.current.focus();
100
+ }
101
+
102
+ if (this.state.subblocks.length === 0) {
103
+ this.addSubblock();
104
+ }
105
+
106
+ if (this.nodeF && this.nodeF.current) {
107
+ this.nodeF.current.addEventListener('keydown', this.handleEnter, false);
108
+ this.nodeF.current.addEventListener('click', this.handleClick, false);
109
+ }
47
110
  }
111
+
48
112
  /**
49
113
  * Render method.
50
114
  * @method render
@@ -56,29 +120,33 @@ class Edit extends SubblocksEdit {
56
120
  }
57
121
 
58
122
  return (
59
- <div className="public-ui">
123
+ <div className="public-ui" tabIndex="-1" ref={this.nodeF}>
60
124
  <div
61
125
  className={`full-width section bg-${
62
126
  this.props.data.bg_color ?? 'primary'
63
127
  } py-5`}
128
+ role="form"
129
+ aria-label={this.props.blocksConfig[this.props.type].title}
64
130
  >
65
131
  <Container className="px-md-4">
66
132
  <div className="block-header">
67
133
  <div className="title">
68
134
  <TextEditorWidget
135
+ {...this.props}
136
+ key="title"
137
+ showToolbar={false}
69
138
  data={this.props.data}
70
139
  fieldName="title"
71
140
  selected={this.state.selectedField === 'title'}
72
- block={this.props.block}
73
- onChangeBlock={(data) => {
74
- this.props.onChangeBlock(this.props.block, {
75
- ...data,
76
- });
77
- }}
78
141
  placeholder={this.props.intl.formatMessage(messages.title)}
79
- showToolbar={false}
80
- onSelectBlock={() => {}}
81
- onAddBlock={() => {
142
+ setSelected={(f) => {
143
+ this.setState({ selectedField: f, subIndexSelected: -1 });
144
+ if (!this.props.selected) {
145
+ //a11y - per il focus del blocco da tastiera
146
+ this.props.onSelectBlock(this.props.block);
147
+ }
148
+ }}
149
+ focusNextField={() => {
82
150
  this.setState({ selectedField: 'description' });
83
151
  }}
84
152
  />
@@ -86,21 +154,23 @@ class Edit extends SubblocksEdit {
86
154
 
87
155
  <div className="description">
88
156
  <TextEditorWidget
157
+ {...this.props}
158
+ key="description"
89
159
  data={this.props.data}
90
160
  fieldName="description"
91
161
  selected={this.state.selectedField === 'description'}
92
- block={this.props.block}
93
- onChangeBlock={(data) =>
94
- this.props.onChangeBlock(this.props.block, {
95
- ...data,
96
- })
97
- }
98
162
  placeholder={this.props.intl.formatMessage(
99
163
  messages.description,
100
164
  )}
101
- showToolbar={true}
102
- onSelectBlock={() => {}}
103
- onAddBlock={() => {}}
165
+ setSelected={(f) => {
166
+ this.setState({ selectedField: f, subIndexSelected: -1 });
167
+ }}
168
+ focusPrevField={() => {
169
+ this.setState({ selectedField: 'title' });
170
+ }}
171
+ focusNextField={() => {
172
+ this.setState({ selectedField: null, subIndexSelected: 0 });
173
+ }}
104
174
  />
105
175
  </div>
106
176
  </div>
@@ -116,11 +186,21 @@ class Edit extends SubblocksEdit {
116
186
  {this.state.subblocks.map((subblock, subindex) => (
117
187
  <Col lg="4" key={subblock.id} className="pb-3">
118
188
  <EditBlock
189
+ {...this.props}
119
190
  data={subblock}
120
191
  index={subindex}
192
+ blockIndex={this.props.index}
121
193
  selected={this.isSubblockSelected(subindex)}
122
194
  {...this.subblockProps}
123
- openObjectBrowser={this.props.openObjectBrowser}
195
+ onChangeFocus={this.onSubblockChangeFocus}
196
+ isLast={subindex === this.state.subblocks.length - 1}
197
+ isFirst={subindex === 0}
198
+ onFocusPreviousBlock={() => {
199
+ this.setState({
200
+ selectedField: 'description',
201
+ subIndexSelected: -1,
202
+ });
203
+ }}
124
204
  />
125
205
  </Col>
126
206
  ))}
@@ -134,7 +214,6 @@ class Edit extends SubblocksEdit {
134
214
  )}
135
215
  </Row>
136
216
  </SubblocksWrapper>
137
-
138
217
  {this.props.data.href && this.props.data.linkMoreTitle && (
139
218
  <div className="link-button text-center my-4">
140
219
  <UniversalLink
@@ -5,43 +5,35 @@
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';
13
- import config from '@plone/volto/registry';
14
-
12
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
15
13
  /**
16
14
  * View Accordion block class.
17
15
  * @class View
18
16
  * @extends Component
19
17
  */
20
- const AccordionView = ({ data, block }) => {
21
- const id = new Date().getTime();
18
+ const AccordionView = ({ data, block, id }) => {
19
+ const now = new Date().getTime();
22
20
  return (
23
- <div className="block contacts">
21
+ <div className="block contacts" id={id}>
24
22
  <div className="public-ui">
25
23
  <div
26
24
  className={`full-width section bg-${data.bg_color ?? 'primary'} py-5`}
27
25
  >
28
26
  <Container className="px-md-4">
29
- <div className="block-header">
30
- <div className="title">
31
- {redraft(
32
- data.title,
33
- config.settings.richtextViewSettings.ToHTMLRenderers,
34
- config.settings.richtextViewSettings.ToHTMLOptions,
35
- )}
36
- </div>
37
- <div className="description">
38
- {redraft(
39
- data.description,
40
- config.settings.richtextViewSettings.ToHTMLRenderers,
41
- config.settings.richtextViewSettings.ToHTMLOptions,
27
+ {(data.title || data.description) && (
28
+ <div className="block-header">
29
+ {data.title && <div className="title">{data.title}</div>}
30
+ {data.description && (
31
+ <div className="description">
32
+ <TextBlockView id={id} data={{ value: data.description }} />
33
+ </div>
42
34
  )}
43
35
  </div>
44
- </div>
36
+ )}
45
37
  <Row
46
38
  className={
47
39
  data.subblocks.length > 3
@@ -54,7 +46,7 @@ const AccordionView = ({ data, block }) => {
54
46
  <ViewBlock
55
47
  data={subblock}
56
48
  key={index}
57
- id={id}
49
+ id={now}
58
50
  index={index}
59
51
  />
60
52
  </Col>
@@ -8,6 +8,7 @@ import cx from 'classnames';
8
8
  import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
9
9
  import Sidebar from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/CountDown/Sidebar';
10
10
  import CountDown from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/CountDown/CountDown';
11
+ import { useHandleDetachedBlockFocus } from 'design-comuni-plone-theme/helpers/blocks';
11
12
 
12
13
  const messages = defineMessages({
13
14
  text: {
@@ -17,20 +18,16 @@ const messages = defineMessages({
17
18
  });
18
19
 
19
20
  const Edit = (props) => {
20
- const {
21
- data,
22
- block,
23
- onChangeBlock,
24
- selected,
25
- onSelectBlock,
26
- onAddBlock,
27
- index,
28
- } = props;
21
+ const { data, block, selected, ...otherProps } = props;
29
22
  const intl = useIntl();
23
+ const { selectedField, setSelectedField } = useHandleDetachedBlockFocus(
24
+ props,
25
+ 'text',
26
+ );
30
27
 
31
28
  return (
32
29
  <>
33
- <div className="public-ui">
30
+ <div className="public-ui" tabIndex="-1">
34
31
  <div
35
32
  className={cx('block-content', { 'full-width': data.showFullWidth })}
36
33
  >
@@ -68,17 +65,16 @@ const Edit = (props) => {
68
65
  className="text"
69
66
  >
70
67
  <TextEditorWidget
68
+ {...otherProps}
71
69
  data={data}
72
70
  fieldName="text"
73
- selected={selected}
71
+ selected={selected && selectedField === 'text'}
74
72
  block={block}
75
- onChangeBlock={(data) => onChangeBlock(block, data)}
76
73
  placeholder={intl.formatMessage(messages.text)}
77
- showToolbar={true}
78
- onSelectBlock={onSelectBlock}
79
- onAddBlock={onAddBlock}
80
- index={index}
81
- disableMoveToNearest={true}
74
+ setSelected={setSelectedField}
75
+ focusNextField={() => {
76
+ setSelectedField('countdown_text');
77
+ }}
82
78
  />
83
79
  </Col>
84
80
  <Col
@@ -99,17 +95,17 @@ const Edit = (props) => {
99
95
  showSeconds={data.showSeconds}
100
96
  />
101
97
  <TextEditorWidget
98
+ {...otherProps}
99
+ showToolbar={true}
102
100
  data={data}
103
- fieldName="countdown_text"
104
- selected={selected}
105
101
  block={block}
106
- onChangeBlock={(data) => onChangeBlock(block, data)}
102
+ fieldName="countdown_text"
103
+ selected={selected && selectedField === 'countdown_text'}
107
104
  placeholder={intl.formatMessage(messages.text)}
108
- showToolbar={true}
109
- onSelectBlock={onSelectBlock}
110
- onAddBlock={onAddBlock}
111
- index={index}
112
- disableMoveToNearest={true}
105
+ setSelected={setSelectedField}
106
+ focusPrevField={() => {
107
+ setSelectedField('text');
108
+ }}
113
109
  />
114
110
  </Col>
115
111
  </Row>