design-comuni-plone-theme 11.10.2 → 12.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/.github/workflows/slate.yml +47 -0
  2. package/.yarn/cache/@babel-helper-module-imports-npm-7.24.3-edb733448b-c23492189b.zip +0 -0
  3. package/.yarn/cache/@babel-types-npm-7.24.0-a0508cb308-4b574a37d4.zip +0 -0
  4. package/.yarn/cache/babel-plugin-lodash-npm-3.3.4-c7161075b6-044a4261e6.zip +0 -0
  5. package/.yarn/cache/require-package-name-npm-2.0.1-ac9a206b63-00f4e9e467.zip +0 -0
  6. package/.yarn/cache/{volto-form-block-npm-3.7.2-f24953a510-7387a1b85a.zip → volto-form-block-npm-3.8.2-e49cbe07d5-5b72a06a5e.zip} +0 -0
  7. package/.yarn/cache/{volto-gdpr-privacy-npm-2.2.1-bc93b3e168-bce76108c3.zip → volto-gdpr-privacy-npm-2.2.0-6be0f74d53-8a93254251.zip} +0 -0
  8. package/.yarn/install-state.gz +0 -0
  9. package/CHANGELOG.md +878 -916
  10. package/RELEASE.md +8 -0
  11. package/locales/de/LC_MESSAGES/volto.po +86 -18
  12. package/locales/en/LC_MESSAGES/volto.po +86 -18
  13. package/locales/es/LC_MESSAGES/volto.po +86 -18
  14. package/locales/fr/LC_MESSAGES/volto.po +86 -18
  15. package/locales/it/LC_MESSAGES/volto.po +86 -18
  16. package/locales/volto.pot +87 -19
  17. package/package.json +5 -3
  18. package/publiccode.yml +2 -2
  19. package/src/components/Collapse.jsx +1 -0
  20. package/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx +29 -24
  21. package/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx +4 -12
  22. package/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx +67 -6
  23. package/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx +60 -113
  24. package/src/components/ItaliaTheme/Blocks/Alert/Sidebar.jsx +1 -0
  25. package/src/components/ItaliaTheme/Blocks/Alert/View.jsx +5 -14
  26. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx +16 -11
  27. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx +2 -1
  28. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Edit.jsx +39 -1
  29. package/src/components/ItaliaTheme/Blocks/CTABlock/Block.jsx +35 -95
  30. package/src/components/ItaliaTheme/Blocks/Callout/Edit.jsx +108 -0
  31. package/src/components/ItaliaTheme/Blocks/Callout/Sidebar.jsx +173 -0
  32. package/src/components/ItaliaTheme/Blocks/Callout/View.jsx +45 -0
  33. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx +84 -63
  34. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/ViewBlock.jsx +19 -39
  35. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx +92 -19
  36. package/src/components/ItaliaTheme/Blocks/ContactsBlock/View.jsx +13 -21
  37. package/src/components/ItaliaTheme/Blocks/CountDown/Edit.jsx +21 -25
  38. package/src/components/ItaliaTheme/Blocks/CountDown/View.jsx +6 -15
  39. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx +40 -15
  40. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx +6 -21
  41. package/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx +93 -20
  42. package/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx +1 -9
  43. package/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx +4 -17
  44. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx +46 -15
  45. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/ViewBlock.jsx +2 -18
  46. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx +84 -11
  47. package/src/components/ItaliaTheme/Blocks/NumbersBlock/View.jsx +2 -11
  48. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx +33 -67
  49. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Edit.jsx +2 -8
  50. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/BodyWrapper.jsx +2 -1
  51. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx +98 -84
  52. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/View.jsx +20 -3
  53. package/src/components/ItaliaTheme/Blocks/__tests__/Accordion.test.jsx +11 -28
  54. package/src/components/ItaliaTheme/Blocks/__tests__/Alert.test.jsx +10 -14
  55. package/src/components/ItaliaTheme/Blocks/__tests__/ArgumentsInEvidence.test.jsx +20 -28
  56. package/src/components/ItaliaTheme/Blocks/__tests__/CTABlock.test.jsx +14 -29
  57. package/src/components/ItaliaTheme/Blocks/__tests__/CardWithImage.test.jsx +11 -28
  58. package/src/components/ItaliaTheme/Blocks/__tests__/ContactsBlock.test.jsx +75 -140
  59. package/src/components/ItaliaTheme/Blocks/__tests__/Countdown.test.jsx +20 -28
  60. package/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx +22 -56
  61. package/src/components/ItaliaTheme/Blocks/__tests__/NumbersBlock.test.jsx +14 -43
  62. package/src/components/ItaliaTheme/Blocks/__tests__/SimpleCard.test.jsx +14 -30
  63. package/src/components/ItaliaTheme/Footer/FooterInfos.jsx +22 -8
  64. package/src/components/ItaliaTheme/Footer/FooterNavigation.jsx +3 -3
  65. package/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx +5 -1
  66. package/src/components/ItaliaTheme/Slider/SingleSlideWrapper.jsx +2 -3
  67. package/src/components/ItaliaTheme/View/BandoView/BandoApprofondimenti.jsx +1 -2
  68. package/src/components/ItaliaTheme/View/CartellaModulisticaView/DocRow.jsx +14 -5
  69. package/src/components/ItaliaTheme/View/Commons/Attachment.jsx +19 -3
  70. package/src/components/ItaliaTheme/View/Commons/Attachments.jsx +0 -1
  71. package/src/components/ItaliaTheme/View/Commons/DownloadFileFormat.jsx +11 -7
  72. package/src/components/ItaliaTheme/View/Commons/Module.jsx +7 -6
  73. package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderLinkServizio.jsx +6 -2
  74. package/src/components/ItaliaTheme/View/Commons/RichTextRender.jsx +8 -6
  75. package/src/components/ItaliaTheme/View/Commons/__tests__/RichText.test.jsx +14 -17
  76. package/src/components/ItaliaTheme/View/ServizioView/ServizioAccedi.jsx +5 -6
  77. package/src/components/ItaliaTheme/View/ServizioView/ServizioMetatag.jsx +4 -0
  78. package/src/components/ItaliaTheme/View/__tests__/CartellaModulisticaView.test.jsx +12 -1
  79. package/src/components/ItaliaTheme/View/__tests__/IncaricoView.test.jsx +24 -30
  80. package/src/components/ItaliaTheme/View/__tests__/PageView.test.jsx +24 -2
  81. package/src/components/ItaliaTheme/View/__tests__/PersonaView.test.jsx +96 -92
  82. package/src/components/ItaliaTheme/View/__tests__/ServizioAChiSiRivolge.test.jsx +240 -286
  83. package/src/components/ItaliaTheme/View/__tests__/ServizioAccedi.test.jsx +240 -286
  84. package/src/components/ItaliaTheme/View/__tests__/ServizioCasiParticolari.test.jsx +240 -286
  85. package/src/components/ItaliaTheme/View/__tests__/ServizioComeFare.test.jsx +240 -286
  86. package/src/components/ItaliaTheme/View/__tests__/ServizioCondizioni.test.jsx +240 -286
  87. package/src/components/ItaliaTheme/View/__tests__/ServizioContatti.test.jsx +240 -286
  88. package/src/components/ItaliaTheme/View/__tests__/ServizioCosE.test.jsx +240 -286
  89. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaServe.test.jsx +240 -286
  90. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaSiOttiene.test.jsx +240 -286
  91. package/src/components/ItaliaTheme/View/__tests__/ServizioCostiVincoli.test.jsx +240 -286
  92. package/src/components/ItaliaTheme/View/__tests__/ServizioMetadati.test.jsx +240 -286
  93. package/src/components/ItaliaTheme/View/__tests__/ServizioModulistica.test.jsx +240 -286
  94. package/src/components/ItaliaTheme/View/__tests__/ServizioProcedure.test.jsx +240 -286
  95. package/src/components/ItaliaTheme/View/__tests__/ServizioSitiEsterni.test.jsx +240 -286
  96. package/src/components/ItaliaTheme/View/__tests__/ServizioTempiScadenze.test.jsx +240 -286
  97. package/src/components/ItaliaTheme/View/__tests__/ServizioUlterioriInformazioni.test.jsx +240 -286
  98. package/src/components/ItaliaTheme/View/__tests__/ServizioView.test.jsx +470 -560
  99. package/src/components/ItaliaTheme/View/__tests__/TrasparenzaView.test.jsx +12 -1
  100. package/src/components/ItaliaTheme/manage/Widgets/ColorListWidget.jsx +11 -2
  101. package/src/components/ItaliaTheme/manage/Widgets/HtmlSlateWidget.jsx +154 -0
  102. package/src/components/ItaliaTheme/manage/Widgets/RichTextWidget.jsx +88 -0
  103. package/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx +158 -0
  104. package/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx +167 -270
  105. package/src/config/Blocks/ListingOptions/index.js +0 -1
  106. package/src/config/Blocks/ListingOptions/utils.js +0 -7
  107. package/src/config/Blocks/blocks.js +29 -8
  108. package/src/config/Blocks/listingVariations.js +1 -1
  109. package/src/config/Slate/Alignment/AlignMenu.jsx +169 -0
  110. package/src/config/Slate/Alignment/index.js +42 -0
  111. package/src/config/Slate/Blockquote/BlockquoteMenu.jsx +151 -0
  112. package/src/config/Slate/Blockquote/index.js +12 -0
  113. package/src/config/Slate/Headings/HeadingsMenu.jsx +139 -0
  114. package/src/config/Slate/Headings/headingsMenu.scss +44 -0
  115. package/src/config/Slate/Headings/index.js +62 -0
  116. package/src/config/Slate/Link/deserializer.js +25 -0
  117. package/src/config/Slate/Link/index.js +126 -0
  118. package/src/config/Slate/Link/renderer.jsx +99 -0
  119. package/src/config/Slate/LinkButton/index.js +47 -0
  120. package/src/config/Slate/TextLarger/index.js +51 -0
  121. package/src/config/Slate/Underline/index.js +10 -0
  122. package/src/config/Slate/config.js +43 -0
  123. package/src/config/Slate/deserializers.js +66 -0
  124. package/src/config/Slate/dropdownStyle.scss +14 -0
  125. package/src/config/Slate/dropdownUtils.js +422 -0
  126. package/src/config/Slate/extensions/breakList.js +91 -0
  127. package/src/config/Slate/handlers.js +243 -0
  128. package/src/config/Slate/utils.js +73 -0
  129. package/src/config/Widgets/widgets.js +1 -2
  130. package/src/config/italiaConfig.js +7 -54
  131. package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +360 -0
  132. package/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx +75 -200
  133. package/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx +1 -1
  134. package/src/customizations/volto/components/manage/Form/BlocksToolbar.jsx +1 -1
  135. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +59 -6
  136. package/src/customizations/volto-form-block/components/Field.jsx +45 -22
  137. package/src/customizations/volto-form-block/components/FormResult.jsx +74 -0
  138. package/src/customizations/volto-form-block/components/FormView.jsx +79 -66
  139. package/src/customizations/volto-form-block/components/Widget/Button.jsx +50 -0
  140. package/src/helpers/EnhanceLink.js +44 -0
  141. package/src/helpers/FormValidation/FormValidationHelpers.js +3 -0
  142. package/src/helpers/blocks.js +86 -0
  143. package/src/helpers/files.js +14 -14
  144. package/src/helpers/index.js +4 -3
  145. package/src/helpers/richTextHelper.js +10 -0
  146. package/src/icons/Group.svg +1 -0
  147. package/src/icons/blocco-icone.svg +0 -3
  148. package/src/icons/blockquote-card-dark.svg +1 -0
  149. package/src/icons/blockquote-card.svg +1 -0
  150. package/src/icons/blockquote-simple.svg +1 -0
  151. package/src/icons/text-larger.svg +1 -0
  152. package/src/theme/ItaliaTheme/Blocks/_accordion.scss +1 -10
  153. package/src/theme/ItaliaTheme/Blocks/_alert.scss +53 -1
  154. package/src/theme/ItaliaTheme/Blocks/_bandiInEvidenceTemplate.scss +1 -0
  155. package/src/theme/ItaliaTheme/Blocks/_callout.scss +32 -0
  156. package/src/theme/ItaliaTheme/Blocks/_contacts.scss +15 -32
  157. package/src/theme/ItaliaTheme/Blocks/_ctaBlock.scss +0 -14
  158. package/src/theme/ItaliaTheme/Blocks/_gridBlock.scss +1 -1
  159. package/src/theme/ItaliaTheme/Blocks/_hero.scss +1 -8
  160. package/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss +0 -30
  161. package/src/theme/ItaliaTheme/Blocks/_imageCardTextBlock.scss +3 -2
  162. package/src/theme/ItaliaTheme/Blocks/_numbers.scss +1 -5
  163. package/src/theme/ItaliaTheme/Blocks/_simpleCardTextBlock.scss +8 -2
  164. package/src/theme/ItaliaTheme/Blocks/_tableOfContents.scss +1 -0
  165. package/src/theme/ItaliaTheme/Components/_megamenu.scss +0 -4
  166. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_cta.scss +1 -0
  167. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_searchSections.scss +1 -0
  168. package/src/theme/ItaliaTheme/Subsites/bootstrap-italia/custom/_headercenter.scss +1 -0
  169. package/src/theme/ItaliaTheme/Views/_cartellaModulistica.scss +11 -2
  170. package/src/theme/ItaliaTheme/Views/_slider.scss +3 -3
  171. package/src/theme/ItaliaTheme/Widgets/_iconWidget.scss +4 -0
  172. package/src/theme/ItaliaTheme/_main.scss +42 -54
  173. package/src/theme/_cms-ui.scss +59 -161
  174. package/src/theme/extras/_forms.scss +2 -14
  175. package/src/theme/site.scss +1 -0
  176. package/test-setup-config.js +58 -0
  177. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Block.jsx +0 -151
  178. package/src/config/RichTextEditor/LinkEntity.jsx +0 -27
  179. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/Link/index.jsx +0 -44
  180. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +0 -349
  181. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/index.js +0 -150
  182. package/src/config/RichTextEditor/Plugins/AnchorPlugin/index.js +0 -88
  183. package/src/config/RichTextEditor/ToolbarButtons/AlignButton.jsx +0 -61
  184. package/src/config/RichTextEditor/ToolbarButtons/ButtonsButton.jsx +0 -14
  185. package/src/config/RichTextEditor/ToolbarButtons/CalloutsButton.jsx +0 -38
  186. package/src/config/RichTextEditor/ToolbarButtons/DraftJsDropdownButton.jsx +0 -106
  187. package/src/config/RichTextEditor/ToolbarButtons/HeadingsButton.jsx +0 -57
  188. package/src/config/RichTextEditor/ToolbarButtons/TextSizeButton.jsx +0 -65
  189. package/src/config/RichTextEditor/ToolbarButtons/UnderlineButton.jsx +0 -14
  190. package/src/config/RichTextEditor/config.js +0 -253
  191. package/src/config/volto-gdpr-privacy-defaultPanelConfig.js +0 -292
  192. package/src/customizations/volto/components/manage/Blocks/ToC/View.jsx +0 -134
  193. package/src/customizations/volto/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +0 -99
  194. package/src/customizations/volto/config/RichTextEditor/Plugins.jsx +0 -63
  195. package/src/helpers/redraftHelper.js +0 -9
@@ -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);
@@ -58,6 +58,18 @@ class EditBlock extends SubblockEdit {
58
58
  }
59
59
  });
60
60
  }
61
+
62
+ UNSAFE_componentWillReceiveProps(nextProps) {
63
+ if (!this.props.selected && nextProps.focusOn) {
64
+ this.props.onSelectBlock(this.props.block);
65
+ }
66
+
67
+ if (nextProps.selected && !this.state.focusOn) {
68
+ this.setState({ focusOn: 'title' });
69
+ } else if (!nextProps.selected) {
70
+ this.setState({ focusOn: null });
71
+ }
72
+ }
61
73
  /**
62
74
  * Render method.
63
75
  * @method render
@@ -69,7 +81,7 @@ class EditBlock extends SubblockEdit {
69
81
  }
70
82
 
71
83
  return (
72
- <Subblock subblock={this} className="subblock-edit">
84
+ <Subblock subblock={this} className="subblock-edit" tabIndex="-1">
73
85
  <Card
74
86
  className="card-bg rounded"
75
87
  noWrapper={false}
@@ -81,104 +93,113 @@ class EditBlock extends SubblockEdit {
81
93
  <CardBody tag="div">
82
94
  <div className="contact-title">
83
95
  {/* eslint-disable */}
84
- <div
85
- onClick={() => {
86
- this.setState({ focusOn: 'title' });
96
+ <TextEditorWidget
97
+ {...this.props}
98
+ key="title"
99
+ showToolbar={false}
100
+ data={this.props.data}
101
+ fieldName="title"
102
+ onChangeBlock={(block, _data) => {
103
+ this.props.onChangeBlock(this.props.index, _data);
87
104
  }}
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>
105
+ placeholder={this.props.intl.formatMessage(
106
+ messages.titlePlaceholder,
107
+ )}
108
+ selected={this.props.selected && this.state.focusOn === 'title'}
109
+ setSelected={(f) => {
110
+ this.setState({ focusOn: f });
111
+ }}
112
+ focusNextField={() => {
113
+ this.setState({ focusOn: 'text' });
114
+ }}
115
+ focusPrevField={
116
+ this.props.isFirst
117
+ ? this.props.onFocusPreviousBlock
118
+ : () => {
119
+ this.props.onSubblockChangeFocus(this.props.index - 1);
120
+ }
121
+ }
122
+ />
108
123
  </div>
109
124
 
110
- <div
111
- className="contact-text"
112
- onClick={() => {
113
- this.setState({ focusOn: 'text' });
114
- }}
115
- >
125
+ <div className="contact-text">
116
126
  <TextEditorWidget
127
+ {...this.props}
128
+ key="text"
117
129
  data={this.props.data}
118
130
  fieldName="text"
119
- selected={this.props.selected && this.state.focusOn === 'text'}
120
- block={this.props.block}
121
- onChangeBlock={this.onChange}
122
131
  placeholder={this.props.intl.formatMessage(
123
132
  messages.textPlaceholder,
124
133
  )}
125
- prevFocus="title"
126
- nextFocus="tel"
127
- setFocus={(f) => {
128
- this.setState({ focusOn: f });
134
+ onChangeBlock={(block, _data) => {
135
+ this.props.onChangeBlock(this.props.index, _data);
136
+ }}
137
+ selected={this.props.selected && this.state.focusOn === 'text'}
138
+ setSelected={(f) => this.setState({ focusOn: f })}
139
+ focusPrevField={() => {
140
+ this.setState({ focusOn: 'title' });
141
+ }}
142
+ focusNextField={() => {
143
+ this.setState({ focusOn: 'tel' });
129
144
  }}
130
- key="text"
131
145
  />
132
146
  </div>
133
147
 
134
- <div
135
- className="contact-info"
136
- onClick={() => {
137
- this.setState({ focusOn: 'tel' });
138
- }}
139
- >
148
+ <div className="contact-info">
140
149
  <div className="icon-wrapper">
141
150
  <Icon icon="phone-alt" />
142
151
  </div>
143
152
  <TextEditorWidget
153
+ {...this.props}
154
+ key="tel"
144
155
  data={this.props.data}
145
156
  fieldName="tel"
157
+ wrapClass="tel"
146
158
  selected={this.props.selected && this.state.focusOn === 'tel'}
147
- block={this.props.block}
148
- onChangeBlock={this.onChange}
159
+ onChangeBlock={(block, _data) => {
160
+ this.props.onChangeBlock(this.props.index, _data);
161
+ }}
149
162
  placeholder={this.props.intl.formatMessage(
150
163
  messages.textPlaceholder,
151
164
  )}
152
- prevFocus="text"
153
- setFocus={(f) => {
154
- this.setState({ focusOn: f });
165
+ setSelected={(f) => this.setState({ focusOn: f })}
166
+ focusPrevField={() => {
167
+ this.setState({ focusOn: 'text' });
168
+ }}
169
+ focusNextField={() => {
170
+ this.setState({ focusOn: 'email' });
155
171
  }}
156
- key="tel"
157
172
  />
158
173
  </div>
159
- <div
160
- className="contact-info"
161
- onClick={() => {
162
- this.setState({ focusOn: 'email' });
163
- }}
164
- >
174
+ <div className="contact-info">
165
175
  <div className="icon-wrapper">
166
176
  <Icon icon="envelope" />
167
177
  </div>
168
178
  <TextEditorWidget
179
+ {...this.props}
180
+ key="email"
181
+ wrapClass="email"
169
182
  data={this.props.data}
170
183
  fieldName="email"
171
184
  selected={this.props.selected && this.state.focusOn === 'email'}
172
- block={this.props.block}
173
- onChangeBlock={this.onChange}
185
+ onChangeBlock={(block, _data) => {
186
+ this.props.onChangeBlock(this.props.index, _data);
187
+ }}
174
188
  placeholder={this.props.intl.formatMessage(
175
189
  messages.textPlaceholder,
176
190
  )}
177
- prevFocus="email"
178
- setFocus={(f) => {
179
- this.setState({ focusOn: f });
191
+ setSelected={(f) => this.setState({ focusOn: f })}
192
+ focusPrevField={() => {
193
+ this.setState({ focusOn: 'tel' });
180
194
  }}
181
- key="email"
195
+ focusNextField={
196
+ !this.props.isLast
197
+ ? () => {
198
+ this.setState({ focusOn: null });
199
+ this.props.onSubblockChangeFocus(this.props.index + 1);
200
+ }
201
+ : null //default go to next block
202
+ }
182
203
  />
183
204
  </div>
184
205
  </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,68 @@ 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
+ this.setState({ selectedField: 'title' });
54
+ }
55
+ } else {
56
+ this.setState({ selectedField: null });
57
+ }
58
+ }
59
+
60
+ handleEnter = (e) => {
61
+ if (
62
+ this.props.selected &&
63
+ this.state.subIndexSelected < 0 &&
64
+ !this.state.selectedField
65
+ ) {
66
+ handleKeyDownOwnFocusManagement(e, this.props);
67
+ }
68
+ };
69
+
70
+ handleClick = (e) => {
71
+ const hasParent = (element, className) => {
72
+ if (!element.parentNode) {
73
+ return false;
74
+ }
75
+
76
+ if (element.classList.contains(className)) {
77
+ return true;
78
+ }
79
+
80
+ return hasParent(element.parentNode, className);
81
+ };
82
+ const clickOutsideSubblocks =
83
+ !e.target.classList.contains('volto-subblocks-wrapper') &&
84
+ !hasParent(e.target, 'volto-subblocks-wrapper');
85
+
86
+ if (clickOutsideSubblocks) {
87
+ this.setState({ subIndexSelected: -1 });
88
+ }
89
+ };
90
+
91
+ componentDidMount() {
92
+ if (this.props.selected && this.node) {
93
+ this.node.focus();
94
+ }
95
+ if (this.props.selected && this.nodeF.current) {
96
+ this.nodeF.current.focus();
97
+ }
98
+
99
+ if (this.state.subblocks.length === 0) {
100
+ this.addSubblock();
101
+ }
102
+
103
+ if (this.nodeF && this.nodeF.current) {
104
+ this.nodeF.current.addEventListener('keydown', this.handleEnter, false);
105
+ this.nodeF.current.addEventListener('click', this.handleClick, false);
106
+ }
47
107
  }
108
+
48
109
  /**
49
110
  * Render method.
50
111
  * @method render
@@ -56,7 +117,7 @@ class Edit extends SubblocksEdit {
56
117
  }
57
118
 
58
119
  return (
59
- <div className="public-ui">
120
+ <div className="public-ui" tabIndex="-1" ref={this.nodeF}>
60
121
  <div
61
122
  className={`full-width section bg-${
62
123
  this.props.data.bg_color ?? 'primary'
@@ -66,19 +127,18 @@ class Edit extends SubblocksEdit {
66
127
  <div className="block-header">
67
128
  <div className="title">
68
129
  <TextEditorWidget
130
+ {...this.props}
131
+ key="title"
132
+ showToolbar={false}
69
133
  data={this.props.data}
70
134
  fieldName="title"
71
135
  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
136
  placeholder={this.props.intl.formatMessage(messages.title)}
79
- showToolbar={false}
80
137
  onSelectBlock={() => {}}
81
- onAddBlock={() => {
138
+ setSelected={(f) => {
139
+ this.setState({ selectedField: f, subIndexSelected: -1 });
140
+ }}
141
+ focusNextField={() => {
82
142
  this.setState({ selectedField: 'description' });
83
143
  }}
84
144
  />
@@ -86,21 +146,24 @@ class Edit extends SubblocksEdit {
86
146
 
87
147
  <div className="description">
88
148
  <TextEditorWidget
149
+ {...this.props}
150
+ key="description"
89
151
  data={this.props.data}
90
152
  fieldName="description"
91
153
  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
154
  placeholder={this.props.intl.formatMessage(
99
155
  messages.description,
100
156
  )}
101
- showToolbar={true}
102
157
  onSelectBlock={() => {}}
103
- onAddBlock={() => {}}
158
+ setSelected={(f) => {
159
+ this.setState({ selectedField: f, subIndexSelected: -1 });
160
+ }}
161
+ focusPrevField={() => {
162
+ this.setState({ selectedField: 'title' });
163
+ }}
164
+ focusNextField={() => {
165
+ this.setState({ selectedField: null, subIndexSelected: 0 });
166
+ }}
104
167
  />
105
168
  </div>
106
169
  </div>
@@ -116,11 +179,22 @@ class Edit extends SubblocksEdit {
116
179
  {this.state.subblocks.map((subblock, subindex) => (
117
180
  <Col lg="4" key={subblock.id} className="pb-3">
118
181
  <EditBlock
182
+ {...this.props}
119
183
  data={subblock}
120
184
  index={subindex}
121
185
  selected={this.isSubblockSelected(subindex)}
122
186
  {...this.subblockProps}
123
187
  openObjectBrowser={this.props.openObjectBrowser}
188
+ onSubblockChangeFocus={this.onSubblockChangeFocus}
189
+ onChangeFocus={this.onSubblockChangeFocus}
190
+ isLast={this.state.subblocks.length - 1 === subindex}
191
+ isFirst={subindex === 0}
192
+ onFocusPreviousBlock={() => {
193
+ this.setState({
194
+ selectedField: 'description',
195
+ subIndexSelected: -1,
196
+ });
197
+ }}
124
198
  />
125
199
  </Col>
126
200
  ))}
@@ -134,7 +208,6 @@ class Edit extends SubblocksEdit {
134
208
  )}
135
209
  </Row>
136
210
  </SubblocksWrapper>
137
-
138
211
  {this.props.data.href && this.props.data.linkMoreTitle && (
139
212
  <div className="link-button text-center my-4">
140
213
  <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={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={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>
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import redraft from 'redraft';
4
- import { checkRedraftHasContent } from 'design-comuni-plone-theme/helpers';
3
+ import { checkRichTextHasContent } from 'design-comuni-plone-theme/helpers';
5
4
  import { Container, Row, Col } from 'design-react-kit';
6
5
  import { addAppURL, flattenToAppURL } from '@plone/volto/helpers';
7
6
  import cx from 'classnames';
8
7
  import CountDown from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/CountDown/CountDown';
9
- import config from '@plone/volto/registry';
8
+ import { TextBlockView } from '@plone/volto-slate/blocks/Text';
10
9
 
11
10
  const View = ({ data, id }) => {
12
11
  return (
@@ -37,7 +36,7 @@ const View = ({ data, id }) => {
37
36
  )}
38
37
  <Container className="px-md-4">
39
38
  <Row>
40
- {checkRedraftHasContent(data.text) && (
39
+ {checkRichTextHasContent(data.text) && (
41
40
  <Col
42
41
  xs={{
43
42
  size: 12,
@@ -48,11 +47,7 @@ const View = ({ data, id }) => {
48
47
  }}
49
48
  className="text"
50
49
  >
51
- {redraft(
52
- data.text,
53
- config.settings.richtextViewSettings.ToHTMLRenderers,
54
- config.settings.richtextViewSettings.ToHTMLOptions,
55
- )}
50
+ <TextBlockView data={{ value: data.text }} />
56
51
  </Col>
57
52
  )}
58
53
  <Col
@@ -71,13 +66,9 @@ const View = ({ data, id }) => {
71
66
  showMinutes={data.showMinutes}
72
67
  showSeconds={data.showSeconds}
73
68
  />
74
- {checkRedraftHasContent(data.countdown_text) && (
69
+ {checkRichTextHasContent(data.countdown_text) && (
75
70
  <div className="countdown_text">
76
- {redraft(
77
- data.countdown_text,
78
- config.settings.richtextViewSettings.ToHTMLRenderers,
79
- config.settings.richtextViewSettings.ToHTMLOptions,
80
- )}
71
+ <TextBlockView data={{ value: data.countdown_text }} />
81
72
  </div>
82
73
  )}
83
74
  </Col>