@plone/volto 15.11.2 → 15.12.2

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 (86) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/assets.json +1 -1
  3. package/dist/chunks.json +44 -44
  4. package/dist/loadable-stats.json +90 -90
  5. package/dist/public/static/css/{client.4276094c.chunk.css → client.9942f128.chunk.css} +1 -1
  6. package/dist/public/static/css/{plone-volto-components-manage-Widgets-DatetimeWidget.b91b7bf1.chunk.css → plone-volto-components-manage-Widgets-DatetimeWidget.b8ddbbab.chunk.css} +1 -1
  7. package/dist/public/static/js/21.04729ca9.chunk.js +2 -0
  8. package/dist/public/static/js/22.a6848d06.chunk.js +2 -0
  9. package/dist/public/static/js/23.04473925.chunk.js +2 -0
  10. package/dist/public/static/js/24.c137b820.chunk.js +2 -0
  11. package/dist/public/static/js/25.81267da9.chunk.js +2 -0
  12. package/dist/public/static/js/26.7570fb21.chunk.js +2 -0
  13. package/dist/public/static/js/27.3d3e804c.chunk.js +2 -0
  14. package/dist/public/static/js/28.43bd3576.chunk.js +2 -0
  15. package/dist/public/static/js/29.a5bf09d3.chunk.js +2 -0
  16. package/dist/public/static/js/30.d1fb3bf5.chunk.js +2 -0
  17. package/dist/public/static/js/31.bd5283de.chunk.js +2 -0
  18. package/dist/public/static/js/32.6ff7dbdc.chunk.js +2 -0
  19. package/dist/public/static/js/client.9942f128.chunk.js +2 -0
  20. package/dist/public/static/js/plone-volto-components-manage-Widgets-DatetimeWidget.b8ddbbab.chunk.js +2 -0
  21. package/dist/public/static/js/react-select.32a96e2d.chunk.js +2 -0
  22. package/dist/public/static/js/runtime~client.084b02ee.js +2 -0
  23. package/dist/server.js +1 -1
  24. package/locales/ca/LC_MESSAGES/volto.po +17 -0
  25. package/locales/ca.json +1 -1
  26. package/locales/de/LC_MESSAGES/volto.po +17 -0
  27. package/locales/de.json +1 -1
  28. package/locales/en/LC_MESSAGES/volto.po +17 -0
  29. package/locales/en.json +1 -1
  30. package/locales/es/LC_MESSAGES/volto.po +17 -0
  31. package/locales/es.json +1 -1
  32. package/locales/eu/LC_MESSAGES/volto.po +17 -0
  33. package/locales/eu.json +1 -1
  34. package/locales/fr/LC_MESSAGES/volto.po +17 -0
  35. package/locales/fr.json +1 -1
  36. package/locales/it/LC_MESSAGES/volto.po +18 -1
  37. package/locales/it.json +1 -1
  38. package/locales/ja/LC_MESSAGES/volto.po +17 -0
  39. package/locales/ja.json +1 -1
  40. package/locales/nl/LC_MESSAGES/volto.po +17 -0
  41. package/locales/nl.json +1 -1
  42. package/locales/pt/LC_MESSAGES/volto.po +17 -0
  43. package/locales/pt.json +1 -1
  44. package/locales/pt_BR/LC_MESSAGES/volto.po +17 -0
  45. package/locales/pt_BR.json +1 -1
  46. package/locales/ro/LC_MESSAGES/volto.po +17 -0
  47. package/locales/ro.json +1 -1
  48. package/locales/volto.pot +18 -1
  49. package/package.json +1 -1
  50. package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +12 -0
  51. package/src/components/manage/Blocks/Search/components/DateRangeFacet.jsx +6 -2
  52. package/src/components/manage/Toolbar/More.jsx +77 -1
  53. package/src/components/manage/UniversalLink/UniversalLink.jsx +7 -0
  54. package/src/components/manage/Widgets/ArrayWidget.jsx +5 -3
  55. package/src/components/manage/Widgets/DatetimeWidget.jsx +17 -6
  56. package/src/components/manage/Widgets/QueryWidget.jsx +13 -4
  57. package/src/components/manage/Widgets/RecurrenceWidget/ByDayField.jsx +3 -3
  58. package/src/components/manage/Widgets/RecurrenceWidget/MonthOfTheYearField.jsx +3 -3
  59. package/src/components/manage/Widgets/RecurrenceWidget/Occurences.jsx +3 -1
  60. package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +6 -2
  61. package/src/components/manage/Widgets/RecurrenceWidget/Utils.js +2 -2
  62. package/src/components/manage/Widgets/RecurrenceWidget/WeekdayOfTheMonthField.jsx +3 -3
  63. package/src/components/manage/Widgets/SelectAutoComplete.jsx +7 -6
  64. package/src/components/manage/Widgets/SelectStyling.jsx +2 -0
  65. package/src/components/manage/Widgets/SelectWidget.jsx +6 -3
  66. package/src/components/manage/Widgets/TokenWidget.jsx +22 -3
  67. package/src/components/theme/View/EventDatesInfo.jsx +3 -3
  68. package/src/config/index.js +1 -0
  69. package/test-setup-config.js +2 -1
  70. package/dist/public/static/js/21.01b5f37b.chunk.js +0 -2
  71. package/dist/public/static/js/22.a94b1e88.chunk.js +0 -2
  72. package/dist/public/static/js/23.174cb9eb.chunk.js +0 -2
  73. package/dist/public/static/js/24.59b8b6f3.chunk.js +0 -2
  74. package/dist/public/static/js/25.dde0dc57.chunk.js +0 -2
  75. package/dist/public/static/js/26.efdc324c.chunk.js +0 -2
  76. package/dist/public/static/js/27.4e1e4efe.chunk.js +0 -2
  77. package/dist/public/static/js/28.f75211b4.chunk.js +0 -2
  78. package/dist/public/static/js/29.166cae59.chunk.js +0 -2
  79. package/dist/public/static/js/30.50c41d5c.chunk.js +0 -2
  80. package/dist/public/static/js/31.451a371f.chunk.js +0 -2
  81. package/dist/public/static/js/32.36023657.chunk.js +0 -2
  82. package/dist/public/static/js/client.4276094c.chunk.js +0 -2
  83. package/dist/public/static/js/plone-volto-components-manage-Widgets-DatetimeWidget.b91b7bf1.chunk.js +0 -2
  84. package/dist/public/static/js/react-select.43b5407c.chunk.js +0 -2
  85. package/dist/public/static/js/runtime~client.f90e8aab.js +0 -2
  86. package/src/components/manage/Widgets/AttachImage.jsx +0 -186
@@ -45,6 +45,10 @@ const messages = defineMessages({
45
45
  id: 'Manage Translations',
46
46
  defaultMessage: 'Manage Translations',
47
47
  },
48
+ manageContent: {
49
+ id: 'Manage content…',
50
+ defaultMessage: 'Manage content…',
51
+ },
48
52
  CreateWorkingCopy: {
49
53
  id: 'Create working copy',
50
54
  defaultMessage: 'Create working copy',
@@ -75,6 +79,22 @@ const messages = defineMessages({
75
79
  id: 'The working copy was discarded',
76
80
  defaultMessage: 'The working copy was discarded',
77
81
  },
82
+ Unauthorized: {
83
+ id: 'Unauthorized',
84
+ defaultMessage: 'Unauthorized',
85
+ },
86
+ workingCopyErrorUnauthorized: {
87
+ id: 'workingCopyErrorUnauthorized',
88
+ defaultMessage: 'You are not authorized to perform this operation.',
89
+ },
90
+ Error: {
91
+ id: 'Error',
92
+ defaultMessage: 'Error',
93
+ },
94
+ workingCopyGenericError: {
95
+ id: 'workingCopyGenericError',
96
+ defaultMessage: 'An error occurred while performing this operation.',
97
+ },
78
98
  });
79
99
 
80
100
  /**
@@ -122,6 +142,59 @@ class More extends Component {
122
142
  document.removeEventListener('mousedown', this.handleClickOutside, false);
123
143
  };
124
144
 
145
+ componentDidUpdate(prevProps, prevState) {
146
+ let erroredAction = '';
147
+ if (
148
+ prevProps.workingCopy.apply.loading &&
149
+ this.props.workingCopy.apply.error
150
+ ) {
151
+ erroredAction = 'apply';
152
+ } else if (
153
+ prevProps.workingCopy.create.loading &&
154
+ this.props.workingCopy.create.error
155
+ ) {
156
+ erroredAction = 'create';
157
+ } else if (
158
+ prevProps.workingCopy.remove.loading &&
159
+ this.props.workingCopy.remove.error
160
+ ) {
161
+ erroredAction = 'remove';
162
+ }
163
+
164
+ if (erroredAction) {
165
+ const errorStatus = this.props.workingCopy[erroredAction].error.status;
166
+ if (errorStatus === 401 || errorStatus === 403) {
167
+ toast.error(
168
+ <Toast
169
+ error
170
+ title={this.props.intl.formatMessage(messages.Unauthorized)}
171
+ content={this.props.intl.formatMessage(
172
+ messages.workingCopyErrorUnauthorized,
173
+ )}
174
+ />,
175
+ {
176
+ toastId: 'workingCopyErrorUnauthorized',
177
+ autoClose: 10000,
178
+ },
179
+ );
180
+ } else {
181
+ toast.error(
182
+ <Toast
183
+ error
184
+ title={this.props.intl.formatMessage(messages.Error)}
185
+ content={this.props.intl.formatMessage(
186
+ messages.workingCopyGenericError,
187
+ )}
188
+ />,
189
+ {
190
+ toastId: 'workingCopyGenericError',
191
+ autoClose: 10000,
192
+ },
193
+ );
194
+ }
195
+ }
196
+ }
197
+
125
198
  /**
126
199
  * Render method.
127
200
  * @method render
@@ -221,7 +294,9 @@ class More extends Component {
221
294
  {pluggables.length > 0 && (
222
295
  <>
223
296
  <header>
224
- <h2>Manage content...</h2>
297
+ <h2>
298
+ {this.props.intl.formatMessage(messages.manageContent)}
299
+ </h2>
225
300
  </header>
226
301
  <div className="pastanaga-menu-list">
227
302
  <ul>
@@ -416,6 +491,7 @@ export default compose(
416
491
  pathname: props.pathname,
417
492
  content: state.content.data,
418
493
  lang: state.intl.locale,
494
+ workingCopy: state.workingCopy,
419
495
  }),
420
496
  { applyWorkingCopy, createWorkingCopy, removeWorkingCopy },
421
497
  ),
@@ -56,6 +56,13 @@ const UniversalLink = ({
56
56
  ) {
57
57
  url = `${url}/@@download/file`;
58
58
  }
59
+
60
+ if (
61
+ !token &&
62
+ config.settings.viewableInBrowserObjects.includes(item['@type'])
63
+ ) {
64
+ url = `${url}/@@display-file/file`;
65
+ }
59
66
  }
60
67
  }
61
68
 
@@ -222,7 +222,7 @@ class ArrayWidget extends Component {
222
222
  this.props.getVocabulary({
223
223
  vocabNameOrURL: this.props.vocabBaseUrl,
224
224
  size: -1,
225
- subrequest: this.props.intl.locale,
225
+ subrequest: this.props.lang,
226
226
  });
227
227
  }
228
228
  }
@@ -371,21 +371,23 @@ export default compose(
371
371
  getVocabFromItems(props);
372
372
 
373
373
  const vocabState =
374
- state.vocabularies?.[vocabBaseUrl]?.subrequests?.[props.intl.locale];
374
+ state.vocabularies?.[vocabBaseUrl]?.subrequests?.[state.intl.locale];
375
375
 
376
376
  // If the schema already has the choices in it, then do not try to get the vocab,
377
377
  // even if there is one
378
378
  if (props.items?.choices) {
379
379
  return {
380
380
  choices: props.items.choices,
381
+ lang: state.intl.locale,
381
382
  };
382
383
  } else if (vocabState) {
383
384
  return {
384
385
  choices: vocabState.items,
385
386
  vocabBaseUrl,
387
+ lang: state.intl.locale,
386
388
  };
387
389
  }
388
- return { vocabBaseUrl };
390
+ return { vocabBaseUrl, lang: state.intl.locale };
389
391
  },
390
392
  { getVocabulary },
391
393
  ),
@@ -6,6 +6,7 @@ import React, { Component } from 'react';
6
6
  import { compose } from 'redux';
7
7
  import PropTypes from 'prop-types';
8
8
  import { defineMessages, injectIntl } from 'react-intl';
9
+ import { connect } from 'react-redux';
9
10
  import loadable from '@loadable/component';
10
11
  import cx from 'classnames';
11
12
  import { Icon, FormFieldWrapper } from '@plone/volto/components';
@@ -100,7 +101,7 @@ export class DatetimeWidgetComponent extends Component {
100
101
  // if passed value matches the construction time, we guess it's a default
101
102
  isDefault:
102
103
  parseDateTime(
103
- this.props.intl.locale,
104
+ this.props.lang,
104
105
  this.props.value,
105
106
  undefined,
106
107
  this.moment,
@@ -110,7 +111,7 @@ export class DatetimeWidgetComponent extends Component {
110
111
 
111
112
  getInternalValue() {
112
113
  return parseDateTime(
113
- this.props.intl.locale,
114
+ this.props.lang,
114
115
  this.props.value,
115
116
  undefined,
116
117
  this.moment,
@@ -178,7 +179,14 @@ export class DatetimeWidgetComponent extends Component {
178
179
  onFocusChange = ({ focused }) => this.setState({ focused });
179
180
 
180
181
  render() {
181
- const { id, resettable, intl, reactDates, widgetOptions } = this.props;
182
+ const {
183
+ id,
184
+ resettable,
185
+ intl,
186
+ reactDates,
187
+ widgetOptions,
188
+ lang,
189
+ } = this.props;
182
190
  const noPastDates =
183
191
  this.props.noPastDates || widgetOptions?.pattern_options?.noPastDates;
184
192
  const moment = this.props.moment.default;
@@ -203,7 +211,7 @@ export class DatetimeWidgetComponent extends Component {
203
211
  {...(noPastDates ? {} : { isOutsideRange: () => false })}
204
212
  onFocusChange={this.onFocusChange}
205
213
  noBorder
206
- displayFormat={moment.localeData(intl.locale).longDateFormat('L')}
214
+ displayFormat={moment.localeData(lang).longDateFormat('L')}
207
215
  navPrev={<PrevIcon />}
208
216
  navNext={<NextIcon />}
209
217
  id={`${id}-date`}
@@ -223,9 +231,9 @@ export class DatetimeWidgetComponent extends Component {
223
231
  onChange={this.onTimeChange}
224
232
  allowEmpty={false}
225
233
  showSecond={false}
226
- use12Hours={intl.locale === 'en'}
234
+ use12Hours={lang === 'en'}
227
235
  id={`${id}-time`}
228
- format={moment.localeData(intl.locale).longDateFormat('LT')}
236
+ format={moment.localeData(lang).longDateFormat('LT')}
229
237
  placeholder={intl.formatMessage(messages.time)}
230
238
  focusOnOpen
231
239
  placement="bottomRight"
@@ -283,5 +291,8 @@ DatetimeWidgetComponent.defaultProps = {
283
291
 
284
292
  export default compose(
285
293
  injectLazyLibs(['reactDates', 'moment']),
294
+ connect((state) => ({
295
+ lang: state.intl.locale,
296
+ })),
286
297
  injectIntl,
287
298
  )(DatetimeWidgetComponent);
@@ -295,10 +295,16 @@ export class QuerystringWidgetComponent extends Component {
295
295
  ),
296
296
  (group) => ({
297
297
  label: group[0],
298
- options: map(group[1], (field) => ({
299
- label: field[1].title,
300
- value: field[0],
301
- })),
298
+ options: map(
299
+ filter(group[1], (item) => item[1].enabled),
300
+ (field) => ({
301
+ label: field[1].title,
302
+ value: field[0],
303
+ isDisabled: (value || []).some(
304
+ (v) => v['i'] === field[0],
305
+ ),
306
+ }),
307
+ ),
302
308
  }),
303
309
  )}
304
310
  styles={customSelectStyles}
@@ -425,6 +431,9 @@ export class QuerystringWidgetComponent extends Component {
425
431
  (field) => ({
426
432
  label: field[1].title,
427
433
  value: field[0],
434
+ isDisabled: (value || []).some(
435
+ (v) => v['i'] === field[0],
436
+ ),
428
437
  }),
429
438
  ),
430
439
  }),
@@ -7,8 +7,8 @@ import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { Form, Grid, Button } from 'semantic-ui-react';
9
9
  import { Days } from './Utils';
10
- import { useIntl } from 'react-intl';
11
10
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
11
+ import { useSelector } from 'react-redux';
12
12
 
13
13
  /**
14
14
  * ByDayField component class.
@@ -16,9 +16,9 @@ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
16
16
  * @returns {string} Markup of the component.
17
17
  */
18
18
  const ByDayField = ({ label, value, onChange, moment: momentlib }) => {
19
- const intl = useIntl();
19
+ const lang = useSelector((state) => state.intl.locale);
20
20
  const moment = momentlib.default;
21
- moment.locale(intl.locale);
21
+ moment.locale(lang);
22
22
 
23
23
  const toggleWeekDay = (dayName) => {
24
24
  var day = Days[dayName];
@@ -6,10 +6,10 @@
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { map } from 'lodash';
9
- import { useIntl } from 'react-intl';
10
9
  import { Form } from 'semantic-ui-react';
11
10
  import SelectInput from './SelectInput';
12
11
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
12
+ import { useSelector } from 'react-redux';
13
13
 
14
14
  /**
15
15
  * MonthOfTheYearField component class.
@@ -24,8 +24,8 @@ const MonthOfTheYearField = ({
24
24
  moment: momentlib,
25
25
  }) => {
26
26
  const moment = momentlib.default;
27
- const intl = useIntl();
28
- moment.locale(intl.locale);
27
+ const lang = useSelector((state) => state.intl.locale);
28
+ moment.locale(lang);
29
29
  const monthList = [
30
30
  ...map(moment.months(), (m, i) => ({
31
31
  value: i + 1,
@@ -13,6 +13,7 @@ import addSVG from '@plone/volto/icons/circle-plus.svg';
13
13
  import trashSVG from '@plone/volto/icons/delete.svg';
14
14
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
15
15
 
16
+ import { useSelector } from 'react-redux';
16
17
  import { toISOString } from './Utils';
17
18
 
18
19
  const messages = defineMessages({
@@ -66,7 +67,8 @@ const Occurences_ = ({
66
67
  moment: momentlib,
67
68
  }) => {
68
69
  const moment = momentlib.default;
69
- moment.locale(intl.locale);
70
+ const lang = useSelector((state) => state.intl.locale);
71
+ moment.locale(lang);
70
72
  let all = [];
71
73
  const isExcluded = (date) => {
72
74
  var dateISO = toISOString(date);
@@ -7,6 +7,7 @@ import React, { Component } from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { compose } from 'redux';
9
9
  import { RRule, RRuleSet, rrulestr } from 'rrule';
10
+ import { connect } from 'react-redux';
10
11
 
11
12
  import cx from 'classnames';
12
13
  import { isEqual, map, find, concat, remove } from 'lodash';
@@ -181,7 +182,7 @@ class RecurrenceWidget extends Component {
181
182
  super(props);
182
183
 
183
184
  this.moment = this.props.moment.default;
184
- this.moment.locale(this.props.intl.locale);
185
+ this.moment.locale(this.props.lang);
185
186
 
186
187
  let rruleSet = this.props.value
187
188
  ? rrulestr(props.value, {
@@ -199,7 +200,7 @@ class RecurrenceWidget extends Component {
199
200
  open: false,
200
201
  rruleSet: rruleSet,
201
202
  formValues: this.getFormValues(rruleSet),
202
- RRULE_LANGUAGE: rrulei18n(this.props.intl, this.moment),
203
+ RRULE_LANGUAGE: rrulei18n(this.props.intl, this.moment, this.props.lang),
203
204
  };
204
205
  }
205
206
 
@@ -964,5 +965,8 @@ class RecurrenceWidget extends Component {
964
965
 
965
966
  export default compose(
966
967
  injectLazyLibs(['moment']),
968
+ connect((state) => ({
969
+ lang: state.intl.locale,
970
+ })),
967
971
  injectIntl,
968
972
  )(RecurrenceWidget);
@@ -42,8 +42,8 @@ export const toISOString = (date) => {
42
42
  return date.toISOString().split('T')[0];
43
43
  };
44
44
 
45
- export const rrulei18n = (intl, moment) => {
46
- moment.locale(intl.locale);
45
+ export const rrulei18n = (intl, moment, lang) => {
46
+ moment.locale(lang);
47
47
 
48
48
  const messages = defineMessages({
49
49
  every: { id: 'rrule_every', defaultMessage: 'every' },
@@ -5,11 +5,11 @@
5
5
 
6
6
  import React from 'react';
7
7
  import { map } from 'lodash';
8
- import { useIntl } from 'react-intl';
9
8
  import { Days } from './Utils';
10
9
  import SelectInput from './SelectInput';
11
10
  import { Form } from 'semantic-ui-react';
12
11
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
12
+ import { useSelector } from 'react-redux';
13
13
 
14
14
  /**
15
15
  * WeekdayOfTheMonthField component class.
@@ -19,10 +19,10 @@ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
19
19
 
20
20
  const WeekdayOfTheMonthField = (props) => {
21
21
  const { disabled = false, moment: momentlib } = props;
22
- const intl = useIntl();
22
+ const lang = useSelector((state) => state.intl.locale);
23
23
 
24
24
  const moment = momentlib.default;
25
- moment.locale(intl.locale);
25
+ moment.locale(lang);
26
26
 
27
27
  const weekdayOfTheMonthList = [
28
28
  ...map(Object.keys(Days), (d) => ({
@@ -120,7 +120,7 @@ class SelectAutoComplete extends Component {
120
120
  }
121
121
 
122
122
  componentDidMount() {
123
- const { id, intl, value, choices } = this.props;
123
+ const { id, lang, value, choices } = this.props;
124
124
  if (value && value?.length > 0) {
125
125
  const tokensQuery = convertValueToVocabQuery(
126
126
  normalizeValue(choices, value, this.props.intl),
@@ -128,7 +128,7 @@ class SelectAutoComplete extends Component {
128
128
 
129
129
  this.props.getVocabularyTokenTitle({
130
130
  vocabNameOrURL: this.props.vocabBaseUrl,
131
- subrequest: `widget-${id}-${intl.locale}`,
131
+ subrequest: `widget-${id}-${lang}`,
132
132
  ...tokensQuery,
133
133
  });
134
134
  }
@@ -189,7 +189,7 @@ class SelectAutoComplete extends Component {
189
189
  vocabNameOrURL: this.props.vocabBaseUrl,
190
190
  query,
191
191
  size: -1,
192
- subrequest: this.props.intl.locale,
192
+ subrequest: this.props.lang,
193
193
  });
194
194
 
195
195
  return normalizeChoices(resp.items || [], this.props.intl);
@@ -263,19 +263,20 @@ export default compose(
263
263
 
264
264
  const vocabState =
265
265
  state.vocabularies?.[vocabBaseUrl]?.subrequests?.[
266
- `widget-${props.id}-${props.intl.locale}`
266
+ `widget-${props.id}-${state.intl.locale}`
267
267
  ]?.items;
268
268
 
269
269
  // If the schema already has the choices in it, then do not try to get
270
270
  // the vocab, even if there is one
271
271
  return props.items?.choices
272
- ? { choices: props.items.choices }
272
+ ? { choices: props.items.choices, lang: state.intl.locale }
273
273
  : vocabState
274
274
  ? {
275
275
  choices: vocabState,
276
276
  vocabBaseUrl,
277
+ lang: state.intl.locale,
277
278
  }
278
- : { vocabBaseUrl };
279
+ : { vocabBaseUrl, lang: state.intl.locale };
279
280
  },
280
281
  { getVocabulary, getVocabularyTokenTitle },
281
282
  ),
@@ -147,6 +147,8 @@ export const customSelectStyles = {
147
147
  padding: '12px 12px',
148
148
  color: state.isSelected
149
149
  ? '#007bc1'
150
+ : state.isDisabled
151
+ ? '#b5b5b5'
150
152
  : state.isFocused
151
153
  ? '#4a4a4a'
152
154
  : 'inherit',
@@ -160,7 +160,7 @@ class SelectWidget extends Component {
160
160
  this.props.getVocabulary({
161
161
  vocabNameOrURL: this.props.vocabBaseUrl,
162
162
  size: -1,
163
- subrequest: this.props.intl.locale,
163
+ subrequest: this.props.lang,
164
164
  });
165
165
  }
166
166
  }
@@ -263,27 +263,30 @@ export default compose(
263
263
  : '';
264
264
 
265
265
  const vocabState =
266
- state.vocabularies?.[vocabBaseUrl]?.subrequests?.[props.intl.locale];
266
+ state.vocabularies?.[vocabBaseUrl]?.subrequests?.[state.intl.locale];
267
267
 
268
268
  // If the schema already has the choices in it, then do not try to get the vocab,
269
269
  // even if there is one
270
270
  if (props.choices) {
271
271
  return {
272
272
  choices: props.choices,
273
+ lang: state.intl.locale,
273
274
  };
274
275
  } else if (vocabState) {
275
276
  return {
276
277
  vocabBaseUrl,
277
278
  choices: vocabState?.items ?? [],
279
+ lang: state.intl.locale,
278
280
  };
279
281
  // There is a moment that vocabState is not there yet, so we need to pass the
280
282
  // vocabBaseUrl to the component.
281
283
  } else if (vocabBaseUrl) {
282
284
  return {
283
285
  vocabBaseUrl,
286
+ lang: state.intl.locale,
284
287
  };
285
288
  }
286
- return {};
289
+ return { lang: state.intl.locale };
287
290
  },
288
291
  { getVocabulary, getVocabularyTokenTitle },
289
292
  ),
@@ -61,6 +61,8 @@ class TokenWidget extends Component {
61
61
  error: PropTypes.arrayOf(PropTypes.string),
62
62
  getVocabulary: PropTypes.func.isRequired,
63
63
  choices: PropTypes.arrayOf(PropTypes.object),
64
+ vocabLoading: PropTypes.bool,
65
+ vocabLoaded: PropTypes.bool,
64
66
  items: PropTypes.shape({
65
67
  vocabulary: PropTypes.object,
66
68
  }),
@@ -112,7 +114,21 @@ class TokenWidget extends Component {
112
114
  this.props.getVocabulary({
113
115
  vocabNameOrURL: this.props.vocabBaseUrl,
114
116
  size: -1,
115
- subrequest: this.props.intl.locale,
117
+ subrequest: this.props.lang,
118
+ });
119
+ }
120
+ }
121
+
122
+ componentDidUpdate() {
123
+ if (
124
+ !this.props.choices?.length &&
125
+ this.props.vocabLoading === undefined &&
126
+ !this.props.vocabLoaded
127
+ ) {
128
+ this.props.getVocabulary({
129
+ vocabNameOrURL: this.props.vocabBaseUrl,
130
+ size: -1,
131
+ subrequest: this.props.lang,
116
132
  });
117
133
  }
118
134
  }
@@ -188,7 +204,7 @@ export default compose(
188
204
  getVocabFromItems(props);
189
205
 
190
206
  const vocabState =
191
- state.vocabularies?.[vocabBaseUrl]?.subrequests?.[props.intl.locale];
207
+ state.vocabularies?.[vocabBaseUrl]?.subrequests?.[state.intl.locale];
192
208
 
193
209
  if (vocabState) {
194
210
  return {
@@ -198,10 +214,13 @@ export default compose(
198
214
  value: item.value,
199
215
  }))
200
216
  : [],
217
+ vocabLoading: vocabState.loading,
218
+ vocabLoaded: vocabState.loaded,
201
219
  vocabBaseUrl,
220
+ lang: state.intl.locale,
202
221
  };
203
222
  }
204
- return { vocabBaseUrl };
223
+ return { vocabBaseUrl, lang: state.intl.locale };
205
224
  },
206
225
  { getVocabulary },
207
226
  ),
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { List } from 'semantic-ui-react';
4
- import { useIntl } from 'react-intl';
5
4
  import cx from 'classnames';
6
5
  import { RRule, rrulestr } from 'rrule';
7
6
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
7
+ import { useSelector } from 'react-redux';
8
8
 
9
9
  export const datesForDisplay = (start, end, moment) => {
10
10
  const mStart = moment(start);
@@ -25,10 +25,10 @@ export const datesForDisplay = (start, end, moment) => {
25
25
  };
26
26
 
27
27
  const When_ = ({ start, end, whole_day, open_end, moment: momentlib }) => {
28
- const intl = useIntl();
28
+ const lang = useSelector((state) => state.intl.locale);
29
29
 
30
30
  const moment = momentlib.default;
31
- moment.locale(intl.locale);
31
+ moment.locale(lang);
32
32
 
33
33
  const datesInfo = datesForDisplay(start, end, moment);
34
34
  if (!datesInfo) {
@@ -96,6 +96,7 @@ let config = {
96
96
  imageObjects: ['Image'],
97
97
  reservedIds: ['login', 'layout', 'plone', 'zip', 'properties'],
98
98
  downloadableObjects: ['File'], //list of content-types for which the direct download of the file will be carried out if the user is not authenticated
99
+ viewableInBrowserObjects: [], //ex: ['File']. List of content-types for which the file will be displayed in browser if the user is not authenticated
99
100
  listingPreviewImageField: 'image', // deprecated from Volto 14 onwards
100
101
  notSupportedBrowsers: ['ie'],
101
102
  defaultPageSize: 25,
@@ -66,7 +66,8 @@ config.set('settings', {
66
66
  },
67
67
  controlPanelsIcons,
68
68
  apiExpanders: [],
69
- downloadableObjects: ['Link'],
69
+ downloadableObjects: ['File'],
70
+ viewableInBrowserObjects: [],
70
71
  });
71
72
  config.set('blocks', {
72
73
  blocksConfig: {