@plone/volto 17.0.0-alpha.24 → 17.0.0-alpha.25

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 (78) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/CHANGELOG.md +41 -0
  3. package/CONTRIBUTING.md +5 -1
  4. package/README.md +2 -1
  5. package/locales/ca/LC_MESSAGES/volto.po +5 -0
  6. package/locales/ca.json +1 -1
  7. package/locales/de/LC_MESSAGES/volto.po +5 -0
  8. package/locales/de.json +1 -1
  9. package/locales/en/LC_MESSAGES/volto.po +5 -0
  10. package/locales/en.json +1 -1
  11. package/locales/es/LC_MESSAGES/volto.po +5 -0
  12. package/locales/es.json +1 -1
  13. package/locales/eu/LC_MESSAGES/volto.po +5 -0
  14. package/locales/eu.json +1 -1
  15. package/locales/fi/LC_MESSAGES/volto.po +5 -0
  16. package/locales/fi.json +1 -1
  17. package/locales/fr/LC_MESSAGES/volto.po +5 -0
  18. package/locales/fr.json +1 -1
  19. package/locales/it/LC_MESSAGES/volto.po +5 -0
  20. package/locales/it.json +1 -1
  21. package/locales/ja/LC_MESSAGES/volto.po +5 -0
  22. package/locales/ja.json +1 -1
  23. package/locales/nl/LC_MESSAGES/volto.po +5 -0
  24. package/locales/nl.json +1 -1
  25. package/locales/pt/LC_MESSAGES/volto.po +5 -0
  26. package/locales/pt.json +1 -1
  27. package/locales/pt_BR/LC_MESSAGES/volto.po +5 -0
  28. package/locales/pt_BR.json +1 -1
  29. package/locales/ro/LC_MESSAGES/volto.po +5 -0
  30. package/locales/ro.json +1 -1
  31. package/locales/volto.pot +6 -1
  32. package/locales/zh_CN/LC_MESSAGES/volto.po +5 -0
  33. package/locales/zh_CN.json +1 -1
  34. package/package.json +1 -1
  35. package/packages/volto-slate/build/messages/src/blocks/Table/TableBlockEdit.json +90 -0
  36. package/packages/volto-slate/build/messages/src/blocks/Text/DefaultTextBlockEditor.json +6 -0
  37. package/packages/volto-slate/build/messages/src/blocks/Text/DetachedTextBlockEditor.json +6 -0
  38. package/packages/volto-slate/build/messages/src/blocks/Text/SlashMenu.json +6 -0
  39. package/packages/volto-slate/build/messages/src/editor/plugins/AdvancedLink/index.json +10 -0
  40. package/packages/volto-slate/build/messages/src/editor/plugins/Link/index.json +10 -0
  41. package/packages/volto-slate/build/messages/src/editor/plugins/Table/index.json +30 -0
  42. package/packages/volto-slate/build/messages/src/elementEditor/messages.json +10 -0
  43. package/packages/volto-slate/build/messages/src/widgets/HtmlSlateWidget.json +6 -0
  44. package/packages/volto-slate/build/messages/src/widgets/RichTextWidgetView.json +6 -0
  45. package/packages/volto-slate/package.json +1 -1
  46. package/src/actions/index.js +1 -0
  47. package/src/actions/relations/relations.js +17 -0
  48. package/src/components/manage/Blocks/Image/schema.js +5 -1
  49. package/src/components/manage/Blocks/Listing/withQuerystringResults.jsx +18 -11
  50. package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +4 -3
  51. package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx +44 -0
  52. package/src/components/manage/Contents/Contents.jsx +27 -0
  53. package/src/components/manage/Controlpanels/Relations/BrokenRelations.jsx +11 -9
  54. package/src/components/manage/Controlpanels/Relations/Relations.jsx +3 -3
  55. package/src/components/manage/Controlpanels/Relations/RelationsListing.jsx +8 -7
  56. package/src/components/manage/Controlpanels/Relations/RelationsMatrix.jsx +15 -9
  57. package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +25 -10
  58. package/src/components/manage/Diff/DiffField.jsx +25 -1
  59. package/src/components/manage/LinksToItem/LinksToItem.jsx +1 -1
  60. package/src/components/manage/LinksToItem/LinksToItem.test.jsx +1 -1
  61. package/src/components/manage/Sharing/Sharing.jsx +11 -5
  62. package/src/components/manage/Widgets/FormFieldWrapper.jsx +1 -1
  63. package/src/components/theme/Comments/Comment.stories.jsx +84 -0
  64. package/src/components/theme/Comments/Comments.jsx +273 -378
  65. package/src/components/theme/Logout/Logout.jsx +36 -83
  66. package/src/components/theme/Search/SearchTags.jsx +30 -60
  67. package/src/components/theme/Sitemap/Sitemap.jsx +24 -13
  68. package/src/components/theme/Sitemap/Sitemap.test.jsx +23 -2
  69. package/src/constants/ActionTypes.js +1 -0
  70. package/src/reducers/relations/relations.js +74 -46
  71. package/src/server.jsx +9 -0
  72. package/theme/themes/pastanaga/collections/form.overrides +46 -0
  73. package/theme/themes/pastanaga/elements/input.overrides +6 -0
  74. package/theme/themes/pastanaga/elements/label.overrides +10 -0
  75. package/.gitignore~ +0 -71
  76. package/news/4547.breaking~ +0 -1
  77. package/package.json~ +0 -444
  78. package/src/config/index.js~ +0 -223
@@ -17,7 +17,11 @@ import {
17
17
  import withObjectBrowser from '@plone/volto/components/manage/Sidebar/ObjectBrowser';
18
18
  import { messages } from '@plone/volto/helpers';
19
19
  import { Icon, Toast } from '@plone/volto/components';
20
- import { rebuildRelations, queryRelations } from '@plone/volto/actions';
20
+ import {
21
+ getRelationStats,
22
+ queryRelations,
23
+ rebuildRelations,
24
+ } from '@plone/volto/actions';
21
25
  import RelationsListing from './RelationsListing';
22
26
  import BrokenRelations from './BrokenRelations';
23
27
  import helpSVG from '@plone/volto/icons/help.svg';
@@ -39,12 +43,14 @@ const RelationsMatrix = (props) => {
39
43
  id: 'plone_setup',
40
44
  });
41
45
 
42
- const relationtypes = useSelector((state) => state.relations?.stats?.stats);
46
+ const relationtypes = useSelector(
47
+ (state) => state.relations?.stats?.data?.stats,
48
+ );
43
49
  const relationsListError = useSelector(
44
- (state) => state.relations?.list?.error?.response?.body?.error,
50
+ (state) => state.relations?.stats?.error?.response?.body?.error,
45
51
  );
46
52
  const brokenRelations = useSelector(
47
- (state) => state.relations?.stats?.broken,
53
+ (state) => state.relations?.stats?.data?.broken,
48
54
  );
49
55
 
50
56
  let filter_options = useSelector((state) => state.groups.filter_groups);
@@ -67,7 +73,7 @@ const RelationsMatrix = (props) => {
67
73
  }
68
74
 
69
75
  useEffect(() => {
70
- dispatch(queryRelations());
76
+ dispatch(getRelationStats());
71
77
  }, [dispatch]);
72
78
 
73
79
  const onReset = (event) => {
@@ -128,9 +134,7 @@ const RelationsMatrix = (props) => {
128
134
  const rebuildRelationsHandler = (flush = false) => {
129
135
  dispatch(rebuildRelations(flush))
130
136
  .then(() => {
131
- dispatch(queryRelations());
132
- })
133
- .then(() => {
137
+ dispatch(getRelationStats());
134
138
  dispatch(queryRelations(null, true, 'broken'));
135
139
  })
136
140
  .then(() => {
@@ -443,7 +447,9 @@ const RelationsMatrix = (props) => {
443
447
  ) : null}
444
448
  </div>
445
449
  ) : (
446
- <p>{relationsListError?.message}</p>
450
+ <p>
451
+ <b>{relationsListError?.type}</b> {relationsListError?.message}
452
+ </p>
447
453
  )}
448
454
  </Tab.Pane>
449
455
  ),
@@ -107,6 +107,7 @@ class UsersControlpanel extends Component {
107
107
  isClient: false,
108
108
  currentPage: 0,
109
109
  pageSize: 10,
110
+ loginUsingEmail: false,
110
111
  };
111
112
  }
112
113
 
@@ -122,6 +123,14 @@ class UsersControlpanel extends Component {
122
123
  }
123
124
  };
124
125
 
126
+ // Because username field needs to be disabled if email login is enabled!
127
+ checkLoginUsingEmailStatus = async () => {
128
+ await this.props.getControlpanel('security');
129
+ this.setState({
130
+ loginUsingEmail: this.props.controlPanelData?.data.use_email_as_login,
131
+ });
132
+ };
133
+
125
134
  /**
126
135
  * Component did mount
127
136
  * @method componentDidMount
@@ -132,6 +141,7 @@ class UsersControlpanel extends Component {
132
141
  isClient: true,
133
142
  });
134
143
  this.fetchData();
144
+ this.checkLoginUsingEmailStatus();
135
145
  }
136
146
 
137
147
  UNSAFE_componentWillReceiveProps(nextProps) {
@@ -425,7 +435,7 @@ class UsersControlpanel extends Component {
425
435
  id: 'default',
426
436
  title: 'FIXME: User Data',
427
437
  fields: [
428
- 'username',
438
+ ...(!this.state.loginUsingEmail ? ['username'] : []),
429
439
  'fullname',
430
440
  'email',
431
441
  'password',
@@ -436,15 +446,19 @@ class UsersControlpanel extends Component {
436
446
  },
437
447
  ],
438
448
  properties: {
439
- username: {
440
- title: this.props.intl.formatMessage(
441
- messages.addUserFormUsernameTitle,
442
- ),
443
- type: 'string',
444
- description: this.props.intl.formatMessage(
445
- messages.addUserFormUsernameDescription,
446
- ),
447
- },
449
+ ...(!this.state.loginUsingEmail
450
+ ? {
451
+ username: {
452
+ title: this.props.intl.formatMessage(
453
+ messages.addUserFormUsernameTitle,
454
+ ),
455
+ type: 'string',
456
+ description: this.props.intl.formatMessage(
457
+ messages.addUserFormUsernameDescription,
458
+ ),
459
+ },
460
+ }
461
+ : {}),
448
462
  fullname: {
449
463
  title: this.props.intl.formatMessage(
450
464
  messages.addUserFormFullnameTitle,
@@ -670,6 +684,7 @@ export default compose(
670
684
  createRequest: state.users.create,
671
685
  loadRolesRequest: state.roles,
672
686
  inheritedRole: state.authRole.authenticatedRole,
687
+ controlPanelData: state.controlpanels?.controlpanel,
673
688
  }),
674
689
  (dispatch) =>
675
690
  bindActionCreators(
@@ -17,6 +17,7 @@ import { useSelector } from 'react-redux';
17
17
  import { Api } from '@plone/volto/helpers';
18
18
  import configureStore from '@plone/volto/store';
19
19
  import { DefaultView } from '@plone/volto/components/';
20
+ import { serializeNodes } from '@plone/volto-slate/editor/render';
20
21
 
21
22
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
22
23
 
@@ -69,7 +70,7 @@ const DiffField = ({
69
70
  .replace('\u202F', ' '),
70
71
  );
71
72
  break;
72
- case 'json':
73
+ case 'json': {
73
74
  const api = new Api();
74
75
  const history = createBrowserHistory();
75
76
  const store = configureStore(window.__data, history, api);
@@ -90,6 +91,29 @@ const DiffField = ({
90
91
  ),
91
92
  );
92
93
  break;
94
+ }
95
+ case 'slate': {
96
+ const api = new Api();
97
+ const history = createBrowserHistory();
98
+ const store = configureStore(window.__data, history, api);
99
+ parts = diffWords(
100
+ ReactDOMServer.renderToStaticMarkup(
101
+ <Provider store={store}>
102
+ <ConnectedRouter history={history}>
103
+ {serializeNodes(one)}
104
+ </ConnectedRouter>
105
+ </Provider>,
106
+ ),
107
+ ReactDOMServer.renderToStaticMarkup(
108
+ <Provider store={store}>
109
+ <ConnectedRouter history={history}>
110
+ {serializeNodes(two)}
111
+ </ConnectedRouter>
112
+ </Provider>,
113
+ ),
114
+ );
115
+ break;
116
+ }
93
117
  case 'textarea':
94
118
  default:
95
119
  parts = diffWords(one, two);
@@ -44,7 +44,7 @@ const LinksToItem = (props) => {
44
44
 
45
45
  const title = useSelector((state) => state.content.data?.title || '');
46
46
  const myrelations = useSelector(
47
- (state) => state.relations.subrequests[itempath]?.relations,
47
+ (state) => state.relations.subrequests[itempath]?.data,
48
48
  );
49
49
  const actions = useSelector((state) => state.actions?.actions ?? {});
50
50
  const ploneSetupAction = find(actions.user, {
@@ -20,7 +20,7 @@ describe('LinksToItem', () => {
20
20
  relations: {
21
21
  subrequests: {
22
22
  '/page-1': {
23
- relations: {
23
+ data: {
24
24
  isReferencing: {
25
25
  items: [
26
26
  {
@@ -246,9 +246,9 @@ class SharingComponent extends Component {
246
246
  * @returns {undefined}
247
247
  */
248
248
  onToggleInherit() {
249
- this.setState({
250
- inherit: !this.state.inherit,
251
- });
249
+ this.setState((state) => ({
250
+ inherit: !state.inherit,
251
+ }));
252
252
  }
253
253
 
254
254
  /**
@@ -404,9 +404,15 @@ class SharingComponent extends Component {
404
404
  <Segment attached>
405
405
  <Form.Field>
406
406
  <Checkbox
407
- checked={this.state.inherit}
407
+ id="inherit-permissions-checkbox"
408
+ name="inherit-permissions-checkbox"
409
+ defaultChecked={this.state.inherit}
408
410
  onChange={this.onToggleInherit}
409
- label={this.props.intl.formatMessage(messages.inherit)}
411
+ label={
412
+ <label htmlFor="inherit-permissions-checkbox">
413
+ {this.props.intl.formatMessage(messages.inherit)}
414
+ </label>
415
+ }
410
416
  />
411
417
  </Form.Field>
412
418
  <p className="help">
@@ -96,7 +96,7 @@ class FormFieldWrapper extends Component {
96
96
  {this.props.children}
97
97
 
98
98
  {map(error, (message) => (
99
- <Label key={message} basic color="red" pointing>
99
+ <Label key={message} basic color="red" className="form-error-label">
100
100
  {message}
101
101
  </Label>
102
102
  ))}
@@ -0,0 +1,84 @@
1
+ import { injectIntl } from 'react-intl';
2
+ import React from 'react';
3
+ import CommentsComponent from './Comments';
4
+ import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
5
+
6
+ const IntlCommentsComponent = injectIntl(CommentsComponent);
7
+
8
+ function StoryComponent(args) {
9
+ return (
10
+ <Wrapper
11
+ customStore={{
12
+ comments: {
13
+ items: [
14
+ {
15
+ '@id': 'someurl',
16
+ comment_id: '1614094601171408',
17
+ ...args,
18
+ is_deletable: true,
19
+ is_editable: true,
20
+ can_reply: true,
21
+ },
22
+ ],
23
+ permissions: {
24
+ view_comments: true,
25
+ can_reply: true,
26
+ },
27
+ add: {
28
+ loading: false,
29
+ loaded: true,
30
+ },
31
+ delete: {
32
+ loading: false,
33
+ loaded: true,
34
+ },
35
+ update: {
36
+ loading: false,
37
+ loaded: true,
38
+ },
39
+ },
40
+ intl: {
41
+ locale: 'en',
42
+ messages: {},
43
+ },
44
+ }}
45
+ >
46
+ <div id="toolbar" style={{ display: 'none' }} />
47
+ <IntlCommentsComponent {...args} />
48
+ </Wrapper>
49
+ );
50
+ }
51
+
52
+ export const CommentsModal = StoryComponent.bind({});
53
+ CommentsModal.args = {
54
+ author_name: 'admin',
55
+ creation_date: '2017-11-06T19:36:01',
56
+ text: { data: 'Plone 6' },
57
+ };
58
+ export default {
59
+ title: 'Public components/Comments/Comments Modal',
60
+ component: CommentsComponent,
61
+ decorators: [
62
+ (Story) => (
63
+ <div className="ui segment form attached" style={{ width: '400px' }}>
64
+ <Story />
65
+ </div>
66
+ ),
67
+ ],
68
+ argTypes: {
69
+ creation_date: {
70
+ control: 'date',
71
+ description: 'Date comment was created',
72
+ },
73
+ author_name: {
74
+ control: 'text',
75
+ description: 'Comment author name',
76
+ },
77
+ text: {
78
+ data: {
79
+ control: 'date',
80
+ },
81
+ description: 'Comment text',
82
+ },
83
+ },
84
+ };