@plone/volto 15.0.0-alpha.0 → 15.0.0-alpha.11

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 (236) hide show
  1. package/.eslintrc +1 -1
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +7 -6
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -1
  4. package/.github/workflows/{core-sandbox.yml → coresandbox.yml} +1 -1
  5. package/.github/workflows/docs.yml +15 -55
  6. package/.storybook/main.js +3 -9
  7. package/CHANGELOG.md +140 -2
  8. package/CODE_OF_CONDUCT.md +0 -1
  9. package/COMMITLINT.md +19 -21
  10. package/README.md +2 -1
  11. package/SECURITY.md +0 -1
  12. package/addon-registry.js +20 -12
  13. package/create-addons-loader.js +1 -1
  14. package/cypress/support/commands.js +3 -1
  15. package/dist/assets.json +1 -0
  16. package/dist/chunks.json +571 -0
  17. package/dist/loadable-stats.json +2070 -0
  18. package/dist/public/android-chrome-192x192.png +0 -0
  19. package/dist/public/android-chrome-512x512.png +0 -0
  20. package/dist/public/apple-touch-icon.png +0 -0
  21. package/dist/public/favicon-16x16.png +0 -0
  22. package/dist/public/favicon-32x32.png +0 -0
  23. package/dist/public/favicon.ico +0 -0
  24. package/dist/public/icon.svg +13 -0
  25. package/dist/public/index.html.spa +34 -0
  26. package/dist/public/robots.txt +2 -0
  27. package/dist/public/site.webmanifest +19 -0
  28. package/dist/public/static/css/14.803b450c.chunk.css +409 -0
  29. package/dist/public/static/css/3.a3490306.chunk.css +2 -0
  30. package/dist/public/static/css/client.0ead607b.chunk.css +8 -0
  31. package/dist/public/static/css/plone-volto-components-manage-Widgets-DatetimeWidget.77a7ad0d.chunk.css +2 -0
  32. package/dist/public/static/js/0.3e794c57.chunk.js +2 -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/14.803b450c.chunk.js +3 -0
  36. package/dist/public/static/js/14.803b450c.chunk.js.LICENSE.txt +146 -0
  37. package/dist/public/static/js/15.c1eb25b4.chunk.js +3 -0
  38. package/dist/public/static/js/15.c1eb25b4.chunk.js.LICENSE.txt +8 -0
  39. package/dist/public/static/js/16.70e24cba.chunk.js +2 -0
  40. package/dist/public/static/js/17.f03d2a82.chunk.js +2 -0
  41. package/dist/public/static/js/18.0f0b1dfa.chunk.js +2 -0
  42. package/dist/public/static/js/19.61ef8815.chunk.js +3 -0
  43. package/dist/public/static/js/19.61ef8815.chunk.js.LICENSE.txt +8 -0
  44. package/dist/public/static/js/20.6b37f925.chunk.js +2 -0
  45. package/dist/public/static/js/21.8704b265.chunk.js +2 -0
  46. package/dist/public/static/js/22.5a2b56ff.chunk.js +2 -0
  47. package/dist/public/static/js/23.a53c8d7b.chunk.js +2 -0
  48. package/dist/public/static/js/24.d44c620a.chunk.js +2 -0
  49. package/dist/public/static/js/25.3129d6c8.chunk.js +2 -0
  50. package/dist/public/static/js/26.9dfad319.chunk.js +2 -0
  51. package/dist/public/static/js/27.efbb318a.chunk.js +2 -0
  52. package/dist/public/static/js/28.b4840d60.chunk.js +2 -0
  53. package/dist/public/static/js/29.690d4b54.chunk.js +2 -0
  54. package/dist/public/static/js/3.a3490306.chunk.js +2 -0
  55. package/dist/public/static/js/30.5f174f94.chunk.js +2 -0
  56. package/dist/public/static/js/31.4a7cf109.chunk.js +2 -0
  57. package/dist/public/static/js/32.2247dcf7.chunk.js +2 -0
  58. package/dist/public/static/js/33.87874f33.chunk.js +2 -0
  59. package/dist/public/static/js/34.aec37d56.chunk.js +3 -0
  60. package/dist/public/static/js/34.aec37d56.chunk.js.LICENSE.txt +37 -0
  61. package/dist/public/static/js/35.73887e02.chunk.js +3 -0
  62. package/dist/public/static/js/35.73887e02.chunk.js.LICENSE.txt +7 -0
  63. package/dist/public/static/js/36.19d2e05a.chunk.js +3 -0
  64. package/dist/public/static/js/36.19d2e05a.chunk.js.LICENSE.txt +14 -0
  65. package/dist/public/static/js/37.96925a5f.chunk.js +3 -0
  66. package/dist/public/static/js/37.96925a5f.chunk.js.LICENSE.txt +8 -0
  67. package/dist/public/static/js/38.701a2e85.chunk.js +2 -0
  68. package/dist/public/static/js/39.4cbf0549.chunk.js +2 -0
  69. package/dist/public/static/js/4.bdc4a5c5.chunk.js +2 -0
  70. package/dist/public/static/js/6.69ba4792.chunk.js +2 -0
  71. package/dist/public/static/js/client.0ead607b.chunk.js +2 -0
  72. package/dist/public/static/js/draft-js-lib-isSoftNewlineEvent.ad4b1307.chunk.js +2 -0
  73. package/dist/public/static/js/moment.dfd83abb.chunk.js +2 -0
  74. package/dist/public/static/js/plone-volto-components-manage-Widgets-DatetimeWidget.77a7ad0d.chunk.js +2 -0
  75. package/dist/public/static/js/plone-volto-components-theme-View-EventView.c500936a.chunk.js +2 -0
  76. package/dist/public/static/js/react-dates.d94a34ee.chunk.js +2 -0
  77. package/dist/public/static/js/react-select.43f17559.chunk.js +2 -0
  78. package/dist/public/static/js/react-simple-code-editor.484ec69f.chunk.js +2 -0
  79. package/dist/public/static/js/runtime~client.c0921d19.js +2 -0
  80. package/dist/public/static/media/Logo.16e25cdf.svg +21 -0
  81. package/dist/public/static/media/block-image.8a4a14d5.svg +8 -0
  82. package/dist/public/static/media/block-maps.731e84f6.svg +7 -0
  83. package/dist/public/static/media/block-video.832fa3ff.svg +7 -0
  84. package/dist/public/static/media/default-image.9451b251.svg +13 -0
  85. package/dist/public/static/media/flags.9c74e172.png +0 -0
  86. package/dist/public/static/media/icons.022583c4.svg +320 -0
  87. package/dist/public/static/media/icons.06400145.ttf +0 -0
  88. package/dist/public/static/media/icons.dbc1ef8b.eot +0 -0
  89. package/dist/public/static/media/icons.df45b7de.woff +0 -0
  90. package/dist/server.js +2 -0
  91. package/docker-compose.yml +15 -10
  92. package/locales/ca/LC_MESSAGES/volto.po +33 -9
  93. package/locales/ca.json +1 -1
  94. package/locales/de/LC_MESSAGES/volto.po +33 -9
  95. package/locales/de.json +1 -1
  96. package/locales/en/LC_MESSAGES/volto.po +33 -9
  97. package/locales/en.json +1 -1
  98. package/locales/es/LC_MESSAGES/volto.po +33 -9
  99. package/locales/es.json +1 -1
  100. package/locales/eu/LC_MESSAGES/volto.po +33 -9
  101. package/locales/eu.json +1 -1
  102. package/locales/fr/LC_MESSAGES/volto.po +33 -9
  103. package/locales/fr.json +1 -1
  104. package/locales/it/LC_MESSAGES/volto.po +33 -9
  105. package/locales/it.json +1 -1
  106. package/locales/ja/LC_MESSAGES/volto.po +33 -9
  107. package/locales/ja.json +1 -1
  108. package/locales/nl/LC_MESSAGES/volto.po +33 -9
  109. package/locales/nl.json +1 -1
  110. package/locales/pt/LC_MESSAGES/volto.po +33 -9
  111. package/locales/pt.json +1 -1
  112. package/locales/pt_BR/LC_MESSAGES/volto.po +33 -9
  113. package/locales/pt_BR.json +1 -1
  114. package/locales/ro/LC_MESSAGES/volto.po +33 -9
  115. package/locales/ro.json +1 -1
  116. package/locales/volto.pot +34 -10
  117. package/logos/Logo.png +0 -0
  118. package/logos/volto-colorful.png +0 -0
  119. package/logos/volto-colorful.svg +35 -0
  120. package/logos/volto-guide.png +0 -0
  121. package/logos/volto-h-transparent.svg +6 -0
  122. package/logos/volto-transparent.png +0 -0
  123. package/logos/volto-transparent.svg +19 -0
  124. package/logos/volto-transparent2.svg +5 -0
  125. package/logos/volto-yellow.svg +29 -0
  126. package/logos/volto.sketch +0 -0
  127. package/netlify.toml +2 -0
  128. package/package.json +22 -12
  129. package/pyvenv.cfg +3 -0
  130. package/razzle.config.js +17 -13
  131. package/src/actions/language/language.js +23 -11
  132. package/src/actions/lazyLibraries/lazyLibraries.js +8 -4
  133. package/src/components/index.js +2 -0
  134. package/src/components/manage/Add/Add.jsx +1 -1
  135. package/src/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +1 -2
  136. package/src/components/manage/AnchorPlugin/components/LinkButton/index.jsx +15 -6
  137. package/src/components/manage/AnchorPlugin/index.jsx +12 -5
  138. package/src/components/manage/AnchorPlugin/utils/EditorUtils.js +8 -7
  139. package/src/components/manage/Blocks/Description/Edit.jsx +33 -19
  140. package/src/components/manage/Blocks/Description/Edit.test.jsx +6 -0
  141. package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +37 -26
  142. package/src/components/manage/Blocks/HeroImageLeft/Edit.test.jsx +6 -0
  143. package/src/components/manage/Blocks/Listing/View.jsx +1 -1
  144. package/src/components/manage/Blocks/Search/README.md +20 -0
  145. package/src/components/manage/Blocks/Search/components/CheckboxFacet.jsx +16 -3
  146. package/src/components/manage/Blocks/Search/components/DateRangeFacet.jsx +120 -0
  147. package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +34 -0
  148. package/src/components/manage/Blocks/Search/components/DateRangeFacetFilterListEntry.jsx +39 -0
  149. package/src/components/manage/Blocks/Search/components/Facets.jsx +24 -25
  150. package/src/components/manage/Blocks/Search/components/FilterList.jsx +37 -67
  151. package/src/components/manage/Blocks/Search/components/FilterList.test.jsx +49 -1
  152. package/src/components/manage/Blocks/Search/components/SelectFacet.jsx +9 -0
  153. package/src/components/manage/Blocks/Search/components/SelectFacetFilterListEntry.jsx +42 -0
  154. package/src/components/manage/Blocks/Search/components/SelectStyling.jsx +1 -1
  155. package/src/components/manage/Blocks/Search/components/ToggleFacet.jsx +38 -0
  156. package/src/components/manage/Blocks/Search/components/ToggleFacetFilterListEntry.jsx +39 -0
  157. package/src/components/manage/Blocks/Search/components/base.js +52 -0
  158. package/src/components/manage/Blocks/Search/components/index.js +5 -0
  159. package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +68 -27
  160. package/src/components/manage/Blocks/Search/schema.js +7 -4
  161. package/src/components/manage/Blocks/Search/utils.js +16 -0
  162. package/src/components/manage/Blocks/Table/Cell.jsx +40 -14
  163. package/src/components/manage/Blocks/Table/Cell.test.jsx +7 -1
  164. package/src/components/manage/Blocks/Table/Edit.jsx +7 -3
  165. package/src/components/manage/Blocks/Table/Edit.test.jsx +6 -0
  166. package/src/components/manage/Blocks/Table/View.jsx +2 -2
  167. package/src/components/manage/Blocks/Text/Edit.jsx +56 -14
  168. package/src/components/manage/Blocks/Text/Edit.test.jsx +7 -1
  169. package/src/components/manage/Blocks/Text/View.jsx +2 -2
  170. package/src/components/manage/Blocks/Title/Edit.jsx +25 -13
  171. package/src/components/manage/Blocks/Title/Edit.test.jsx +6 -0
  172. package/src/components/manage/Contents/ContentsIndexHeader.test.jsx +2 -1
  173. package/src/components/manage/Contents/ContentsUploadModal.jsx +3 -1
  174. package/src/components/manage/Multilingual/CreateTranslation.jsx +1 -1
  175. package/src/components/manage/Multilingual/TranslationObject.jsx +1 -1
  176. package/src/components/manage/Pluggable/index.js +1 -1
  177. package/src/components/manage/Preferences/PersonalPreferences.jsx +1 -1
  178. package/src/components/manage/Sidebar/Sidebar.jsx +5 -1
  179. package/src/components/manage/Toolbar/Toolbar.jsx +3 -1
  180. package/src/components/manage/UniversalLink/UniversalLink.jsx +5 -2
  181. package/src/components/manage/Widgets/DatetimeWidget.jsx +3 -1
  182. package/src/components/manage/Widgets/IdWidget.jsx +234 -0
  183. package/src/components/manage/Widgets/IdWidget.stories.jsx +21 -0
  184. package/src/components/manage/Widgets/IdWidget.test.jsx +135 -0
  185. package/src/components/manage/Widgets/SelectAutoComplete.jsx +2 -2
  186. package/src/components/manage/Widgets/UrlWidget.jsx +1 -1
  187. package/src/components/manage/Widgets/WysiwygWidget.jsx +45 -19
  188. package/src/components/manage/Widgets/WysiwygWidget.test.jsx +7 -1
  189. package/src/components/theme/ContactForm/ContactForm.jsx +1 -1
  190. package/src/components/theme/EventDetails/EventDetails.jsx +140 -0
  191. package/src/components/theme/EventDetails/EventDetails.test.jsx +87 -0
  192. package/src/components/theme/LanguageSelector/LanguageSelector.js +2 -18
  193. package/src/components/theme/Login/Login.jsx +3 -1
  194. package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +10 -31
  195. package/src/components/theme/View/EventView.jsx +62 -140
  196. package/src/components/theme/View/LinkView.jsx +3 -3
  197. package/src/components/theme/View/NewsItemView.jsx +44 -35
  198. package/src/components/theme/View/View.jsx +5 -1
  199. package/src/config/Blocks.jsx +31 -0
  200. package/src/config/Loadables.jsx +22 -0
  201. package/src/config/RichTextEditor/Blocks.jsx +25 -20
  202. package/src/config/RichTextEditor/Plugins.jsx +38 -31
  203. package/src/config/RichTextEditor/Styles.jsx +48 -44
  204. package/src/config/RichTextEditor/index.js +25 -0
  205. package/src/config/Widgets.jsx +2 -0
  206. package/src/config/index.js +15 -18
  207. package/src/helpers/Api/Api.js +20 -4
  208. package/src/helpers/Extensions/index.js +1 -1
  209. package/src/helpers/Extensions/withBlockExtensions.js +4 -0
  210. package/src/helpers/Extensions/withBlockExtensions.test.js +26 -1
  211. package/src/helpers/Url/Url.js +41 -1
  212. package/src/helpers/Url/Url.test.js +7 -0
  213. package/src/helpers/Url/urlRegex.js +7 -1
  214. package/src/helpers/index.js +3 -0
  215. package/src/middleware/api.js +35 -3
  216. package/src/server.jsx +20 -6
  217. package/src/start-client.jsx +2 -2
  218. package/src/store.js +1 -1
  219. package/test-setup-config.js +22 -7
  220. package/theme/themes/pastanaga/extras/blocks.less +29 -0
  221. package/theme/themes/pastanaga/extras/contents.less +6 -0
  222. package/{webpack-bundle-analyze-plugin.js → webpack-plugins/webpack-bundle-analyze-plugin.js} +0 -0
  223. package/{webpack-less-plugin.js → webpack-plugins/webpack-less-plugin.js} +0 -0
  224. package/{webpack-relative-resolver.js → webpack-plugins/webpack-relative-resolver.js} +0 -0
  225. package/{webpack-root-resolver.js → webpack-plugins/webpack-root-resolver.js} +0 -0
  226. package/{webpack-sentry-plugin.js → webpack-plugins/webpack-sentry-plugin.js} +0 -0
  227. package/{webpack-svg-plugin.js → webpack-plugins/webpack-svg-plugin.js} +0 -0
  228. package/.surgeignore +0 -2
  229. package/Dockerfile.slim +0 -27
  230. package/patches/fixprettier.patch +0 -11
  231. package/patches/fixstylelint.patch +0 -11
  232. package/src/components/manage/AnchorPlugin/utils/URLUtils.js +0 -36
  233. package/src/components/manage/AnchorPlugin/utils/mailRegex.js +0 -2
  234. package/src/components/manage/AnchorPlugin/utils/telRegex.js +0 -1
  235. package/src/components/manage/AnchorPlugin/utils/urlRegex.js +0 -54
  236. package/styleguide.config.js +0 -42
@@ -5,62 +5,13 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import { defineMessages, injectIntl } from 'react-intl';
9
- import { flattenHTMLToAppURL } from '@plone/volto/helpers';
10
- import { Container, Image, Segment, Header, List } from 'semantic-ui-react';
8
+ import { hasBlocksData, flattenHTMLToAppURL } from '@plone/volto/helpers';
9
+ import { Image, Grid } from 'semantic-ui-react';
10
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
11
+ import { EventDetails } from '@plone/volto/components';
11
12
 
12
- import {
13
- When,
14
- Recurrence,
15
- } from '@plone/volto/components/theme/View/EventDatesInfo';
16
-
17
- const messages = defineMessages({
18
- what: {
19
- id: 'event_what',
20
- defaultMessage: 'What',
21
- },
22
- when: {
23
- id: 'event_when',
24
- defaultMessage: 'When',
25
- },
26
- allDates: {
27
- id: 'event_alldates',
28
- defaultMessage: 'All dates',
29
- },
30
- where: {
31
- id: 'event_where',
32
- defaultMessage: 'Where',
33
- },
34
- contactName: {
35
- id: 'event_contactname',
36
- defaultMessage: 'Contact Name',
37
- },
38
- contactPhone: {
39
- id: 'event_contactphone',
40
- defaultMessage: 'Contact Phone',
41
- },
42
- attendees: {
43
- id: 'event_attendees',
44
- defaultMessage: 'Attendees',
45
- },
46
- website: {
47
- id: 'event_website',
48
- defaultMessage: 'Website',
49
- },
50
- visitWebsite: {
51
- id: 'visit_external_website',
52
- defaultMessage: 'Visit external website',
53
- },
54
- });
55
-
56
- /**
57
- * EventView view component class.
58
- * @function EventView
59
- * @params {object} content Content object.
60
- * @returns {string} Markup of the component.
61
- */
62
- const EventView = ({ intl, content }) => (
63
- <Container className="view-wrapper event-view">
13
+ const EventTextfieldView = ({ content }) => (
14
+ <React.Fragment>
64
15
  {content.title && <h1 className="documentFirstHeading">{content.title}</h1>}
65
16
  {content.description && (
66
17
  <p className="documentDescription">{content.description}</p>
@@ -72,89 +23,6 @@ const EventView = ({ intl, content }) => (
72
23
  floated="right"
73
24
  />
74
25
  )}
75
- <Segment floated="right">
76
- {content.subjects.length > 0 && (
77
- <>
78
- <Header dividing sub>
79
- {intl.formatMessage(messages.what)}
80
- </Header>
81
- <List items={content.subjects} />
82
- </>
83
- )}
84
- <Header dividing sub>
85
- {intl.formatMessage(messages.when)}
86
- </Header>
87
- <When
88
- start={content.start}
89
- end={content.end}
90
- whole_day={content.whole_day}
91
- open_end={content.open_end}
92
- />
93
- {content.recurrence && (
94
- <>
95
- <Header dividing sub>
96
- {intl.formatMessage(messages.allDates)}
97
- </Header>
98
- <Recurrence recurrence={content.recurrence} start={content.start} />
99
- </>
100
- )}
101
- {content.location && (
102
- <>
103
- <Header dividing sub>
104
- {intl.formatMessage(messages.where)}
105
- </Header>
106
- <p>{content.location}</p>
107
- </>
108
- )}
109
- {content.contact_name && (
110
- <>
111
- <Header dividing sub>
112
- {intl.formatMessage(messages.contactName)}
113
- </Header>
114
- <p>
115
- {content.contact_email ? (
116
- <a href={`mailto:${content.contact_email}`}>
117
- {content.contact_name}
118
- </a>
119
- ) : (
120
- content.contact_name
121
- )}
122
- </p>
123
- </>
124
- )}
125
- {content.contact_phone && (
126
- <>
127
- <Header dividing sub>
128
- {intl.formatMessage(messages.contactPhone)}
129
- </Header>
130
- <p>{content.contact_phone}</p>
131
- </>
132
- )}
133
- {content.attendees.length > 0 && (
134
- <>
135
- <Header dividing sub>
136
- {intl.formatMessage(messages.attendees)}
137
- </Header>
138
- <List items={content.attendees} />
139
- </>
140
- )}
141
- {content.event_url && (
142
- <>
143
- <Header dividing sub>
144
- {intl.formatMessage(messages.website)}
145
- </Header>
146
- <p>
147
- <a
148
- href={content.event_url}
149
- target="_blank"
150
- rel="noopener noreferrer"
151
- >
152
- {intl.formatMessage(messages.visitWebsite)}
153
- </a>
154
- </p>
155
- </>
156
- )}
157
- </Segment>
158
26
  {content.text && (
159
27
  <div
160
28
  dangerouslySetInnerHTML={{
@@ -162,9 +30,63 @@ const EventView = ({ intl, content }) => (
162
30
  }}
163
31
  />
164
32
  )}
165
- </Container>
33
+ </React.Fragment>
166
34
  );
167
35
 
36
+ /**
37
+ * EventView view component class.
38
+ * @function EventView
39
+ * @params {object} content Content object.
40
+ * @returns {string} Markup of the component.
41
+ */
42
+ const EventView = (props) => {
43
+ const { content } = props;
44
+
45
+ return (
46
+ <div id="page-document" className="ui container viewwrapper event-view">
47
+ <Grid>
48
+ <Grid.Column width={7} className="mobile hidden">
49
+ {hasBlocksData(content) ? (
50
+ <RenderBlocks {...props} />
51
+ ) : (
52
+ <EventTextfieldView {...props} />
53
+ )}
54
+ </Grid.Column>
55
+ <Grid.Column width={5} className="mobile hidden">
56
+ <EventDetails content={content} />
57
+ </Grid.Column>
58
+ <Grid.Column width={12} only="mobile">
59
+ {hasBlocksData(content) ? (
60
+ <>
61
+ <RenderBlocks
62
+ {...props}
63
+ content={{
64
+ ...content,
65
+ blocks_layout: {
66
+ items: props.content.blocks_layout.items.slice(0, 1),
67
+ },
68
+ }}
69
+ />
70
+ <EventDetails content={content} display_as="div" />
71
+ <RenderBlocks
72
+ {...props}
73
+ content={{
74
+ ...content,
75
+ blocks_layout: {
76
+ items: props.content.blocks_layout.items.slice(1),
77
+ },
78
+ }}
79
+ />
80
+ </>
81
+ ) : (
82
+ <EventTextfieldView {...props} />
83
+ )}
84
+ </Grid.Column>
85
+ </Grid>
86
+ </div>
87
+ );
88
+ };
89
+
168
90
  /**
169
91
  * Property types.
170
92
  * @property {Object} propTypes Property types.
@@ -192,4 +114,4 @@ EventView.propTypes = {
192
114
  }).isRequired,
193
115
  };
194
116
 
195
- export default injectIntl(EventView);
117
+ export default EventView;
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
9
9
  import { Link } from 'react-router-dom';
10
10
  import { Container } from 'semantic-ui-react';
11
- import URLUtils from '@plone/volto/components/manage/AnchorPlugin/utils/URLUtils';
11
+ import { URLUtils } from '@plone/volto/helpers';
12
12
  import { FormattedMessage } from 'react-intl';
13
13
 
14
14
  /**
@@ -68,7 +68,7 @@ class LinkView extends Component {
68
68
  </p>
69
69
  )}
70
70
  {remoteUrl && (
71
- <span>
71
+ <p>
72
72
  <FormattedMessage
73
73
  id="The link address is:"
74
74
  defaultMessage="The link address is:"
@@ -108,7 +108,7 @@ class LinkView extends Component {
108
108
  )}
109
109
  </>
110
110
  )}
111
- </span>
111
+ </p>
112
112
  )}
113
113
  </Container>
114
114
  );
@@ -6,8 +6,12 @@
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { Container, Image } from 'semantic-ui-react';
9
-
10
- import { flattenToAppURL, flattenHTMLToAppURL } from '@plone/volto/helpers';
9
+ import {
10
+ hasBlocksData,
11
+ flattenToAppURL,
12
+ flattenHTMLToAppURL,
13
+ } from '@plone/volto/helpers';
14
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
11
15
 
12
16
  /**
13
17
  * NewsItemView view component class.
@@ -15,39 +19,44 @@ import { flattenToAppURL, flattenHTMLToAppURL } from '@plone/volto/helpers';
15
19
  * @params {object} content Content object.
16
20
  * @returns {string} Markup of the component.
17
21
  */
18
- const NewsItemView = ({ content }) => (
19
- <Container className="view-wrapper">
20
- {content.title && (
21
- <h1 className="documentFirstHeading">
22
- {content.title}
23
- {content.subtitle && ` - ${content.subtitle}`}
24
- </h1>
25
- )}
26
- {content.description && (
27
- <p className="documentDescription">{content.description}</p>
28
- )}
29
- {content.image && (
30
- <Image
31
- className="documentImage"
32
- alt={content.title}
33
- title={content.title}
34
- src={
35
- content.image['content-type'] === 'image/svg+xml'
36
- ? flattenToAppURL(content.image.download)
37
- : flattenToAppURL(content.image.scales.mini.download)
38
- }
39
- floated="right"
40
- />
41
- )}
42
- {content.text && (
43
- <div
44
- dangerouslySetInnerHTML={{
45
- __html: flattenHTMLToAppURL(content.text.data),
46
- }}
47
- />
48
- )}
49
- </Container>
50
- );
22
+ const NewsItemView = ({ content }) =>
23
+ hasBlocksData(content) ? (
24
+ <div id="page-document" className="ui container viewwrapper event-view">
25
+ <RenderBlocks content={content} />
26
+ </div>
27
+ ) : (
28
+ <Container className="view-wrapper">
29
+ {content.title && (
30
+ <h1 className="documentFirstHeading">
31
+ {content.title}
32
+ {content.subtitle && ` - ${content.subtitle}`}
33
+ </h1>
34
+ )}
35
+ {content.description && (
36
+ <p className="documentDescription">{content.description}</p>
37
+ )}
38
+ {content.image && (
39
+ <Image
40
+ className="documentImage"
41
+ alt={content.title}
42
+ title={content.title}
43
+ src={
44
+ content.image['content-type'] === 'image/svg+xml'
45
+ ? flattenToAppURL(content.image.download)
46
+ : flattenToAppURL(content.image.scales.mini.download)
47
+ }
48
+ floated="right"
49
+ />
50
+ )}
51
+ {content.text && (
52
+ <div
53
+ dangerouslySetInnerHTML={{
54
+ __html: flattenHTMLToAppURL(content.text.data),
55
+ }}
56
+ />
57
+ )}
58
+ </Container>
59
+ );
51
60
 
52
61
  /**
53
62
  * Property types.
@@ -7,6 +7,7 @@ import React, { Component } from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { connect } from 'react-redux';
9
9
  import { compose } from 'redux';
10
+ import { Redirect } from 'react-router-dom';
10
11
  import { Portal } from 'react-portal';
11
12
  import { injectIntl } from 'react-intl';
12
13
  import qs from 'query-string';
@@ -21,6 +22,7 @@ import { listActions, getContent } from '@plone/volto/actions';
21
22
  import {
22
23
  BodyClass,
23
24
  getBaseUrl,
25
+ flattenToAppURL,
24
26
  getLayoutFieldname,
25
27
  } from '@plone/volto/helpers';
26
28
 
@@ -194,7 +196,9 @@ class View extends Component {
194
196
  */
195
197
  render() {
196
198
  const { views } = config;
197
- if (this.props.error && !this.props.connectionRefused) {
199
+ if (this.props.error && this.props.error.code === 301) {
200
+ return <Redirect to={flattenToAppURL(this.props.error.url)} />;
201
+ } else if (this.props.error && !this.props.connectionRefused) {
198
202
  let FoundView;
199
203
  if (this.props.error.status === undefined) {
200
204
  // For some reason, while development and if CORS is in place and the
@@ -56,6 +56,11 @@ import TopSideFacets from '@plone/volto/components/manage/Blocks/Search/layout/T
56
56
  import {
57
57
  SelectFacet,
58
58
  CheckboxFacet,
59
+ DateRangeFacet,
60
+ ToggleFacet,
61
+ ToggleFacetFilterListEntry,
62
+ SelectFacetFilterListEntry,
63
+ DateRangeFacetFilterListEntry,
59
64
  } from '@plone/volto/components/manage/Blocks/Search/components';
60
65
  import getListingBlockAsyncData from '@plone/volto/components/manage/Blocks/Listing/getAsyncData';
61
66
 
@@ -438,12 +443,38 @@ const blocksConfig = {
438
443
  title: 'Select',
439
444
  view: SelectFacet,
440
445
  isDefault: true,
446
+ schemaEnhancer: SelectFacet.schemaEnhancer,
447
+ stateToValue: SelectFacet.stateToValue,
448
+ valueToQuery: SelectFacet.valueToQuery,
449
+ filterListComponent: SelectFacetFilterListEntry,
441
450
  },
442
451
  {
443
452
  id: 'checkboxFacet',
444
453
  title: 'Checkbox',
445
454
  view: CheckboxFacet,
446
455
  isDefault: false,
456
+ schemaEnhancer: CheckboxFacet.schemaEnhancer,
457
+ stateToValue: CheckboxFacet.stateToValue,
458
+ valueToQuery: CheckboxFacet.valueToQuery,
459
+ filterListComponent: SelectFacetFilterListEntry,
460
+ },
461
+ {
462
+ id: 'daterangeFacet',
463
+ title: 'Date range',
464
+ view: DateRangeFacet,
465
+ isDefault: false,
466
+ stateToValue: DateRangeFacet.stateToValue,
467
+ valueToQuery: DateRangeFacet.valueToQuery,
468
+ filterListComponent: DateRangeFacetFilterListEntry,
469
+ },
470
+ {
471
+ id: 'toggleFacet',
472
+ title: 'Toggle',
473
+ view: ToggleFacet,
474
+ isDefault: false,
475
+ stateToValue: ToggleFacet.stateToValue,
476
+ valueToQuery: ToggleFacet.valueToQuery,
477
+ filterListComponent: ToggleFacetFilterListEntry,
447
478
  },
448
479
  ],
449
480
  },
@@ -32,4 +32,26 @@ export const loadables = {
32
32
  reactDnd: loadable.lib(() => import('react-dnd')),
33
33
  reactDndHtml5Backend: loadable.lib(() => import('react-dnd-html5-backend')),
34
34
  reactBeautifulDnd: loadable.lib(() => import('react-beautiful-dnd')),
35
+
36
+ // draftjs libs
37
+ immutableLib: loadable.lib(() => import('immutable')),
38
+ draftJs: loadable.lib(() => import('draft-js')),
39
+ draftJsLibIsSoftNewlineEvent: loadable.lib(() =>
40
+ import('draft-js/lib/isSoftNewlineEvent'),
41
+ ),
42
+ draftJsFilters: loadable.lib(() => import('draftjs-filters')),
43
+ draftJsInlineToolbarPlugin: loadable.lib(() =>
44
+ import('draft-js-inline-toolbar-plugin'),
45
+ ),
46
+ draftJsImportHtml: loadable.lib(() => import('draft-js-import-html')),
47
+ draftJsBlockBreakoutPlugin: loadable.lib(() =>
48
+ import('draft-js-block-breakout-plugin'),
49
+ ),
50
+ draftJsCreateInlineStyleButton: loadable.lib(() =>
51
+ import('draft-js-buttons/lib/utils/createInlineStyleButton'),
52
+ ),
53
+ draftJsCreateBlockStyleButton: loadable.lib(() =>
54
+ import('draft-js-buttons/lib/utils/createBlockStyleButton'),
55
+ ),
56
+ draftJsPluginsUtils: loadable.lib(() => import('draft-js-plugins-utils')),
35
57
  };
@@ -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;