@plone/volto 17.0.0-alpha.12 → 17.0.0-alpha.14

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 (64) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/CHANGELOG.md +62 -0
  3. package/README.md +2 -2
  4. package/docker-compose.yml +1 -1
  5. package/locales/ca/LC_MESSAGES/volto.po +10 -0
  6. package/locales/ca.json +1 -1
  7. package/locales/de/LC_MESSAGES/volto.po +11 -1
  8. package/locales/de.json +1 -1
  9. package/locales/en/LC_MESSAGES/volto.po +10 -0
  10. package/locales/en.json +1 -1
  11. package/locales/es/LC_MESSAGES/volto.po +53 -43
  12. package/locales/es.json +1 -1
  13. package/locales/eu/LC_MESSAGES/volto.po +10 -0
  14. package/locales/eu.json +1 -1
  15. package/locales/fi/LC_MESSAGES/volto.po +10 -0
  16. package/locales/fi.json +1 -1
  17. package/locales/fr/LC_MESSAGES/volto.po +10 -0
  18. package/locales/fr.json +1 -1
  19. package/locales/it/LC_MESSAGES/volto.po +10 -0
  20. package/locales/it.json +1 -1
  21. package/locales/ja/LC_MESSAGES/volto.po +10 -0
  22. package/locales/ja.json +1 -1
  23. package/locales/nl/LC_MESSAGES/volto.po +10 -0
  24. package/locales/nl.json +1 -1
  25. package/locales/pt/LC_MESSAGES/volto.po +10 -0
  26. package/locales/pt.json +1 -1
  27. package/locales/pt_BR/LC_MESSAGES/volto.po +10 -0
  28. package/locales/pt_BR.json +1 -1
  29. package/locales/ro/LC_MESSAGES/volto.po +10 -0
  30. package/locales/ro.json +1 -1
  31. package/locales/volto.pot +11 -1
  32. package/locales/zh_CN/LC_MESSAGES/volto.po +10 -0
  33. package/locales/zh_CN.json +1 -1
  34. package/package.json +2 -1
  35. package/packages/volto-slate/package.json +1 -1
  36. package/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx +8 -3
  37. package/packages/volto-slate/src/blocks/Text/TextBlockView.jsx +20 -16
  38. package/packages/volto-slate/src/blocks/Text/extensions/withDeserializers.js +3 -1
  39. package/packages/volto-slate/src/editor/config.jsx +5 -4
  40. package/packages/volto-slate/src/editor/less/slate.less +28 -0
  41. package/packages/volto-slate/src/editor/render.jsx +68 -8
  42. package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +6 -1
  43. package/src/components/manage/Blocks/Image/Edit.jsx +11 -7
  44. package/src/components/manage/Blocks/Listing/ListingBody.jsx +30 -8
  45. package/src/components/manage/Blocks/Title/View.jsx +15 -5
  46. package/src/components/manage/Blocks/Title/View.test.jsx +16 -1
  47. package/src/components/manage/Blocks/ToC/View.jsx +8 -1
  48. package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +17 -4
  49. package/src/components/manage/Blocks/ToC/variations/HorizontalMenu.jsx +6 -2
  50. package/src/components/manage/Contents/ContentsUploadModal.jsx +10 -5
  51. package/src/components/manage/Toast/Toast.jsx +1 -1
  52. package/src/components/manage/Widgets/FileWidget.jsx +2 -1
  53. package/src/components/theme/Anontools/Anontools.jsx +45 -72
  54. package/src/components/theme/Anontools/Anontools.test.jsx +16 -2
  55. package/src/config/index.js +1 -0
  56. package/src/helpers/Extensions/withBlockSchemaEnhancer.js +15 -11
  57. package/src/helpers/Extensions/withBlockSchemaEnhancer.test.js +145 -0
  58. package/src/helpers/FormValidation/FormValidation.js +29 -0
  59. package/src/helpers/MessageLabels/MessageLabels.js +8 -0
  60. package/src/helpers/ScrollToTop/ScrollToTop.jsx +5 -3
  61. package/src/helpers/index.js +3 -1
  62. package/src/hooks/clipboard/useClipboard.js +26 -0
  63. package/src/hooks/content/useContent.js +31 -0
  64. package/src/hooks/index.js +2 -0
@@ -260,6 +260,10 @@ export const messages = defineMessages({
260
260
  id: 'Show groups of users below',
261
261
  defaultMessage: 'Show groups of users below',
262
262
  },
263
+ urlClipboardCopy: {
264
+ id: 'Link copied to clipboard',
265
+ defaultMessage: 'Link copied to clipboard',
266
+ },
263
267
  inspectRelations: {
264
268
  id: 'Inspect relations',
265
269
  defaultMessage: 'Inspect relations',
@@ -332,4 +336,8 @@ export const messages = defineMessages({
332
336
  id: 'Filter',
333
337
  defaultMessage: 'Filter',
334
338
  },
339
+ fileTooLarge: {
340
+ id: 'fileTooLarge',
341
+ defaultMessage: 'This website does not accept files larger than {limit}',
342
+ },
335
343
  });
@@ -28,15 +28,17 @@ class ScrollToTop extends React.Component {
28
28
  * @memberof ScrollToTop
29
29
  */
30
30
  componentDidUpdate(prevProps) {
31
+ const { location } = this.props;
31
32
  const noInitialBlocksFocus = // Do not scroll on /edit
32
33
  config.blocks?.initialBlocksFocus === null
33
34
  ? this.props.location?.pathname.slice(-5) !== '/edit'
34
35
  : true;
36
+
37
+ const isHash = location?.hash || location?.pathname.hash;
35
38
  if (
36
- !this.props.location?.hash &&
37
- !this.props.location?.pathname.hash &&
39
+ !isHash &&
38
40
  noInitialBlocksFocus &&
39
- this.props.location?.pathname !== prevProps.location?.pathname
41
+ location?.pathname !== prevProps.location?.pathname
40
42
  ) {
41
43
  window.scrollTo(0, 0);
42
44
  }
@@ -71,7 +71,9 @@ export {
71
71
 
72
72
  export langmap from './LanguageMap/LanguageMap';
73
73
  export Helmet from './Helmet/Helmet';
74
- export FormValidation from './FormValidation/FormValidation';
74
+ export FormValidation, {
75
+ validateFileUploadSize,
76
+ } from './FormValidation/FormValidation';
75
77
  export {
76
78
  difference,
77
79
  getColor,
@@ -0,0 +1,26 @@
1
+ import { useState, useRef, useEffect, useCallback } from 'react';
2
+
3
+ export default function useClipboard(clipboardText = '') {
4
+ const stringToCopy = useRef(clipboardText);
5
+ const [copied, setCopied] = useState(false);
6
+
7
+ //synchronous: window.clipboardData.setData(options.format || "text", text);
8
+ const copyToClipboard = async (text) => {
9
+ if ('clipboard' in navigator) {
10
+ return await navigator.clipboard.writeText(text);
11
+ } else {
12
+ return document.execCommand('copy', true, text);
13
+ }
14
+ };
15
+
16
+ const copyAction = useCallback(() => {
17
+ const copiedString = copyToClipboard(stringToCopy.current);
18
+ setCopied(copiedString);
19
+ }, [stringToCopy]);
20
+
21
+ useEffect(() => {
22
+ stringToCopy.current = clipboardText;
23
+ }, [clipboardText]);
24
+
25
+ return [copied, copyAction, setCopied];
26
+ }
@@ -0,0 +1,31 @@
1
+ import { useSelector, shallowEqual } from 'react-redux';
2
+
3
+ /**
4
+ * useContent hook
5
+ *
6
+ * This hook returns the current content that is stored in the Redux store in the
7
+ * `content` reducer, and returns it along with the related state (loading/loaded/error).
8
+ *
9
+ * @export
10
+ * @return {{ data: ContentData, loading: boolean, loaded: boolean, error: Error }}
11
+ */
12
+ export function useContent() {
13
+ const data = useSelector((state) => state.content.data, shallowEqual);
14
+ const loading = useSelector((state) => state.content.get.loading);
15
+ const loaded = useSelector((state) => state.content.get.loaded);
16
+ const error = useSelector((state) => state.content.get.error, shallowEqual);
17
+
18
+ return { data, loading, loaded, error };
19
+ }
20
+
21
+ // For reference purposes: Potential future useQuery version
22
+ // export function useContent() {
23
+ // // the cache will need to know the current location
24
+ // const pathname = useLocation();
25
+ // const query = useQuery(getContentQuery({ path }))
26
+
27
+ // // This might not be needed if we rename the properties
28
+ // const {isLoading: loading, isSuccess: loaded, ...rest} = query;
29
+
30
+ // return { loading, loaded, ...rest };
31
+ // }
@@ -0,0 +1,2 @@
1
+ export useClipboard from '@plone/volto/hooks/clipboard/useClipboard';
2
+ export useToken from '@plone/volto/hooks/userSession/useToken';