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
package/publiccode.yml CHANGED
@@ -227,9 +227,9 @@ maintenance:
227
227
  name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici
228
228
  platforms:
229
229
  - web
230
- releaseDate: '2025-03-26'
230
+ releaseDate: '2025-03-31'
231
231
  softwareType: standalone/web
232
- softwareVersion: 11.29.2
232
+ softwareVersion: 12.0.0
233
233
  url: 'https://github.com/italia/design-comuni-plone-theme'
234
234
  usedBy:
235
235
  - ASP Comuni Modenesi Area Nord
@@ -59,6 +59,7 @@ const Collapse = ({
59
59
  className="overlay"
60
60
  style={{ display: isOpen ? 'block' : 'none' }}
61
61
  onClick={onOverlayClick}
62
+ onKeyDown={() => {}}
62
63
  ></div>
63
64
  {/* Deprecato - non viene più utilizzato da v12.0.0 per ragioni di accessibilità
64
65
  Close button ora presente in Navigation.jsx
@@ -5,20 +5,16 @@ CUSTOMIZATIONS:
5
5
 
6
6
  import React from 'react';
7
7
  import { useIntl } from 'react-intl';
8
- import { useSelector } from 'react-redux';
9
8
  import { Helmet } from '@plone/volto/helpers';
10
9
  import { SiteProperty } from 'volto-site-settings';
11
10
  import { getSiteProperty } from 'design-comuni-plone-theme/helpers';
12
11
 
13
12
  const SiteSettingsExtras = (props) => {
14
13
  const intl = useIntl();
15
- const subsite = useSelector((state) => state.subsite?.data);
16
14
  let siteTitle = SiteProperty({
17
15
  property: 'site_title',
18
16
  getValue: true,
19
17
  defaultValue: getSiteProperty('siteTitle', intl.locale),
20
- // TODO DEPRECATED: remove and only use defaultValue in v12
21
- forceValue: subsite?.title || getSiteProperty('siteTitle', intl.locale),
22
18
  });
23
19
 
24
20
  const parentSiteTitle = SiteProperty({
@@ -26,8 +22,6 @@ const SiteSettingsExtras = (props) => {
26
22
  getValue: true,
27
23
  getParent: true,
28
24
  defaultValue: getSiteProperty('siteTitle', intl.locale),
29
- // TODO DEPRECATED: remove and only use defaultValue in v12
30
- forceValue: getSiteProperty('siteTitle', intl.locale),
31
25
  });
32
26
 
33
27
  if (parentSiteTitle !== siteTitle) {
@@ -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 Accordion Edit
42
42
  */
43
43
  constructor(props) {
44
44
  super(props);
@@ -87,30 +87,33 @@ class EditBlock extends SubblockEdit {
87
87
  }}
88
88
  >
89
89
  <TextEditorWidget
90
+ {...this.props}
91
+ key="title"
92
+ showToolbar={false}
90
93
  data={this.props.data}
91
94
  fieldName="title"
92
- selected={this.props.selected && this.state.focusOn === 'title'}
93
- block={this.props.block}
94
- onChangeBlock={this.onChange}
95
+ onChangeBlock={(block, _data) => {
96
+ this.onChange(_data);
97
+ }}
95
98
  placeholder={this.props.intl.formatMessage(
96
99
  messages.titlePlaceholder,
97
100
  )}
98
- onSelectBlock={() => {}}
99
- onAddBlock={() => {
100
- this.setState({ focusOn: 'text' });
101
+ selected={this.props.selected && this.state.focusOn === 'title'}
102
+ setSelected={(f) => {
103
+ this.setState({
104
+ focusOn: f,
105
+ });
101
106
  }}
102
- onFocusNextBlock={() => {
107
+ focusNextField={() => {
103
108
  this.setState({ focusOn: 'text' });
104
109
  }}
105
- onFocusPreviousBlock={
110
+ focusPrevField={
106
111
  this.props.isFirst
107
112
  ? this.props.onFocusPreviousBlock
108
113
  : () => {
109
114
  this.props.onSubblockChangeFocus(this.props.index - 1);
110
115
  }
111
116
  }
112
- showToolbar={false}
113
- key="title"
114
117
  />
115
118
  </div>
116
119
  </h3>
@@ -123,31 +126,33 @@ class EditBlock extends SubblockEdit {
123
126
  >
124
127
  <div className="accordion-inner">
125
128
  <TextEditorWidget
129
+ {...this.props}
130
+ key="text"
126
131
  data={this.props.data}
127
132
  fieldName="text"
128
133
  selected={
129
134
  this.props.selected && this.state.focusOn === 'text'
130
135
  }
131
- block={this.props.block}
132
- onChangeBlock={this.onChange}
133
136
  placeholder={this.props.intl.formatMessage(
134
137
  messages.textPlaceholder,
135
138
  )}
136
- onAddBlock={this.props.onFocusNextBlock}
137
- onFocusNextBlock={
138
- this.props.isLast
139
- ? this.props.onFocusNextBlock
140
- : () => {
141
- this.setState({ focusOn: null });
142
- this.props.onSubblockChangeFocus(
143
- this.props.index + 1,
144
- );
139
+ onChangeBlock={(block, _data) => {
140
+ this.onChange(_data);
141
+ }}
142
+ setSelected={(f) => this.setState({ focusOn: f })}
143
+ focusNextField={
144
+ !this.props.isLast
145
+ ? () => {
146
+ this.setState({
147
+ focusOn: null,
148
+ subIndexSelected: this.props.index + 1,
149
+ });
145
150
  }
151
+ : null //default go to next block
146
152
  }
147
- onFocusPreviousBlock={() => {
153
+ focusPrevField={() => {
148
154
  this.setState({ focusOn: 'title' });
149
155
  }}
150
- key="text"
151
156
  />
152
157
  </div>
153
158
  {this.props.data.href && (
@@ -5,12 +5,11 @@
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 cx from 'classnames';
11
10
  import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
12
11
  import { UniversalLink } from '@plone/volto/components';
13
- import config from '@plone/volto/registry';
12
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
14
13
 
15
14
  const messages = defineMessages({
16
15
  vedi: {
@@ -34,6 +33,7 @@ const messages = defineMessages({
34
33
  */
35
34
  const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
36
35
  const intl = useIntl();
36
+
37
37
  return (
38
38
  <div className="accordion-item subblock-view">
39
39
  {data.title && (
@@ -55,11 +55,7 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
55
55
  }
56
56
  />
57
57
 
58
- {redraft(
59
- data.title,
60
- config.settings.richtextViewSettings.ToHTMLRenderers,
61
- config.settings.richtextViewSettings.ToHTMLOptions,
62
- )}
58
+ {data.title}
63
59
  </button>
64
60
  </h3>
65
61
  )}
@@ -73,11 +69,7 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
73
69
  hidden={!isOpen}
74
70
  >
75
71
  <div className="accordion-inner">
76
- {redraft(
77
- data.text,
78
- config.settings.richtextViewSettings.ToHTMLRenderers,
79
- config.settings.richtextViewSettings.ToHTMLOptions,
80
- )}
72
+ <TextBlockView id={id} data={{ value: data.text }} />
81
73
  </div>
82
74
  {data.href && (
83
75
  <div className="link-more">
@@ -12,14 +12,14 @@ import {
12
12
  SubblocksEdit,
13
13
  SubblocksWrapper,
14
14
  } from 'volto-subblocks';
15
+ import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
15
16
 
16
17
  import { SidebarPortal } from '@plone/volto/components';
18
+ import { handleKeyDownOwnFocusManagement } from 'design-comuni-plone-theme/helpers/blocks';
17
19
  import Sidebar from './Sidebar.jsx';
18
20
 
19
21
  import { defineMessages } from 'react-intl';
20
22
 
21
- import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
22
-
23
23
  const messages = defineMessages({
24
24
  addItem: {
25
25
  id: 'Add accordion item',
@@ -40,6 +40,68 @@ const messages = defineMessages({
40
40
  * @extends Component
41
41
  */
42
42
  class Edit extends SubblocksEdit {
43
+ constructor(props) {
44
+ super(props);
45
+ this.nodeF = React.createRef();
46
+ }
47
+
48
+ UNSAFE_componentWillReceiveProps(newProps) {
49
+ if (newProps.selected) {
50
+ if (!this.props.selected) {
51
+ if (this.state.subIndexSelected < 0) {
52
+ this.onSubblockChangeFocus(0);
53
+ }
54
+ }
55
+ } else {
56
+ this.onSubblockChangeFocus(-1);
57
+ }
58
+ }
59
+
60
+ handleEnter = (e) => {
61
+ if (this.props.selected && this.state.subIndexSelected < 0) {
62
+ handleKeyDownOwnFocusManagement(e, this.props);
63
+ }
64
+ };
65
+
66
+ handleClick = (e) => {
67
+ const hasParent = (element, className) => {
68
+ if (!element.parentNode) {
69
+ return false;
70
+ }
71
+
72
+ if (element.classList.contains(className)) {
73
+ return true;
74
+ }
75
+
76
+ return hasParent(element.parentNode, className);
77
+ };
78
+ const clickOutsideSubblocks =
79
+ !e.target.classList.contains('volto-subblocks-wrapper') &&
80
+ !hasParent(e.target, 'volto-subblocks-wrapper');
81
+
82
+ if (clickOutsideSubblocks) {
83
+ this.setState({ subIndexSelected: -1 });
84
+ }
85
+ };
86
+
87
+ componentDidMount() {
88
+ if (this.props.selected && this.node) {
89
+ this.node.focus();
90
+ }
91
+ if (this.props.selected && this.nodeF.current) {
92
+ this.nodeF.current.focus();
93
+ }
94
+
95
+ if (this.state.subblocks.length === 0) {
96
+ this.addSubblock();
97
+ }
98
+
99
+ if (this.nodeF && this.nodeF.current) {
100
+ this.nodeF.current.addEventListener('keydown', this.handleEnter, false);
101
+ this.nodeF.current.addEventListener('click', this.handleClick, false);
102
+ }
103
+ }
104
+
43
105
  /**
44
106
  * Render method.
45
107
  * @method render
@@ -50,60 +112,74 @@ class Edit extends SubblocksEdit {
50
112
  return <div />;
51
113
  }
52
114
  return (
53
- <div className="public-ui">
115
+ <div className="public-ui" tabIndex="-1" ref={this.nodeF}>
54
116
  <div className="full-width section section-muted section-inset-shadow py-5 is-edit-mode">
55
117
  <Container className="px-md-4">
56
118
  <Card className="card-bg rounded" noWrapper={false} space tag="div">
119
+ <div className="block-header">
120
+ <div className="title">
121
+ <TextEditorWidget
122
+ {...this.props}
123
+ showToolbar={false}
124
+ data={this.props.data}
125
+ key={'title'}
126
+ fieldName="title"
127
+ selected={this.state.selectedField === 'title'}
128
+ setSelected={(f) => {
129
+ this.setState({
130
+ selectedField: f,
131
+ subIndexSelected: -1,
132
+ });
133
+ }}
134
+ placeholder={this.props.intl.formatMessage(messages.title)}
135
+ focusNextField={() => {
136
+ this.setState({ selectedField: 'description' });
137
+ }}
138
+ />
139
+ </div>
140
+
141
+ <div className="description">
142
+ <TextEditorWidget
143
+ {...this.props}
144
+ showToolbar={true}
145
+ data={this.props.data}
146
+ fieldName="description"
147
+ selected={this.state.selectedField === 'description'}
148
+ setSelected={(f) => {
149
+ this.setState({
150
+ selectedField: f,
151
+ subIndexSelected: -1,
152
+ });
153
+ }}
154
+ placeholder={this.props.intl.formatMessage(
155
+ messages.description,
156
+ )}
157
+ focusPrevField={() => {
158
+ this.setState({ selectedField: 'title' });
159
+ }}
160
+ focusNextField={() => {
161
+ this.setState({
162
+ selectedField: null,
163
+ subIndexSelected: 0,
164
+ });
165
+ }}
166
+ />
167
+ </div>
168
+ </div>
57
169
  <CardBody tag="div">
58
- <TextEditorWidget
59
- data={this.props.data}
60
- fieldName="title"
61
- selected={this.state.selectedField === 'title'}
62
- block={this.props.block}
63
- onChangeBlock={(data) => {
64
- this.props.onChangeBlock(this.props.block, {
65
- ...data,
66
- });
67
- }}
68
- placeholder={this.props.intl.formatMessage(messages.title)}
69
- showToolbar={false}
70
- onSelectBlock={() => {}}
71
- onAddBlock={() => {
72
- this.setState({ selectedField: 'description' });
73
- }}
74
- />
75
- <TextEditorWidget
76
- data={this.props.data}
77
- fieldName="description"
78
- selected={this.state.selectedField === 'description'}
79
- block={this.props.block}
80
- onChangeBlock={(data) =>
81
- this.props.onChangeBlock(this.props.block, {
82
- ...data,
83
- })
84
- }
85
- placeholder={this.props.intl.formatMessage(
86
- messages.description,
87
- )}
88
- showToolbar={true}
89
- onSelectBlock={() => {}}
90
- onAddBlock={() => {}}
91
- />
92
170
  <SubblocksWrapper node={this.node}>
93
171
  {this.state.subblocks.map((subblock, subindex) => (
94
172
  <div className="accordion-item" key={subblock.id}>
95
173
  <EditBlock
174
+ {...this.props}
175
+ {...this.subblockProps}
176
+ onChangeFocus={this.onSubblockChangeFocus}
96
177
  data={subblock}
97
178
  index={subindex}
98
179
  selected={
99
180
  this.props.selected &&
100
181
  this.isSubblockSelected(subindex)
101
182
  }
102
- {...this.subblockProps}
103
- openObjectBrowser={this.props.openObjectBrowser}
104
- onFocusPreviousBlock={this.props.onFocusPreviousBlock}
105
- onFocusNextBlock={this.props.onFocusNextBlock}
106
- onSubblockChangeFocus={this.onSubblockChangeFocus}
107
183
  isLast={this.state.subblocks.length - 1 === subindex}
108
184
  isFirst={subindex === 0}
109
185
  />
@@ -6,10 +6,8 @@
6
6
  import React, { useState } from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import ViewBlock from './Block/ViewBlock';
9
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
9
10
  import { Container, Card, CardBody } from 'design-react-kit';
10
- import redraft from 'redraft';
11
- import config from '@plone/volto/registry';
12
- import { checkRedraftHasContent } from 'design-comuni-plone-theme/helpers';
13
11
 
14
12
  /**
15
13
  * View Accordion block class.
@@ -29,22 +27,10 @@ const AccordionView = ({ data, block }) => {
29
27
  <Container className="px-md-4">
30
28
  <Card className="card-bg rounded" noWrapper={false} space tag="div">
31
29
  <div className="block-header">
32
- {checkRedraftHasContent(data.title) && (
33
- <div className="title">
34
- {redraft(
35
- data.title,
36
- config.settings.richtextViewSettings.ToHTMLRenderers,
37
- config.settings.richtextViewSettings.ToHTMLOptions,
38
- )}
39
- </div>
40
- )}
41
- {checkRedraftHasContent(data.description) && (
30
+ {data.title && <div className="title">{data.title}</div>}
31
+ {data.description && (
42
32
  <div className="description">
43
- {redraft(
44
- data.description,
45
- config.settings.richtextViewSettings.ToHTMLRenderers,
46
- config.settings.richtextViewSettings.ToHTMLOptions,
47
- )}
33
+ <TextBlockView data={{ value: data.description }} />
48
34
  </div>
49
35
  )}
50
36
  </div>
@@ -3,18 +3,14 @@
3
3
  * @module components/manage/Blocks/Image/Edit
4
4
  */
5
5
 
6
- import React, { Component } from 'react';
7
- import PropTypes from 'prop-types';
8
- import { connect } from 'react-redux';
9
- import { compose } from 'redux';
6
+ import React, { useEffect } from 'react';
10
7
 
11
8
  import cx from 'classnames';
12
9
  import { Container, Row, Col } from 'design-react-kit';
13
10
 
14
- import { createContent } from '@plone/volto/actions';
15
11
  import { SidebarPortal } from '@plone/volto/components';
16
- import { defineMessages, injectIntl } from 'react-intl';
17
-
12
+ import { defineMessages, useIntl } from 'react-intl';
13
+ import { useHandleDetachedBlockFocus } from 'design-comuni-plone-theme/helpers/blocks';
18
14
  import {
19
15
  AlertSidebar,
20
16
  TextEditorWidget,
@@ -26,116 +22,67 @@ const messages = defineMessages({
26
22
  defaultMessage: 'Digita il testo…',
27
23
  },
28
24
  });
29
- /**
30
- * Edit Alert block class.
31
- * @class Edit
32
- * @extends Component
33
- */
34
- class Edit extends Component {
35
- /**
36
- * Property types.
37
- * @property {Object} propTypes Property types.
38
- * @static
39
- */
40
- static propTypes = {
41
- selected: PropTypes.bool.isRequired,
42
- block: PropTypes.string.isRequired,
43
- index: PropTypes.number.isRequired,
44
- data: PropTypes.objectOf(PropTypes.any).isRequired,
45
- content: PropTypes.objectOf(PropTypes.any).isRequired,
46
- request: PropTypes.shape({
47
- loading: PropTypes.bool,
48
- loaded: PropTypes.bool,
49
- }).isRequired,
50
- pathname: PropTypes.string.isRequired,
51
- onChangeBlock: PropTypes.func.isRequired,
52
- onSelectBlock: PropTypes.func.isRequired,
53
- onDeleteBlock: PropTypes.func.isRequired,
54
- onFocusPreviousBlock: PropTypes.func.isRequired,
55
- onFocusNextBlock: PropTypes.func.isRequired,
56
- handleKeyDown: PropTypes.func.isRequired,
57
- createContent: PropTypes.func.isRequired,
58
- };
59
25
 
60
- constructor(props) {
61
- super(props);
62
- if (!this.props.data.bg_color) {
63
- this.props.data.bg_color = this.props.data.color ?? 'warning'; // backwards compatibility with previous background-color variable name 'color'
64
- }
65
- this.blockNode = React.createRef();
66
- }
26
+ const Edit = (props) => {
27
+ const { data, onChangeBlock, block, selected } = props;
28
+ const intl = useIntl();
29
+ const { selectedField, setSelectedField } = useHandleDetachedBlockFocus(
30
+ props,
31
+ 'text',
32
+ );
67
33
 
68
- render() {
69
- if (__SERVER__) {
70
- return <div />;
34
+ useEffect(() => {
35
+ if (!data.bg_color) {
36
+ onChangeBlock(block, {
37
+ ...data,
38
+ bg_color: data.color ?? 'warning',
39
+ });
71
40
  }
72
- return (
73
- <div className="public-ui">
74
- <div
75
- className={cx('alertblock', {
76
- selected: this.props.selected,
77
- })}
78
- >
79
- <Row
80
- className={cx(
81
- 'full-width p-5',
82
- 'bg-alert-' + this.props.data.bg_color,
83
- )}
84
- >
85
- <Container className="ui">
86
- <Row className="align-items-start">
87
- {this.props.data.image?.data && (
88
- <Col sm={2} className="pb-3 image-col">
89
- <img
90
- src={`data:${this.props.data.image['content-type']};${this.props.data.image.encoding},${this.props.data.image.data}`}
91
- alt=""
92
- className={cx('left-image', [
93
- this.props.data.sizeImage
94
- ? 'size-' + this.props.data.sizeImage
95
- : 'size-l',
96
- ])}
97
- />
98
- </Col>
99
- )}
100
- <Col>
101
- <TextEditorWidget
102
- data={this.props.data}
103
- fieldName="text"
104
- selected={this.props.selected}
105
- block={this.props.block}
106
- onChangeBlock={(data) =>
107
- this.props.onChangeBlock(this.props.block, data)
108
- }
109
- placeholder={this.props.intl.formatMessage(
110
- messages.content_placeholder,
111
- )}
112
- showToolbar={true}
113
- onSelectBlock={this.props.onSelectBlock}
114
- onAddBlock={this.props.onAddBlock}
115
- index={this.props.index}
116
- onFocusNextBlock={this.props.onFocusNextBlock}
117
- onFocusPreviousBlock={this.props.onFocusPreviousBlock}
41
+ }, [data, onChangeBlock, block]);
42
+
43
+ return __SERVER__ ? (
44
+ <div />
45
+ ) : (
46
+ <div className="public-ui" tabIndex="-1">
47
+ <div
48
+ className={cx('alertblock', {
49
+ selected: selected,
50
+ })}
51
+ >
52
+ <Row className={cx('full-width p-5', 'bg-alert-' + data.bg_color)}>
53
+ <Container className="ui">
54
+ <Row className="align-items-start">
55
+ {data.image?.data && (
56
+ <Col sm={2} className="pb-3 image-col">
57
+ <img
58
+ src={`data:${data.image['content-type']};${data.image.encoding},${data.image.data}`}
59
+ alt=""
60
+ className={cx('left-image', [
61
+ data.sizeImage ? 'size-' + data.sizeImage : 'size-l',
62
+ ])}
118
63
  />
119
64
  </Col>
120
- </Row>
121
- </Container>
122
- </Row>
123
- </div>
124
- <SidebarPortal selected={this.props.selected}>
125
- <AlertSidebar {...this.props} />
126
- </SidebarPortal>
65
+ )}
66
+ <Col>
67
+ <TextEditorWidget
68
+ {...props}
69
+ data={data}
70
+ fieldName="text"
71
+ selected={selected && selectedField === 'text'}
72
+ setSelected={setSelectedField}
73
+ placeholder={intl.formatMessage(messages.content_placeholder)}
74
+ showToolbar={true}
75
+ />
76
+ </Col>
77
+ </Row>
78
+ </Container>
79
+ </Row>
127
80
  </div>
128
- );
129
- }
130
- }
81
+ <SidebarPortal selected={selected}>
82
+ <AlertSidebar {...props} />
83
+ </SidebarPortal>
84
+ </div>
85
+ );
86
+ };
131
87
 
132
- export default compose(
133
- injectIntl,
134
- connect(
135
- (state) => ({
136
- request: state.content.create,
137
- content: state.content.data,
138
- }),
139
- { createContent },
140
- ),
141
- )(Edit);
88
+ export default Edit;
@@ -68,6 +68,7 @@ class Sidebar extends Component {
68
68
  <Segment className="form">
69
69
  <ColorListWidget
70
70
  id="bg_color"
71
+ className="alert-colors-widget"
71
72
  title={this.props.intl.formatMessage(messages.Color)}
72
73
  value={this.props.data.bg_color}
73
74
  onChange={(id, value) => {