design-comuni-plone-theme 11.29.2 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/.github/workflows/main.yml +16 -16
  2. package/.github/workflows/npm.yml +1 -1
  3. package/.github/workflows/withnewsletter.yml +47 -0
  4. package/.release-it.json +1 -0
  5. package/.yarn/cache/@babel-helper-module-imports-npm-7.24.3-edb733448b-c23492189b.zip +0 -0
  6. package/.yarn/cache/@babel-types-npm-7.24.0-a0508cb308-4b574a37d4.zip +0 -0
  7. package/.yarn/cache/babel-plugin-lodash-npm-3.3.4-c7161075b6-044a4261e6.zip +0 -0
  8. package/.yarn/cache/braces-npm-3.0.3-582c14023c-b95aa0b3bd.zip +0 -0
  9. package/.yarn/cache/fill-range-npm-7.1.1-bf491486db-b4abfbca38.zip +0 -0
  10. package/.yarn/cache/micromatch-npm-4.0.8-c9570e4aca-79920eb634.zip +0 -0
  11. package/.yarn/cache/require-package-name-npm-2.0.1-ac9a206b63-00f4e9e467.zip +0 -0
  12. package/.yarn/install-state.gz +0 -0
  13. package/CHANGELOG.md +1728 -1659
  14. package/RELEASE.md +6 -0
  15. package/locales/de/LC_MESSAGES/volto.po +86 -19
  16. package/locales/en/LC_MESSAGES/volto.po +86 -19
  17. package/locales/es/LC_MESSAGES/volto.po +86 -19
  18. package/locales/fr/LC_MESSAGES/volto.po +86 -19
  19. package/locales/it/LC_MESSAGES/volto.po +87 -20
  20. package/locales/volto.pot +87 -20
  21. package/package.json +3 -1
  22. package/publiccode.yml +2 -2
  23. package/src/components/Collapse.jsx +1 -0
  24. package/src/components/ItaliaTheme/AppExtras/SiteSettingsExtras.jsx +0 -6
  25. package/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx +29 -24
  26. package/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx +4 -12
  27. package/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx +118 -42
  28. package/src/components/ItaliaTheme/Blocks/Accordion/View.jsx +4 -18
  29. package/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx +60 -113
  30. package/src/components/ItaliaTheme/Blocks/Alert/Sidebar.jsx +1 -0
  31. package/src/components/ItaliaTheme/Blocks/Alert/View.jsx +5 -14
  32. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx +16 -11
  33. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx +2 -1
  34. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Edit.jsx +39 -1
  35. package/src/components/ItaliaTheme/Blocks/CTABlock/Block.jsx +35 -95
  36. package/src/components/ItaliaTheme/Blocks/Callout/Edit.jsx +108 -0
  37. package/src/components/ItaliaTheme/Blocks/Callout/Sidebar.jsx +173 -0
  38. package/src/components/ItaliaTheme/Blocks/Callout/View.jsx +45 -0
  39. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx +86 -63
  40. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/ViewBlock.jsx +19 -39
  41. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx +101 -22
  42. package/src/components/ItaliaTheme/Blocks/ContactsBlock/View.jsx +13 -21
  43. package/src/components/ItaliaTheme/Blocks/CountDown/Edit.jsx +21 -25
  44. package/src/components/ItaliaTheme/Blocks/CountDown/View.jsx +6 -15
  45. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx +52 -22
  46. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx +9 -29
  47. package/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx +108 -21
  48. package/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx +1 -9
  49. package/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx +6 -14
  50. package/src/components/ItaliaTheme/Blocks/Listing/CardWithSlideUpTextTemplate.jsx +0 -1
  51. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx +45 -15
  52. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/ViewBlock.jsx +2 -18
  53. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx +98 -11
  54. package/src/components/ItaliaTheme/Blocks/NumbersBlock/View.jsx +2 -7
  55. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx +35 -67
  56. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Edit.jsx +2 -8
  57. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/BodyWrapper.jsx +2 -1
  58. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx +98 -84
  59. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/View.jsx +20 -3
  60. package/src/components/ItaliaTheme/Blocks/UOSearch/Sidebar.jsx +11 -11
  61. package/src/components/ItaliaTheme/Blocks/__tests__/Accordion.test.jsx +11 -28
  62. package/src/components/ItaliaTheme/Blocks/__tests__/Alert.test.jsx +10 -14
  63. package/src/components/ItaliaTheme/Blocks/__tests__/ArgumentsInEvidence.test.jsx +20 -28
  64. package/src/components/ItaliaTheme/Blocks/__tests__/CTABlock.test.jsx +14 -29
  65. package/src/components/ItaliaTheme/Blocks/__tests__/CardWithImage.test.jsx +11 -28
  66. package/src/components/ItaliaTheme/Blocks/__tests__/ContactsBlock.test.jsx +75 -140
  67. package/src/components/ItaliaTheme/Blocks/__tests__/Countdown.test.jsx +20 -28
  68. package/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx +22 -56
  69. package/src/components/ItaliaTheme/Blocks/__tests__/NumbersBlock.test.jsx +14 -43
  70. package/src/components/ItaliaTheme/Blocks/__tests__/SimpleCard.test.jsx +14 -30
  71. package/src/components/ItaliaTheme/BrandText/BrandText.jsx +8 -14
  72. package/src/components/ItaliaTheme/BrandTextFooter/BrandTextFooter.jsx +31 -2
  73. package/src/components/ItaliaTheme/Footer/FooterInfos.jsx +21 -8
  74. package/src/components/ItaliaTheme/Footer/FooterNavigation.jsx +3 -3
  75. package/src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlim.jsx +0 -7
  76. package/src/components/ItaliaTheme/Icons/Icon.jsx +0 -1
  77. package/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx +5 -1
  78. package/src/components/ItaliaTheme/View/BandoView/BandoApprofondimenti.jsx +1 -2
  79. package/src/components/ItaliaTheme/View/CartellaModulisticaView/DocRow.jsx +14 -5
  80. package/src/components/ItaliaTheme/View/Commons/Attachment.jsx +19 -3
  81. package/src/components/ItaliaTheme/View/Commons/Attachments.jsx +0 -1
  82. package/src/components/ItaliaTheme/View/Commons/DownloadFileFormat.jsx +11 -7
  83. package/src/components/ItaliaTheme/View/Commons/Gallery.jsx +1 -0
  84. package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderEventDates.jsx +0 -1
  85. package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderLinkServizio.jsx +6 -2
  86. package/src/components/ItaliaTheme/View/Commons/RichTextRender.jsx +8 -6
  87. package/src/components/ItaliaTheme/View/Commons/__tests__/RichText.test.jsx +14 -17
  88. package/src/components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreEsterno.jsx +1 -1
  89. package/src/components/ItaliaTheme/View/EventoView/EventoUlterioriInformazioni.jsx +0 -4
  90. package/src/components/ItaliaTheme/View/ServizioView/ServizioAccedi.jsx +10 -7
  91. package/src/components/ItaliaTheme/View/ServizioView/ServizioMetatag.jsx +4 -3
  92. package/src/components/ItaliaTheme/View/__disabled_tests__/IncaricoView.test__disabled.jsx +24 -30
  93. package/src/components/ItaliaTheme/View/__tests__/CartellaModulisticaView.test.jsx +12 -1
  94. package/src/components/ItaliaTheme/View/__tests__/PageView.test.jsx +24 -2
  95. package/src/components/ItaliaTheme/View/__tests__/PersonaView.test.jsx +96 -92
  96. package/src/components/ItaliaTheme/View/__tests__/ServizioAChiSiRivolge.test.jsx +240 -286
  97. package/src/components/ItaliaTheme/View/__tests__/ServizioAccedi.test.jsx +240 -286
  98. package/src/components/ItaliaTheme/View/__tests__/ServizioCasiParticolari.test.jsx +240 -286
  99. package/src/components/ItaliaTheme/View/__tests__/ServizioComeFare.test.jsx +240 -286
  100. package/src/components/ItaliaTheme/View/__tests__/ServizioCondizioni.test.jsx +240 -286
  101. package/src/components/ItaliaTheme/View/__tests__/ServizioContatti.test.jsx +240 -286
  102. package/src/components/ItaliaTheme/View/__tests__/ServizioCosE.test.jsx +240 -286
  103. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaServe.test.jsx +240 -286
  104. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaSiOttiene.test.jsx +240 -286
  105. package/src/components/ItaliaTheme/View/__tests__/ServizioCostiVincoli.test.jsx +240 -286
  106. package/src/components/ItaliaTheme/View/__tests__/ServizioMetadati.test.jsx +240 -286
  107. package/src/components/ItaliaTheme/View/__tests__/ServizioModulistica.test.jsx +240 -286
  108. package/src/components/ItaliaTheme/View/__tests__/ServizioProcedure.test.jsx +240 -286
  109. package/src/components/ItaliaTheme/View/__tests__/ServizioSitiEsterni.test.jsx +240 -286
  110. package/src/components/ItaliaTheme/View/__tests__/ServizioTempiScadenze.test.jsx +240 -286
  111. package/src/components/ItaliaTheme/View/__tests__/ServizioUlterioriInformazioni.test.jsx +240 -286
  112. package/src/components/ItaliaTheme/View/__tests__/ServizioView.test.jsx +470 -560
  113. package/src/components/ItaliaTheme/View/__tests__/TrasparenzaView.test.jsx +12 -1
  114. package/src/components/ItaliaTheme/index.js +0 -1
  115. package/src/components/ItaliaTheme/manage/Widgets/ColorListWidget.jsx +11 -2
  116. package/src/components/ItaliaTheme/manage/Widgets/HtmlSlateWidget.jsx +156 -0
  117. package/src/components/ItaliaTheme/manage/Widgets/RichTextWidget.jsx +88 -0
  118. package/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx +158 -0
  119. package/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx +167 -270
  120. package/src/config/Blocks/ListingOptions/index.js +0 -1
  121. package/src/config/Blocks/ListingOptions/utils.js +0 -7
  122. package/src/config/Blocks/blocks.js +29 -8
  123. package/src/config/Blocks/listingVariations.js +1 -1
  124. package/src/config/Slate/Alignment/AlignMenu.jsx +169 -0
  125. package/src/config/Slate/Alignment/index.js +42 -0
  126. package/src/config/Slate/Blockquote/BlockquoteMenu.jsx +151 -0
  127. package/src/config/Slate/Blockquote/index.js +19 -0
  128. package/src/config/Slate/Headings/HeadingsMenu.jsx +139 -0
  129. package/src/config/Slate/Headings/headingsMenu.scss +44 -0
  130. package/src/config/Slate/Headings/index.js +62 -0
  131. package/src/config/Slate/Link/deserializer.js +25 -0
  132. package/src/config/Slate/Link/index.js +126 -0
  133. package/src/config/Slate/Link/renderer.jsx +99 -0
  134. package/src/config/Slate/LinkButton/index.js +47 -0
  135. package/src/config/Slate/TextLarger/index.js +51 -0
  136. package/src/config/Slate/Underline/index.js +10 -0
  137. package/src/config/Slate/config.js +43 -0
  138. package/src/config/Slate/deserializers.js +66 -0
  139. package/src/config/Slate/dropdownStyle.scss +14 -0
  140. package/src/config/Slate/dropdownUtils.js +422 -0
  141. package/src/config/Slate/extensions/breakList.js +91 -0
  142. package/src/config/Slate/handlers.js +243 -0
  143. package/src/config/Slate/utils.js +73 -0
  144. package/src/config/Widgets/widgets.js +1 -2
  145. package/src/config/italiaConfig.js +5 -53
  146. package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +361 -0
  147. package/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx +75 -200
  148. package/src/customizations/volto/components/manage/Blocks/Video/Body.jsx +0 -1
  149. package/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx +1 -1
  150. package/src/customizations/volto/components/manage/Form/BlocksToolbar.jsx +1 -1
  151. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +76 -18
  152. package/src/customizations/volto/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +4 -0
  153. package/src/customizations/volto-form-block/components/Field.jsx +45 -22
  154. package/src/helpers/EnhanceLink.js +44 -0
  155. package/src/helpers/FormValidation/FormValidationHelpers.js +3 -0
  156. package/src/helpers/blocks.js +80 -0
  157. package/src/helpers/files.js +13 -13
  158. package/src/helpers/index.js +4 -3
  159. package/src/helpers/richTextHelper.js +10 -0
  160. package/src/icons/Group.svg +1 -0
  161. package/src/icons/blocco-icone.svg +0 -3
  162. package/src/icons/blockquote-card-dark.svg +1 -0
  163. package/src/icons/blockquote-card.svg +1 -0
  164. package/src/icons/blockquote-simple.svg +1 -0
  165. package/src/icons/text-larger.svg +1 -0
  166. package/src/theme/ItaliaTheme/Blocks/_accordion.scss +2 -22
  167. package/src/theme/ItaliaTheme/Blocks/_alert.scss +51 -4
  168. package/src/theme/ItaliaTheme/Blocks/_bandiInEvidenceTemplate.scss +1 -0
  169. package/src/theme/ItaliaTheme/Blocks/_callout.scss +32 -0
  170. package/src/theme/ItaliaTheme/Blocks/_contacts.scss +17 -51
  171. package/src/theme/ItaliaTheme/Blocks/_countdown.scss +10 -1
  172. package/src/theme/ItaliaTheme/Blocks/_ctaBlock.scss +7 -23
  173. package/src/theme/ItaliaTheme/Blocks/_gridBlock.scss +1 -1
  174. package/src/theme/ItaliaTheme/Blocks/_hero.scss +1 -8
  175. package/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss +6 -77
  176. package/src/theme/ItaliaTheme/Blocks/_imageCardTextBlock.scss +3 -2
  177. package/src/theme/ItaliaTheme/Blocks/_numbers.scss +6 -20
  178. package/src/theme/ItaliaTheme/Blocks/_simpleCardTextBlock.scss +8 -2
  179. package/src/theme/ItaliaTheme/Blocks/_subblocks-edit.scss +3 -1
  180. package/src/theme/ItaliaTheme/Blocks/_tableOfContents.scss +1 -0
  181. package/src/theme/ItaliaTheme/Components/_megamenu.scss +0 -4
  182. package/src/theme/ItaliaTheme/Components/_mobileMenu.scss +12 -16
  183. package/src/theme/ItaliaTheme/Print/_page.scss +1 -1
  184. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_contacts.scss +3 -0
  185. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_cta.scss +1 -0
  186. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_searchSections.scss +1 -0
  187. package/src/theme/ItaliaTheme/Subsites/bootstrap-italia/custom/_headercenter.scss +1 -0
  188. package/src/theme/ItaliaTheme/Views/_cartellaModulistica.scss +11 -2
  189. package/src/theme/ItaliaTheme/Views/_servizio.scss +2 -2
  190. package/src/theme/ItaliaTheme/Views/_slider.scss +3 -0
  191. package/src/theme/ItaliaTheme/Widgets/_iconWidget.scss +4 -0
  192. package/src/theme/ItaliaTheme/_common.scss +1 -0
  193. package/src/theme/ItaliaTheme/_home.scss +0 -4
  194. package/src/theme/ItaliaTheme/_main.scss +78 -84
  195. package/src/theme/_cms-ui.scss +63 -160
  196. package/src/theme/_mixins.scss +13 -0
  197. package/src/theme/bootstrap-override/_bootstrap-italia-site.scss +1 -0
  198. package/src/theme/bootstrap-override/bootstrap-italia/_footer.scss +1 -1
  199. package/src/theme/bootstrap-override/bootstrap-italia/_forms.scss +7 -0
  200. package/src/theme/bootstrap-override/bootstrap-italia/_headercenter.scss +8 -3
  201. package/src/theme/extras/_forms.scss +2 -14
  202. package/src/theme/site.scss +1 -1
  203. package/test-setup-config.js +58 -0
  204. package/.yarn/cache/braces-npm-3.0.2-782240b28a-e2a8e769a8.zip +0 -0
  205. package/.yarn/cache/fill-range-npm-7.0.1-b8b1817caa-cc283f4e65.zip +0 -0
  206. package/.yarn/cache/micromatch-npm-4.0.5-cfab5d7669-02a17b671c.zip +0 -0
  207. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Block.jsx +0 -151
  208. package/src/components/ItaliaTheme/RemoveBodyClass/RemoveBodyClass.jsx +0 -84
  209. package/src/config/RichTextEditor/LinkEntity.jsx +0 -27
  210. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/Link/index.jsx +0 -44
  211. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +0 -349
  212. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/index.js +0 -150
  213. package/src/config/RichTextEditor/Plugins/AnchorPlugin/index.js +0 -88
  214. package/src/config/RichTextEditor/ToolbarButtons/AlignButton.jsx +0 -61
  215. package/src/config/RichTextEditor/ToolbarButtons/ButtonsButton.jsx +0 -14
  216. package/src/config/RichTextEditor/ToolbarButtons/CalloutsButton.jsx +0 -38
  217. package/src/config/RichTextEditor/ToolbarButtons/DraftJsDropdownButton.jsx +0 -106
  218. package/src/config/RichTextEditor/ToolbarButtons/HeadingsButton.jsx +0 -57
  219. package/src/config/RichTextEditor/ToolbarButtons/TextSizeButton.jsx +0 -65
  220. package/src/config/RichTextEditor/ToolbarButtons/UnderlineButton.jsx +0 -14
  221. package/src/config/RichTextEditor/config.js +0 -253
  222. package/src/config/volto-gdpr-privacy-defaultPanelConfig.js +0 -292
  223. package/src/customizations/volto/components/manage/Blocks/ToC/View.jsx +0 -134
  224. package/src/customizations/volto/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +0 -99
  225. package/src/customizations/volto/config/RichTextEditor/Plugins.jsx +0 -63
  226. package/src/helpers/redraftHelper.js +0 -9
  227. package/src/theme/ItaliaTheme/Components/_logo.scss +0 -10
@@ -1,6 +1,7 @@
1
1
  /*
2
2
  CUSTOMIZATIONS:
3
3
  - Added stores link
4
+ - Added slate
4
5
  */
5
6
 
6
7
  /**
@@ -17,8 +18,7 @@ import { Button, Dimmer, Loader, Message } from 'semantic-ui-react';
17
18
  import { isEqual } from 'lodash';
18
19
  import { defineMessages, injectIntl } from 'react-intl';
19
20
  import cx from 'classnames';
20
-
21
- import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
21
+ import { handleKeyDownOwnFocusManagement } from 'design-comuni-plone-theme/helpers/blocks';
22
22
  import {
23
23
  flattenToAppURL,
24
24
  getBaseUrl,
@@ -29,6 +29,7 @@ import { Icon, SidebarPortal } from '@plone/volto/components';
29
29
 
30
30
  import clearSVG from '@plone/volto/icons/clear.svg';
31
31
 
32
+ import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
32
33
  import StoresButtons from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/HeroImageLeft/StoresButtons';
33
34
  import HeroSidebar from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/HeroImageLeft/HeroSidebar';
34
35
 
@@ -104,7 +105,7 @@ class EditComponent extends Component {
104
105
  * Constructor
105
106
  * @method constructor
106
107
  * @param {Object} props Component properties
107
- * @constructs WysiwygEditor
108
+ * @constructs Hero Image left edit
108
109
  */
109
110
  constructor(props) {
110
111
  super(props);
@@ -114,58 +115,20 @@ class EditComponent extends Component {
114
115
  uploading: false,
115
116
  };
116
117
 
117
- const { Map } = this.props.immutableLib;
118
-
119
118
  if (!__SERVER__) {
120
- const { DefaultDraftBlockRenderMap, EditorState } = props.draftJs;
121
- const { stateFromHTML } = props.draftJsImportHtml;
122
-
123
- const blockTitleRenderMap = Map({
124
- unstyled: {
125
- element: 'h1',
126
- },
127
- });
128
-
129
- const blockDescriptionRenderMap = Map({
130
- unstyled: {
131
- element: 'div',
132
- },
133
- });
134
-
135
- this.extendedBlockRenderMap =
136
- DefaultDraftBlockRenderMap.merge(blockTitleRenderMap);
137
-
138
- this.extendedDescripBlockRenderMap = DefaultDraftBlockRenderMap.merge(
139
- blockDescriptionRenderMap,
140
- );
141
-
142
- let titleEditorState;
143
- let descriptionEditorState;
144
- if (props.data && props.data.title) {
145
- titleEditorState = EditorState.createWithContent(
146
- stateFromHTML(props.data.title),
147
- );
148
- } else {
149
- titleEditorState = EditorState.createEmpty();
150
- }
151
- if (props.data && props.data.description) {
152
- descriptionEditorState = EditorState.createWithContent(
153
- stateFromHTML(props.data.description),
154
- );
155
- } else {
156
- descriptionEditorState = EditorState.createEmpty();
157
- }
158
119
  this.state = {
159
120
  uploading: false,
160
- titleEditorState,
161
- descriptionEditorState,
162
121
  currentFocused: 'title',
163
122
  };
164
123
  }
165
-
166
- this.onChangeTitle = this.onChangeTitle.bind(this);
167
- this.onChangeDescription = this.onChangeDescription.bind(this);
168
124
  }
125
+ blockRef = React.createRef();
126
+
127
+ handleEnter = (e) => {
128
+ if (this.props.selected) {
129
+ handleKeyDownOwnFocusManagement(e, this.props);
130
+ }
131
+ };
169
132
 
170
133
  /**
171
134
  * Component did mount
@@ -174,7 +137,22 @@ class EditComponent extends Component {
174
137
  */
175
138
  componentDidMount() {
176
139
  if (this.props.selected) {
177
- this.titleEditor.focus();
140
+ this.setState(() => ({ currentFocused: 'title' }));
141
+ }
142
+
143
+ const blockNode = this.props.blockNode;
144
+
145
+ if (this.props.selected && this.node) {
146
+ this.node.focus();
147
+ }
148
+ if (blockNode && blockNode.current) {
149
+ blockNode.current.addEventListener('keydown', this.handleEnter, false);
150
+ } else if (this.blockRef && this.blockRef.current) {
151
+ this.blockRef.current.addEventListener(
152
+ 'keydown',
153
+ this.handleEnter,
154
+ false,
155
+ );
178
156
  }
179
157
  }
180
158
 
@@ -199,44 +177,14 @@ class EditComponent extends Component {
199
177
  });
200
178
  }
201
179
 
202
- const { EditorState } = this.props.draftJs;
203
- const { stateFromHTML } = this.props.draftJsImportHtml;
204
-
205
- if (
206
- nextProps.data.title &&
207
- this.props.data.title !== nextProps.data.title &&
208
- !this.props.selected
209
- ) {
210
- const contentState = stateFromHTML(nextProps.data.title);
211
- this.setState({
212
- titleEditorState: nextProps.data.title
213
- ? EditorState.createWithContent(contentState)
214
- : EditorState.createEmpty(),
215
- });
216
- }
217
-
218
- if (
219
- nextProps.data.description &&
220
- this.props.data.description !== nextProps.data.description &&
221
- !this.props.selected
222
- ) {
223
- const contentState = stateFromHTML(nextProps.data.description);
224
- this.setState({
225
- descriptionEditorState: nextProps.data.description
226
- ? EditorState.createWithContent(contentState)
227
- : EditorState.createEmpty(),
228
- });
229
- }
230
-
231
- if (nextProps.selected !== this.props.selected) {
232
- if (this.state.currentFocused === 'title') {
233
- this.titleEditor.focus();
234
- } else {
235
- this.descriptionEditor.focus();
180
+ if (nextProps.selected) {
181
+ if (!this.props.selected) {
182
+ this.setState({ currentFocused: 'title' });
236
183
  }
184
+ } else {
185
+ this.setState({ currentFocused: null });
237
186
  }
238
187
  }
239
-
240
188
  /**
241
189
  * @param {*} nextProps
242
190
  * @param {*} nextState
@@ -247,36 +195,6 @@ class EditComponent extends Component {
247
195
  return this.props.selected || !isEqual(this.props.data, nextProps.data);
248
196
  }
249
197
 
250
- /**
251
- * Change Title handler
252
- * @method onChangeTitle
253
- * @param {object} titleEditorState Editor state.
254
- * @returns {undefined}
255
- */
256
- onChangeTitle(titleEditorState) {
257
- this.setState({ titleEditorState }, () => {
258
- this.props.onChangeBlock(this.props.block, {
259
- ...this.props.data,
260
- title: titleEditorState.getCurrentContent().getPlainText(),
261
- });
262
- });
263
- }
264
-
265
- /**
266
- * Change Description handler
267
- * @method onChangeDescription
268
- * @param {object} descriptionEditorState Editor state.
269
- * @returns {undefined}
270
- */
271
- onChangeDescription(descriptionEditorState) {
272
- this.setState({ descriptionEditorState }, () => {
273
- this.props.onChangeBlock(this.props.block, {
274
- ...this.props.data,
275
- description: descriptionEditorState.getCurrentContent().getPlainText(),
276
- });
277
- });
278
- }
279
-
280
198
  /**
281
199
  * Upload image handler
282
200
  * @method onUploadImage
@@ -315,13 +233,21 @@ class EditComponent extends Component {
315
233
  if (__SERVER__) {
316
234
  return <div />;
317
235
  }
318
- const { Editor } = this.props.draftJs;
236
+
319
237
  const placeholder =
320
238
  this.props.data.placeholder ||
321
239
  this.props.intl.formatMessage(messages.placeholder);
322
240
 
323
241
  return (
324
- <div className="public-ui">
242
+ <div
243
+ className="public-ui"
244
+ tabIndex="-1"
245
+ ref={(node) => {
246
+ if (node) {
247
+ this.blockRef.current = node;
248
+ }
249
+ }}
250
+ >
325
251
  <div
326
252
  className={cx('block hero', {
327
253
  selected: this.props.selected,
@@ -392,92 +318,43 @@ class EditComponent extends Component {
392
318
  })}
393
319
  >
394
320
  <div className="edit-title">
395
- <Editor
396
- ref={(node) => {
397
- this.titleEditor = node;
398
- }}
399
- readOnly={!this.props.editable}
400
- onChange={this.onChangeTitle}
401
- editorState={this.state.titleEditorState}
402
- blockRenderMap={this.extendedBlockRenderMap}
403
- handleReturn={() => true}
404
- placeholder={this.props.intl.formatMessage(messages.title)}
405
- blockStyleFn={() => 'title-editor'}
406
- onUpArrow={() => {
407
- const selectionState =
408
- this.state.titleEditorState.getSelection();
409
- const { titleEditorState } = this.state;
410
- if (
411
- titleEditorState
412
- .getCurrentContent()
413
- .getBlockMap()
414
- .first()
415
- .getKey() === selectionState.getFocusKey()
416
- ) {
417
- this.props.onFocusPreviousBlock(
418
- this.props.block,
419
- this.props.blockNode.current,
420
- );
421
- }
422
- }}
423
- onDownArrow={() => {
424
- const selectionState =
425
- this.state.titleEditorState.getSelection();
426
- const { titleEditorState } = this.state;
427
- if (
428
- titleEditorState
429
- .getCurrentContent()
430
- .getBlockMap()
431
- .last()
432
- .getKey() === selectionState.getFocusKey()
433
- ) {
321
+ <h1>
322
+ <TextEditorWidget
323
+ {...this.props}
324
+ showToolbar={false}
325
+ data={this.props.data}
326
+ fieldName="title"
327
+ selected={this.state.currentFocused === 'title'}
328
+ placeholder={this.props.intl.formatMessage(messages.title)}
329
+ setSelected={(f) => {
330
+ this.setState(() => ({ currentFocused: f }));
331
+ }}
332
+ focusNextField={() => {
434
333
  this.setState(() => ({ currentFocused: 'description' }));
435
- this.descriptionEditor.focus();
436
- }
437
- }}
438
- />
334
+ }}
335
+ />
336
+ </h1>
439
337
  </div>
440
- <Editor
441
- ref={(node) => {
442
- this.descriptionEditor = node;
443
- }}
444
- readOnly={!this.props.editable}
445
- onChange={this.onChangeDescription}
446
- editorState={this.state.descriptionEditorState}
447
- blockRenderMap={this.extendedDescripBlockRenderMap}
448
- handleReturn={() => true}
449
- placeholder={this.props.intl.formatMessage(
450
- messages.description,
451
- )}
452
- blockStyleFn={() => 'description-editor'}
453
- onUpArrow={() => {
454
- const selectionState =
455
- this.state.descriptionEditorState.getSelection();
456
- const currentCursorPosition = selectionState.getStartOffset();
457
338
 
458
- if (currentCursorPosition === 0) {
339
+ <p>
340
+ <TextEditorWidget
341
+ {...this.props}
342
+ showToolbar={false}
343
+ data={this.props.data}
344
+ fieldName="description"
345
+ selected={this.state.currentFocused === 'description'}
346
+ placeholder={this.props.intl.formatMessage(
347
+ messages.description,
348
+ )}
349
+ setSelected={(f) => {
350
+ this.setState(() => ({ currentFocused: f }));
351
+ }}
352
+ focusPrevField={() => {
459
353
  this.setState(() => ({ currentFocused: 'title' }));
460
- this.titleEditor.focus();
461
- }
462
- }}
463
- onDownArrow={() => {
464
- const selectionState =
465
- this.state.descriptionEditorState.getSelection();
466
- const { descriptionEditorState } = this.state;
467
- const currentCursorPosition = selectionState.getStartOffset();
468
- const blockLength = descriptionEditorState
469
- .getCurrentContent()
470
- .getFirstBlock()
471
- .getLength();
354
+ }}
355
+ />
356
+ </p>
472
357
 
473
- if (currentCursorPosition === blockLength) {
474
- this.props.onFocusNextBlock(
475
- this.props.block,
476
- this.props.blockNode.current,
477
- );
478
- }
479
- }}
480
- />
481
358
  <StoresButtons data={this.props.data} />
482
359
  </div>
483
360
  </div>
@@ -490,9 +367,7 @@ class EditComponent extends Component {
490
367
  }
491
368
  }
492
369
 
493
- const Edit = injectLazyLibs(['draftJs', 'immutableLib', 'draftJsImportHtml'])(
494
- EditComponent,
495
- );
370
+ const Edit = EditComponent;
496
371
 
497
372
  export default compose(
498
373
  injectIntl,
@@ -34,7 +34,6 @@ const Body = ({ data, isEditMode }) => {
34
34
  let placeholder = null;
35
35
  let videoID = null;
36
36
  let listID = null;
37
-
38
37
  if (data.url) {
39
38
  const [computedID, computedPlaceholder] = videoUrlHelper(
40
39
  data.url,
@@ -74,7 +74,7 @@ class Edit extends Component {
74
74
  * Constructor
75
75
  * @method constructor
76
76
  * @param {Object} props Component properties
77
- * @constructs WysiwygEditor
77
+ * @constructs Video block edit
78
78
  */
79
79
  constructor(props) {
80
80
  super(props);
@@ -17,7 +17,7 @@ import { Icon } from '@plone/volto/components';
17
17
  import { Plug } from '@plone/volto/components/manage/Pluggable';
18
18
  import { load } from 'redux-localstorage-simple';
19
19
  import { isEqual, omit, without } from 'lodash';
20
- import { cloneBlock } from 'design-comuni-plone-theme/config/Blocks/ListingOptions';
20
+ import { cloneBlock } from 'design-comuni-plone-theme/helpers/blocks';
21
21
  import { setBlocksClipboard, resetBlocksClipboard } from '@plone/volto/actions';
22
22
  import config from '@plone/volto/registry';
23
23
 
@@ -5,12 +5,14 @@
5
5
  * CUSTOMIZATIONS:
6
6
  * - aggiunto icona per link esterni
7
7
  * - aggiunto title informativo per link esterni
8
+ * - aggiunta la dimensione del file se il link punta a un file (enhanced_link_infos)
9
+ * - aggiunto il parametro hideFileFormat per nascondere il formato del file dall'enhance link
8
10
  * - aggiunta la condizione su @@display-file e @download-file per gestire i casi in cui questi parametri vengono imposti a monte
9
11
  */
10
12
 
11
13
  import React from 'react';
12
14
  import PropTypes from 'prop-types';
13
- import { useIntl } from 'react-intl';
15
+ import { useIntl, defineMessages } from 'react-intl';
14
16
  import { HashLink as Link } from 'react-router-hash-link';
15
17
  import { useSelector } from 'react-redux';
16
18
  import {
@@ -20,9 +22,16 @@ import {
20
22
  } from '@plone/volto/helpers/Url/Url';
21
23
  import { matchPath } from 'react-router';
22
24
  import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
23
-
25
+ import { EnhanceLink } from 'design-comuni-plone-theme/helpers';
26
+ import cx from 'classnames';
24
27
  import config from '@plone/volto/registry';
25
28
 
29
+ const messages = defineMessages({
30
+ opensInNewTab: {
31
+ id: 'opensInNewTab',
32
+ defaultMessage: 'Apre in un nuovo tab',
33
+ },
34
+ });
26
35
  const UniversalLink = ({
27
36
  href,
28
37
  item = null,
@@ -32,13 +41,31 @@ const UniversalLink = ({
32
41
  className = null,
33
42
  title = null,
34
43
  overrideMarkSpecialLinks = false,
44
+ hideFileFormat = false,
35
45
  ...props
36
46
  }) => {
37
- const intl = useIntl();
47
+ let translations = {
48
+ opensInNewTab: {
49
+ defaultMessage: messages.opensInNewTab.defaultMessage,
50
+ },
51
+ };
52
+ //questo perchè il provider di intl non è sempre definito, ad esempio in slate_wysiwyg_box (Slate RichTextWidget)
53
+ let intl = null;
54
+ try {
55
+ intl = useIntl();
56
+ Object.keys(translations).forEach(
57
+ (k) => (translations[k].message = intl.formatMessage(messages[k])),
58
+ );
59
+ } catch (e) {
60
+ // eslint-disable-next-line no-console
61
+ console.log('Cannot use intl here. View default messages.', e);
62
+ }
38
63
  const token = useSelector((state) => state.userSession?.token);
39
64
  const { openExternalLinkInNewTab } = config.settings;
40
65
 
41
66
  let url = href;
67
+ let enhanced_link_infos = null;
68
+
42
69
  if (!href && item) {
43
70
  if (!item['@id']) {
44
71
  // eslint-disable-next-line no-console
@@ -79,6 +106,16 @@ const UniversalLink = ({
79
106
  }
80
107
  }
81
108
 
109
+ if (item && item['@id']) {
110
+ /*enhance link*/
111
+ if (item && item.enhanced_links_enabled) {
112
+ enhanced_link_infos = { ...item };
113
+ if (!enhanced_link_infos.filename) {
114
+ enhanced_link_infos.filename = item['@id'];
115
+ }
116
+ }
117
+ }
118
+
82
119
  const isBlacklisted =
83
120
  (config.settings.externalRoutes ?? []).find((route) =>
84
121
  matchPath(flattenToAppURL(url), route.match),
@@ -91,6 +128,18 @@ const UniversalLink = ({
91
128
  const checkedURL = URLUtils.checkAndNormalizeUrl(url);
92
129
  url = checkedURL.url;
93
130
 
131
+ let aria_label = props['aria-label'] ?? item?.title ?? null;
132
+ let enhanced_link = null;
133
+ let extended_children = <></>;
134
+
135
+ if (enhanced_link_infos) {
136
+ enhanced_link = EnhanceLink({ enhanced_link_infos, aria_label });
137
+ extended_children = enhanced_link.children;
138
+ aria_label = enhanced_link.aria_label;
139
+ }
140
+ const showExternalIcon =
141
+ !overrideMarkSpecialLinks &&
142
+ config.settings.siteProperties.markSpecialLinks;
94
143
  let tag = (
95
144
  <Link
96
145
  to={flattenToAppURL(url)}
@@ -99,8 +148,10 @@ const UniversalLink = ({
99
148
  className={className}
100
149
  smooth={config.settings.hashLinkSmoothScroll}
101
150
  {...props}
151
+ aria-label={aria_label}
102
152
  >
103
153
  {children}
154
+ {extended_children}
104
155
  </Link>
105
156
  );
106
157
 
@@ -113,30 +164,33 @@ const UniversalLink = ({
113
164
  tag = (
114
165
  <a
115
166
  href={url}
116
- title={`${title ? title + ' - ' : ''}${intl.formatMessage({
117
- id: 'opensInNewTab',
118
- })}`}
167
+ title={`${title ? title + ' - ' : ''}${
168
+ translations.opensInNewTab.message ??
169
+ translations.opensInNewTab.defaultMessage
170
+ }`}
119
171
  target={
120
172
  !checkedURL.isMail && !checkedURL.isTelephone && openInNewTab
121
173
  ? '_blank'
122
174
  : null
123
175
  }
124
176
  rel="noopener noreferrer"
125
- className={className}
177
+ className={cx(className, {
178
+ 'with-external-link-icon': showExternalIcon,
179
+ })}
126
180
  {...props}
181
+ aria-label={aria_label}
127
182
  >
128
183
  {children}
129
- {!overrideMarkSpecialLinks &&
130
- config.settings.siteProperties.markSpecialLinks && (
131
- <Icon
132
- icon="it-external-link"
133
- title={`${title ? title + ' - ' : ''}${intl.formatMessage({
134
- id: 'opensInNewTab',
135
- })}`}
136
- size="xs"
137
- className="ms-1 align-sub external-link"
138
- />
139
- )}
184
+ {showExternalIcon && (
185
+ <Icon
186
+ icon="it-external-link"
187
+ title={`${title ? title + ' - ' : ''}${intl?.formatMessage({
188
+ id: 'opensInNewTab',
189
+ })}`}
190
+ size="xs"
191
+ className="ms-1 align-sub external-link"
192
+ />
193
+ )}
140
194
  </a>
141
195
  );
142
196
  } else if (isDownload) {
@@ -147,8 +201,10 @@ const UniversalLink = ({
147
201
  title={title}
148
202
  className={className}
149
203
  {...props}
204
+ aria-label={aria_label}
150
205
  >
151
206
  {children}
207
+ {extended_children}
152
208
  </a>
153
209
  );
154
210
  } else if (isDisplayFile) {
@@ -160,8 +216,10 @@ const UniversalLink = ({
160
216
  rel="noopener noreferrer"
161
217
  className={className}
162
218
  {...props}
219
+ aria-label={aria_label}
163
220
  >
164
221
  {children}
222
+ {extended_children}
165
223
  </a>
166
224
  );
167
225
  }
@@ -1008,6 +1008,7 @@ class RecurrenceWidget extends Component {
1008
1008
  onChange={this.onChangeRule}
1009
1009
  />
1010
1010
  )}
1011
+
1011
1012
  {/***** byday *****/}
1012
1013
  {OPTIONS.frequences[formValues.freq].byday && (
1013
1014
  <ByDayField
@@ -1016,6 +1017,7 @@ class RecurrenceWidget extends Component {
1016
1017
  onChange={this.onChangeRule}
1017
1018
  />
1018
1019
  )}
1020
+
1019
1021
  {/***** bymonth *****/}
1020
1022
  {OPTIONS.frequences[formValues.freq].bymonth && (
1021
1023
  <ByMonthField
@@ -1029,6 +1031,7 @@ class RecurrenceWidget extends Component {
1029
1031
  onChange={this.onChangeRule}
1030
1032
  />
1031
1033
  )}
1034
+
1032
1035
  {/***** byyear *****/}
1033
1036
  {OPTIONS.frequences[formValues.freq].byyear && (
1034
1037
  <ByYearField
@@ -1043,6 +1046,7 @@ class RecurrenceWidget extends Component {
1043
1046
  onChange={this.onChangeRule}
1044
1047
  />
1045
1048
  )}
1049
+
1046
1050
  {/*-- ends after N recurrence or date --*/}
1047
1051
  <EndField
1048
1052
  value={formValues.recurrenceEnds}