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,253 +0,0 @@
1
- import React from 'react';
2
- import Styles from '@plone/volto/config/RichTextEditor/Styles';
3
-
4
- import ToHTMLRenderers from '@plone/volto/config/RichTextEditor/ToHTML';
5
- import FromHTML from '@plone/volto/config/RichTextEditor/FromHTML';
6
- import Plugins from '@plone/volto/config/RichTextEditor/Plugins';
7
- import Blocks from '@plone/volto/config/RichTextEditor/Blocks';
8
- //import FromHTMLCustomBlockFn from '@plone/volto/config/RichTextEditor/FromHTML';
9
-
10
- import UnderlineButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/UnderlineButton';
11
- import HeadingsButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/HeadingsButton';
12
- import AlignButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/AlignButton';
13
- import CalloutsButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/CalloutsButton';
14
- import ButtonsButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/ButtonsButton';
15
- import TextSizeButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/TextSizeButton';
16
-
17
- import LinkEntity from 'design-comuni-plone-theme/config/RichTextEditor/LinkEntity';
18
-
19
- const ItaliaRichTextEditorPlugins = (props) => [];
20
- const ItaliaRichTextEditorInlineToolbarButtons = (props, plugins) => {
21
- const linkPlugin = plugins.filter((p) => p.LinkButton != null)[0];
22
- const Separator = props.draftJsInlineToolbarPlugin.Separator;
23
-
24
- const buttons = Styles(props);
25
- const {
26
- BoldButton,
27
- ItalicButton,
28
- // HeadlineTwoButton,
29
- // HeadlineThreeButton,
30
- UnorderedListButton,
31
- OrderedListButton,
32
- BlockquoteButton,
33
- // CalloutButton,
34
- } = buttons;
35
-
36
- return [
37
- AlignButton,
38
- Separator,
39
- BoldButton,
40
- ItalicButton,
41
- UnderlineButton(props),
42
- TextSizeButton(props),
43
- Separator,
44
- HeadingsButton(props),
45
- linkPlugin.LinkButton,
46
- ButtonsButton(props),
47
- Separator,
48
- UnorderedListButton,
49
- OrderedListButton,
50
- BlockquoteButton,
51
- CalloutsButton(props),
52
- ];
53
- };
54
-
55
- const renderHTMLBlock = (child) => {
56
- return child.map((subchild) => {
57
- if (Array.isArray(subchild)) {
58
- return subchild.map((subchildren) => {
59
- if (typeof subchildren === 'string') {
60
- const last = subchildren.split('\n').length - 1;
61
- return subchildren.split('\n').map((item, index) => (
62
- <React.Fragment key={index}>
63
- {item}
64
- {index !== last && <br />}
65
- </React.Fragment>
66
- ));
67
- } else {
68
- return subchildren;
69
- }
70
- });
71
- } else {
72
- return subchild;
73
- }
74
- });
75
- };
76
- const ItaliaBlocksHtmlRenderers = {
77
- blockquote: (children, { keys }) =>
78
- children.map((child, i) => (
79
- <blockquote key={keys[i]}>{renderHTMLBlock(child)}</blockquote>
80
- )),
81
- 'align-center': (children, { keys }) =>
82
- children.map((child, i) => (
83
- <p id={keys[i]} key={keys[i]} className="text-center">
84
- {renderHTMLBlock(child)}
85
- </p>
86
- )),
87
- 'align-right': (children, { keys }) =>
88
- children.map((child, i) => (
89
- <p id={keys[i]} key={keys[i]} className="text-end">
90
- {renderHTMLBlock(child)}
91
- </p>
92
- )),
93
- 'align-justify': (children, { keys }) =>
94
- children.map((child, i) => (
95
- <p id={keys[i]} key={keys[i]} className="text-justify">
96
- {renderHTMLBlock(child)}
97
- </p>
98
- )),
99
- callout: (children, { keys }) =>
100
- children.map((child, i) => (
101
- <p id={keys[i]} key={keys[i]} className="callout" role="note">
102
- {renderHTMLBlock(child)}
103
- </p>
104
- )),
105
- 'callout-bg': (children, { keys }) =>
106
- children.map((child, i) => (
107
- <p id={keys[i]} key={keys[i]} className="callout-bg" role="note">
108
- {renderHTMLBlock(child)}
109
- </p>
110
- )),
111
- buttons: (children, { keys }) =>
112
- children.map((child, i) => (
113
- <p id={keys[i]} key={keys[i]} className="draftjs-buttons">
114
- {renderHTMLBlock(child)}
115
- </p>
116
- )),
117
- };
118
-
119
- const ItaliaInlineHtmlRenderers = {
120
- TEXT_LARGER: (children, { key }) => (
121
- <span key={key} className="draftjs-text-larger">
122
- {children}
123
- </span>
124
- ),
125
- };
126
-
127
- const ItaliaFromHTMLCustomBlockFn = (element) => {
128
- let ret = FromHTML(element); //get default from plone/volto
129
-
130
- if (!ret) {
131
- if (element.className === 'callout-bg') {
132
- ret = {
133
- type: 'callout-bg',
134
- };
135
- } else if (element.className === 'draftjs-buttons') {
136
- ret = {
137
- type: 'buttons',
138
- };
139
- } else if (element.className === 'text-center') {
140
- ret = {
141
- type: 'align-center',
142
- };
143
- } else if (element.className === 'text-end') {
144
- ret = {
145
- type: 'align-right',
146
- };
147
- } else if (element.className === 'text-justify') {
148
- ret = {
149
- type: 'align-justify',
150
- };
151
- }
152
- }
153
- return ret;
154
- };
155
-
156
- const ItaliaFromHTMLCustomInlineFn = (element, { Style }) => {
157
- if (element.tagName === 'SPAN') {
158
- if (element.className === 'draftjs-text-larger') {
159
- return Style('TEXT_LARGER');
160
- }
161
- }
162
- };
163
-
164
- export default function applyConfig(config) {
165
- config.settings.richtextEditorSettings = (props) => {
166
- const { plugins /*, inlineToolbarButtons*/ } = Plugins(props); // volto plugins
167
- const { extendedBlockRenderMap, blockStyleFn, listBlockTypes } = Blocks(
168
- props,
169
- );
170
-
171
- const { immutableLib } = props;
172
- const { Map } = immutableLib;
173
-
174
- const blockRenderMap = Map({
175
- 'align-center': {
176
- element: (props) => <p {...props} style={{ textAlign: 'center' }} />,
177
- },
178
- 'align-right': {
179
- element: (props) => <p {...props} style={{ textAlign: 'right' }} />,
180
- },
181
- 'align-justify': {
182
- element: (props) => <p {...props} style={{ textAlign: 'justify' }} />,
183
- },
184
- 'callout-bg': {
185
- element: 'p',
186
- },
187
- buttons: {
188
- element: 'p',
189
- },
190
- });
191
-
192
- const italiaBlockStyleFunction = (contentBlock) => {
193
- const type = contentBlock.getType();
194
-
195
- let r = blockStyleFn(contentBlock) || '';
196
- r = r.length > 0 ? ' ' : r;
197
-
198
- const styles = {
199
- callout: 'callout',
200
- 'callout-bg': 'callout-bg',
201
- buttons: 'draftjs-buttons',
202
- };
203
-
204
- r += styles[type] ?? '';
205
-
206
- return r;
207
- };
208
-
209
- return {
210
- extendedBlockRenderMap: extendedBlockRenderMap
211
- .update('text-center', (element = 'p') => element)
212
- .merge(blockRenderMap),
213
- voltoBlockStyleFn: blockStyleFn,
214
- blockStyleFn: italiaBlockStyleFunction,
215
- listBlockTypes: listBlockTypes,
216
- richTextEditorPlugins: [
217
- ...plugins,
218
- ...ItaliaRichTextEditorPlugins(props),
219
- ],
220
- richTextEditorInlineToolbarButtons: ItaliaRichTextEditorInlineToolbarButtons(
221
- props,
222
- plugins,
223
- ), //[inlineToolbarButtons,...ItaliaRichTextEditorInlineToolbarButtons(props)]
224
- FromHTMLCustomBlockFn: ItaliaFromHTMLCustomBlockFn,
225
- FromHTMLCustomInlineFn: ItaliaFromHTMLCustomInlineFn,
226
- customStyleMap: {
227
- TEXT_LARGER: { fontSize: '1.75rem' },
228
- },
229
- };
230
- };
231
-
232
- // TODO: rimuovere questa customizzazione quando sistemano https://github.com/plone/volto/issues/1601
233
- config.settings.richtextViewSettings.ToHTMLRenderers = {
234
- ...config.settings.richtextViewSettings.ToHTMLRenderers,
235
- entities: {
236
- ...config.settings.richtextViewSettings.ToHTMLRenderers.entities,
237
- LINK: (children, props, other) => {
238
- return (
239
- <LinkEntity key={other.key} {...props}>
240
- {children}
241
- </LinkEntity>
242
- );
243
- },
244
- },
245
- blocks: {
246
- ...ToHTMLRenderers.blocks,
247
- ...ItaliaBlocksHtmlRenderers,
248
- },
249
- inline: { ...ToHTMLRenderers.inline, ...ItaliaInlineHtmlRenderers },
250
- };
251
-
252
- return config;
253
- }
@@ -1,292 +0,0 @@
1
- const defaultPanelConfig = {
2
- last_updated: '2022-03-03T11:25:00+00:00', //it is used to know whether to resubmit the banner to the user if the choices have changed.
3
- focusTrapEnabled: true,
4
-
5
- text: {
6
- //Text that is shown when the banner appears
7
- it: {
8
- title: 'Usiamo i cookie',
9
- description:
10
- "Questo sito utilizza i cookie tecnici di navigazione e di sessione per garantire un miglior servizio di navigazione del sito, e cookie analitici per raccogliere informazioni sull'uso del sito da parte degli utenti. Utilizza anche cookie di profilazione dell'utente per fini statistici. Per i cookie di profilazione puoi decidere se abilitarli o meno cliccando sul pulsante 'Impostazioni'. Per saperne di più, su come disabilitare i cookie oppure abilitarne solo alcuni, consulta la nostra <a href='/privacy-policy'>Cookie Policy</a>.",
11
- },
12
- en: {
13
- title: 'We use cookies',
14
- description:
15
- "This site uses technical navigation and session cookies to ensure a better site navigation service, and analytical cookies to collect information on the use of the site by users. It also uses user profiling cookies for statistical. For profiling cookies you can decide whether to enable them or not by clicking on the 'Settings' button. To find out more, on how to disable cookies or enable only some of them, consult our <a href='/en/privacy-policy'>Cookie Policy</a>.",
16
- },
17
- es: {
18
- title: 'Nosotros usamos cookies',
19
- description:
20
- 'Este sitio utiliza cookies técnicas de navegación y sesión para garantizar un mejor servicio de navegación en el sitio, y cookies analíticas para recopilar información sobre el uso del sitio por parte de los usuarios. También utiliza cookies de perfil de usuario con fines estadísticos. Para las cookies de creación de perfiles, puede decidir habilitarlas o no haciendo clic en el botón "Configuración". Para obtener más información sobre cómo deshabilitar las cookies o habilitar solo ciertas cookies, consulte nuestra <a href=\'/es/privacy-policy\'>Política de Cookies</a>.',
21
- },
22
- fr: {
23
- title: 'We use cookies',
24
- description:
25
- "Ce site utilise des cookies techniques de navigation et de session pour assurer un meilleur service de navigation sur le site, et des cookies analytiques pour collecter des informations sur l'utilisation du site par les utilisateurs. Il utilise également des cookies de profilage des utilisateurs à des fins statistiques. Pour les cookies de profilage, vous pouvez décider de les activer ou non en cliquant sur le bouton « Paramètres ». Pour en savoir plus, sur la façon de désactiver les cookies ou d'en activer seulement certains, consultez notre <a href='/fr/privacy-policy'>Politique relative aux cookies</a>.",
26
- },
27
- },
28
-
29
- //technical cookies configurations
30
- technical: {
31
- //main title and text for the technical cookies column in banner-cookies-settings
32
- text: {
33
- it: {
34
- title: 'Cookie tecnici',
35
- description:
36
- 'Il sito utilizza cookie tecnici per analizzare il traffico da e verso il sito. I cookie tecnici consento anche di fornire un migliore servizio di navigazione sul sito, e raccolgono informazioni di navigazione a questo scopo.',
37
- },
38
- en: {
39
- title: 'Technical cookies',
40
- description:
41
- 'The site uses technical cookies to analyze traffic to and from the site. Technical cookies also allow us to provide a better navigation service on the site, and collect navigation information for this purpose.',
42
- },
43
- es: {
44
- title: 'Cookies técnicas',
45
- description:
46
- 'El sitio utiliza cookies técnicas para analizar el tráfico hacia y desde el sitio. Las cookies técnicas también nos permiten brindar un mejor servicio de navegación en el sitio y recopilar información de navegación para este propósito.',
47
- },
48
- fr: {
49
- title: 'Cookies techniques',
50
- description:
51
- 'Le site utilise des cookies techniques pour analyser le trafic vers et depuis le site. Les cookies techniques nous permettent également de fournir un meilleur service de navigation sur le site, et de collecter des informations de navigation à cette fin.',
52
- },
53
- },
54
-
55
- //technical cookies
56
- choices: [
57
- {
58
- config_key: 'GANALYTICS', //reference to config.gdprPrivacyConfig keys
59
- text: {
60
- it: {
61
- title: 'Google Analytics',
62
- description:
63
- "I cookie di Google Analytics sono usati per analizzare la navigazione sul sito al fine di migliorarla e fornire all'utente un'esperienza di navigazione migliore possibile.",
64
- },
65
- en: {
66
- title: 'Google Analytics',
67
- description:
68
- 'Google Analytics cookies are used to analyze navigation on the site in order to improve it and provide the user with the best possible browsing experience.',
69
- },
70
- es: {
71
- title: 'Google Analytics',
72
- description:
73
- 'Las cookies de Google Analytics se utilizan para analizar la navegación en el sitio con el fin de mejorarlo y proporcionar al usuario la mejor experiencia de navegación posible.',
74
- },
75
- fr: {
76
- title: 'Google Analytics',
77
- description:
78
- "Les cookies de Google Analytics sont utilisés pour analyser la navigation sur le site afin de l'améliorer et offrir à l'utilisateur la meilleure expérience de navigation possible.",
79
- },
80
- },
81
- },
82
- {
83
- config_key: 'GRECAPTCHA',
84
- text: {
85
- it: {
86
- title: 'Google Re-Captcha',
87
- description:
88
- "I cookie di Google Re-Captcha sono usati per analizzare la navigazione sul sito al fine di migliorarla e fornire all'utente un'esperienza di navigazione migliore possibile.",
89
- },
90
- en: {
91
- title: 'Google Re-Captcha',
92
- description:
93
- 'Google Re-Captcha cookies are used to analyze navigation on the site in order to improve it and provide the user with the best possible browsing experience.',
94
- },
95
- es: {
96
- title: 'Google Re-Captcha',
97
- description:
98
- 'Las cookies de Google Recaptcha se utilizan para analizar la navegación en el sitio con el fin de mejorarlo y proporcionar al usuario la mejor experiencia de navegación posible.',
99
- },
100
- fr: {
101
- title: 'Google Re-Captcha',
102
- description:
103
- "Les cookies de Google Re-Captcha sont utilisés pour analyser la navigation sur le site afin de l'améliorer et offrir à l'utilisateur la meilleure expérience de navigation possible.",
104
- },
105
- },
106
- },
107
- ],
108
- },
109
-
110
- //profiling cookies configuration
111
- profiling: {
112
- text: {
113
- it: {
114
- title: 'Cookie di profilazione',
115
- description:
116
- "Il sito utilizza cookie di profilazione per analizzare il comportamento e le scelte degli utenti al fine di proporre contenuti mirati corrispondenti al profilo dell'utente",
117
- },
118
- en: {
119
- title: 'Profiling cookies',
120
- description:
121
- "The site uses profiling cookies to analyze user behavior and choices in order to propose targeted content corresponding to the user's profile",
122
- },
123
- es: {
124
- title: 'Cookies de perfil',
125
- description:
126
- 'El sitio utiliza cookies de perfil para analizar el comportamiento y las elecciones del usuario con el fin de proponer contenido específico que se corresponda con el perfil del usuario.',
127
- },
128
- fr: {
129
- title: 'Cookies de profilage',
130
- description:
131
- "Le site utilise des cookies de profilage pour analyser le comportement et les choix de l'utilisateur afin de proposer un contenu ciblé correspondant au profil de l'utilisateur",
132
- },
133
- },
134
-
135
- choices: [
136
- {
137
- config_key: 'YOUTUBE',
138
- referenceUrls: ['youtube.com', 'youtube-nocookie.com', 'youtu.be'],
139
- text: {
140
- it: {
141
- title: 'Youtube',
142
- description:
143
- "I cookie di profilazione di Youtube permettono di mostrarti le pubblicità che potrebbero interessarti di più, fare analisi di accesso alla pagina e sul comportamento dell'utente, facilitare l'accesso ai servizi di Google.",
144
- //text to show in conditional embed if that cookies are not enabled
145
- conditional_embed_text:
146
- 'Per vedere il video, accetta i cookies di Youtube.',
147
- },
148
- en: {
149
- title: 'Youtube',
150
- description:
151
- 'Youtube profiling cookies allow you to show advertisements that may interest you the most, analyze page access and user behavior, facilitate access to Google services. ',
152
- //text to show in conditional embed if that cookies are not enabled
153
- conditional_embed_text:
154
- 'To view the video, please accept Youtube cookies.',
155
- },
156
- es: {
157
- title: 'Youtube',
158
- description:
159
- 'Las cookies de perfil de Youtube le permiten mostrar los anuncios que más le pueden interesar, analizar el acceso a la página y el comportamiento del usuario, facilitar el acceso a los servicios de Google.',
160
- //text to show in conditional embed if that cookies are not enabled
161
- conditional_embed_text:
162
- 'Para ver el video, acepte las cookies de Youtube.',
163
- },
164
- fr: {
165
- title: 'Youtube',
166
- description:
167
- "Les cookies de profilage Youtube vous permettent d'afficher les publicités susceptibles de vous intéresser le plus, d'analyser l'accès aux pages et le comportement des utilisateurs, de faciliter l'accès aux services Google.",
168
- //text to show in conditional embed if that cookies are not enabled
169
- conditional_embed_text:
170
- 'Pour voir la vidéo, veuillez accepter les cookies Youtube.',
171
- },
172
- },
173
- },
174
- {
175
- config_key: 'VIMEO',
176
- referenceUrls: ['vimeo.com'],
177
- text: {
178
- it: {
179
- title: 'Vimeo',
180
- description:
181
- "I cookie di profilazione di Vimeo permettono di fare analisi di accesso alla pagina e sul comportamento dell'utente, e di mostrarti le pubblicità che potrebbero interessarti di più.",
182
- //text to show in conditional embed if that cookies are not enabled
183
- conditional_embed_text:
184
- 'Per vedere il video, accetta i cookies di Vimeo.',
185
- },
186
- en: {
187
- title: 'Vimeo',
188
- description:
189
- 'Vimeo profiling cookies allow you to analyze page access and user behavior, and to show you the advertisements that may interest you the most.',
190
- //text to show in conditional embed if that cookies are not enabled
191
- conditional_embed_text:
192
- 'To view the video, please accept Vimeo cookies.',
193
- },
194
- es: {
195
- title: 'Vimeo',
196
- description:
197
- 'Las cookies de creación de perfiles de Vimeo le permiten analizar el acceso a la página y el comportamiento del usuario, y mostrarle los anuncios que más le pueden interesar.',
198
- //text to show in conditional embed if that cookies are not enabled
199
- conditional_embed_text:
200
- 'Para ver el video, acepte las cookies de Vimeo.',
201
- },
202
- fr: {
203
- title: 'Vimeo',
204
- description:
205
- "Les cookies de profilage Vimeo vous permettent d'analyser l'accès aux pages et le comportement des utilisateurs, et de vous montrer les publicités qui pourraient vous intéresser le plus.",
206
- //text to show in conditional embed if that cookies are not enabled
207
- conditional_embed_text:
208
- 'Pour voir la vidéo, veuillez accepter les cookies Vimeo.',
209
- },
210
- },
211
- },
212
- /*{
213
- config_key: 'GOOGLEMAPS',
214
- referenceUrls: ['google.com/maps'],
215
- text: {
216
- it: {
217
- title: 'Google Maps',
218
- description:
219
- "I cookie di profilazione di Google permettono di fare analisi di accesso alla pagina e sul comportamento dell'utente, e di mostrarti le pubblicità che potrebbero interessarti di più.",
220
- //text to show in conditional embed if that cookies are not enabled
221
- conditional_embed_text:
222
- 'Per vedere la mappa, accetta i cookies di Google Maps.',
223
- },
224
- en: {
225
- title: 'Google Maps',
226
- description:
227
- 'Google profiling cookies allow you to analyze page access and user behavior, and to show you the advertisements that may interest you the most.',
228
- //text to show in conditional embed if that cookies are not enabled
229
- conditional_embed_text:
230
- 'To view map, please accept Google Maps cookies.',
231
- },
232
- es: {
233
- title: 'Google Maps',
234
- description:
235
- 'Las cookies de creación de perfiles de Google le permiten analizar el acceso a la página y el comportamiento del usuario, y mostrarle los anuncios que más le pueden interesar.',
236
- //text to show in conditional embed if that cookies are not enabled
237
- conditional_embed_text:
238
- 'Para ver el mapa, acepte las cookies de Google Maps.',
239
- },
240
- fr: {
241
- title: 'Google Maps',
242
- description:
243
- "Les cookies de profilage Google vous permettent d'analyser l'accès aux pages et le comportement des utilisateurs, et de vous montrer les publicités qui pourraient vous intéresser le plus.",
244
- //text to show in conditional embed if that cookies are not enabled
245
- conditional_embed_text:
246
- 'Pour afficher la carte, veuillez accepter les cookies de Google Maps.',
247
- },
248
- },
249
- },*/
250
- {
251
- config_key: 'META',
252
- referenceUrls: ['facebook.com', 'instagram.com'],
253
- text: {
254
- it: {
255
- title: 'Facebook e Instagram (prodotti Meta)',
256
- description:
257
- "I cookie di profilazione di Meta permettono di fare analisi di accesso alla pagina e sul comportamento dell'utente, e di mostrarti le pubblicità che potrebbero interessarti di più, solo se sei iscritto a Facebook o Instagram o ad uno dei prodotti di Meta.",
258
- //text to show in conditional embed if that cookies are not enabled
259
- conditional_embed_text:
260
- 'Per vedere i contenuti di Meta (Facebook, Instagram), accetta i cookies di Meta.',
261
- },
262
- en: {
263
- title: 'Facebook and Instagram (Meta products)',
264
- description:
265
- 'Meta profiling cookies allow you to analyze page access and user behavior, and to show you the advertisements that may interest you the most, only if you are subscribed into Facebook or Instagram or in one of Meta products.',
266
- //text to show in conditional embed if that cookies are not enabled
267
- conditional_embed_text:
268
- 'To view Meta contents, please accept Meta cookies.',
269
- },
270
- es: {
271
- title: 'Facebook e Instagram (productos Meta)',
272
- description:
273
- 'Las cookies de metaperfilado le permiten analizar el acceso a la página y el comportamiento del usuario, y mostrarle los anuncios que más le pueden interesar, solo si está suscrito a Facebook o Instagram o en uno de los productos de Meta.',
274
- //text to show in conditional embed if that cookies are not enabled
275
- conditional_embed_text:
276
- 'Para ver el contenido de Meta, acepte las cookies de Meta.',
277
- },
278
- fr: {
279
- title: 'Facebook et Instagram (produits Meta)',
280
- description:
281
- "Les cookies de méta profilage vous permettent d'analyser l'accès aux pages et le comportement des utilisateurs, et de vous montrer les publicités susceptibles de vous intéresser le plus, uniquement si vous êtes abonné à Facebook ou Instagram ou à l'un des produits Meta.",
282
- //text to show in conditional embed if that cookies are not enabled
283
- conditional_embed_text:
284
- 'Pour afficher le contenu Meta, veuillez accepter les cookies Meta.',
285
- },
286
- },
287
- },
288
- ],
289
- },
290
- };
291
-
292
- export default defaultPanelConfig;
@@ -1,134 +0,0 @@
1
- /**
2
- * View toc block.
3
- * CUSTOMIZATIONS:
4
- * - TOC component cannot work with DraftJS, block ids
5
- * are different than block id in layout
6
- * @module components/manage/Blocks/ToC/View
7
- */
8
-
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- import { injectIntl } from 'react-intl';
12
- import cx from 'classnames';
13
- import { Message } from 'semantic-ui-react';
14
- import config from '@plone/volto/registry';
15
- import { withBlockExtensions } from '@plone/volto/helpers';
16
-
17
- import {
18
- getBlocksFieldname,
19
- getBlocksLayoutFieldname,
20
- } from '@plone/volto/helpers';
21
-
22
- /**
23
- * View toc block class.
24
- * @class View
25
- * @extends Component
26
- */
27
- const View = (props) => {
28
- const { properties, data } = props;
29
- const { variation } = props;
30
- const blocksFieldname = getBlocksFieldname(properties);
31
- const blocksLayoutFieldname = getBlocksLayoutFieldname(properties);
32
- const levels = React.useMemo(
33
- () =>
34
- data.levels?.length > 0
35
- ? data.levels.map((l) => parseInt(l.slice(1)))
36
- : [1, 2, 3, 4, 5, 6],
37
- [data],
38
- );
39
- const tocEntries = React.useMemo(() => {
40
- let rootLevel = Infinity;
41
- let entries = [];
42
- let prevEntry = {};
43
- let tocEntries = {};
44
- let tocEntriesLayout = [];
45
-
46
- properties[blocksLayoutFieldname].items.forEach((id) => {
47
- const block = properties[blocksFieldname][id];
48
- if (typeof block === 'undefined') {
49
- return null;
50
- }
51
- if (!config.blocks.blocksConfig[block['@type']]?.tocEntry) return null;
52
- const entry = config.blocks.blocksConfig[block['@type']]?.tocEntry(
53
- block,
54
- data,
55
- );
56
- if (entry) {
57
- const level = entry[0];
58
- const title = entry[1];
59
- const draftJSKey = entry[2];
60
- const items = [];
61
-
62
- if (!level || !levels.includes(level)) return;
63
- tocEntriesLayout.push(draftJSKey);
64
- tocEntries[draftJSKey] = {
65
- level,
66
- title: title || block.plaintext,
67
- items,
68
- id: draftJSKey,
69
- override_toc: block.override_toc,
70
- plaintext: block.plaintext,
71
- };
72
- if (level < rootLevel) {
73
- rootLevel = level;
74
- }
75
- }
76
- });
77
-
78
- tocEntriesLayout.forEach((id) => {
79
- const entry = tocEntries[id];
80
- if (entry.level === rootLevel) {
81
- entries.push(entry);
82
- prevEntry = entry;
83
- return;
84
- }
85
- if (!prevEntry.id) return;
86
- if (entry.level > prevEntry.level) {
87
- entry.parentId = prevEntry.id;
88
- prevEntry.items.push(entry);
89
- prevEntry = entry;
90
- } else if (entry.level < prevEntry.level) {
91
- let parent = tocEntries[prevEntry.parentId];
92
- while (entry.level <= parent.level) {
93
- parent = tocEntries[parent.parentId];
94
- }
95
- entry.parentId = parent.id;
96
- parent.items.push(entry);
97
- prevEntry = entry;
98
- } else {
99
- entry.parentId = prevEntry.parentId;
100
- tocEntries[prevEntry.parentId].items.push(entry);
101
- prevEntry = entry;
102
- }
103
- });
104
-
105
- return entries;
106
- }, [data, levels, properties, blocksFieldname, blocksLayoutFieldname]);
107
-
108
- const Renderer = variation?.view;
109
-
110
- return (
111
- <div className={cx('table-of-contents', variation?.id)}>
112
- {props.mode === 'edit' && !data.title && !tocEntries.length && (
113
- <Message>Table of content</Message>
114
- )}
115
-
116
- {Renderer ? (
117
- <Renderer {...props} tocEntries={tocEntries} properties={properties} />
118
- ) : (
119
- <div>View extension not found</div>
120
- )}
121
- </div>
122
- );
123
- };
124
-
125
- /**
126
- * Property types.
127
- * @property {Object} propTypes Property types.
128
- * @static
129
- */
130
- View.propTypes = {
131
- properties: PropTypes.objectOf(PropTypes.any).isRequired,
132
- };
133
-
134
- export default injectIntl(withBlockExtensions(View));