@plone/volto 17.0.0-alpha.13 → 17.0.0-alpha.15

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 (84) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/CHANGELOG.md +68 -0
  3. package/README.md +2 -2
  4. package/docker-compose.yml +1 -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 +49 -44
  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 +5 -0
  32. package/locales/zh_CN/LC_MESSAGES/volto.po +5 -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/actions/index.js +1 -1
  37. package/packages/volto-slate/src/blocks/Text/TextBlockView.jsx +20 -16
  38. package/packages/volto-slate/src/blocks/Text/index.js +2 -2
  39. package/packages/volto-slate/src/editor/config.jsx +5 -4
  40. package/packages/volto-slate/src/editor/index.js +4 -4
  41. package/packages/volto-slate/src/editor/less/slate.less +28 -0
  42. package/packages/volto-slate/src/editor/render.jsx +68 -8
  43. package/packages/volto-slate/src/editor/ui/SlateContextToolbar.jsx +2 -2
  44. package/packages/volto-slate/src/editor/ui/index.js +15 -15
  45. package/packages/volto-slate/src/index.js +2 -2
  46. package/src/components/manage/AnchorPlugin/index.jsx +2 -2
  47. package/src/components/manage/AnchorPlugin/utils/EditorUtils.js +3 -1
  48. package/src/components/manage/Blocks/Block/Style.jsx +2 -2
  49. package/src/components/manage/Blocks/Listing/DefaultTemplate.jsx +18 -3
  50. package/src/components/manage/Blocks/Listing/ListingBody.jsx +30 -8
  51. package/src/components/manage/Blocks/Listing/getAsyncData.js +3 -5
  52. package/src/components/manage/Blocks/Search/components/index.js +13 -13
  53. package/src/components/manage/Blocks/Search/hocs/index.js +2 -2
  54. package/src/components/manage/Blocks/Search/hocs/withQueryString.jsx +2 -2
  55. package/src/components/manage/Blocks/Title/View.jsx +15 -5
  56. package/src/components/manage/Blocks/Title/View.test.jsx +16 -1
  57. package/src/components/manage/Blocks/ToC/View.jsx +8 -1
  58. package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +17 -4
  59. package/src/components/manage/Blocks/ToC/variations/HorizontalMenu.jsx +6 -2
  60. package/src/components/manage/Blocks/ToC/variations/index.js +3 -1
  61. package/src/components/theme/Anontools/Anontools.jsx +45 -72
  62. package/src/components/theme/Anontools/Anontools.stories.jsx +16 -6
  63. package/src/components/theme/Anontools/Anontools.test.jsx +16 -2
  64. package/src/config/RichTextEditor/Blocks.jsx +2 -2
  65. package/src/config/RichTextEditor/FromHTML.jsx +2 -2
  66. package/src/config/RichTextEditor/Styles.jsx +1 -1
  67. package/src/constants/Indexes.js +3 -1
  68. package/src/express-middleware/devproxy.js +1 -1
  69. package/src/express-middleware/files.js +3 -3
  70. package/src/express-middleware/images.js +4 -4
  71. package/src/express-middleware/robotstxt.js +1 -1
  72. package/src/express-middleware/sitemap.js +1 -1
  73. package/src/express-middleware/static.js +3 -3
  74. package/src/helpers/Extensions/index.js +2 -1
  75. package/src/helpers/MessageLabels/MessageLabels.js +4 -0
  76. package/src/helpers/ScrollToTop/ScrollToTop.jsx +5 -3
  77. package/src/helpers/Utils/UseDetectClickOutside.stories.jsx +191 -0
  78. package/src/helpers/index.js +9 -10
  79. package/src/hooks/clipboard/useClipboard.js +26 -0
  80. package/src/hooks/content/useContent.js +31 -0
  81. package/src/hooks/index.js +2 -0
  82. package/src/middleware/index.js +2 -2
  83. package/src/start-server.js +2 -2
  84. package/theme/themes/pastanaga/extras/blocks.less +3 -1
@@ -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';
@@ -4,8 +4,8 @@
4
4
  * @example import { api } from 'middleware';
5
5
  */
6
6
 
7
- export api from '@plone/volto/middleware/api';
8
- export blacklistRoutes from './blacklistRoutes';
7
+ export { default as api } from '@plone/volto/middleware/api';
8
+ export { default as blacklistRoutes } from './blacklistRoutes';
9
9
  export {
10
10
  protectLoadStart,
11
11
  protectLoadEnd,
@@ -4,7 +4,7 @@ import http from 'http';
4
4
  import app from './server';
5
5
  import debug from 'debug';
6
6
 
7
- export default () => {
7
+ export default function server() {
8
8
  const server = http.createServer(app);
9
9
  // const host = process.env.HOST || 'localhost';
10
10
  const port = process.env.PORT || 3000;
@@ -46,4 +46,4 @@ export default () => {
46
46
  currentApp = newApp;
47
47
  });
48
48
  };
49
- };
49
+ }
@@ -477,7 +477,9 @@ body.has-toolbar.has-sidebar-collapsed .ui.wrapper > .ui.inner.block.full {
477
477
 
478
478
  &.new-add-block {
479
479
  bottom: -26px;
480
- left: 50%;
480
+ left: calc(
481
+ 50% - 12px
482
+ ); // This is to compensate the width of the icon and center it correctly
481
483
  padding: 0 !important;
482
484
  border: none !important;
483
485
  background: white !important;