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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/.github/workflows/slate.yml +47 -0
  2. package/.yarn/cache/@babel-helper-module-imports-npm-7.24.3-edb733448b-c23492189b.zip +0 -0
  3. package/.yarn/cache/@babel-types-npm-7.24.0-a0508cb308-4b574a37d4.zip +0 -0
  4. package/.yarn/cache/babel-plugin-lodash-npm-3.3.4-c7161075b6-044a4261e6.zip +0 -0
  5. package/.yarn/cache/require-package-name-npm-2.0.1-ac9a206b63-00f4e9e467.zip +0 -0
  6. package/.yarn/cache/{volto-form-block-npm-3.7.2-f24953a510-7387a1b85a.zip → volto-form-block-npm-3.8.2-e49cbe07d5-5b72a06a5e.zip} +0 -0
  7. package/.yarn/cache/{volto-gdpr-privacy-npm-2.2.1-bc93b3e168-bce76108c3.zip → volto-gdpr-privacy-npm-2.2.0-6be0f74d53-8a93254251.zip} +0 -0
  8. package/.yarn/install-state.gz +0 -0
  9. package/CHANGELOG.md +878 -916
  10. package/RELEASE.md +8 -0
  11. package/locales/de/LC_MESSAGES/volto.po +86 -18
  12. package/locales/en/LC_MESSAGES/volto.po +86 -18
  13. package/locales/es/LC_MESSAGES/volto.po +86 -18
  14. package/locales/fr/LC_MESSAGES/volto.po +86 -18
  15. package/locales/it/LC_MESSAGES/volto.po +86 -18
  16. package/locales/volto.pot +87 -19
  17. package/package.json +5 -3
  18. package/publiccode.yml +2 -2
  19. package/src/components/Collapse.jsx +1 -0
  20. package/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx +29 -24
  21. package/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx +4 -12
  22. package/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx +67 -6
  23. package/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx +60 -113
  24. package/src/components/ItaliaTheme/Blocks/Alert/Sidebar.jsx +1 -0
  25. package/src/components/ItaliaTheme/Blocks/Alert/View.jsx +5 -14
  26. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx +16 -11
  27. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx +2 -1
  28. package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Edit.jsx +39 -1
  29. package/src/components/ItaliaTheme/Blocks/CTABlock/Block.jsx +35 -95
  30. package/src/components/ItaliaTheme/Blocks/Callout/Edit.jsx +108 -0
  31. package/src/components/ItaliaTheme/Blocks/Callout/Sidebar.jsx +173 -0
  32. package/src/components/ItaliaTheme/Blocks/Callout/View.jsx +45 -0
  33. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx +84 -63
  34. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/ViewBlock.jsx +19 -39
  35. package/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx +92 -19
  36. package/src/components/ItaliaTheme/Blocks/ContactsBlock/View.jsx +13 -21
  37. package/src/components/ItaliaTheme/Blocks/CountDown/Edit.jsx +21 -25
  38. package/src/components/ItaliaTheme/Blocks/CountDown/View.jsx +6 -15
  39. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx +40 -15
  40. package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx +6 -21
  41. package/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx +93 -20
  42. package/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx +1 -9
  43. package/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx +4 -17
  44. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx +46 -15
  45. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/ViewBlock.jsx +2 -18
  46. package/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx +84 -11
  47. package/src/components/ItaliaTheme/Blocks/NumbersBlock/View.jsx +2 -11
  48. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx +33 -67
  49. package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Edit.jsx +2 -8
  50. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/BodyWrapper.jsx +2 -1
  51. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx +98 -84
  52. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/View.jsx +20 -3
  53. package/src/components/ItaliaTheme/Blocks/__tests__/Accordion.test.jsx +11 -28
  54. package/src/components/ItaliaTheme/Blocks/__tests__/Alert.test.jsx +10 -14
  55. package/src/components/ItaliaTheme/Blocks/__tests__/ArgumentsInEvidence.test.jsx +20 -28
  56. package/src/components/ItaliaTheme/Blocks/__tests__/CTABlock.test.jsx +14 -29
  57. package/src/components/ItaliaTheme/Blocks/__tests__/CardWithImage.test.jsx +11 -28
  58. package/src/components/ItaliaTheme/Blocks/__tests__/ContactsBlock.test.jsx +75 -140
  59. package/src/components/ItaliaTheme/Blocks/__tests__/Countdown.test.jsx +20 -28
  60. package/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx +22 -56
  61. package/src/components/ItaliaTheme/Blocks/__tests__/NumbersBlock.test.jsx +14 -43
  62. package/src/components/ItaliaTheme/Blocks/__tests__/SimpleCard.test.jsx +14 -30
  63. package/src/components/ItaliaTheme/Footer/FooterInfos.jsx +22 -8
  64. package/src/components/ItaliaTheme/Footer/FooterNavigation.jsx +3 -3
  65. package/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx +5 -1
  66. package/src/components/ItaliaTheme/Slider/SingleSlideWrapper.jsx +2 -3
  67. package/src/components/ItaliaTheme/View/BandoView/BandoApprofondimenti.jsx +1 -2
  68. package/src/components/ItaliaTheme/View/CartellaModulisticaView/DocRow.jsx +14 -5
  69. package/src/components/ItaliaTheme/View/Commons/Attachment.jsx +19 -3
  70. package/src/components/ItaliaTheme/View/Commons/Attachments.jsx +0 -1
  71. package/src/components/ItaliaTheme/View/Commons/DownloadFileFormat.jsx +11 -7
  72. package/src/components/ItaliaTheme/View/Commons/Module.jsx +7 -6
  73. package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderLinkServizio.jsx +6 -2
  74. package/src/components/ItaliaTheme/View/Commons/RichTextRender.jsx +8 -6
  75. package/src/components/ItaliaTheme/View/Commons/__tests__/RichText.test.jsx +14 -17
  76. package/src/components/ItaliaTheme/View/ServizioView/ServizioAccedi.jsx +5 -6
  77. package/src/components/ItaliaTheme/View/ServizioView/ServizioMetatag.jsx +4 -0
  78. package/src/components/ItaliaTheme/View/__tests__/CartellaModulisticaView.test.jsx +12 -1
  79. package/src/components/ItaliaTheme/View/__tests__/IncaricoView.test.jsx +24 -30
  80. package/src/components/ItaliaTheme/View/__tests__/PageView.test.jsx +24 -2
  81. package/src/components/ItaliaTheme/View/__tests__/PersonaView.test.jsx +96 -92
  82. package/src/components/ItaliaTheme/View/__tests__/ServizioAChiSiRivolge.test.jsx +240 -286
  83. package/src/components/ItaliaTheme/View/__tests__/ServizioAccedi.test.jsx +240 -286
  84. package/src/components/ItaliaTheme/View/__tests__/ServizioCasiParticolari.test.jsx +240 -286
  85. package/src/components/ItaliaTheme/View/__tests__/ServizioComeFare.test.jsx +240 -286
  86. package/src/components/ItaliaTheme/View/__tests__/ServizioCondizioni.test.jsx +240 -286
  87. package/src/components/ItaliaTheme/View/__tests__/ServizioContatti.test.jsx +240 -286
  88. package/src/components/ItaliaTheme/View/__tests__/ServizioCosE.test.jsx +240 -286
  89. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaServe.test.jsx +240 -286
  90. package/src/components/ItaliaTheme/View/__tests__/ServizioCosaSiOttiene.test.jsx +240 -286
  91. package/src/components/ItaliaTheme/View/__tests__/ServizioCostiVincoli.test.jsx +240 -286
  92. package/src/components/ItaliaTheme/View/__tests__/ServizioMetadati.test.jsx +240 -286
  93. package/src/components/ItaliaTheme/View/__tests__/ServizioModulistica.test.jsx +240 -286
  94. package/src/components/ItaliaTheme/View/__tests__/ServizioProcedure.test.jsx +240 -286
  95. package/src/components/ItaliaTheme/View/__tests__/ServizioSitiEsterni.test.jsx +240 -286
  96. package/src/components/ItaliaTheme/View/__tests__/ServizioTempiScadenze.test.jsx +240 -286
  97. package/src/components/ItaliaTheme/View/__tests__/ServizioUlterioriInformazioni.test.jsx +240 -286
  98. package/src/components/ItaliaTheme/View/__tests__/ServizioView.test.jsx +470 -560
  99. package/src/components/ItaliaTheme/View/__tests__/TrasparenzaView.test.jsx +12 -1
  100. package/src/components/ItaliaTheme/manage/Widgets/ColorListWidget.jsx +11 -2
  101. package/src/components/ItaliaTheme/manage/Widgets/HtmlSlateWidget.jsx +154 -0
  102. package/src/components/ItaliaTheme/manage/Widgets/RichTextWidget.jsx +88 -0
  103. package/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx +158 -0
  104. package/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx +167 -270
  105. package/src/config/Blocks/ListingOptions/index.js +0 -1
  106. package/src/config/Blocks/ListingOptions/utils.js +0 -7
  107. package/src/config/Blocks/blocks.js +29 -8
  108. package/src/config/Blocks/listingVariations.js +1 -1
  109. package/src/config/Slate/Alignment/AlignMenu.jsx +169 -0
  110. package/src/config/Slate/Alignment/index.js +42 -0
  111. package/src/config/Slate/Blockquote/BlockquoteMenu.jsx +151 -0
  112. package/src/config/Slate/Blockquote/index.js +12 -0
  113. package/src/config/Slate/Headings/HeadingsMenu.jsx +139 -0
  114. package/src/config/Slate/Headings/headingsMenu.scss +44 -0
  115. package/src/config/Slate/Headings/index.js +62 -0
  116. package/src/config/Slate/Link/deserializer.js +25 -0
  117. package/src/config/Slate/Link/index.js +126 -0
  118. package/src/config/Slate/Link/renderer.jsx +99 -0
  119. package/src/config/Slate/LinkButton/index.js +47 -0
  120. package/src/config/Slate/TextLarger/index.js +51 -0
  121. package/src/config/Slate/Underline/index.js +10 -0
  122. package/src/config/Slate/config.js +43 -0
  123. package/src/config/Slate/deserializers.js +66 -0
  124. package/src/config/Slate/dropdownStyle.scss +14 -0
  125. package/src/config/Slate/dropdownUtils.js +422 -0
  126. package/src/config/Slate/extensions/breakList.js +91 -0
  127. package/src/config/Slate/handlers.js +243 -0
  128. package/src/config/Slate/utils.js +73 -0
  129. package/src/config/Widgets/widgets.js +1 -2
  130. package/src/config/italiaConfig.js +7 -54
  131. package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +360 -0
  132. package/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx +75 -200
  133. package/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx +1 -1
  134. package/src/customizations/volto/components/manage/Form/BlocksToolbar.jsx +1 -1
  135. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +59 -6
  136. package/src/customizations/volto-form-block/components/Field.jsx +45 -22
  137. package/src/customizations/volto-form-block/components/FormResult.jsx +74 -0
  138. package/src/customizations/volto-form-block/components/FormView.jsx +79 -66
  139. package/src/customizations/volto-form-block/components/Widget/Button.jsx +50 -0
  140. package/src/helpers/EnhanceLink.js +44 -0
  141. package/src/helpers/FormValidation/FormValidationHelpers.js +3 -0
  142. package/src/helpers/blocks.js +86 -0
  143. package/src/helpers/files.js +14 -14
  144. package/src/helpers/index.js +4 -3
  145. package/src/helpers/richTextHelper.js +10 -0
  146. package/src/icons/Group.svg +1 -0
  147. package/src/icons/blocco-icone.svg +0 -3
  148. package/src/icons/blockquote-card-dark.svg +1 -0
  149. package/src/icons/blockquote-card.svg +1 -0
  150. package/src/icons/blockquote-simple.svg +1 -0
  151. package/src/icons/text-larger.svg +1 -0
  152. package/src/theme/ItaliaTheme/Blocks/_accordion.scss +1 -10
  153. package/src/theme/ItaliaTheme/Blocks/_alert.scss +53 -1
  154. package/src/theme/ItaliaTheme/Blocks/_bandiInEvidenceTemplate.scss +1 -0
  155. package/src/theme/ItaliaTheme/Blocks/_callout.scss +32 -0
  156. package/src/theme/ItaliaTheme/Blocks/_contacts.scss +15 -32
  157. package/src/theme/ItaliaTheme/Blocks/_ctaBlock.scss +0 -14
  158. package/src/theme/ItaliaTheme/Blocks/_gridBlock.scss +1 -1
  159. package/src/theme/ItaliaTheme/Blocks/_hero.scss +1 -8
  160. package/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss +0 -30
  161. package/src/theme/ItaliaTheme/Blocks/_imageCardTextBlock.scss +3 -2
  162. package/src/theme/ItaliaTheme/Blocks/_numbers.scss +1 -5
  163. package/src/theme/ItaliaTheme/Blocks/_simpleCardTextBlock.scss +8 -2
  164. package/src/theme/ItaliaTheme/Blocks/_tableOfContents.scss +1 -0
  165. package/src/theme/ItaliaTheme/Components/_megamenu.scss +0 -4
  166. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_cta.scss +1 -0
  167. package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_searchSections.scss +1 -0
  168. package/src/theme/ItaliaTheme/Subsites/bootstrap-italia/custom/_headercenter.scss +1 -0
  169. package/src/theme/ItaliaTheme/Views/_cartellaModulistica.scss +11 -2
  170. package/src/theme/ItaliaTheme/Views/_slider.scss +3 -3
  171. package/src/theme/ItaliaTheme/Widgets/_iconWidget.scss +4 -0
  172. package/src/theme/ItaliaTheme/_main.scss +42 -54
  173. package/src/theme/_cms-ui.scss +59 -161
  174. package/src/theme/extras/_forms.scss +2 -14
  175. package/src/theme/site.scss +1 -0
  176. package/test-setup-config.js +58 -0
  177. package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Block.jsx +0 -151
  178. package/src/config/RichTextEditor/LinkEntity.jsx +0 -27
  179. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/Link/index.jsx +0 -44
  180. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +0 -349
  181. package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/index.js +0 -150
  182. package/src/config/RichTextEditor/Plugins/AnchorPlugin/index.js +0 -88
  183. package/src/config/RichTextEditor/ToolbarButtons/AlignButton.jsx +0 -61
  184. package/src/config/RichTextEditor/ToolbarButtons/ButtonsButton.jsx +0 -14
  185. package/src/config/RichTextEditor/ToolbarButtons/CalloutsButton.jsx +0 -38
  186. package/src/config/RichTextEditor/ToolbarButtons/DraftJsDropdownButton.jsx +0 -106
  187. package/src/config/RichTextEditor/ToolbarButtons/HeadingsButton.jsx +0 -57
  188. package/src/config/RichTextEditor/ToolbarButtons/TextSizeButton.jsx +0 -65
  189. package/src/config/RichTextEditor/ToolbarButtons/UnderlineButton.jsx +0 -14
  190. package/src/config/RichTextEditor/config.js +0 -253
  191. package/src/config/volto-gdpr-privacy-defaultPanelConfig.js +0 -292
  192. package/src/customizations/volto/components/manage/Blocks/ToC/View.jsx +0 -134
  193. package/src/customizations/volto/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +0 -99
  194. package/src/customizations/volto/config/RichTextEditor/Plugins.jsx +0 -63
  195. package/src/helpers/redraftHelper.js +0 -9
@@ -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);
@@ -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;