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,150 +0,0 @@
1
- /**
2
- * Customizzato:
3
- * - Aggiunta gestione data-element
4
- * - Importato AddLinkForm file customizzato
5
- */
6
- import React, { Component } from 'react';
7
- import PropTypes from 'prop-types';
8
- import cx from 'classnames';
9
- import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
10
- import EditorUtils from '@plone/volto/components/manage/AnchorPlugin/utils/EditorUtils';
11
- import Icon from '@plone/volto/components/theme/Icon/Icon';
12
-
13
- import AddLinkForm from 'design-comuni-plone-theme/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/AddLinkForm';
14
-
15
- import linkSVG from '@plone/volto/icons/link.svg';
16
- import unlinkSVG from '@plone/volto/icons/unlink.svg';
17
-
18
- /**
19
- * Add link form class.
20
- * @class LinkButton
21
- * @extends Component
22
- */
23
- class LinkButton extends Component {
24
- static propTypes = {
25
- placeholder: PropTypes.string,
26
- theme: PropTypes.shape({}).isRequired,
27
- ownTheme: PropTypes.shape({}).isRequired,
28
- onRemoveLinkAtSelection: PropTypes.func.isRequired,
29
- onOverrideContent: PropTypes.func.isRequired,
30
- };
31
-
32
- constructor(props) {
33
- super(props);
34
-
35
- this.DraftEditorUtils = props.draftJsPluginsUtils.default;
36
- this.EditorUtils = EditorUtils(props);
37
- }
38
-
39
- static defaultProps = {
40
- placeholder: '',
41
- };
42
-
43
- onMouseDown = (event) => {
44
- event.preventDefault();
45
- };
46
-
47
- onAddLinkClick = (e) => {
48
- e.preventDefault();
49
- e.stopPropagation();
50
- const { ownTheme, placeholder, onOverrideContent } = this.props;
51
- const data =
52
- this.EditorUtils.getCurrentEntity(
53
- this.props.getEditorState(),
54
- )?.getData() ?? {};
55
- const link = data.url || '';
56
- const dataElement = data.dataElement || data['data-element'] || '';
57
-
58
- const content = (props) => (
59
- <AddLinkForm
60
- {...props}
61
- placeholder={placeholder}
62
- theme={ownTheme}
63
- block="draft-js"
64
- data={{ url: link, dataElement }}
65
- onChangeBlock={() => {}}
66
- onClear={() => {
67
- this.props.setEditorState(
68
- this.DraftEditorUtils.removeLinkAtSelection(
69
- this.props.getEditorState(),
70
- ),
71
- );
72
- }}
73
- onChangeValue={(url, dataElement) => {
74
- this.props.setEditorState(
75
- createLinkAtSelection(
76
- this.props.draftJs,
77
- this.props.getEditorState(),
78
- url,
79
- dataElement,
80
- ),
81
- );
82
- }}
83
- />
84
- );
85
- onOverrideContent(content);
86
- };
87
-
88
- /**
89
- * Render method.
90
- * @method render
91
- * @returns {string} Markup for the component.
92
- */
93
- render() {
94
- const { theme } = this.props;
95
- const hasLinkSelected = this.EditorUtils.hasEntity(
96
- this.props.getEditorState(),
97
- 'LINK',
98
- );
99
- const className = hasLinkSelected
100
- ? cx(theme.button, theme.active)
101
- : theme.button;
102
-
103
- return (
104
- <div
105
- className={theme.buttonWrapper}
106
- onMouseDown={this.onMouseDown}
107
- role="presentation"
108
- >
109
- <button
110
- className={className}
111
- onClick={
112
- this.onAddLinkClick
113
- // hasLinkSelected
114
- // ? () =>
115
- // onRemoveLinkAtSelection(
116
- // this.props.setEditorState,
117
- // this.props.getEditorState,
118
- // )
119
- // : this.onAddLinkClick
120
- }
121
- type="button"
122
- >
123
- {!hasLinkSelected ? (
124
- <Icon name={linkSVG} size="24px" />
125
- ) : (
126
- <Icon name={unlinkSVG} size="24px" />
127
- )}
128
- </button>
129
- </div>
130
- );
131
- }
132
- }
133
-
134
- export default injectLazyLibs(['draftJs', 'draftJsPluginsUtils'])(LinkButton);
135
-
136
- function createLinkAtSelection(draftJs, editorState, url, dataElement) {
137
- const contentState = editorState
138
- .getCurrentContent()
139
- .createEntity('LINK', 'MUTABLE', { url, dataElement });
140
- const entityKey = contentState.getLastCreatedEntityKey();
141
- const withLink = draftJs.RichUtils.toggleLink(
142
- editorState,
143
- editorState.getSelection(),
144
- entityKey,
145
- );
146
- return draftJs.EditorState.forceSelection(
147
- withLink,
148
- editorState.getSelection(),
149
- );
150
- }
@@ -1,88 +0,0 @@
1
- /**
2
- * Customizzato
3
- * - Cambiato import dei link per poter customizzare i file
4
- */
5
- import decorateComponentWithProps from 'decorate-component-with-props';
6
- import linkStrategy, {
7
- matchesEntityType,
8
- } from '@plone/volto/components/manage/AnchorPlugin/linkStrategy';
9
-
10
- import DefaultLink from 'design-comuni-plone-theme/config/RichTextEditor/Plugins/AnchorPlugin/components/Link';
11
- import LinkButton from 'design-comuni-plone-theme/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton';
12
-
13
- function unboundRemoveEntity(editorState) {
14
- const contentState = editorState.getCurrentContent();
15
- const selectionState = editorState.getSelection();
16
- const startKey = selectionState.getStartKey();
17
- const contentBlock = contentState.getBlockForKey(startKey);
18
- const startOffset = selectionState.getStartOffset();
19
- const entity = contentBlock.getEntityAt(startOffset);
20
-
21
- if (!entity) {
22
- return editorState;
23
- }
24
-
25
- let entitySelection = null;
26
-
27
- contentBlock.findEntityRanges(
28
- (character) => character.getEntity() === entity,
29
- (start, end) => {
30
- entitySelection = selectionState.merge({
31
- anchorOffset: start,
32
- focusOffset: end,
33
- isBackward: false,
34
- });
35
- },
36
- );
37
-
38
- const newContentState = this.Modifier.applyEntity(
39
- contentState,
40
- entitySelection,
41
- null,
42
- );
43
-
44
- const newEditorState = this.EditorState.push(
45
- editorState,
46
- newContentState,
47
- 'apply-entity',
48
- );
49
-
50
- return newEditorState;
51
- }
52
-
53
- export default function AnchorPlugin(config = {}) {
54
- // ToDo: Get rif of the remainings of having the original CSS modules
55
- const defaultTheme = {};
56
-
57
- const {
58
- theme = defaultTheme,
59
- placeholder,
60
- Link,
61
- linkTarget,
62
- libraries,
63
- } = config;
64
-
65
- const removeEntity = unboundRemoveEntity.bind(libraries);
66
-
67
- return {
68
- decorators: [
69
- {
70
- strategy: linkStrategy,
71
- matchesEntityType,
72
- component:
73
- Link ||
74
- decorateComponentWithProps(DefaultLink, {
75
- className: 'link-anchorlink-theme',
76
- target: linkTarget,
77
- }),
78
- },
79
- ],
80
-
81
- LinkButton: decorateComponentWithProps(LinkButton, {
82
- ownTheme: theme,
83
- placeholder,
84
- onRemoveLinkAtSelection: (setEditorState, getEditorState) =>
85
- setEditorState(removeEntity(getEditorState())),
86
- }),
87
- };
88
- }
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
3
- import Icon from '@plone/volto/components/theme/Icon/Icon';
4
- import alignCenterSVG from '@plone/volto/icons/align-center.svg';
5
- import alignLeftSVG from '@plone/volto/icons/align-left.svg';
6
- import alignRightSVG from '@plone/volto/icons/align-right.svg';
7
- import alignJustifySVG from '@plone/volto/icons/align-justify.svg';
8
-
9
- import DraftJsDropdownButton from './DraftJsDropdownButton';
10
-
11
- const AlignButtonComponent = (props) => {
12
- const createBlockStyleButton = props.draftJsCreateBlockStyleButton.default;
13
- const options = [
14
- {
15
- block_type: 'align-left',
16
- value: createBlockStyleButton({
17
- blockType: 'align-left',
18
- children: <Icon name={alignLeftSVG} size="24px" />,
19
- }),
20
- contentWhenSelected: <Icon name={alignLeftSVG} size="24px" />,
21
- },
22
- {
23
- block_type: 'align-center',
24
- value: createBlockStyleButton({
25
- blockType: 'align-center',
26
- children: <Icon name={alignCenterSVG} size="24px" />,
27
- }),
28
- contentWhenSelected: <Icon name={alignCenterSVG} size="24px" />,
29
- },
30
- {
31
- block_type: 'align-right',
32
- value: createBlockStyleButton({
33
- blockType: 'align-right',
34
- children: <Icon name={alignRightSVG} size="24px" />,
35
- }),
36
- contentWhenSelected: <Icon name={alignRightSVG} size="24px" />,
37
- },
38
- {
39
- block_type: 'align-justify',
40
- value: createBlockStyleButton({
41
- blockType: 'align-justify',
42
- children: <Icon name={alignJustifySVG} size="24px" />,
43
- }),
44
- contentWhenSelected: <Icon name={alignJustifySVG} size="24px" />,
45
- },
46
- ];
47
-
48
- return (
49
- <DraftJsDropdownButton
50
- {...props}
51
- optionsList={options}
52
- content={<Icon name={alignLeftSVG} size="24px" />}
53
- />
54
- );
55
- };
56
-
57
- export const AlignButton = injectLazyLibs(['draftJsCreateBlockStyleButton'])(
58
- AlignButtonComponent,
59
- );
60
-
61
- export default React.memo(AlignButton);
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
-
3
- import Icon from '@plone/volto/components/theme/Icon/Icon';
4
- import circleMenuSVG from '@plone/volto/icons/circle-menu.svg';
5
-
6
- const ButtonsButton = (props) => {
7
- const createBlockStyleButton = props.draftJsCreateBlockStyleButton.default;
8
- return createBlockStyleButton({
9
- blockType: 'buttons',
10
- children: <Icon name={circleMenuSVG} size="24px" />,
11
- });
12
- };
13
-
14
- export default ButtonsButton;
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import Icon from '@plone/volto/components/theme/Icon/Icon';
3
-
4
- import DraftJsDropdownButton from './DraftJsDropdownButton';
5
- import { FontAwesomeIcon } from 'design-comuni-plone-theme/components/ItaliaTheme';
6
-
7
- import calloutSVG from '@plone/volto/icons/megaphone.svg';
8
-
9
- const CalloutsButton = (props) => {
10
- const createBlockStyleButton = props.draftJsCreateBlockStyleButton.default;
11
-
12
- const options = [
13
- {
14
- block_type: 'callout',
15
- value: createBlockStyleButton({
16
- blockType: 'callout',
17
- children: <FontAwesomeIcon icon={['far', 'square']} />,
18
- }),
19
- },
20
- {
21
- block_type: 'callout-bg',
22
- value: createBlockStyleButton({
23
- blockType: 'callout-bg',
24
- children: <FontAwesomeIcon icon={['fas', 'square']} />,
25
- }),
26
- },
27
- ];
28
-
29
- return (_props) => (
30
- <DraftJsDropdownButton
31
- {..._props}
32
- optionsList={options}
33
- content={<Icon name={calloutSVG} size="24px" />}
34
- />
35
- );
36
- };
37
-
38
- export default CalloutsButton;
@@ -1,106 +0,0 @@
1
- import React, { useState } from 'react';
2
- import PropTypes from 'prop-types';
3
- import unionClassNames from 'union-class-names';
4
-
5
- /*
6
- Questo è un componente di utility che serve per fare i menu a tendina nella toolbar di draftjs.
7
- Basta passargli le prop del componente stesso e nella prop optionsList l'elenco delle opzioni
8
- da mostrare nella tendina.
9
- */
10
- const DraftJsDropdownButton = (props) => {
11
- const { theme, optionsList } = props;
12
- const [open, setOpen] = useState(false);
13
-
14
- const getCurrentBlockType = () => {
15
- if (!props.getEditorState) {
16
- return false;
17
- }
18
-
19
- const editorState = props.getEditorState();
20
- const type = editorState
21
- .getCurrentContent()
22
- .getBlockForKey(editorState.getSelection().getStartKey())
23
- .getType();
24
- return type;
25
- };
26
-
27
- const hasBlockStyle = () => {
28
- const type = getCurrentBlockType();
29
- return props.optionsList.map((o) => o.block_type).indexOf(type) >= 0;
30
- };
31
-
32
- const getDropdownToggleContent = () => {
33
- const type = getCurrentBlockType();
34
- let contentWhenSelected = props.optionsList.filter(
35
- (o) => o.block_type === type,
36
- )?.[0]?.contentWhenSelected;
37
-
38
- return contentWhenSelected || props.content;
39
- };
40
-
41
- const className = hasBlockStyle()
42
- ? unionClassNames(theme.button, theme.active)
43
- : theme.button;
44
-
45
- const onMouseDown = (event) => {
46
- event.preventDefault();
47
- };
48
-
49
- const openDropdown = (e) => {
50
- e.preventDefault();
51
- e.stopPropagation();
52
- setOpen(!open);
53
- };
54
-
55
- return (
56
- <div
57
- className={`${theme.buttonWrapper} draftJsToolbarDropdown`}
58
- onMouseDown={onMouseDown}
59
- role="presentation"
60
- >
61
- <button
62
- className={`${className} draftJsToolbarDropdown-toggle`}
63
- onClick={openDropdown}
64
- type="button"
65
- >
66
- {getDropdownToggleContent()}
67
- <span className={`caret ${open ? 'up' : 'down'}`}></span>
68
- </button>
69
-
70
- <ul
71
- className={`draftJsToolbarDropdown-optionswrapper ${
72
- open ? '' : 'hide'
73
- }`}
74
- >
75
- {optionsList.map((item) => {
76
- let OptionButton = item.value;
77
-
78
- return (
79
- <li
80
- key={item.block_type}
81
- className="draftJsToolbarDropdown-option"
82
- onClick={() => {
83
- setOpen(false);
84
- }}
85
- >
86
- <OptionButton {...props} />
87
- </li>
88
- );
89
- })}
90
- </ul>
91
- </div>
92
- );
93
- };
94
-
95
- DraftJsDropdownButton.propTypes = {
96
- onChange: PropTypes.func,
97
- editorState: PropTypes.object,
98
- placeholder: PropTypes.string,
99
- theme: PropTypes.shape({}).isRequired,
100
- ownTheme: PropTypes.shape({}),
101
- onOverrideContent: PropTypes.func.isRequired,
102
- optionsList: PropTypes.arrayOf(
103
- PropTypes.shape({ block_type: PropTypes.string, value: PropTypes.any }),
104
- ).isRequired,
105
- };
106
- export default React.memo(DraftJsDropdownButton);
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
-
3
- import Icon from '@plone/volto/components/theme/Icon/Icon';
4
- import textSVG from '@plone/volto/icons/text.svg';
5
- import DraftJsDropdownButton from './DraftJsDropdownButton';
6
-
7
- const HeadingsButton = (props) => {
8
- const createBlockStyleButton = props.draftJsCreateBlockStyleButton.default;
9
-
10
- const options = [
11
- {
12
- block_type: 'header-two',
13
- value: createBlockStyleButton({
14
- blockType: 'header-two',
15
- children: <h2>H2</h2>,
16
- }),
17
- },
18
- {
19
- block_type: 'header-three',
20
- value: createBlockStyleButton({
21
- blockType: 'header-three',
22
- children: <h3>h3</h3>,
23
- }),
24
- },
25
- {
26
- block_type: 'header-four',
27
- value: createBlockStyleButton({
28
- blockType: 'header-four',
29
- children: <h4>h4</h4>,
30
- }),
31
- },
32
- {
33
- block_type: 'header-five',
34
- value: createBlockStyleButton({
35
- blockType: 'header-five',
36
- children: <h5>h5</h5>,
37
- }),
38
- },
39
- {
40
- block_type: 'header-six',
41
- value: createBlockStyleButton({
42
- blockType: 'header-six',
43
- children: <h6>h6</h6>,
44
- }),
45
- },
46
- ];
47
-
48
- return (_props) => (
49
- <DraftJsDropdownButton
50
- {..._props}
51
- optionsList={options}
52
- content={<Icon name={textSVG} size="24px" />}
53
- />
54
- );
55
- };
56
-
57
- export default HeadingsButton;
@@ -1,65 +0,0 @@
1
- import React from 'react';
2
- import { defineMessages, useIntl } from 'react-intl';
3
- import Icon from '@plone/volto/components/theme/Icon/Icon';
4
-
5
- // import DraftJsDropdownButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/DraftJsDropdownButton';
6
-
7
- import formatSVG from '@plone/volto/icons/format.svg';
8
-
9
- const messages = defineMessages({
10
- TextSizeButton: {
11
- id: 'text-size-button',
12
- defaultMessage: 'Dimensione del testo',
13
- },
14
- });
15
-
16
- /*
17
- const TextSizeButton = (props) => {
18
- const createInlineStyleButton = props.draftJsCreateInlineStyleButton.default;
19
-
20
- const options = [
21
- {
22
- block_type: 'text-larger',
23
- value: createInlineStyleButton({
24
- style: 'TEXT_LARGER',
25
- children: <Icon name={formatSVG} size="1.25em" />,
26
- }),
27
- },
28
- {
29
- block_type: 'text-smaller',
30
- value: createInlineStyleButton({
31
- style: 'TEXT_SMALLER',
32
- children: <Icon name={formatSVG} size="0.75em" />,
33
- }),
34
- },
35
- ];
36
-
37
- return (_props)=>(
38
- <DraftJsDropdownButton
39
- {..._props}
40
- optionsList={options}
41
- content={<Icon name={formatSVG} size="1em" />}
42
- />
43
- );
44
- };
45
- */
46
-
47
- const ButtonIcon = (props) => {
48
- const intl = useIntl();
49
- return (
50
- <Icon
51
- name={formatSVG}
52
- size="1.25em"
53
- title={intl.formatMessage(messages.TextSizeButton)}
54
- />
55
- );
56
- };
57
-
58
- const TextSizeButton = (props) => {
59
- const createInlineStyleButton = props.draftJsCreateInlineStyleButton.default;
60
- return createInlineStyleButton({
61
- style: 'TEXT_LARGER',
62
- children: <ButtonIcon />,
63
- });
64
- };
65
- export default TextSizeButton;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
-
3
- import Icon from '@plone/volto/components/theme/Icon/Icon';
4
- import underlineSVG from '@plone/volto/icons/underline.svg';
5
-
6
- const UnderlineButton = (props) => {
7
- const createInlineStyleButton = props.draftJsCreateInlineStyleButton.default;
8
- return createInlineStyleButton({
9
- style: 'UNDERLINE',
10
- children: <Icon name={underlineSVG} size="24px" />,
11
- });
12
- };
13
-
14
- export default UnderlineButton;