@plone/volto 19.0.0-alpha.5 → 19.0.0-alpha.7

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 (123) hide show
  1. package/.eslintrc +20 -0
  2. package/CHANGELOG.md +73 -0
  3. package/README.md +2 -2
  4. package/cypress/support/commands.js +5 -6
  5. package/locales/af.json +1 -1
  6. package/locales/ar.json +1 -1
  7. package/locales/bg.json +1 -1
  8. package/locales/bn.json +1 -1
  9. package/locales/ca/LC_MESSAGES/volto.po +25 -5
  10. package/locales/ca.json +1 -1
  11. package/locales/cs.json +1 -1
  12. package/locales/cy.json +1 -1
  13. package/locales/da.json +1 -1
  14. package/locales/de/LC_MESSAGES/volto.po +25 -5
  15. package/locales/de.json +1 -1
  16. package/locales/el.json +1 -1
  17. package/locales/en/LC_MESSAGES/volto.po +25 -5
  18. package/locales/en.json +1 -1
  19. package/locales/en_AU.json +1 -1
  20. package/locales/en_GB.json +1 -1
  21. package/locales/eo.json +1 -1
  22. package/locales/es/LC_MESSAGES/volto.po +25 -5
  23. package/locales/es.json +1 -1
  24. package/locales/et.json +1 -1
  25. package/locales/eu/LC_MESSAGES/volto.po +25 -5
  26. package/locales/eu.json +1 -1
  27. package/locales/fa.json +1 -1
  28. package/locales/fi/LC_MESSAGES/volto.po +25 -5
  29. package/locales/fi.json +1 -1
  30. package/locales/fr/LC_MESSAGES/volto.po +25 -5
  31. package/locales/fr.json +1 -1
  32. package/locales/fu.json +1 -1
  33. package/locales/gl.json +1 -1
  34. package/locales/he.json +1 -1
  35. package/locales/hi/LC_MESSAGES/volto.po +25 -5
  36. package/locales/hi.json +1 -1
  37. package/locales/hr.json +1 -1
  38. package/locales/hu.json +1 -1
  39. package/locales/hy.json +1 -1
  40. package/locales/id.json +1 -1
  41. package/locales/it/LC_MESSAGES/volto.po +26 -6
  42. package/locales/it.json +1 -1
  43. package/locales/ja/LC_MESSAGES/volto.po +25 -5
  44. package/locales/ja.json +1 -1
  45. package/locales/ka.json +1 -1
  46. package/locales/kn.json +1 -1
  47. package/locales/ko.json +1 -1
  48. package/locales/lt.json +1 -1
  49. package/locales/lv.json +1 -1
  50. package/locales/mi.json +1 -1
  51. package/locales/mk.json +1 -1
  52. package/locales/my.json +1 -1
  53. package/locales/nb_NO.json +1 -1
  54. package/locales/nl/LC_MESSAGES/volto.po +25 -5
  55. package/locales/nl.json +1 -1
  56. package/locales/nn.json +1 -1
  57. package/locales/pl.json +1 -1
  58. package/locales/pt/LC_MESSAGES/volto.po +25 -5
  59. package/locales/pt.json +1 -1
  60. package/locales/pt_BR/LC_MESSAGES/volto.po +36 -16
  61. package/locales/pt_BR.json +1 -1
  62. package/locales/rm.json +1 -1
  63. package/locales/ro/LC_MESSAGES/volto.po +25 -5
  64. package/locales/ro.json +1 -1
  65. package/locales/ru/LC_MESSAGES/volto.po +25 -5
  66. package/locales/ru.json +1 -1
  67. package/locales/sk.json +1 -1
  68. package/locales/sl.json +1 -1
  69. package/locales/sm.json +1 -1
  70. package/locales/sq.json +1 -1
  71. package/locales/sr.json +1 -1
  72. package/locales/sr@cyrl.json +1 -1
  73. package/locales/sr@latn.json +1 -1
  74. package/locales/sv.json +1 -1
  75. package/locales/ta.json +1 -1
  76. package/locales/te.json +1 -1
  77. package/locales/th.json +1 -1
  78. package/locales/to.json +1 -1
  79. package/locales/tr.json +1 -1
  80. package/locales/uk.json +1 -1
  81. package/locales/vi.json +1 -1
  82. package/locales/volto.pot +26 -6
  83. package/locales/zh_CN/LC_MESSAGES/volto.po +25 -5
  84. package/locales/zh_CN.json +1 -1
  85. package/locales/zh_Hant.json +1 -1
  86. package/locales/zh_Hant_HK.json +1 -1
  87. package/package.json +10 -10
  88. package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +9 -4
  89. package/src/components/manage/Blocks/LeadImage/Edit.jsx +2 -2
  90. package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +1 -1
  91. package/src/components/manage/Blocks/Maps/Edit.jsx +2 -1
  92. package/src/components/manage/Blocks/Teaser/Data.jsx +20 -6
  93. package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +1 -1
  94. package/src/components/manage/Blocks/Video/Edit.jsx +2 -1
  95. package/src/components/manage/Contents/Contents.jsx +20 -2
  96. package/src/components/manage/Controlpanels/ContentType.jsx +1 -1
  97. package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +3 -2
  98. package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +156 -175
  99. package/src/components/manage/Sidebar/ObjectBrowserNav.jsx +2 -1
  100. package/src/components/manage/TemplateChooser/TemplateChooser.jsx +2 -1
  101. package/src/components/manage/Toolbar/PersonalTools.jsx +2 -1
  102. package/src/components/manage/Widgets/DatetimeWidget.jsx +5 -0
  103. package/src/components/manage/Widgets/FileWidget.jsx +14 -8
  104. package/src/components/manage/Widgets/ImageWidget.jsx +2 -2
  105. package/src/components/manage/Widgets/InternalUrlWidget.jsx +2 -0
  106. package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +3 -0
  107. package/src/components/manage/Widgets/UrlWidget.jsx +2 -0
  108. package/src/components/theme/Avatar/Avatar.jsx +2 -1
  109. package/src/components/theme/PreviewImage/PreviewImage.jsx +1 -1
  110. package/src/components/theme/Widgets/ImageWidget.jsx +2 -1
  111. package/src/helpers/Content/withClientSideContent.jsx +35 -0
  112. package/src/helpers/Html/Html.jsx +1 -9
  113. package/src/helpers/MessageLabels/MessageLabels.js +5 -0
  114. package/src/middleware/api.js +3 -3
  115. package/src/routes.js +3 -1
  116. package/theme/themes/pastanaga/extras/contents.less +12 -0
  117. package/theme/themes/pastanaga/extras/main.less +4 -0
  118. package/types/components/manage/Controlpanels/Users/RenderUsers.d.ts +18 -2
  119. package/types/components/manage/Controlpanels/index.d.ts +1 -1
  120. package/types/helpers/Content/withClientSideContent.d.ts +1 -0
  121. package/types/helpers/MessageLabels/MessageLabels.d.ts +68 -62
  122. package/src/helpers/Url/bulkFlattenToAppURL.test.ts +0 -122
  123. package/src/helpers/Url/bulkFlattenToAppURL.ts +0 -24
@@ -399,6 +399,7 @@ export class ObjectBrowserWidgetComponent extends Component {
399
399
  {this.state.manualLinkInput && isEmpty(items) && (
400
400
  <Button.Group>
401
401
  <Button
402
+ type="button"
402
403
  basic
403
404
  className="cancel"
404
405
  onClick={(e) => {
@@ -409,6 +410,7 @@ export class ObjectBrowserWidgetComponent extends Component {
409
410
  <Icon name={clearSVG} size="18px" color="#e40166" />
410
411
  </Button>
411
412
  <Button
413
+ type="button"
412
414
  basic
413
415
  primary
414
416
  disabled={!this.state.validURL}
@@ -423,6 +425,7 @@ export class ObjectBrowserWidgetComponent extends Component {
423
425
  )}
424
426
  {!this.state.manualLinkInput && (
425
427
  <Button
428
+ type="button"
426
429
  aria-label={this.props.intl.formatMessage(
427
430
  messages.openObjectBrowser,
428
431
  )}
@@ -105,6 +105,7 @@ export const UrlWidget = (props) => {
105
105
  {value?.length > 0 ? (
106
106
  <Button.Group>
107
107
  <Button
108
+ type="button"
108
109
  basic
109
110
  className="cancel"
110
111
  aria-label="clearUrlBrowser"
@@ -120,6 +121,7 @@ export const UrlWidget = (props) => {
120
121
  ) : (
121
122
  <Button.Group>
122
123
  <Button
124
+ type="button"
123
125
  basic
124
126
  icon
125
127
  aria-label="openUrlBrowser"
@@ -5,6 +5,7 @@
5
5
  import React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { getInitials } from '@plone/volto/helpers/Utils/Utils';
8
+ import Image from '@plone/volto/components/theme/Image/Image';
8
9
 
9
10
  const defaultSize = 30;
10
11
  const defaultColor = 'Teal';
@@ -15,7 +16,7 @@ const Avatar = ({ src, title, text, size, color, className }) => {
15
16
  return (
16
17
  <div className={className} title={title}>
17
18
  {src ? (
18
- <img src={src} alt={title}></img>
19
+ <Image src={src} alt={title} />
19
20
  ) : (
20
21
  <svg width={size} height={size}>
21
22
  <circle cx={radius} cy={radius} r={radius} fill={color} />
@@ -25,7 +25,7 @@ function PreviewImage({ item, alt, image_field, showDefault = true, ...rest }) {
25
25
  return image;
26
26
  } else {
27
27
  return (
28
- <img
28
+ <Image
29
29
  src={
30
30
  config.getComponent({
31
31
  name: 'DefaultImage',
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
4
+ import Image from '@plone/volto/components/theme/Image/Image';
4
5
 
5
6
  const niceBytes = (bytes) => {
6
7
  bytes = Number(bytes);
@@ -18,7 +19,7 @@ const niceBytes = (bytes) => {
18
19
  const ImageWidget = ({ value, className }) =>
19
20
  value ? (
20
21
  <span className={cx(className, 'image', 'widget')}>
21
- <img
22
+ <Image
22
23
  src={
23
24
  value.data
24
25
  ? `data:${value['content-type']};base64,${value.data}`
@@ -0,0 +1,35 @@
1
+ /*
2
+ This is a HOC for use with the volto Edit component.
3
+ It makes sure that we fetch the content from the API on the client side
4
+ when the Edit component is mounted, if there is an internalApiPath
5
+ that is different from the public API path. Otherwise we might end up
6
+ saving backend API paths back to the server.
7
+
8
+ It's admittedly a bit of a workaround.
9
+ Ideally the volto SSR should produce correct URLs
10
+ so that we don't have to do this on the client side.
11
+ But, that requires refactoring that won't happen quickly...
12
+ */
13
+
14
+ import { useEffect } from 'react';
15
+ import { useDispatch, useSelector } from 'react-redux';
16
+ import hoistNonReactStatics from 'hoist-non-react-statics';
17
+ import config from '@plone/volto/registry';
18
+ import { getContent } from '@plone/volto/actions/content/content';
19
+
20
+ export default function withClientSideContent(WrappedComponent) {
21
+ function WithClientSideContent(props) {
22
+ const { internalApiPath } = config.settings;
23
+ const dispatch = useDispatch();
24
+ const content = useSelector((state) => state.content);
25
+ const id = content.data?.['@id'];
26
+ useEffect(() => {
27
+ if (internalApiPath && id?.startsWith(internalApiPath)) {
28
+ dispatch(getContent(id.substring(internalApiPath.length)));
29
+ }
30
+ }, [internalApiPath, dispatch, id]);
31
+ return <WrappedComponent {...props} />;
32
+ }
33
+
34
+ return hoistNonReactStatics(WithClientSideContent, WrappedComponent);
35
+ }
@@ -11,7 +11,6 @@ import join from 'lodash/join';
11
11
  import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
12
12
  import { runtimeConfig } from '@plone/volto/runtime_config';
13
13
  import config from '@plone/volto/registry';
14
- import { bulkFlattenToAppURL } from '../Url/bulkFlattenToAppURL';
15
14
 
16
15
  const CRITICAL_CSS_TEMPLATE = `function alter() {
17
16
  document.querySelectorAll("head link[rel='prefetch']").forEach(function(el) { el.rel = 'stylesheet'});
@@ -190,14 +189,7 @@ class Html extends Component {
190
189
  <script
191
190
  dangerouslySetInnerHTML={{
192
191
  __html: `window.__data=${serialize(
193
- loadReducers({
194
- ...store.getState(),
195
- // Flatten the content URLs in initial request in SSR
196
- // it normalizes the URLs in case the INTERNAL_API_PATH is set
197
- // and prevents unwanted leaks of INTERNAL_API_PATH in the client
198
- // (only in the first request)
199
- content: bulkFlattenToAppURL(store.getState().content),
200
- }),
192
+ loadReducers(store.getState()),
201
193
  )};`,
202
194
  }}
203
195
  charSet="UTF-8"
@@ -152,6 +152,11 @@ export const messages = defineMessages({
152
152
  id: 'Groupname',
153
153
  defaultMessage: 'Groupname',
154
154
  },
155
+ addGroupsFormGroupNameDescription: {
156
+ id: 'A unique identifier for the group. Cannot be changed after creation. No spaces allowed.',
157
+ defaultMessage:
158
+ 'A unique identifier for the group. Cannot be changed after creation. No spaces allowed.',
159
+ },
155
160
  addGroupsFormDescriptionTitle: {
156
161
  id: 'Description',
157
162
  defaultMessage: 'Description',
@@ -348,7 +348,7 @@ const apiMiddlewareFactory =
348
348
  }
349
349
 
350
350
  // Only SSR can set ECONNREFUSED
351
- if (error.code === 'ECONNREFUSED') {
351
+ if (error?.code === 'ECONNREFUSED') {
352
352
  next({
353
353
  ...rest,
354
354
  error,
@@ -359,7 +359,7 @@ const apiMiddlewareFactory =
359
359
  }
360
360
 
361
361
  // Response error is marked crossDomain if CORS error happen
362
- else if (error.crossDomain) {
362
+ else if (error?.crossDomain) {
363
363
  next({
364
364
  ...rest,
365
365
  error,
@@ -410,7 +410,7 @@ const apiMiddlewareFactory =
410
410
  ...rest,
411
411
  error,
412
412
  statusCode: error.response,
413
- message: error.response.body.message,
413
+ message: error.response?.body?.message,
414
414
  connectionRefused: false,
415
415
  type: SET_APIERROR,
416
416
  });
package/src/routes.js CHANGED
@@ -52,6 +52,8 @@ import {
52
52
  UpgradeControlPanel,
53
53
  } from '@plone/volto/components/manage/Controlpanels';
54
54
 
55
+ import withClientSideContent from '@plone/volto/helpers/Content/withClientSideContent';
56
+
55
57
  import App from '@plone/volto/components/theme/App/App';
56
58
  import View from '@plone/volto/components/theme/View/View';
57
59
 
@@ -244,7 +246,7 @@ export const defaultRoutes = [
244
246
  },
245
247
  {
246
248
  path: ['/edit', '/**/edit'],
247
- component: Edit,
249
+ component: withClientSideContent(Edit),
248
250
  },
249
251
  {
250
252
  path: ['/contents', '/**/contents'],
@@ -107,6 +107,18 @@
107
107
  top: auto;
108
108
  bottom: 100%;
109
109
  }
110
+
111
+ .search-feedback {
112
+ position: absolute;
113
+ overflow: hidden;
114
+ width: 1px;
115
+ height: 1px;
116
+ padding: 0;
117
+ border: 0;
118
+ margin: -1px;
119
+ clip: rect(0, 0, 0, 0);
120
+ white-space: nowrap;
121
+ }
110
122
  }
111
123
 
112
124
  .ui.table .icon-align,
@@ -443,6 +443,10 @@ fieldset.invisible {
443
443
  padding: 0;
444
444
  border: none;
445
445
  margin: 0;
446
+ // Reset visibility, this 'invisible' is not meant to hide the fieldset
447
+ // This prevents issues when used along other CSS framworks that might
448
+ // have this utility class defined (e.g. TailwindCSS)
449
+ visibility: initial;
446
450
  }
447
451
 
448
452
  .vertical-form {
@@ -1,2 +1,18 @@
1
- declare const _default: any;
2
- export default _default;
1
+ export default RenderUsers;
2
+ /**
3
+ * RenderUsers functional component.
4
+ * @function RenderUsers
5
+ */
6
+ declare function RenderUsers(props: any): import("react/jsx-runtime").JSX.Element;
7
+ declare namespace RenderUsers {
8
+ namespace propTypes {
9
+ let user: any;
10
+ let roles: any;
11
+ let onDelete: any;
12
+ let isUserManager: any;
13
+ let listUsers: any;
14
+ let updateUser: any;
15
+ let inheritedRole: any;
16
+ let userschema: any;
17
+ }
18
+ }
@@ -5,7 +5,7 @@ export declare const AddRuleControlpanel: import("@loadable/component").Loadable
5
5
  export declare const EditRuleControlpanel: import("@loadable/component").LoadableClassComponent<any>;
6
6
  export declare const ConfigureRuleControlpanel: import("@loadable/component").LoadableClassComponent<any>;
7
7
  export declare const UsersControlpanel: import("@loadable/component").LoadableClassComponent<any>;
8
- export declare const RenderUsers: import("@loadable/component").LoadableClassComponent<any>;
8
+ export declare const RenderUsers: import("@loadable/component").LoadableComponent<any>;
9
9
  export declare const UserGroupMembershipControlPanel: import("@loadable/component").LoadableComponent<unknown>;
10
10
  export declare const GroupsControlpanel: import("@loadable/component").LoadableClassComponent<any>;
11
11
  export declare const RenderGroups: import("@loadable/component").LoadableComponent<any>;
@@ -0,0 +1 @@
1
+ export default function withClientSideContent(WrappedComponent: any): any;