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,151 +0,0 @@
1
- /* eslint-disable jsx-a11y/no-static-element-interactions */
2
- /* eslint-disable jsx-a11y/click-events-have-key-events */
3
- import React, { useState, useEffect } from 'react';
4
- import { Card, CardBody, CardTitle } from 'design-react-kit';
5
- import { defineMessages, useIntl } from 'react-intl';
6
- import PropTypes from 'prop-types';
7
- import redraft from 'redraft';
8
- import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
9
- import { Divider } from 'semantic-ui-react';
10
- import cx from 'classnames';
11
- import config from '@plone/volto/registry';
12
-
13
- const messages = defineMessages({
14
- simple_card_title: {
15
- id: 'Type the title…',
16
- defaultMessage: 'Type the title…',
17
- },
18
- simple_card_content: {
19
- id: 'Type description…',
20
- defaultMessage: 'Digita la descrizione…',
21
- },
22
- simple_card_click: {
23
- id: 'Type text…',
24
- defaultMessage: 'Digita il testo…',
25
- },
26
- });
27
-
28
- const Block = ({
29
- inEditMode,
30
- data,
31
- block,
32
- onChange,
33
- onSelectBlock,
34
- onAddBlock,
35
- onFocusPreviousBlock,
36
- onFocusNextBlock,
37
- index,
38
- selected,
39
- }) => {
40
- const intl = useIntl();
41
- const title = data?.simple_card_title?.blocks[0]?.text;
42
- const content = data?.simple_card_content;
43
- const [selectedField, setSelectedField] = useState('title');
44
-
45
- useEffect(() => {
46
- if (selected) {
47
- setSelectedField('title');
48
- } else {
49
- setSelectedField(null);
50
- }
51
- }, [selected]);
52
-
53
- return (
54
- <div className="simple-text-card-wrapper">
55
- <Card color="white" className="no-after card-bg rounded" space tag="div">
56
- <CardBody>
57
- <div className={cx('simple-text-card', { 'cms-ui': inEditMode })}>
58
- {inEditMode ? (
59
- <>
60
- <CardTitle tag="h3" className="h4">
61
- <div
62
- onClick={() => {
63
- setSelectedField('title');
64
- }}
65
- onFocus={() => {
66
- setSelectedField('title');
67
- }}
68
- >
69
- <TextEditorWidget
70
- data={data}
71
- fieldName="simple_card_title"
72
- selected={selectedField === 'title'}
73
- block={block}
74
- onChangeBlock={(data) =>
75
- onChange(data, 'simple_card_title')
76
- }
77
- placeholder={intl.formatMessage(
78
- messages.simple_card_title,
79
- )}
80
- showToolbar={false}
81
- onSelectBlock={() => {}}
82
- onAddBlock={() => {
83
- setSelectedField('content');
84
- }}
85
- onFocusNextBlock={() => {
86
- setSelectedField('content');
87
- }}
88
- onFocusPreviousBlock={onFocusPreviousBlock}
89
- />
90
- </div>
91
- </CardTitle>
92
- <Divider />
93
- <div
94
- onClick={() => {
95
- setSelectedField('content');
96
- }}
97
- onFocus={() => {
98
- setSelectedField('content');
99
- }}
100
- >
101
- <TextEditorWidget
102
- data={data}
103
- fieldName="simple_card_content"
104
- selected={selectedField === 'content'}
105
- block={block}
106
- onChangeBlock={(data) =>
107
- onChange(data, 'simple_card_content')
108
- }
109
- placeholder={intl.formatMessage(
110
- messages.simple_card_content,
111
- )}
112
- showToolbar={true}
113
- onSelectBlock={onSelectBlock}
114
- onAddBlock={onAddBlock}
115
- index={index}
116
- onFocusNextBlock={onFocusNextBlock}
117
- onFocusPreviousBlock={() => {
118
- setSelectedField('title');
119
- }}
120
- />
121
- </div>
122
- </>
123
- ) : (
124
- <>
125
- <CardTitle tag="h3" id={block.id + '-title'} className="h4">
126
- {title}
127
- </CardTitle>
128
- <hr />
129
- {redraft(
130
- content,
131
- config.settings.richtextViewSettings.ToHTMLRenderers,
132
- config.settings.richtextViewSettings.ToHTMLOptions,
133
- )}
134
- </>
135
- )}
136
- </div>
137
- </CardBody>
138
- </Card>
139
- </div>
140
- );
141
- };
142
-
143
- Block.propTypes = {
144
- entityMap: PropTypes.any,
145
- data: PropTypes.any,
146
- block: PropTypes.any,
147
- inEditMode: PropTypes.bool.isRequired,
148
- onChange: PropTypes.func,
149
- };
150
-
151
- export default Block;
@@ -1,84 +0,0 @@
1
- import { Component, Children } from 'react';
2
- import PropTypes from 'prop-types';
3
- import withSideEffect from 'react-side-effect';
4
-
5
- /**
6
- * @export
7
- * @class RemoveBodyClass
8
- * @extends {Component}
9
- */
10
- class RemoveBodyClass extends Component {
11
- /**
12
- * Render method.
13
- * @method render
14
- * @returns {string} Markup for the component.
15
- */
16
- render() {
17
- if (this.props.children) {
18
- return Children.only(this.props.children);
19
- }
20
- return null;
21
- }
22
- }
23
-
24
- RemoveBodyClass.propTypes = {
25
- children: PropTypes.element,
26
- className: PropTypes.string,
27
- };
28
-
29
- RemoveBodyClass.defaultProps = {
30
- children: null,
31
- className: null,
32
- };
33
-
34
- /**
35
- * reducePropsToState
36
- * @function reducePropsToState
37
- * @param {*} propsList propsList
38
- * @returns {List} classList
39
- */
40
- function reducePropsToState(propsList) {
41
- let classList = [];
42
- propsList.forEach((props) => {
43
- if (props.className) {
44
- classList = classList.concat(props.className);
45
- }
46
- });
47
- return classList;
48
- }
49
-
50
- /**
51
- * handleStateChangeOnClient
52
- * @function handleStateChangeOnClient
53
- * @param {*} classList classList
54
- * @returns {null} null
55
- */
56
- function handleStateChangeOnClient(classList) {
57
- // document.body.className = '';
58
- let domClassNames = [];
59
- Object.keys(document.body.classList).forEach((k) => {
60
- domClassNames.push(document.body.classList[k]);
61
- });
62
-
63
- classList.forEach((className) => {
64
- // This allows the component to accept more than one class at the same time
65
- if (className.includes(' ')) {
66
- className.split(' ').forEach((className) => {
67
- if (document.body.classList.contains(className)) {
68
- domClassNames.splice(domClassNames.indexOf(className), 1);
69
- }
70
- });
71
- document.body.classList = domClassNames.join(' ');
72
- } else {
73
- if (document.body.classList.contains(className)) {
74
- domClassNames.splice(domClassNames.indexOf(className), 1);
75
- document.body.classList = domClassNames.join(' ');
76
- }
77
- }
78
- });
79
- }
80
-
81
- export default withSideEffect(
82
- reducePropsToState,
83
- handleStateChangeOnClient,
84
- )(RemoveBodyClass);
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import { connect } from 'react-redux';
3
- import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
4
- import { IntlProvider } from 'react-intl';
5
-
6
- const LinkEntity = connect((state) => ({
7
- token: state.userSession.token,
8
- }))((props) => {
9
- const { token, url, target, targetUrl, download, children, dataElement } =
10
- props;
11
- const to = token ? url : targetUrl || url;
12
-
13
- return (
14
- <IntlProvider>
15
- <UniversalLink
16
- href={to}
17
- openLinkInNewTab={target === '_blank' || undefined}
18
- download={download}
19
- data-element={dataElement || props['data-element'] || null}
20
- >
21
- {children}
22
- </UniversalLink>
23
- </IntlProvider>
24
- );
25
- });
26
-
27
- export default LinkEntity;
@@ -1,44 +0,0 @@
1
- /**
2
- * Questo è il link quando viene mostrato dentro l'editor nelle viste di edit
3
- * Customizzato
4
- * - aggiunto data-element
5
- * - aggiunto icona link esterno
6
- */
7
- import React from 'react';
8
- import PropTypes from 'prop-types';
9
- import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
10
-
11
- const propTypes = {
12
- className: PropTypes.string,
13
- children: PropTypes.node.isRequired,
14
- entityKey: PropTypes.string,
15
- getEditorState: PropTypes.func.isRequired,
16
- target: PropTypes.string,
17
- };
18
-
19
- const Link = ({ children, className, entityKey, getEditorState, target }) => {
20
- const entity = getEditorState().getCurrentContent().getEntity(entityKey);
21
- const entityData = entity ? entity.get('data') : undefined;
22
- const href = (entityData && entityData.url) || undefined;
23
-
24
- return (
25
- <a
26
- className={className}
27
- title={href}
28
- href={isInternalURL(href) ? flattenToAppURL(href) : href}
29
- target={target}
30
- rel="noopener noreferrer"
31
- data-element={entityData.dataElement || entityData['data-element']}
32
- >
33
- {children}
34
- </a>
35
- );
36
- };
37
-
38
- Link.propTypes = propTypes;
39
- Link.defaultProps = {
40
- className: null,
41
- entityKey: null,
42
- target: null,
43
- };
44
- export default Link;
@@ -1,349 +0,0 @@
1
- /**
2
- * Add link form.
3
- * @module components/manage/AnchorPlugin/components/LinkButton/AddLinkForm
4
- * Customizzato
5
- * - Aggiunta gestione data-element
6
- * - Aggiunte opzioni per la select del data-element
7
- * - Modificate icone ed elementi per stilizzare il tooltip del link
8
- */
9
-
10
- import React, { Component } from 'react';
11
- import PropTypes from 'prop-types';
12
- import { compose } from 'redux';
13
-
14
- import cx from 'classnames';
15
- import {
16
- addAppURL,
17
- isInternalURL,
18
- flattenToAppURL,
19
- URLUtils,
20
- } from '@plone/volto/helpers';
21
-
22
- import { doesNodeContainClick } from 'semantic-ui-react/dist/commonjs/lib';
23
- import { Input, Form, Button } from 'semantic-ui-react';
24
- import { defineMessages, injectIntl } from 'react-intl';
25
-
26
- import clearSVG from '@plone/volto/icons/clear.svg';
27
- import navTreeSVG from '@plone/volto/icons/nav.svg';
28
- import aheadSVG from '@plone/volto/icons/ahead.svg';
29
-
30
- import withObjectBrowser from '@plone/volto/components/manage/Sidebar/ObjectBrowser';
31
- import { withRouter } from 'react-router';
32
-
33
- import { Icon, SelectWidget } from '@plone/volto/components';
34
-
35
- const messages = defineMessages({
36
- placeholder: {
37
- id: 'Enter URL or select an item',
38
- defaultMessage: 'Enter URL or select an item',
39
- },
40
- placeholderLighthouse: {
41
- id: 'Select a data-element ID',
42
- defaultMessage: 'Seleziona un data-element ID', // TO DO: da sistemare quando si risolve il bug su i18n
43
- },
44
- });
45
-
46
- /**
47
- * Add link form class.
48
- * @class AddLinkForm
49
- * @extends Component
50
- */
51
- class AddLinkForm extends Component {
52
- static propTypes = {
53
- onChangeValue: PropTypes.func.isRequired,
54
- onClear: PropTypes.func.isRequired,
55
- onOverrideContent: PropTypes.func.isRequired,
56
- theme: PropTypes.objectOf(PropTypes.any).isRequired,
57
- openObjectBrowser: PropTypes.func.isRequired,
58
- };
59
-
60
- /**
61
- * Constructor
62
- * @method constructor
63
- * @param {Object} props Component properties
64
- * @constructs AddLinkForm
65
- */
66
- constructor(props) {
67
- super(props);
68
-
69
- this.state = {
70
- dataElement: props.data.dataElement,
71
- value: isInternalURL(props.data.url)
72
- ? flattenToAppURL(props.data.url)
73
- : props.data.url || '',
74
- isInvalid: false,
75
- };
76
- this.onRef = this.onRef.bind(this);
77
- this.onChange = this.onChange.bind(this);
78
- this.onKeyDown = this.onKeyDown.bind(this);
79
- this.onSubmit = this.onSubmit.bind(this);
80
-
81
- // Options to data-element select
82
- this.selectOptions = [
83
- ['appointment-booking', 'appointment-booking'],
84
- ['service-booking-access', 'service-booking-access'],
85
- ['faq', 'faq'],
86
- ['report-inefficiency', 'report-inefficiency'],
87
- ['accessibility-link', 'accessibility-link'],
88
- ['privacy-policy-link', 'privacy-policy-link'],
89
- ['legal-notes', 'legal-notes'],
90
- ['pager-link', 'pager-link'],
91
- ];
92
- }
93
-
94
- /**
95
- * Component did mount
96
- * @method componentDidMount
97
- * @returns {undefined}
98
- */
99
- componentDidMount() {
100
- setTimeout(() => this.input.focus(), 50);
101
- document.addEventListener('mousedown', this.handleClickOutside, false);
102
- }
103
-
104
- componentWillUnmount() {
105
- document.removeEventListener('mousedown', this.handleClickOutside, false);
106
- }
107
-
108
- handleClickOutside = (e) => {
109
- if (
110
- this.linkFormContainer.current &&
111
- doesNodeContainClick(this.linkFormContainer.current, e)
112
- )
113
- return;
114
- if (this.linkFormContainer.current && this.props.isObjectBrowserOpen)
115
- return;
116
- this.onClose();
117
- };
118
-
119
- /**
120
- * Ref handler
121
- * @method onRef
122
- * @param {Object} node Node
123
- * @returns {undefined}
124
- */
125
- onRef(node) {
126
- this.input = node;
127
- }
128
-
129
- linkFormContainer = React.createRef();
130
-
131
- /**
132
- * Change handler
133
- * @method onChange
134
- * @param {Object} value Value
135
- * @returns {undefined}
136
- */
137
- onChange(value, clear) {
138
- let nextState = { value };
139
- if (!clear) {
140
- if (
141
- this.state.isInvalid &&
142
- URLUtils.isUrl(URLUtils.normalizeUrl(value))
143
- ) {
144
- nextState.isInvalid = false;
145
- }
146
-
147
- if (isInternalURL(value)) {
148
- nextState = { value: flattenToAppURL(value) };
149
- }
150
- }
151
- this.setState(nextState);
152
-
153
- if (clear) this.props.onClear();
154
- }
155
-
156
- /**
157
- * Select item handler
158
- * @method onSelectItem
159
- * @param {string} e event
160
- * @param {string} url Url
161
- * @returns {undefined}
162
- */
163
- onSelectItem = (e, url) => {
164
- e.preventDefault();
165
- this.setState({
166
- value: url,
167
- isInvalid: false,
168
- });
169
- this.props.onChangeValue(addAppURL(url));
170
- };
171
-
172
- /**
173
- * Clear handler
174
- * @method clear
175
- * @param {Object} value Value
176
- * @returns {undefined}
177
- */
178
- clear() {
179
- const nextState = { value: '' };
180
- this.setState(nextState);
181
-
182
- this.props.onClear();
183
- }
184
-
185
- /**
186
- * Close handler
187
- * @method onClose
188
- * @returns {undefined}
189
- */
190
- onClose = () => this.props.onOverrideContent(undefined);
191
-
192
- /**
193
- * Keydown handler
194
- * @method onKeyDown
195
- * @param {Object} e Event object
196
- * @returns {undefined}
197
- */
198
- onKeyDown(e) {
199
- if (e.key === 'Enter') {
200
- e.preventDefault();
201
- e.stopPropagation();
202
- this.onSubmit();
203
- } else if (e.key === 'Escape') {
204
- e.preventDefault();
205
- this.onClose();
206
- }
207
- }
208
-
209
- /**
210
- * Submit handler
211
- * @method onSubmit
212
- * @returns {undefined}
213
- */
214
- onSubmit() {
215
- let { value: url, dataElement } = this.state;
216
-
217
- const checkedURL = URLUtils.checkAndNormalizeUrl(url);
218
- url = checkedURL.url;
219
- if (!checkedURL.isValid) {
220
- this.setState({ isInvalid: true });
221
- return;
222
- }
223
-
224
- const editorStateUrl = isInternalURL(url) ? addAppURL(url) : url;
225
-
226
- this.props.onChangeValue(editorStateUrl, dataElement);
227
- this.onClose();
228
- }
229
-
230
- /**
231
- * Render method.
232
- * @method render
233
- * @returns {string} Markup for the component.
234
- */
235
- render() {
236
- const { value, isInvalid, dataElement } = this.state;
237
- const className = isInvalid
238
- ? cx(
239
- 'ui input editor-link',
240
- 'input-anchorlink-theme',
241
- 'input-anchorlink-theme-Invalid',
242
- )
243
- : cx('ui input editor-link', 'input-anchorlink-theme');
244
-
245
- return (
246
- <div className="link-form-container" ref={this.linkFormContainer}>
247
- <Form.Field>
248
- <div className="wrapper-fields">
249
- {/* INPUT LINK */}
250
- <div className="wrap-field">
251
- <Input
252
- className={className}
253
- id={`field-link`}
254
- name="link"
255
- value={value || ''}
256
- onChange={({ target }) => this.onChange(target.value)}
257
- placeholder={this.props.intl.formatMessage(
258
- messages.placeholder,
259
- )}
260
- onKeyDown={this.onKeyDown}
261
- ref={this.onRef}
262
- />
263
- {value.length > 0 ? (
264
- <Button.Group>
265
- <Button
266
- basic
267
- className="cancel"
268
- onClick={(e) => {
269
- e.preventDefault();
270
- e.stopPropagation();
271
- this.clear();
272
- }}
273
- >
274
- <Icon name={clearSVG} size="20px" />
275
- </Button>
276
- </Button.Group>
277
- ) : (
278
- <Button.Group>
279
- <Button
280
- basic
281
- icon
282
- onClick={(e) => {
283
- e.preventDefault();
284
- e.stopPropagation();
285
- this.props.openObjectBrowser({
286
- mode: 'link',
287
- overlay: true,
288
- onSelectItem: (url) => {
289
- this.onChange(url);
290
- this.onSubmit();
291
- },
292
- });
293
- }}
294
- >
295
- <Icon name={navTreeSVG} size="22px" />
296
- </Button>
297
- </Button.Group>
298
- )}
299
- </div>
300
-
301
- {/* DATA-ELEMENT SELECT */}
302
- <div className="wrap-field">
303
- <SelectWidget
304
- id="data-element-select"
305
- title="data-element"
306
- placeholder={this.props.intl.formatMessage(
307
- messages.placeholderLighthouse,
308
- )}
309
- isMulti={false}
310
- value={dataElement}
311
- onChange={(_, value) => {
312
- this.setState({ dataElement: value });
313
- }}
314
- choices={this.selectOptions}
315
- noValueOption={false}
316
- wrapped={false}
317
- />
318
- </div>
319
- </div>
320
-
321
- {/* BUTTON SUBMIT */}
322
- <div className="wrapper-submit">
323
- <Button.Group>
324
- <Button
325
- basic
326
- primary
327
- disabled={!value.length > 0}
328
- onClick={(e) => {
329
- e.preventDefault();
330
- e.stopPropagation();
331
- this.onSubmit();
332
- }}
333
- onKeyDown={(e) => {
334
- e.preventDefault();
335
- e.stopPropagation();
336
- this.onSubmit();
337
- }}
338
- >
339
- <Icon name={aheadSVG} size="28px" />
340
- </Button>
341
- </Button.Group>
342
- </div>
343
- </Form.Field>
344
- </div>
345
- );
346
- }
347
- }
348
-
349
- export default compose(injectIntl, withRouter, withObjectBrowser)(AddLinkForm);