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
@@ -10,7 +10,7 @@ import { Container, Row, Col } from 'design-react-kit';
10
10
  import { SidebarPortal } from '@plone/volto/components';
11
11
  import { addAppURL, flattenToAppURL } from '@plone/volto/helpers';
12
12
  import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
13
-
13
+ import { handleKeyDownOwnFocusManagement } from 'design-comuni-plone-theme/helpers/blocks';
14
14
  import {
15
15
  withDNDContext,
16
16
  SubblocksEdit,
@@ -48,6 +48,69 @@ class Edit extends SubblocksEdit {
48
48
  constructor(props) {
49
49
  super(props);
50
50
  this.state.selectedField = 'title';
51
+ this.nodeF = React.createRef();
52
+ }
53
+
54
+ UNSAFE_componentWillReceiveProps(newProps) {
55
+ if (newProps.selected) {
56
+ if (!this.props.selected) {
57
+ if (!this.state.selectedField && this.state.subIndexSelected < 0) {
58
+ //a11y - test subIndexSelected<0 per gestire il focus con navigazione da tastiera al contrario (dal blocco successivo a questo blocco)
59
+ this.setState({ selectedField: 'title' });
60
+ }
61
+ }
62
+ } else {
63
+ this.setState({ selectedField: null });
64
+ }
65
+ }
66
+
67
+ handleEnter = (e) => {
68
+ if (
69
+ this.props.selected &&
70
+ this.state.subIndexSelected < 0 &&
71
+ !this.state.selectedField
72
+ ) {
73
+ handleKeyDownOwnFocusManagement(e, this.props);
74
+ }
75
+ };
76
+
77
+ handleClick = (e) => {
78
+ const hasParent = (element, className) => {
79
+ if (!element.parentNode) {
80
+ return false;
81
+ }
82
+
83
+ if (element.classList.contains(className)) {
84
+ return true;
85
+ }
86
+
87
+ return hasParent(element.parentNode, className);
88
+ };
89
+ const clickOutsideSubblocks =
90
+ !e.target.classList.contains('volto-subblocks-wrapper') &&
91
+ !hasParent(e.target, 'volto-subblocks-wrapper');
92
+
93
+ if (clickOutsideSubblocks) {
94
+ this.setState({ subIndexSelected: -1 });
95
+ }
96
+ };
97
+
98
+ componentDidMount() {
99
+ if (this.props.selected && this.node) {
100
+ this.node.focus();
101
+ }
102
+ if (this.props.selected && this.nodeF.current) {
103
+ this.nodeF.current.focus();
104
+ }
105
+
106
+ if (this.state.subblocks.length === 0) {
107
+ this.addSubblock();
108
+ }
109
+
110
+ if (this.nodeF && this.nodeF.current) {
111
+ this.nodeF.current.addEventListener('keydown', this.handleEnter, false);
112
+ this.nodeF.current.addEventListener('click', this.handleClick, false);
113
+ }
51
114
  }
52
115
 
53
116
  /**
@@ -61,8 +124,12 @@ class Edit extends SubblocksEdit {
61
124
  }
62
125
 
63
126
  return (
64
- <div className="public-ui">
65
- <div className="full-width section py-5">
127
+ <div className="public-ui" tabIndex="-1" ref={this.nodeF}>
128
+ <div
129
+ className="full-width section py-5"
130
+ role="form"
131
+ aria-label={this.props.blocksConfig[this.props.type].title}
132
+ >
66
133
  {this.props.data?.background?.[0] ? (
67
134
  <div
68
135
  className="background-image"
@@ -119,22 +186,31 @@ class Edit extends SubblocksEdit {
119
186
 
120
187
  <div className="title">
121
188
  <TextEditorWidget
189
+ {...this.props}
190
+ showToolbar={false}
122
191
  data={this.props.data}
192
+ key={'title'}
123
193
  fieldName="title"
124
194
  selected={this.state.selectedField === 'title'}
125
- block={this.props.block}
126
- onChangeBlock={(data) => {
127
- this.props.onChangeBlock(this.props.block, {
128
- ...data,
195
+ setSelected={(f) => {
196
+ this.setState({
197
+ selectedField: f,
198
+ subIndexSelected: -1,
129
199
  });
200
+ if (!this.props.selected) {
201
+ //a11y - per il focus del blocco da tastiera
202
+ this.props.onSelectBlock(this.props.block);
203
+ }
130
204
  }}
205
+ onChangeBlock={this.props.onChangeBlock}
131
206
  placeholder={this.props.intl.formatMessage(
132
207
  messages.title,
133
208
  )}
134
- showToolbar={false}
135
- onSelectBlock={() => {}}
136
- onAddBlock={() => {
137
- this.setState({ selectedField: 'description' });
209
+ focusNextField={() => {
210
+ this.setState({
211
+ selectedField: null,
212
+ subIndexSelected: 0,
213
+ });
138
214
  }}
139
215
  />
140
216
  </div>
@@ -144,11 +220,22 @@ class Edit extends SubblocksEdit {
144
220
  {this.state.subblocks.map((subblock, subindex) => (
145
221
  <Col sm="6" lg="4" key={subblock.id}>
146
222
  <EditBlock
223
+ {...this.props}
147
224
  data={subblock}
148
225
  index={subindex}
226
+ blockIndex={this.props.index}
149
227
  selected={this.isSubblockSelected(subindex)}
150
228
  {...this.subblockProps}
229
+ onChangeFocus={this.onSubblockChangeFocus}
230
+ isFirst={subindex === 0}
231
+ isLast={subindex === this.state.subblocks?.length - 1}
151
232
  openObjectBrowser={this.props.openObjectBrowser}
233
+ onFocusPreviousBlock={() => {
234
+ this.setState({
235
+ selectedField: 'title',
236
+ subIndexSelected: -1,
237
+ });
238
+ }}
152
239
  />
153
240
  </Col>
154
241
  ))}
@@ -5,12 +5,11 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import redraft from 'redraft';
8
+
9
9
  import ViewBlock from './Block/ViewBlock';
10
10
  import { Container, Row, Col } from 'design-react-kit';
11
11
  import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
12
12
  import { addAppURL, flattenToAppURL } from '@plone/volto/helpers';
13
- import config from '@plone/volto/registry';
14
13
 
15
14
  /**
16
15
  * View block class.
@@ -64,11 +63,7 @@ const NumbersView = ({ data, block }) => {
64
63
 
65
64
  {data.title && (
66
65
  <div className="title">
67
- {redraft(
68
- data.title,
69
- config.settings.richtextViewSettings.ToHTMLRenderers,
70
- config.settings.richtextViewSettings.ToHTMLOptions,
71
- )}
66
+ <h2>{data.title}</h2>
72
67
  </div>
73
68
  )}
74
69
  </div>
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable jsx-a11y/no-static-element-interactions */
2
2
  /* eslint-disable jsx-a11y/click-events-have-key-events */
3
- import React, { useState, useEffect } from 'react';
3
+ import React from 'react';
4
4
  import { Card, CardBody, Container, Row, Col } from 'design-react-kit';
5
5
  import { defineMessages, useIntl } from 'react-intl';
6
6
  import PropTypes from 'prop-types';
7
- import redraft from 'redraft';
8
7
  import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
9
- import config from '@plone/volto/registry';
8
+ import { useHandleDetachedBlockFocus } from 'design-comuni-plone-theme/helpers/blocks';
9
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
10
10
  import cx from 'classnames';
11
11
 
12
12
  const messages = defineMessages({
@@ -44,63 +44,35 @@ const renderImage = (image, showImage, sizeNatural, altText = '') =>
44
44
  </div>
45
45
  ) : null;
46
46
 
47
- const Block = ({
48
- data,
49
- block,
50
- inEditMode,
51
- onChange,
52
- onSelectBlock,
53
- onAddBlock,
54
- onFocusPreviousBlock,
55
- onFocusNextBlock,
56
- index,
57
- selected,
58
- }) => {
47
+ const Block = (props) => {
48
+ const { data, block, inEditMode, onChange, selected, ...otherProps } = props;
59
49
  const intl = useIntl();
60
- const title = data?.image_card_title?.blocks[0]?.text;
50
+ const title = data?.image_card_title;
61
51
  const hasImage = data?.showImage;
62
52
  const content = data?.image_card_content;
63
53
 
64
- const [selectedField, setSelectedField] = useState('title');
65
-
66
- useEffect(() => {
67
- if (selected) {
68
- setSelectedField('title');
69
- } else {
70
- setSelectedField(null);
71
- }
72
- }, [selected]);
73
-
54
+ const { selectedField, setSelectedField } = useHandleDetachedBlockFocus(
55
+ props,
56
+ 'image_card_title',
57
+ );
74
58
  return (
75
59
  <div className="image-text-card-wrapper">
76
60
  <h2 className="mb-4 mt-5" id={block.id + 'title'}>
77
61
  {inEditMode ? (
78
- <div
79
- onClick={() => {
80
- setSelectedField('title');
81
- }}
82
- onFocus={() => {
83
- setSelectedField('title');
62
+ <TextEditorWidget
63
+ {...otherProps}
64
+ showToolbar={false}
65
+ data={data}
66
+ block={block}
67
+ fieldName="image_card_title"
68
+ selected={selected && selectedField === 'image_card_title'}
69
+ onChangeBlock={(block, data) => onChange(data)}
70
+ placeholder={intl.formatMessage(messages.image_card_title)}
71
+ setSelected={setSelectedField}
72
+ focusNextField={() => {
73
+ setSelectedField('image_card_content');
84
74
  }}
85
- >
86
- <TextEditorWidget
87
- data={data}
88
- fieldName="image_card_title"
89
- selected={selectedField === 'title'}
90
- block={block}
91
- onChangeBlock={(data) => onChange(data)}
92
- placeholder={intl.formatMessage(messages.image_card_title)}
93
- showToolbar={false}
94
- onSelectBlock={() => {}}
95
- onAddBlock={() => {
96
- setSelectedField('content');
97
- }}
98
- onFocusNextBlock={() => {
99
- setSelectedField('content');
100
- }}
101
- onFocusPreviousBlock={onFocusPreviousBlock}
102
- />
103
- </div>
75
+ />
104
76
  ) : (
105
77
  title
106
78
  )}
@@ -139,28 +111,28 @@ const Block = ({
139
111
  >
140
112
  <div
141
113
  onClick={() => {
142
- setSelectedField('content');
114
+ setSelectedField('image_card_content');
143
115
  }}
144
116
  onFocus={() => {
145
- setSelectedField('content');
117
+ setSelectedField('image_card_content');
146
118
  }}
147
119
  >
148
120
  <TextEditorWidget
121
+ {...otherProps}
122
+ showToolbar={true}
149
123
  data={data}
150
124
  fieldName="image_card_content"
151
- selected={selectedField === 'content'}
152
125
  block={block}
153
- onChangeBlock={(data) => onChange(data)}
126
+ selected={
127
+ selected && selectedField === 'image_card_content'
128
+ }
129
+ onChangeBlock={(block, data) => onChange(data)}
154
130
  placeholder={intl.formatMessage(
155
131
  messages.image_card_content,
156
132
  )}
157
- showToolbar={true}
158
- onSelectBlock={onSelectBlock}
159
- onAddBlock={onAddBlock}
160
- index={index}
161
- onFocusNextBlock={onFocusNextBlock}
162
- onFocusPreviousBlock={() => {
163
- setSelectedField('title');
133
+ setSelected={setSelectedField}
134
+ focusPrevField={() => {
135
+ setSelectedField('image_card_title');
164
136
  }}
165
137
  />
166
138
  </div>
@@ -195,11 +167,7 @@ const Block = ({
195
167
  'ps-0': data?.rightImage,
196
168
  })}
197
169
  >
198
- {redraft(
199
- content,
200
- config.settings.richtextViewSettings.ToHTMLRenderers,
201
- config.settings.richtextViewSettings.ToHTMLOptions,
202
- )}
170
+ <TextBlockView data={{ value: content }} />
203
171
  </div>
204
172
  </Row>
205
173
  </Container>
@@ -89,19 +89,13 @@ class Edit extends Component {
89
89
  return <div />;
90
90
  }
91
91
  return (
92
- <div>
92
+ <div tabIndex="-1">
93
93
  <BodyWrapper data={this.state.currentBlockData} inEditMode={true}>
94
94
  <Block
95
+ {...this.props}
95
96
  data={this.state.currentBlockData}
96
- block={this.props.block}
97
97
  onChange={(obj) => this.onChange(obj)}
98
98
  inEditMode={true}
99
- onSelectBlock={this.props.onSelectBlock}
100
- onAddBlock={this.props.onAddBlock}
101
- index={this.props.index}
102
- selected={this.props.selected}
103
- onFocusPreviousBlock={this.props.onFocusPreviousBlock}
104
- onFocusNextBlock={this.props.onFocusNextBlock}
105
99
  />
106
100
  </BodyWrapper>
107
101
  <SidebarPortal selected={this.props.selected || false}>
@@ -7,8 +7,9 @@ const BodyWrapper = ({ inEditMode, children }) => {
7
7
  className={cx('block simple-text-block', {
8
8
  'public-ui': inEditMode,
9
9
  })}
10
+ {...(inEditMode ? { tabIndex: '-1' } : {})}
10
11
  >
11
- <div>{children}</div>
12
+ {children}
12
13
  </div>
13
14
  );
14
15
  };
@@ -3,98 +3,112 @@
3
3
  * @module components/Blocks/TitleVM/Edit
4
4
  */
5
5
 
6
- import React, { Component } from 'react';
6
+ import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import Block from './Block';
9
- import { injectIntl } from 'react-intl';
10
- import { isEqual } from 'lodash';
8
+ import { defineMessages, useIntl } from 'react-intl';
9
+ import { Card, CardBody, CardTitle } from 'design-react-kit';
10
+ import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
11
11
  import BodyWrapper from './BodyWrapper';
12
+ import { useHandleDetachedBlockFocus } from 'design-comuni-plone-theme/helpers/blocks';
13
+ import { Divider } from 'semantic-ui-react';
12
14
 
15
+ const messages = defineMessages({
16
+ simple_card_title: {
17
+ id: 'Type the title…',
18
+ defaultMessage: 'Type the title…',
19
+ },
20
+ simple_card_content: {
21
+ id: 'Type description…',
22
+ defaultMessage: 'Digita la descrizione…',
23
+ },
24
+ simple_card_click: {
25
+ id: 'Type text…',
26
+ defaultMessage: 'Digita il testo…',
27
+ },
28
+ });
13
29
  /**
14
- * Edit title block class.
30
+ * Edit Calloout block class.
15
31
  * @class Edit
16
32
  * @extends Component
17
33
  */
18
- class Edit extends Component {
19
- /**
20
- * Property types.
21
- * @property {Object} propTypes Property types.
22
- * @static
23
- */
24
- static propTypes = {
25
- properties: PropTypes.objectOf(PropTypes.any).isRequired,
26
- selected: PropTypes.bool.isRequired,
27
- index: PropTypes.number.isRequired,
28
- onChangeField: PropTypes.func.isRequired,
29
- onSelectBlock: PropTypes.func.isRequired,
30
- onDeleteBlock: PropTypes.func.isRequired,
31
- onAddBlock: PropTypes.func.isRequired,
32
- onFocusPreviousBlock: PropTypes.func.isRequired,
33
- onFocusNextBlock: PropTypes.func.isRequired,
34
- block: PropTypes.string.isRequired,
35
- };
34
+ const Edit = (props) => {
35
+ const { data, onChangeBlock, block, onSelectBlock, selected, ...otherProps } =
36
+ props;
37
+ const intl = useIntl();
36
38
 
37
- /**
38
- * Constructor
39
- * @method constructor
40
- * @param {Object} props Component properties
41
- * @constructs SimpleCard Edit block
42
- */
43
- constructor(props) {
44
- super(props);
39
+ const { selectedField, setSelectedField } = useHandleDetachedBlockFocus(
40
+ props,
41
+ 'simple_card_title',
42
+ );
45
43
 
46
- if (!__SERVER__) {
47
- }
48
- }
44
+ return __SERVER__ ? (
45
+ <div />
46
+ ) : (
47
+ <BodyWrapper data={data} inEditMode={true}>
48
+ <div className="simple-text-card-wrapper">
49
+ <Card
50
+ color="white"
51
+ className="card-bg rounded"
52
+ noWrapper={false}
53
+ space
54
+ tag="div"
55
+ >
56
+ <CardBody>
57
+ <div className="simple-text-card cms-ui">
58
+ <CardTitle tag="h3" className="h4">
59
+ <TextEditorWidget
60
+ {...otherProps}
61
+ showToolbar={false}
62
+ data={data}
63
+ block={block}
64
+ fieldName="simple_card_title"
65
+ selected={selected && selectedField === 'simple_card_title'}
66
+ onChangeBlock={onChangeBlock}
67
+ onSelectBlock={onSelectBlock}
68
+ placeholder={intl.formatMessage(messages.simple_card_title)}
69
+ setSelected={setSelectedField}
70
+ focusNextField={() => {
71
+ setSelectedField('simple_card_content');
72
+ }}
73
+ />
74
+ </CardTitle>
75
+ <Divider />
76
+ <div>
77
+ <TextEditorWidget
78
+ {...otherProps}
79
+ showToolbar={true}
80
+ data={data}
81
+ fieldName="simple_card_content"
82
+ selected={selected && selectedField === 'simple_card_content'}
83
+ setSelected={setSelectedField}
84
+ block={block}
85
+ onChangeBlock={onChangeBlock}
86
+ onSelectBlock={onSelectBlock}
87
+ placeholder={intl.formatMessage(messages.simple_card_content)}
88
+ focusPrevField={() => {
89
+ setSelectedField('simple_card_title');
90
+ }}
91
+ />
92
+ </div>
93
+ </div>
94
+ </CardBody>
95
+ </Card>
96
+ </div>
97
+ </BodyWrapper>
98
+ );
99
+ };
49
100
 
50
- /**
51
- * Component did mount lifecycle method
52
- * @method componentDidMount
53
- * @returns {undefined}
54
- */
55
- componentDidMount() {}
101
+ Edit.propTypes = {
102
+ properties: PropTypes.objectOf(PropTypes.any).isRequired,
103
+ selected: PropTypes.bool.isRequired,
104
+ index: PropTypes.number.isRequired,
105
+ onChangeField: PropTypes.func.isRequired,
106
+ onSelectBlock: PropTypes.func.isRequired,
107
+ onDeleteBlock: PropTypes.func.isRequired,
108
+ onAddBlock: PropTypes.func.isRequired,
109
+ onFocusPreviousBlock: PropTypes.func.isRequired,
110
+ onFocusNextBlock: PropTypes.func.isRequired,
111
+ block: PropTypes.string.isRequired,
112
+ };
56
113
 
57
- /**
58
- * Change handler
59
- * @method onChange
60
- * @param {object} editorState Editor state.
61
- * @returns {undefined}
62
- */
63
- onChange(obj, fieldname) {
64
- if (!isEqual(obj[fieldname], this.props.data[fieldname])) {
65
- this.props.onChangeBlock(this.props.block, {
66
- ...this.props.data,
67
- [fieldname]: obj[fieldname],
68
- });
69
- }
70
- }
71
-
72
- /**
73
- * Render method.
74
- * @method render
75
- * @returns {string} Markup for the component.
76
- */
77
- render() {
78
- if (__SERVER__) {
79
- return <div />;
80
- }
81
- return (
82
- <BodyWrapper data={this.props.data} inEditMode={true}>
83
- <Block
84
- data={this.props.data}
85
- block={this.props.block}
86
- onChange={(obj, fieldname) => this.onChange(obj, fieldname)}
87
- inEditMode={true}
88
- onSelectBlock={this.props.onSelectBlock}
89
- onAddBlock={this.props.onAddBlock}
90
- index={this.props.index}
91
- selected={this.props.selected}
92
- onFocusPreviousBlock={this.props.onFocusPreviousBlock}
93
- onFocusNextBlock={this.props.onFocusNextBlock}
94
- />
95
- </BodyWrapper>
96
- );
97
- }
98
- }
99
-
100
- export default injectIntl(Edit);
114
+ export default Edit;
@@ -5,8 +5,9 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import Block from './Block';
8
+ import { Card, CardBody, CardTitle } from 'design-react-kit';
9
9
  import BodyWrapper from './BodyWrapper';
10
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
10
11
 
11
12
  /**
12
13
  * View title block class.
@@ -14,10 +15,26 @@ import BodyWrapper from './BodyWrapper';
14
15
  * @extends Component
15
16
  */
16
17
 
17
- const TextCardView = ({ data, id }) => {
18
+ const TextCardView = ({ data, id, block }) => {
18
19
  return (
19
20
  <BodyWrapper data={data} inEditMode={false}>
20
- <Block data={data} inEditMode={false} block={{ id: id }} />
21
+ <div className="simple-text-card-wrapper">
22
+ <Card
23
+ color="white"
24
+ className="card-bg rounded"
25
+ noWrapper={false}
26
+ space
27
+ tag="div"
28
+ >
29
+ <CardBody>
30
+ <CardTitle tag="h3" className="h4" id={id + '-title'}>
31
+ {data.simple_card_title}
32
+ </CardTitle>
33
+ <hr />
34
+ <TextBlockView data={{ value: data.simple_card_content }} />
35
+ </CardBody>
36
+ </Card>
37
+ </div>
21
38
  </BodyWrapper>
22
39
  );
23
40
  };
@@ -158,18 +158,18 @@ const Sidebar = (props) => {
158
158
  });
159
159
  }}
160
160
  />
161
+ <CheckboxWidget
162
+ id="always_show_image"
163
+ title={props.intl.formatMessage(messages.always_show_image)}
164
+ value={props.data.always_show_image}
165
+ onChange={(id, value) => {
166
+ props.onChangeBlock(props.block, {
167
+ ...props.data,
168
+ [id]: value,
169
+ });
170
+ }}
171
+ />
161
172
  </div>
162
- <CheckboxWidget
163
- id="always_show_image"
164
- title={props.intl.formatMessage(messages.always_show_image)}
165
- value={props.data.always_show_image}
166
- onChange={(id, value) => {
167
- props.onChangeBlock(props.block, {
168
- ...props.data,
169
- [id]: value,
170
- });
171
- }}
172
- />
173
173
  </Segment>
174
174
  <Accordion fluid styled className="form">
175
175
  <Accordion.Title
@@ -18,34 +18,17 @@ const mock_fields = {
18
18
  href: '/',
19
19
  id: '1675245121000',
20
20
  linkMoreTitle: 'Caught in a landside',
21
- text: {
22
- blocks: [
23
- {
24
- data: {},
25
- depth: 0,
26
- entityRanges: [],
27
- inlineStyleRanges: [],
28
- key: 'b6vem',
29
- text: 'Is this just fantasy',
30
- type: 'unstyled',
31
- },
32
- ],
33
- entityMap: {},
34
- },
35
- title: {
36
- blocks: [
37
- {
38
- data: {},
39
- depth: 0,
40
- entityRanges: [],
41
- inlineStyleRanges: [],
42
- key: '2ikdv',
43
- text: 'Accordion 1',
44
- type: 'unstyled',
45
- },
46
- ],
47
- entityMap: {},
48
- },
21
+ text: [
22
+ {
23
+ children: [
24
+ {
25
+ text: 'Is this just fantasy?',
26
+ },
27
+ ],
28
+ type: 'p',
29
+ },
30
+ ],
31
+ title: 'Accordion 1',
49
32
  },
50
33
  ],
51
34
  };