@plone/volto 15.0.0-alpha.4 → 15.0.0-alpha.8

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 (238) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +7 -6
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -1
  3. package/.github/workflows/docs.yml +15 -55
  4. package/CHANGELOG.md +57 -2
  5. package/CODE_OF_CONDUCT.md +0 -1
  6. package/COMMITLINT.md +19 -21
  7. package/README.md +1 -1
  8. package/SECURITY.md +0 -1
  9. package/addon-registry.js +6 -3
  10. package/dist/assets.json +1 -0
  11. package/dist/chunks.json +572 -0
  12. package/dist/loadable-stats.json +2099 -0
  13. package/dist/public/android-chrome-192x192.png +0 -0
  14. package/dist/public/android-chrome-512x512.png +0 -0
  15. package/dist/public/apple-touch-icon.png +0 -0
  16. package/dist/public/favicon-16x16.png +0 -0
  17. package/dist/public/favicon-32x32.png +0 -0
  18. package/dist/public/favicon.ico +0 -0
  19. package/dist/public/icon.svg +13 -0
  20. package/dist/public/index.html.spa +34 -0
  21. package/dist/public/robots.txt +2 -0
  22. package/dist/public/site.webmanifest +19 -0
  23. package/dist/public/static/css/15.2cdd5437.chunk.css +409 -0
  24. package/dist/public/static/css/15.2cdd5437.chunk.css.map +1 -0
  25. package/dist/public/static/css/8.37cef611.chunk.css +2 -0
  26. package/dist/public/static/css/8.37cef611.chunk.css.map +1 -0
  27. package/dist/public/static/css/client.4cb92c57.chunk.css +8 -0
  28. package/dist/public/static/css/client.4cb92c57.chunk.css.map +1 -0
  29. package/dist/public/static/css/plone-volto-components-manage-Widgets-DatetimeWidget.c847a331.chunk.css +2 -0
  30. package/dist/public/static/css/plone-volto-components-manage-Widgets-DatetimeWidget.c847a331.chunk.css.map +1 -0
  31. package/dist/public/static/js/0.3e794c57.chunk.js +2 -0
  32. package/dist/public/static/js/0.3e794c57.chunk.js.map +1 -0
  33. package/dist/public/static/js/1.fece2b93.chunk.js +3 -0
  34. package/dist/public/static/js/1.fece2b93.chunk.js.LICENSE.txt +8 -0
  35. package/dist/public/static/js/1.fece2b93.chunk.js.map +1 -0
  36. package/dist/public/static/js/15.2cdd5437.chunk.js +3 -0
  37. package/dist/public/static/js/15.2cdd5437.chunk.js.LICENSE.txt +120 -0
  38. package/dist/public/static/js/15.2cdd5437.chunk.js.map +1 -0
  39. package/dist/public/static/js/16.a3a0662d.chunk.js +3 -0
  40. package/dist/public/static/js/16.a3a0662d.chunk.js.LICENSE.txt +8 -0
  41. package/dist/public/static/js/16.a3a0662d.chunk.js.map +1 -0
  42. package/dist/public/static/js/17.9478c50d.chunk.js +2 -0
  43. package/dist/public/static/js/17.9478c50d.chunk.js.map +1 -0
  44. package/dist/public/static/js/18.388e65d0.chunk.js +2 -0
  45. package/dist/public/static/js/18.388e65d0.chunk.js.map +1 -0
  46. package/dist/public/static/js/19.7c6b4a80.chunk.js +2 -0
  47. package/dist/public/static/js/19.7c6b4a80.chunk.js.map +1 -0
  48. package/dist/public/static/js/2.e6b0d690.chunk.js +2 -0
  49. package/dist/public/static/js/2.e6b0d690.chunk.js.map +1 -0
  50. package/dist/public/static/js/20.ada67f0e.chunk.js +3 -0
  51. package/dist/public/static/js/20.ada67f0e.chunk.js.LICENSE.txt +8 -0
  52. package/dist/public/static/js/20.ada67f0e.chunk.js.map +1 -0
  53. package/dist/public/static/js/21.3de49ac8.chunk.js +2 -0
  54. package/dist/public/static/js/21.3de49ac8.chunk.js.map +1 -0
  55. package/dist/public/static/js/22.ecefb8f2.chunk.js +2 -0
  56. package/dist/public/static/js/22.ecefb8f2.chunk.js.map +1 -0
  57. package/dist/public/static/js/23.3027bc00.chunk.js +2 -0
  58. package/dist/public/static/js/23.3027bc00.chunk.js.map +1 -0
  59. package/dist/public/static/js/24.aaaf4abf.chunk.js +2 -0
  60. package/dist/public/static/js/24.aaaf4abf.chunk.js.map +1 -0
  61. package/dist/public/static/js/25.c4d7d5e0.chunk.js +2 -0
  62. package/dist/public/static/js/25.c4d7d5e0.chunk.js.map +1 -0
  63. package/dist/public/static/js/26.d59ac3c1.chunk.js +2 -0
  64. package/dist/public/static/js/26.d59ac3c1.chunk.js.map +1 -0
  65. package/dist/public/static/js/27.266d95dd.chunk.js +2 -0
  66. package/dist/public/static/js/27.266d95dd.chunk.js.map +1 -0
  67. package/dist/public/static/js/28.d965d304.chunk.js +2 -0
  68. package/dist/public/static/js/28.d965d304.chunk.js.map +1 -0
  69. package/dist/public/static/js/29.7d8d1992.chunk.js +2 -0
  70. package/dist/public/static/js/29.7d8d1992.chunk.js.map +1 -0
  71. package/dist/public/static/js/3.025ba843.chunk.js +2 -0
  72. package/dist/public/static/js/3.025ba843.chunk.js.map +1 -0
  73. package/dist/public/static/js/30.a3d54e31.chunk.js +2 -0
  74. package/dist/public/static/js/30.a3d54e31.chunk.js.map +1 -0
  75. package/dist/public/static/js/31.9edf64ee.chunk.js +2 -0
  76. package/dist/public/static/js/31.9edf64ee.chunk.js.map +1 -0
  77. package/dist/public/static/js/32.649dbfc2.chunk.js +2 -0
  78. package/dist/public/static/js/32.649dbfc2.chunk.js.map +1 -0
  79. package/dist/public/static/js/33.45949ca4.chunk.js +2 -0
  80. package/dist/public/static/js/33.45949ca4.chunk.js.map +1 -0
  81. package/dist/public/static/js/34.084257cf.chunk.js +2 -0
  82. package/dist/public/static/js/34.084257cf.chunk.js.map +1 -0
  83. package/dist/public/static/js/35.00679602.chunk.js +3 -0
  84. package/dist/public/static/js/35.00679602.chunk.js.LICENSE.txt +37 -0
  85. package/dist/public/static/js/35.00679602.chunk.js.map +1 -0
  86. package/dist/public/static/js/36.4a29fdbd.chunk.js +3 -0
  87. package/dist/public/static/js/36.4a29fdbd.chunk.js.LICENSE.txt +7 -0
  88. package/dist/public/static/js/36.4a29fdbd.chunk.js.map +1 -0
  89. package/dist/public/static/js/37.fbbe07b3.chunk.js +3 -0
  90. package/dist/public/static/js/37.fbbe07b3.chunk.js.LICENSE.txt +14 -0
  91. package/dist/public/static/js/37.fbbe07b3.chunk.js.map +1 -0
  92. package/dist/public/static/js/38.b31c59ad.chunk.js +3 -0
  93. package/dist/public/static/js/38.b31c59ad.chunk.js.LICENSE.txt +8 -0
  94. package/dist/public/static/js/38.b31c59ad.chunk.js.map +1 -0
  95. package/dist/public/static/js/39.69d6a789.chunk.js +2 -0
  96. package/dist/public/static/js/39.69d6a789.chunk.js.map +1 -0
  97. package/dist/public/static/js/4.bdc4a5c5.chunk.js +2 -0
  98. package/dist/public/static/js/4.bdc4a5c5.chunk.js.map +1 -0
  99. package/dist/public/static/js/40.90de6e4a.chunk.js +2 -0
  100. package/dist/public/static/js/40.90de6e4a.chunk.js.map +1 -0
  101. package/dist/public/static/js/7.7acc66bc.chunk.js +2 -0
  102. package/dist/public/static/js/7.7acc66bc.chunk.js.map +1 -0
  103. package/dist/public/static/js/8.37cef611.chunk.js +3 -0
  104. package/dist/public/static/js/8.37cef611.chunk.js.LICENSE.txt +25 -0
  105. package/dist/public/static/js/8.37cef611.chunk.js.map +1 -0
  106. package/dist/public/static/js/client.4cb92c57.chunk.js +2 -0
  107. package/dist/public/static/js/client.4cb92c57.chunk.js.map +1 -0
  108. package/dist/public/static/js/draft-js-lib-isSoftNewlineEvent.6cd05e34.chunk.js +2 -0
  109. package/dist/public/static/js/draft-js-lib-isSoftNewlineEvent.6cd05e34.chunk.js.map +1 -0
  110. package/dist/public/static/js/moment.2caa76d1.chunk.js +2 -0
  111. package/dist/public/static/js/moment.2caa76d1.chunk.js.map +1 -0
  112. package/dist/public/static/js/plone-volto-components-manage-Widgets-DatetimeWidget.c847a331.chunk.js +2 -0
  113. package/dist/public/static/js/plone-volto-components-manage-Widgets-DatetimeWidget.c847a331.chunk.js.map +1 -0
  114. package/dist/public/static/js/plone-volto-components-theme-View-EventView.433dd14b.chunk.js +2 -0
  115. package/dist/public/static/js/plone-volto-components-theme-View-EventView.433dd14b.chunk.js.map +1 -0
  116. package/dist/public/static/js/react-dates.f71abb7c.chunk.js +2 -0
  117. package/dist/public/static/js/react-dates.f71abb7c.chunk.js.map +1 -0
  118. package/dist/public/static/js/react-simple-code-editor.33478dc3.chunk.js +2 -0
  119. package/dist/public/static/js/react-simple-code-editor.33478dc3.chunk.js.map +1 -0
  120. package/dist/public/static/js/runtime~client.d372df0e.js +2 -0
  121. package/dist/public/static/js/runtime~client.d372df0e.js.map +1 -0
  122. package/dist/public/static/media/Logo.16e25cdf.svg +21 -0
  123. package/dist/public/static/media/block-image.8a4a14d5.svg +8 -0
  124. package/dist/public/static/media/block-maps.731e84f6.svg +7 -0
  125. package/dist/public/static/media/block-video.832fa3ff.svg +7 -0
  126. package/dist/public/static/media/default-image.9451b251.svg +13 -0
  127. package/dist/public/static/media/flags.9c74e172.png +0 -0
  128. package/dist/public/static/media/icons.022583c4.svg +320 -0
  129. package/dist/public/static/media/icons.06400145.ttf +0 -0
  130. package/dist/public/static/media/icons.dbc1ef8b.eot +0 -0
  131. package/dist/public/static/media/icons.df45b7de.woff +0 -0
  132. package/dist/server.js +2 -0
  133. package/locales/ca/LC_MESSAGES/volto.po +14 -0
  134. package/locales/ca.json +1 -1
  135. package/locales/de/LC_MESSAGES/volto.po +14 -0
  136. package/locales/de.json +1 -1
  137. package/locales/en/LC_MESSAGES/volto.po +14 -0
  138. package/locales/en.json +1 -1
  139. package/locales/es/LC_MESSAGES/volto.po +14 -0
  140. package/locales/es.json +1 -1
  141. package/locales/eu/LC_MESSAGES/volto.po +14 -0
  142. package/locales/eu.json +1 -1
  143. package/locales/fr/LC_MESSAGES/volto.po +14 -0
  144. package/locales/fr.json +1 -1
  145. package/locales/it/LC_MESSAGES/volto.po +14 -0
  146. package/locales/it.json +1 -1
  147. package/locales/ja/LC_MESSAGES/volto.po +14 -0
  148. package/locales/ja.json +1 -1
  149. package/locales/nl/LC_MESSAGES/volto.po +14 -0
  150. package/locales/nl.json +1 -1
  151. package/locales/pt/LC_MESSAGES/volto.po +14 -0
  152. package/locales/pt.json +1 -1
  153. package/locales/pt_BR/LC_MESSAGES/volto.po +14 -0
  154. package/locales/pt_BR.json +1 -1
  155. package/locales/ro/LC_MESSAGES/volto.po +14 -0
  156. package/locales/ro.json +1 -1
  157. package/locales/volto.pot +15 -1
  158. package/logos/Logo.png +0 -0
  159. package/logos/volto-colorful.png +0 -0
  160. package/logos/volto-colorful.svg +35 -0
  161. package/logos/volto-guide.png +0 -0
  162. package/logos/volto-h-transparent.svg +6 -0
  163. package/logos/volto-transparent.png +0 -0
  164. package/logos/volto-transparent.svg +19 -0
  165. package/logos/volto-transparent2.svg +5 -0
  166. package/logos/volto-yellow.svg +29 -0
  167. package/logos/volto.sketch +0 -0
  168. package/netlify.toml +2 -0
  169. package/package.json +6 -2
  170. package/razzle.config.js +2 -2
  171. package/src/actions/language/language.js +7 -2
  172. package/src/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +1 -2
  173. package/src/components/manage/AnchorPlugin/components/LinkButton/index.jsx +15 -6
  174. package/src/components/manage/AnchorPlugin/index.jsx +12 -5
  175. package/src/components/manage/AnchorPlugin/utils/EditorUtils.js +8 -7
  176. package/src/components/manage/Blocks/Description/Edit.jsx +33 -19
  177. package/src/components/manage/Blocks/Description/Edit.test.jsx +6 -0
  178. package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +37 -26
  179. package/src/components/manage/Blocks/HeroImageLeft/Edit.test.jsx +6 -0
  180. package/src/components/manage/Blocks/Search/README.md +20 -0
  181. package/src/components/manage/Blocks/Search/components/CheckboxFacet.jsx +16 -3
  182. package/src/components/manage/Blocks/Search/components/DateRangeFacet.jsx +120 -0
  183. package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +34 -0
  184. package/src/components/manage/Blocks/Search/components/DateRangeFacetFilterListEntry.jsx +39 -0
  185. package/src/components/manage/Blocks/Search/components/Facets.jsx +24 -25
  186. package/src/components/manage/Blocks/Search/components/FilterList.jsx +37 -67
  187. package/src/components/manage/Blocks/Search/components/FilterList.test.jsx +49 -1
  188. package/src/components/manage/Blocks/Search/components/SelectFacet.jsx +9 -0
  189. package/src/components/manage/Blocks/Search/components/SelectFacetFilterListEntry.jsx +42 -0
  190. package/src/components/manage/Blocks/Search/components/SelectStyling.jsx +1 -1
  191. package/src/components/manage/Blocks/Search/components/ToggleFacet.jsx +38 -0
  192. package/src/components/manage/Blocks/Search/components/ToggleFacetFilterListEntry.jsx +39 -0
  193. package/src/components/manage/Blocks/Search/components/base.js +52 -0
  194. package/src/components/manage/Blocks/Search/components/index.js +5 -0
  195. package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +68 -27
  196. package/src/components/manage/Blocks/Search/schema.js +7 -4
  197. package/src/components/manage/Blocks/Search/utils.js +16 -0
  198. package/src/components/manage/Blocks/Table/Cell.jsx +40 -14
  199. package/src/components/manage/Blocks/Table/Cell.test.jsx +7 -1
  200. package/src/components/manage/Blocks/Table/Edit.jsx +7 -3
  201. package/src/components/manage/Blocks/Table/Edit.test.jsx +6 -0
  202. package/src/components/manage/Blocks/Table/View.jsx +2 -2
  203. package/src/components/manage/Blocks/Text/Edit.jsx +56 -14
  204. package/src/components/manage/Blocks/Text/Edit.test.jsx +7 -1
  205. package/src/components/manage/Blocks/Text/View.jsx +2 -2
  206. package/src/components/manage/Blocks/Title/Edit.jsx +25 -13
  207. package/src/components/manage/Blocks/Title/Edit.test.jsx +6 -0
  208. package/src/components/manage/Sidebar/Sidebar.jsx +5 -1
  209. package/src/components/manage/Toolbar/Toolbar.jsx +3 -1
  210. package/src/components/manage/UniversalLink/UniversalLink.jsx +5 -2
  211. package/src/components/manage/Widgets/DatetimeWidget.jsx +3 -1
  212. package/src/components/manage/Widgets/UrlWidget.jsx +1 -1
  213. package/src/components/manage/Widgets/WysiwygWidget.jsx +45 -19
  214. package/src/components/manage/Widgets/WysiwygWidget.test.jsx +7 -1
  215. package/src/components/theme/View/LinkView.jsx +1 -1
  216. package/src/components/theme/View/View.jsx +5 -1
  217. package/src/config/Blocks.jsx +31 -0
  218. package/src/config/Loadables.jsx +22 -0
  219. package/src/config/RichTextEditor/Blocks.jsx +25 -20
  220. package/src/config/RichTextEditor/Plugins.jsx +38 -31
  221. package/src/config/RichTextEditor/Styles.jsx +48 -44
  222. package/src/config/RichTextEditor/index.js +25 -0
  223. package/src/config/index.js +14 -18
  224. package/src/helpers/Api/Api.js +18 -4
  225. package/src/helpers/Extensions/index.js +1 -1
  226. package/src/helpers/Extensions/withBlockExtensions.js +4 -0
  227. package/src/helpers/Extensions/withBlockExtensions.test.js +26 -1
  228. package/src/helpers/Url/Url.js +32 -1
  229. package/src/helpers/Url/urlRegex.js +7 -1
  230. package/src/helpers/index.js +2 -0
  231. package/src/middleware/api.js +21 -2
  232. package/src/server.jsx +9 -2
  233. package/test-setup-config.js +22 -7
  234. package/theme/themes/pastanaga/extras/blocks.less +29 -0
  235. package/src/components/manage/AnchorPlugin/utils/URLUtils.js +0 -36
  236. package/src/components/manage/AnchorPlugin/utils/mailRegex.js +0 -2
  237. package/src/components/manage/AnchorPlugin/utils/telRegex.js +0 -1
  238. package/src/components/manage/AnchorPlugin/utils/urlRegex.js +0 -54
@@ -1,25 +1,30 @@
1
- import { Map } from 'immutable';
2
- import { DefaultDraftBlockRenderMap } from 'draft-js';
1
+ export default (props) => {
2
+ const { draftJs, immutableLib } = props;
3
+ const { DefaultDraftBlockRenderMap } = draftJs;
4
+ const { Map } = immutableLib;
3
5
 
4
- const blockRenderMap = Map({
5
- callout: {
6
- element: 'p',
7
- },
8
- unstyled: {
9
- element: 'div',
10
- },
11
- });
6
+ const blockRenderMap = Map({
7
+ callout: {
8
+ element: 'p',
9
+ },
10
+ unstyled: {
11
+ element: 'div',
12
+ },
13
+ });
12
14
 
13
- const extendedBlockRenderMap = DefaultDraftBlockRenderMap.merge(blockRenderMap);
15
+ const extendedBlockRenderMap = DefaultDraftBlockRenderMap.merge(
16
+ blockRenderMap,
17
+ );
14
18
 
15
- const blockStyleFn = (contentBlock) => {
16
- const type = contentBlock.getType();
17
- if (type === 'callout') {
18
- return 'callout';
19
- }
20
- return null;
21
- };
19
+ const blockStyleFn = (contentBlock) => {
20
+ const type = contentBlock.getType();
21
+ if (type === 'callout') {
22
+ return 'callout';
23
+ }
24
+ return null;
25
+ };
22
26
 
23
- const listBlockTypes = ['unordered-list-item', 'ordered-list-item'];
27
+ const listBlockTypes = ['unordered-list-item', 'ordered-list-item'];
24
28
 
25
- export { extendedBlockRenderMap, blockStyleFn, listBlockTypes };
29
+ return { extendedBlockRenderMap, blockStyleFn, listBlockTypes };
30
+ };
@@ -1,19 +1,6 @@
1
- import { Separator } from 'draft-js-inline-toolbar-plugin';
2
-
3
- import createBlockBreakoutPlugin from 'draft-js-block-breakout-plugin';
4
1
  import createLinkPlugin from '@plone/volto/components/manage/AnchorPlugin';
5
- //import createLinkDetectionPlugin from '@plone/volto/components/manage/LinkDetectionPlugin/link-detection-plugin';
6
-
7
- import {
8
- BlockquoteButton,
9
- BoldButton,
10
- CalloutButton,
11
- ItalicButton,
12
- HeadlineTwoButton,
13
- HeadlineThreeButton,
14
- OrderedListButton,
15
- UnorderedListButton,
16
- } from './Styles';
2
+
3
+ import Styles from './Styles';
17
4
 
18
5
  const breakOutOptions = {
19
6
  doubleBreakoutBlocks: [
@@ -31,23 +18,43 @@ const breakOutOptions = {
31
18
  ],
32
19
  };
33
20
 
34
- const blockBreakoutPlugin = createBlockBreakoutPlugin(breakOutOptions);
35
- const linkPlugin = createLinkPlugin();
36
21
  //const linkDetectionPlugin = createLinkDetectionPlugin();
37
22
 
38
- export const inlineToolbarButtons = [
39
- BoldButton,
40
- ItalicButton,
41
- linkPlugin.LinkButton,
42
- Separator,
43
- HeadlineTwoButton,
44
- HeadlineThreeButton,
45
- UnorderedListButton,
46
- OrderedListButton,
47
- BlockquoteButton,
48
- CalloutButton,
49
- ];
50
-
51
- const plugins = [linkPlugin, blockBreakoutPlugin]; //linkDetectionPlugin
23
+ const plugins = (props) => {
24
+ const { draftJsInlineToolbarPlugin, draftJsBlockBreakoutPlugin } = props;
25
+ const { Separator } = draftJsInlineToolbarPlugin;
26
+ const blockBreakoutPlugin = draftJsBlockBreakoutPlugin.default(
27
+ breakOutOptions,
28
+ );
29
+
30
+ const linkPlugin = createLinkPlugin({ libraries: props });
31
+
32
+ const buttons = Styles(props);
33
+ const {
34
+ BoldButton,
35
+ ItalicButton,
36
+ HeadlineTwoButton,
37
+ HeadlineThreeButton,
38
+ UnorderedListButton,
39
+ OrderedListButton,
40
+ BlockquoteButton,
41
+ CalloutButton,
42
+ } = buttons;
43
+
44
+ const inlineToolbarButtons = [
45
+ BoldButton,
46
+ ItalicButton,
47
+ linkPlugin.LinkButton,
48
+ Separator,
49
+ HeadlineTwoButton,
50
+ HeadlineThreeButton,
51
+ UnorderedListButton,
52
+ OrderedListButton,
53
+ BlockquoteButton,
54
+ CalloutButton,
55
+ ];
56
+
57
+ return { inlineToolbarButtons, plugins: [linkPlugin, blockBreakoutPlugin] }; //linkDetectionPlugin
58
+ };
52
59
 
53
60
  export default plugins;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import createInlineStyleButton from 'draft-js-buttons/lib/utils/createInlineStyleButton';
3
- import createBlockStyleButton from 'draft-js-buttons/lib/utils/createBlockStyleButton';
2
+ // import createInlineStyleButton from 'draft-js-buttons/lib/utils/createInlineStyleButton';
3
+ // import createBlockStyleButton from 'draft-js-buttons/lib/utils/createBlockStyleButton';
4
4
 
5
5
  import Icon from '@plone/volto/components/theme/Icon/Icon';
6
6
 
@@ -13,53 +13,57 @@ import orderedListSVG from '@plone/volto/icons/list-numbered.svg';
13
13
  import blockquoteSVG from '@plone/volto/icons/quote.svg';
14
14
  import calloutSVG from '@plone/volto/icons/megaphone.svg';
15
15
 
16
- const BoldButton = createInlineStyleButton({
17
- style: 'BOLD',
18
- children: <Icon name={boldSVG} size="24px" />,
19
- });
16
+ export default function (props) {
17
+ const createInlineStyleButton = props.draftJsCreateInlineStyleButton.default;
18
+ const createBlockStyleButton = props.draftJsCreateBlockStyleButton.default;
20
19
 
21
- const ItalicButton = createInlineStyleButton({
22
- style: 'ITALIC',
23
- children: <Icon name={italicSVG} size="24px" />,
24
- });
20
+ const BoldButton = createInlineStyleButton({
21
+ style: 'BOLD',
22
+ children: <Icon name={boldSVG} size="24px" />,
23
+ });
25
24
 
26
- const HeadlineTwoButton = createBlockStyleButton({
27
- blockType: 'header-two',
28
- children: <Icon name={textSVG} size="24px" />,
29
- });
25
+ const ItalicButton = createInlineStyleButton({
26
+ style: 'ITALIC',
27
+ children: <Icon name={italicSVG} size="24px" />,
28
+ });
30
29
 
31
- const HeadlineThreeButton = createBlockStyleButton({
32
- blockType: 'header-three',
33
- children: <Icon name={subtextSVG} size="24px" />,
34
- });
30
+ const HeadlineTwoButton = createBlockStyleButton({
31
+ blockType: 'header-two',
32
+ children: <Icon name={textSVG} size="24px" />,
33
+ });
35
34
 
36
- const UnorderedListButton = createBlockStyleButton({
37
- blockType: 'unordered-list-item',
38
- children: <Icon name={unorderedListSVG} size="24px" />,
39
- });
35
+ const HeadlineThreeButton = createBlockStyleButton({
36
+ blockType: 'header-three',
37
+ children: <Icon name={subtextSVG} size="24px" />,
38
+ });
40
39
 
41
- const OrderedListButton = createBlockStyleButton({
42
- blockType: 'ordered-list-item',
43
- children: <Icon name={orderedListSVG} size="24px" />,
44
- });
40
+ const UnorderedListButton = createBlockStyleButton({
41
+ blockType: 'unordered-list-item',
42
+ children: <Icon name={unorderedListSVG} size="24px" />,
43
+ });
45
44
 
46
- const BlockquoteButton = createBlockStyleButton({
47
- blockType: 'blockquote',
48
- children: <Icon name={blockquoteSVG} size="24px" />,
49
- });
45
+ const OrderedListButton = createBlockStyleButton({
46
+ blockType: 'ordered-list-item',
47
+ children: <Icon name={orderedListSVG} size="24px" />,
48
+ });
50
49
 
51
- const CalloutButton = createBlockStyleButton({
52
- blockType: 'callout',
53
- children: <Icon name={calloutSVG} size="24px" />,
54
- });
50
+ const BlockquoteButton = createBlockStyleButton({
51
+ blockType: 'blockquote',
52
+ children: <Icon name={blockquoteSVG} size="24px" />,
53
+ });
55
54
 
56
- export {
57
- BlockquoteButton,
58
- BoldButton,
59
- CalloutButton,
60
- ItalicButton,
61
- HeadlineTwoButton,
62
- HeadlineThreeButton,
63
- OrderedListButton,
64
- UnorderedListButton,
65
- };
55
+ const CalloutButton = createBlockStyleButton({
56
+ blockType: 'callout',
57
+ children: <Icon name={calloutSVG} size="24px" />,
58
+ });
59
+ return {
60
+ BlockquoteButton,
61
+ BoldButton,
62
+ CalloutButton,
63
+ ItalicButton,
64
+ HeadlineTwoButton,
65
+ HeadlineThreeButton,
66
+ OrderedListButton,
67
+ UnorderedListButton,
68
+ };
69
+ }
@@ -0,0 +1,25 @@
1
+ import ToHTMLRenderers, { options as ToHTMLOptions } from './ToHTML';
2
+ import Blocks from './Blocks';
3
+ import Plugins from './Plugins';
4
+ import FromHTMLCustomBlockFn from './FromHTML';
5
+
6
+ export const richtextEditorSettings = (props) => {
7
+ const { plugins, inlineToolbarButtons } = Plugins(props);
8
+ const { extendedBlockRenderMap, blockStyleFn, listBlockTypes } = Blocks(
9
+ props,
10
+ );
11
+
12
+ return {
13
+ extendedBlockRenderMap,
14
+ blockStyleFn: blockStyleFn,
15
+ listBlockTypes: listBlockTypes,
16
+ richTextEditorPlugins: plugins,
17
+ richTextEditorInlineToolbarButtons: inlineToolbarButtons,
18
+ FromHTMLCustomBlockFn,
19
+ };
20
+ };
21
+
22
+ export const richtextViewSettings = {
23
+ ToHTMLRenderers,
24
+ ToHTMLOptions,
25
+ };
@@ -11,16 +11,6 @@ import {
11
11
  errorViews,
12
12
  } from './Views';
13
13
  import { nonContentRoutes } from './NonContentRoutes';
14
- import ToHTMLRenderers, {
15
- options as ToHTMLOptions,
16
- } from './RichTextEditor/ToHTML';
17
- import {
18
- extendedBlockRenderMap,
19
- blockStyleFn,
20
- listBlockTypes,
21
- } from './RichTextEditor/Blocks';
22
- import plugins, { inlineToolbarButtons } from './RichTextEditor/Plugins';
23
- import FromHTMLCustomBlockFn from './RichTextEditor/FromHTML';
24
14
  import {
25
15
  groupBlocksOrder,
26
16
  requiredBlocks,
@@ -34,6 +24,8 @@ import { sentryOptions } from './Sentry';
34
24
  import { contentIcons } from './ContentIcons';
35
25
  import { controlPanelsIcons } from './ControlPanels';
36
26
 
27
+ import { richtextEditorSettings, richtextViewSettings } from './RichTextEditor';
28
+
37
29
  import applyAddonConfiguration from 'load-volto-addons';
38
30
 
39
31
  import ConfigRegistry from '@plone/volto/registry';
@@ -96,15 +88,10 @@ let config = {
96
88
  websockets: process.env.RAZZLE_WEBSOCKETS || false,
97
89
  // TODO: legacyTraverse to be removed when the use of the legacy traverse is deprecated.
98
90
  legacyTraverse: process.env.RAZZLE_LEGACY_TRAVERSE || false,
91
+ cookieExpires: 15552000, //in seconds. Default is 6 month (15552000)
99
92
  nonContentRoutes,
100
- extendedBlockRenderMap,
101
- blockStyleFn,
102
- listBlockTypes,
103
- FromHTMLCustomBlockFn,
104
- richTextEditorInlineToolbarButtons: inlineToolbarButtons,
105
- richTextEditorPlugins: plugins,
106
- ToHTMLRenderers,
107
- ToHTMLOptions,
93
+ richtextEditorSettings,
94
+ richtextViewSettings,
108
95
  imageObjects: ['Image'],
109
96
  downloadableObjects: ['File'], //list of content-types for which the direct download of the file will be carried out if the user is not authenticated
110
97
  listingPreviewImageField: 'image', // deprecated from Volto 14 onwards
@@ -136,6 +123,15 @@ let config = {
136
123
  'reactBeautifulDnd',
137
124
  // 'diffLib',
138
125
  ],
126
+ draftEditor: [
127
+ 'immutableLib',
128
+ 'draftJs',
129
+ 'draftJsLibIsSoftNewlineEvent',
130
+ 'draftJsFilters',
131
+ 'draftJsInlineToolbarPlugin',
132
+ 'draftJsImportHtml',
133
+ 'draftJsBlockBreakoutPlugin',
134
+ ],
139
135
  },
140
136
  appExtras: [],
141
137
  maxResponseSize: 2000000000, // This is superagent default (200 mb)
@@ -46,7 +46,10 @@ class Api {
46
46
  const cookies = new Cookies();
47
47
 
48
48
  methods.forEach((method) => {
49
- this[method] = (path, { params, data, type, headers = {} } = {}) => {
49
+ this[method] = (
50
+ path,
51
+ { params, data, type, headers = {}, checkUrl = false } = {},
52
+ ) => {
50
53
  let request;
51
54
  let promise = new Promise((resolve, reject) => {
52
55
  request = superagent[method](formatUrl(path));
@@ -78,9 +81,20 @@ class Api {
78
81
  request.send(data);
79
82
  }
80
83
 
81
- request.end((err, response) =>
82
- err ? reject(err) : resolve(response.body || response.text),
83
- );
84
+ request.end((err, response) => {
85
+ if (
86
+ checkUrl &&
87
+ request.url &&
88
+ request.xhr &&
89
+ request.url !== request.xhr.responseURL
90
+ ) {
91
+ return reject({
92
+ code: 301,
93
+ url: request.xhr.responseURL,
94
+ });
95
+ }
96
+ return err ? reject(err) : resolve(response.body || response.text);
97
+ });
84
98
  });
85
99
  promise.request = request;
86
100
  return promise;
@@ -1,2 +1,2 @@
1
1
  export * from './withBlockSchemaEnhancer';
2
- export withBlockExtensions from './withBlockExtensions';
2
+ export withBlockExtensions, { resolveExtension } from './withBlockExtensions';
@@ -5,6 +5,10 @@
5
5
  import React from 'react';
6
6
  import config from '@plone/volto/registry';
7
7
 
8
+ /**
9
+ * Retrieves the extension (variation) settings from the provided
10
+ * configuration, based on incoming data.
11
+ */
8
12
  export function resolveExtension(name, extensions, data) {
9
13
  const selectedExtension = data[name];
10
14
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import withBlockExtensions from './withBlockExtensions';
2
+ import withBlockExtensions, { resolveExtension } from './withBlockExtensions';
3
3
  import config from '@plone/volto/registry';
4
4
  import { render } from '@testing-library/react';
5
5
 
@@ -56,3 +56,28 @@ describe('withBlockExtensions', () => {
56
56
  expect(container).toMatchSnapshot();
57
57
  });
58
58
  });
59
+
60
+ describe('resolveExtensions', () => {
61
+ it('resolves the extensions from provided configuration', () => {
62
+ const data = { variation: 'extB' };
63
+ const extensions = {
64
+ variations: [
65
+ {
66
+ id: 'extA',
67
+ payload: 'extA specific',
68
+ },
69
+ {
70
+ id: 'extB',
71
+ payload: 'extB specific',
72
+ },
73
+ ],
74
+ };
75
+
76
+ const resolved = resolveExtension(
77
+ 'variation',
78
+ extensions['variations'],
79
+ data,
80
+ );
81
+ expect(resolved.payload).toEqual('extB specific');
82
+ });
83
+ });
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { last, memoize } from 'lodash';
7
- import urlRegex from './urlRegex';
7
+ import { urlRegex, telRegex, mailRegex } from './urlRegex';
8
8
  import prependHttp from 'prepend-http';
9
9
  import config from '@plone/volto/registry';
10
10
 
@@ -214,3 +214,34 @@ export function normalizeUrl(url) {
214
214
  export function removeProtocol(url) {
215
215
  return url.replace('https://', '').replace('http://', '');
216
216
  }
217
+
218
+ export function isMail(text) {
219
+ return mailRegex().test(text);
220
+ }
221
+
222
+ export function isTelephone(text) {
223
+ return telRegex().test(text);
224
+ }
225
+
226
+ export function normaliseMail(email) {
227
+ if (email.toLowerCase().startsWith('mailto:')) {
228
+ return email;
229
+ }
230
+ return `mailto:${email}`;
231
+ }
232
+
233
+ export function normalizeTelephone(tel) {
234
+ if (tel.toLowerCase().startsWith('tel:')) {
235
+ return tel;
236
+ }
237
+ return `tel:${tel}`;
238
+ }
239
+
240
+ export const URLUtils = {
241
+ normalizeTelephone,
242
+ normaliseMail,
243
+ normalizeUrl,
244
+ isTelephone,
245
+ isMail,
246
+ isUrl,
247
+ };
@@ -2,6 +2,12 @@
2
2
  /* eslint-disable no-confusing-arrow */
3
3
  import tlds from 'tlds';
4
4
 
5
+ export const mailRegex = () =>
6
+ /^((mailto:[^<>()/[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i;
7
+
8
+ export const telRegex = () =>
9
+ /^[tel:]*[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s./0-9]*$/g;
10
+
5
11
  const v4 =
6
12
  '(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}';
7
13
  const v6seg = '[0-9a-fA-F]{1,4}';
@@ -31,7 +37,7 @@ ipRegex.v4 = (opts) =>
31
37
  ipRegex.v6 = (opts) =>
32
38
  opts && opts.exact ? new RegExp(`^${v6}$`) : new RegExp(v6, 'g');
33
39
 
34
- export default (_opts) => {
40
+ export const urlRegex = (_opts) => {
35
41
  const opts = Object.assign({ strict: true }, _opts);
36
42
  const protocol = `(?:(?:[a-z]+:)?//)${opts.strict ? '' : '?'}`;
37
43
  const auth = '(?:\\S+(?::\\S*)?@)?';
@@ -26,6 +26,7 @@ export {
26
26
  isUrl,
27
27
  normalizeUrl,
28
28
  removeProtocol,
29
+ URLUtils,
29
30
  } from '@plone/volto/helpers/Url/Url';
30
31
  export { generateSitemap } from '@plone/volto/helpers/Sitemap/Sitemap';
31
32
  export { generateRobots } from '@plone/volto/helpers/Robots/Robots';
@@ -83,6 +84,7 @@ export {
83
84
  withVariationSchemaEnhancer,
84
85
  withBlockExtensions,
85
86
  applySchemaEnhancer,
87
+ resolveExtension,
86
88
  } from './Extensions';
87
89
  export { asyncConnect } from './AsyncConnect';
88
90
  export { userHasRoles } from './User/User';
@@ -104,11 +104,13 @@ function sendOnSocket(request) {
104
104
  * @returns {Promise} Action promise.
105
105
  */
106
106
  export default (api) => ({ dispatch, getState }) => (next) => (action) => {
107
+ const { settings } = config;
108
+
107
109
  if (typeof action === 'function') {
108
110
  return action(dispatch, getState);
109
111
  }
110
112
 
111
- const { request, type, mode = 'paralel', ...rest } = action;
113
+ const { request, type, mode = 'parallel', ...rest } = action;
112
114
  let actionPromise;
113
115
 
114
116
  if (!request) {
@@ -143,6 +145,9 @@ export default (api) => ({ dispatch, getState }) => (next) => (action) => {
143
145
  type: item.type,
144
146
  headers: item.headers,
145
147
  params: request.params,
148
+ checkUrl: settings.actions_raising_api_errors.includes(
149
+ action.type,
150
+ ),
146
151
  }).then((reqres) => {
147
152
  return [...acc, reqres];
148
153
  });
@@ -155,6 +160,9 @@ export default (api) => ({ dispatch, getState }) => (next) => (action) => {
155
160
  type: item.type,
156
161
  headers: item.headers,
157
162
  params: request.params,
163
+ checkUrl: settings.actions_raising_api_errors.includes(
164
+ action.type,
165
+ ),
158
166
  }),
159
167
  ),
160
168
  )
@@ -163,6 +171,7 @@ export default (api) => ({ dispatch, getState }) => (next) => (action) => {
163
171
  type: request.type,
164
172
  headers: request.headers,
165
173
  params: request.params,
174
+ checkUrl: settings.actions_raising_api_errors.includes(action.type),
166
175
  });
167
176
  actionPromise.then(
168
177
  (result) => {
@@ -204,7 +213,6 @@ export default (api) => ({ dispatch, getState }) => (next) => (action) => {
204
213
  return next({ ...rest, result, type: `${type}_SUCCESS` });
205
214
  },
206
215
  (error) => {
207
- const { settings } = config;
208
216
  // Only SRR can set ECONNREFUSED
209
217
  if (error.code === 'ECONNREFUSED') {
210
218
  next({
@@ -238,6 +246,17 @@ export default (api) => ({ dispatch, getState }) => (next) => (action) => {
238
246
  });
239
247
  }
240
248
 
249
+ // Redirect
250
+ else if (error?.code === 301) {
251
+ next({
252
+ ...rest,
253
+ error,
254
+ statusCode: error.code,
255
+ connectionRefused: false,
256
+ type: SET_APIERROR,
257
+ });
258
+ }
259
+
241
260
  // The rest
242
261
  else if (settings.actions_raising_api_errors.includes(action.type)) {
243
262
  if (error?.response?.statusCode === 401) {
package/src/server.jsx CHANGED
@@ -58,7 +58,13 @@ const supported = new locale.Locales(keys(languages), 'en');
58
58
 
59
59
  const server = express()
60
60
  .disable('x-powered-by')
61
- .use(express.static(process.env.RAZZLE_PUBLIC_DIR))
61
+ .use(
62
+ express.static(
63
+ process.env.BUILD_DIR
64
+ ? path.join(process.env.BUILD_DIR, 'public')
65
+ : process.env.RAZZLE_PUBLIC_DIR,
66
+ ),
67
+ )
62
68
  .head('/*', function (req, res) {
63
69
  // Support for HEAD requests. Required by start-test utility in CI.
64
70
  res.send('');
@@ -179,8 +185,9 @@ server.get('/*', (req, res) => {
179
185
  const { store, api, errorHandler } = req.app.locals;
180
186
 
181
187
  // @loadable/server extractor
188
+ const buildDir = process.env.BUILD_DIR || 'build';
182
189
  const extractor = new ChunkExtractor({
183
- statsFile: path.resolve('build/loadable-stats.json'),
190
+ statsFile: path.resolve(path.join(buildDir, 'loadable-stats.json')),
184
191
  entrypoints: ['client'],
185
192
  });
186
193
 
@@ -18,11 +18,30 @@ import {
18
18
  blockStyleFn,
19
19
  listBlockTypes,
20
20
  } from '@plone/volto/config/RichTextEditor/Blocks';
21
+ import FromHTMLCustomBlockFn from '@plone/volto/config/RichTextEditor/FromHTML';
21
22
  import { contentIcons } from '@plone/volto/config/ContentIcons';
22
23
 
23
- import FromHTMLCustomBlockFn from '@plone/volto/config/RichTextEditor/FromHTML';
24
24
  import { controlPanelsIcons } from '@plone/volto/config/ControlPanels';
25
25
 
26
+ // we need to do a redefinition here because of circular import issues
27
+ // because draftjs-based components are not really tested, this is basically
28
+ // dummy code.
29
+ const richtextEditorSettings = (props) => {
30
+ return {
31
+ extendedBlockRenderMap,
32
+ blockStyleFn,
33
+ listBlockTypes,
34
+ FromHTMLCustomBlockFn,
35
+ // richTextEditorPlugins: plugins,
36
+ // richTextEditorInlineToolbarButtons: inlineToolbarButtons,
37
+ };
38
+ };
39
+
40
+ const richtextViewSettings = {
41
+ ToHTMLRenderers,
42
+ ToHTMLOptions,
43
+ };
44
+
26
45
  config.set('settings', {
27
46
  apiPath: 'http://localhost:8080/Plone',
28
47
  defaultLanguage: 'en',
@@ -30,12 +49,8 @@ config.set('settings', {
30
49
  defaultPageSize: 25,
31
50
  isMultilingual: false,
32
51
  nonContentRoutes,
33
- extendedBlockRenderMap,
34
- blockStyleFn,
35
- listBlockTypes,
36
- FromHTMLCustomBlockFn,
37
- ToHTMLRenderers,
38
- ToHTMLOptions,
52
+ richtextEditorSettings,
53
+ richtextViewSettings,
39
54
  contentIcons: contentIcons,
40
55
  loadables,
41
56
  lazyBundles: {
@@ -1057,4 +1057,33 @@ body.has-toolbar.has-sidebar-collapsed .ui.wrapper > .ui.inner.block.full {
1057
1057
  height: 28px !important;
1058
1058
  }
1059
1059
  }
1060
+
1061
+ .daterange-facet {
1062
+ .ui.date-input input {
1063
+ height: auto;
1064
+ }
1065
+
1066
+ .ui-button {
1067
+ margin: 0;
1068
+ }
1069
+
1070
+ .DateInput {
1071
+ width: 40%;
1072
+ min-width: 75px;
1073
+ }
1074
+
1075
+ .DateRangePickerInput_arrow_svg {
1076
+ margin: 0 6px;
1077
+ }
1078
+
1079
+ .DateRangePicker_picker {
1080
+ z-index: 10;
1081
+ }
1082
+
1083
+ .radio {
1084
+ display: flex;
1085
+ min-height: 37px;
1086
+ align-items: center;
1087
+ }
1088
+ }
1060
1089
  }