@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.
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +62 -0
- package/README.md +2 -2
- package/docker-compose.yml +1 -1
- package/locales/ca/LC_MESSAGES/volto.po +10 -0
- package/locales/ca.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +11 -1
- package/locales/de.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +10 -0
- package/locales/en.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +53 -43
- package/locales/es.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +10 -0
- package/locales/eu.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +10 -0
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +10 -0
- package/locales/fr.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +10 -0
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +10 -0
- package/locales/ja.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +10 -0
- package/locales/nl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +10 -0
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +10 -0
- package/locales/pt_BR.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +10 -0
- package/locales/ro.json +1 -1
- package/locales/volto.pot +11 -1
- package/locales/zh_CN/LC_MESSAGES/volto.po +10 -0
- package/locales/zh_CN.json +1 -1
- package/package.json +2 -1
- package/packages/volto-slate/package.json +1 -1
- package/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx +8 -3
- package/packages/volto-slate/src/blocks/Text/TextBlockView.jsx +20 -16
- package/packages/volto-slate/src/blocks/Text/extensions/withDeserializers.js +3 -1
- package/packages/volto-slate/src/editor/config.jsx +5 -4
- package/packages/volto-slate/src/editor/less/slate.less +28 -0
- package/packages/volto-slate/src/editor/render.jsx +68 -8
- package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +6 -1
- package/src/components/manage/Blocks/Image/Edit.jsx +11 -7
- package/src/components/manage/Blocks/Listing/ListingBody.jsx +30 -8
- package/src/components/manage/Blocks/Title/View.jsx +15 -5
- package/src/components/manage/Blocks/Title/View.test.jsx +16 -1
- package/src/components/manage/Blocks/ToC/View.jsx +8 -1
- package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +17 -4
- package/src/components/manage/Blocks/ToC/variations/HorizontalMenu.jsx +6 -2
- package/src/components/manage/Contents/ContentsUploadModal.jsx +10 -5
- package/src/components/manage/Toast/Toast.jsx +1 -1
- package/src/components/manage/Widgets/FileWidget.jsx +2 -1
- package/src/components/theme/Anontools/Anontools.jsx +45 -72
- package/src/components/theme/Anontools/Anontools.test.jsx +16 -2
- package/src/config/index.js +1 -0
- package/src/helpers/Extensions/withBlockSchemaEnhancer.js +15 -11
- package/src/helpers/Extensions/withBlockSchemaEnhancer.test.js +145 -0
- package/src/helpers/FormValidation/FormValidation.js +29 -0
- package/src/helpers/MessageLabels/MessageLabels.js +8 -0
- package/src/helpers/ScrollToTop/ScrollToTop.jsx +5 -3
- package/src/helpers/index.js +3 -1
- package/src/hooks/clipboard/useClipboard.js +26 -0
- package/src/hooks/content/useContent.js +31 -0
- 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
|
-
!
|
|
37
|
-
!this.props.location?.pathname.hash &&
|
|
39
|
+
!isHash &&
|
|
38
40
|
noInitialBlocksFocus &&
|
|
39
|
-
|
|
41
|
+
location?.pathname !== prevProps.location?.pathname
|
|
40
42
|
) {
|
|
41
43
|
window.scrollTo(0, 0);
|
|
42
44
|
}
|
package/src/helpers/index.js
CHANGED
|
@@ -71,7 +71,9 @@ export {
|
|
|
71
71
|
|
|
72
72
|
export langmap from './LanguageMap/LanguageMap';
|
|
73
73
|
export Helmet from './Helmet/Helmet';
|
|
74
|
-
export 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
|
+
// }
|