@eeacms/volto-eea-website-theme 3.19.0 → 4.0.0
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/.eslintrc.js +7 -6
- package/CHANGELOG.md +28 -0
- package/DEVELOP.md +19 -17
- package/README.md +27 -15
- package/docker-compose.yml +1 -1
- package/jest-addon.config.js +8 -4
- package/package.json +1 -1
- package/src/actions/navigation.js +1 -1
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.jsx +4 -2
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.test.jsx +25 -19
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.jsx +2 -1
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.test.jsx +6 -4
- package/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx +2 -2
- package/src/components/manage/Blocks/ContextNavigation/variations/ReportNavigation.jsx +4 -2
- package/src/components/manage/Blocks/ContextNavigation/variations/ReportNavigation.test.jsx +1 -1
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/FlexGroup.jsx +12 -44
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/RenderBlocks.jsx +5 -4
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/editor-flex.less +45 -4
- package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.jsx +2 -1
- package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.test.jsx +12 -4
- package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsView.jsx +1 -1
- package/src/components/manage/Blocks/Title/Edit.jsx +3 -3
- package/src/components/manage/Blocks/Title/View.jsx +2 -1
- package/src/components/manage/Blocks/Title/variations/WebReport.jsx +2 -2
- package/src/components/manage/Blocks/Title/variations/WebReport.test.jsx +6 -4
- package/src/components/manage/Blocks/Title/variations/WebReportPage.jsx +2 -2
- package/src/components/manage/Blocks/Title/variations/WebReportPage.test.jsx +6 -4
- package/src/components/theme/Banner/View.jsx +1 -1
- package/src/components/theme/BaseTag.jsx +2 -1
- package/src/components/theme/BaseTag.test.jsx +7 -2
- package/src/components/theme/DraftBackground/DraftBackground.jsx +2 -1
- package/src/components/theme/Homepage/HomePageInverseView.jsx +3 -3
- package/src/components/theme/Homepage/HomePageInverseView.test.jsx +1 -1
- package/src/components/theme/Homepage/HomePageView.jsx +3 -3
- package/src/components/theme/Homepage/HomePageView.test.jsx +1 -1
- package/src/components/theme/Logo.jsx +3 -3
- package/src/components/theme/NotFound/GoneView.jsx +3 -2
- package/src/components/theme/NotFound/GoneView.test.jsx +5 -4
- package/src/components/theme/NotFound/NotFound.jsx +1 -1
- package/src/components/theme/NotFound/NotFound.test.jsx +3 -2
- package/src/components/theme/PrintLoader/PrintLoader.test.jsx +1 -1
- package/src/components/theme/SubsiteClass.jsx +6 -4
- package/src/components/theme/SubsiteClass.test.jsx +3 -2
- package/src/components/theme/WebReport/WebReportSectionView.jsx +2 -2
- package/src/components/theme/WebReport/WebReportSectionView.test.jsx +10 -5
- package/src/components/theme/Widgets/ADUserGroupSelectWidget.jsx +2 -2
- package/src/components/theme/Widgets/ContributorsViewWidget.jsx +1 -1
- package/src/components/theme/Widgets/CreatableSelectWidget.jsx +7 -4
- package/src/components/theme/Widgets/CreatorsViewWidget.jsx +1 -1
- package/src/components/theme/Widgets/DateWidget.jsx +1 -1
- package/src/components/theme/Widgets/DateWidget.test.js +1 -1
- package/src/components/theme/Widgets/DatetimeWidget.jsx +1 -1
- package/src/components/theme/Widgets/DatetimeWidget.test.js +1 -1
- package/src/components/theme/Widgets/ImageViewWidget.jsx +1 -0
- package/src/components/theme/Widgets/NavigationBehaviorWidget.jsx +7 -3
- package/src/components/theme/Widgets/NavigationBehaviorWidget.test.jsx +51 -46
- package/src/components/theme/Widgets/UserSelectWidget.jsx +13 -10
- package/src/customizations/@plone/volto-slate/blocks/Table/TableBlockView.jsx +3 -3
- package/src/customizations/@plone/volto-slate/blocks/Text/TextBlockView.jsx +2 -2
- package/src/customizations/@plone/volto-slate/editor/SlateEditor.jsx +23 -10
- package/src/customizations/@plone/volto-slate/editor/render.jsx +7 -3
- package/src/customizations/@plone/volto-slate/utils/blocks.js +11 -8
- package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +2 -2
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx +30 -27
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.test.jsx +244 -246
- package/src/customizations/volto/components/manage/Blocks/Image/View.jsx +23 -25
- package/src/customizations/volto/components/manage/Blocks/LeadImage/Edit.jsx +6 -4
- package/src/customizations/volto/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +4 -2
- package/src/customizations/volto/components/manage/Blocks/LeadImage/View.jsx +2 -2
- package/src/customizations/volto/components/manage/Controlpanels/Groups/RenderGroups.jsx +1 -1
- package/src/customizations/volto/components/manage/Controlpanels/Groups/RenderGroups.test.jsx +108 -42
- package/src/customizations/volto/components/manage/Diff/DiffField.jsx +4 -3
- package/src/customizations/volto/components/manage/Display/Display.jsx +8 -7
- package/src/customizations/volto/components/manage/History/History.jsx +58 -52
- package/src/customizations/volto/components/manage/Sidebar/ObjectBrowserBody.jsx +42 -21
- package/src/customizations/volto/components/manage/Sidebar/ObjectBrowserNav.jsx +2 -1
- package/src/customizations/volto/components/manage/Sidebar/SidebarPopup.jsx +46 -24
- package/src/customizations/volto/components/manage/Sidebar/objectBrowserSelection.js +58 -0
- package/src/customizations/volto/components/manage/Toolbar/More.jsx +8 -10
- package/src/customizations/volto/components/manage/Widgets/NumberWidget.jsx +1 -1
- package/src/customizations/volto/components/manage/Widgets/NumberWidget.test.jsx +6 -1
- package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +66 -12
- package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +10 -9
- package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +3 -2
- package/src/customizations/volto/components/theme/Comments/Comments.jsx +9 -8
- package/src/customizations/volto/components/theme/Comments/Comments.test.jsx +29 -7
- package/src/customizations/volto/components/theme/ContactForm/ContactForm.jsx +1 -1
- package/src/customizations/volto/components/theme/ContactForm/ContactForm.test.js +5 -0
- package/src/customizations/volto/components/theme/ContentMetadataTags/ContentMetadataTags.jsx +5 -7
- package/src/customizations/volto/components/theme/EventDetails/EventDetails.jsx +2 -2
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +1 -1
- package/src/customizations/volto/components/theme/Header/Header.jsx +10 -8
- package/src/customizations/volto/components/theme/Header/Header.test.jsx +1 -1
- package/src/customizations/volto/components/theme/Header/LanguageSwitcher.jsx +3 -3
- package/src/customizations/volto/components/theme/Image/Image.jsx +4 -3
- package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.jsx +1 -1
- package/src/customizations/volto/components/theme/View/DefaultView.jsx +4 -3
- package/src/customizations/volto/components/theme/View/EventView.jsx +3 -2
- package/src/customizations/volto/helpers/Html/Html.jsx +16 -6
- package/src/customizations/volto/helpers/Html/Readme.md +7 -1
- package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +3 -6
- package/src/customizations/volto/server.jsx +10 -10
- package/src/helpers/schema-utils.js +1 -1
- package/src/helpers/schema-utils.test.js +1 -1
- package/src/hocs/withErrorBoundary.jsx +1 -1
- package/src/hocs/withErrorBoundary.test.jsx +4 -11
- package/src/hocs/withRootNavigation.jsx +3 -2
- package/src/hocs/withRootNavigation.test.jsx +18 -14
- package/src/index.js +3 -3
- package/src/slate.js +1 -1
- package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.jsx +0 -76
- package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.test.js +0 -50
- package/src/customizations/volto/components/manage/Sidebar/SidebarPopup copy.jsx +0 -82
|
@@ -13,11 +13,12 @@ import {
|
|
|
13
13
|
Label,
|
|
14
14
|
} from 'semantic-ui-react';
|
|
15
15
|
import config from '@plone/volto/registry';
|
|
16
|
-
import { getSchema } from '@plone/volto/actions';
|
|
16
|
+
import { getSchema } from '@plone/volto/actions/schema/schema';
|
|
17
17
|
import { getWidget } from '@plone/volto/helpers/Widget/utils';
|
|
18
|
-
import
|
|
18
|
+
import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
|
|
19
19
|
|
|
20
|
-
import { hasBlocksData
|
|
20
|
+
import { hasBlocksData } from '@plone/volto/helpers/Blocks/Blocks';
|
|
21
|
+
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
21
22
|
import { useDispatch, shallowEqual, useSelector } from 'react-redux';
|
|
22
23
|
|
|
23
24
|
import isEqual from 'lodash/isEqual';
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { hasBlocksData
|
|
8
|
+
import { hasBlocksData } from '@plone/volto/helpers/Blocks/Blocks';
|
|
9
|
+
import { flattenHTMLToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
9
10
|
import { Image } from 'semantic-ui-react';
|
|
10
11
|
import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
|
|
11
|
-
import
|
|
12
|
+
import EventDetails from '@plone/volto/components/theme/EventDetails/EventDetails';
|
|
12
13
|
import './style.less';
|
|
13
14
|
|
|
14
15
|
const EventTextfieldView = ({ content }) => (
|
|
@@ -7,7 +7,7 @@ import React, { Component } from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import Helmet from '@plone/volto/helpers/Helmet/Helmet';
|
|
9
9
|
import serialize from 'serialize-javascript';
|
|
10
|
-
import
|
|
10
|
+
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';
|
|
@@ -104,6 +104,13 @@ class Html extends Component {
|
|
|
104
104
|
{head.link.toComponent()}
|
|
105
105
|
{head.script.toComponent()}
|
|
106
106
|
|
|
107
|
+
{config.settings.cssLayers && (
|
|
108
|
+
// Load the CSS layers from config, if any
|
|
109
|
+
<style>{`@layer ${config.settings.cssLayers.join(', ')};`}</style>
|
|
110
|
+
)}
|
|
111
|
+
|
|
112
|
+
{head.style.toComponent()}
|
|
113
|
+
|
|
107
114
|
{React.createElement('script', {
|
|
108
115
|
nonce: nonce,
|
|
109
116
|
dangerouslySetInnerHTML: {
|
|
@@ -118,6 +125,9 @@ class Html extends Component {
|
|
|
118
125
|
...(publicURL && {
|
|
119
126
|
publicURL,
|
|
120
127
|
}),
|
|
128
|
+
...(process.env.SITE_DEFAULT_LANGUAGE && {
|
|
129
|
+
defaultLanguage: process.env.SITE_DEFAULT_LANGUAGE,
|
|
130
|
+
}),
|
|
121
131
|
},
|
|
122
132
|
{ space: 2 },
|
|
123
133
|
)};`,
|
|
@@ -134,7 +144,7 @@ class Html extends Component {
|
|
|
134
144
|
<link rel="manifest" href="/site.webmanifest" />
|
|
135
145
|
<meta name="generator" content="Plone 6 - https://plone.org" />
|
|
136
146
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
137
|
-
<meta name="
|
|
147
|
+
<meta name="mobile-web-app-capable" content="yes" />
|
|
138
148
|
{process.env.NODE_ENV === 'production' && criticalCss && (
|
|
139
149
|
<style
|
|
140
150
|
dangerouslySetInnerHTML={{ __html: this.props.criticalCss }}
|
|
@@ -148,8 +158,8 @@ class Html extends Component {
|
|
|
148
158
|
rel: !criticalCss
|
|
149
159
|
? elem.props.rel
|
|
150
160
|
: elem.props.as === 'style'
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
? 'prefetch'
|
|
162
|
+
: elem.props.rel,
|
|
153
163
|
}),
|
|
154
164
|
)}
|
|
155
165
|
{/* Styles in development are loaded with Webpack's style-loader, in production,
|
|
@@ -162,8 +172,8 @@ class Html extends Component {
|
|
|
162
172
|
__html: CRITICAL_CSS_TEMPLATE,
|
|
163
173
|
}}
|
|
164
174
|
></script>
|
|
165
|
-
{extractor.getStyleElements().map((elem) => (
|
|
166
|
-
<noscript>
|
|
175
|
+
{extractor.getStyleElements().map((elem, index) => (
|
|
176
|
+
<noscript key={elem.key ?? `noscript-style-${index}`}>
|
|
167
177
|
{React.cloneElement(elem, {
|
|
168
178
|
rel: 'stylesheet',
|
|
169
179
|
crossOrigin:
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
Customized for CSP support
|
|
1
|
+
Customized for CSP support: adds a `nonce` prop that is applied to both inline
|
|
2
|
+
`<script>` tags (`window.env` and `window.__data`) and to all extracted script
|
|
3
|
+
elements, enabling a strict Content-Security-Policy `script-src 'nonce-...'`
|
|
4
|
+
header generated by the paired `server.jsx` customization.
|
|
5
|
+
|
|
6
|
+
Rebased against Volto 18 — also includes cssLayers support, head.style.toComponent(),
|
|
7
|
+
SITE_DEFAULT_LANGUAGE in window.env, and mobile-web-app-capable meta tag.
|
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
* Customized reducer as part of ticket 271001 in order to receive portal_type info
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
getBaseUrl,
|
|
11
|
-
hasApiExpander,
|
|
12
|
-
} from '@plone/volto/helpers';
|
|
7
|
+
import map from 'lodash/map';
|
|
8
|
+
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
9
|
+
import { hasApiExpander } from '@plone/volto/helpers/Utils/Utils';
|
|
13
10
|
|
|
14
11
|
import {
|
|
15
12
|
GET_BREADCRUMBS,
|
|
@@ -8,7 +8,6 @@ import express from 'express';
|
|
|
8
8
|
import { renderToString } from 'react-dom/server';
|
|
9
9
|
import { createMemoryHistory } from 'history';
|
|
10
10
|
import { parse as parseUrl } from 'url';
|
|
11
|
-
import { keys } from 'lodash';
|
|
12
11
|
import locale from 'locale';
|
|
13
12
|
import { detect } from 'detect-browser';
|
|
14
13
|
import path from 'path';
|
|
@@ -22,23 +21,21 @@ import crypto from 'crypto';
|
|
|
22
21
|
import routes from '@plone/volto/routes';
|
|
23
22
|
import config from '@plone/volto/registry';
|
|
24
23
|
|
|
24
|
+
import Html from '@plone/volto/helpers/Html/Html';
|
|
25
|
+
import Api from '@plone/volto/helpers/Api/Api';
|
|
26
|
+
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
27
|
+
import { persistAuthToken } from '@plone/volto/helpers/AuthToken/AuthToken';
|
|
25
28
|
import {
|
|
26
|
-
flattenToAppURL,
|
|
27
|
-
Html,
|
|
28
|
-
Api,
|
|
29
|
-
persistAuthToken,
|
|
30
29
|
toBackendLang,
|
|
31
30
|
toGettextLang,
|
|
32
31
|
toReactIntlLang,
|
|
33
|
-
} from '@plone/volto/helpers';
|
|
34
|
-
import { changeLanguage } from '@plone/volto/actions';
|
|
32
|
+
} from '@plone/volto/helpers/Utils/Utils';
|
|
33
|
+
import { changeLanguage } from '@plone/volto/actions//language/language';
|
|
35
34
|
|
|
36
35
|
import userSession from '@plone/volto/reducers/userSession/userSession';
|
|
37
36
|
|
|
38
37
|
import ErrorPage from '@plone/volto/error';
|
|
39
38
|
|
|
40
|
-
import languages from '@plone/volto/constants/Languages';
|
|
41
|
-
|
|
42
39
|
import configureStore from '@plone/volto/store';
|
|
43
40
|
import {
|
|
44
41
|
ReduxAsyncConnect,
|
|
@@ -61,7 +58,10 @@ function reactIntlErrorHandler(error) {
|
|
|
61
58
|
debug('i18n')(error);
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
const supported = new locale.Locales(
|
|
61
|
+
const supported = new locale.Locales(
|
|
62
|
+
config.settings?.supportedLanguages || ['en'],
|
|
63
|
+
'en',
|
|
64
|
+
);
|
|
65
65
|
|
|
66
66
|
const server = express()
|
|
67
67
|
.disable('x-powered-by')
|
|
@@ -5,7 +5,7 @@ import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
|
5
5
|
import alignTopSVG from '@plone/volto/icons/move-up.svg';
|
|
6
6
|
import alignCenterSVG from '@plone/volto/icons/row.svg';
|
|
7
7
|
import alignBottomSVG from '@plone/volto/icons/move-down.svg';
|
|
8
|
-
import { addStyling } from '@plone/volto/helpers';
|
|
8
|
+
import { addStyling } from '@plone/volto/helpers/Extensions';
|
|
9
9
|
|
|
10
10
|
export const ALIGN_INFO_MAP = {
|
|
11
11
|
narrow_width: [imageNarrowSVG, 'Narrow width'],
|
|
@@ -16,7 +16,7 @@ jest.mock('@plone/volto/icons/move-up.svg', () => 'move-up-svg');
|
|
|
16
16
|
jest.mock('@plone/volto/icons/row.svg', () => 'row-svg');
|
|
17
17
|
jest.mock('@plone/volto/icons/move-down.svg', () => 'move-down-svg');
|
|
18
18
|
|
|
19
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
19
|
+
jest.mock('@plone/volto/helpers/Extensions', () => ({
|
|
20
20
|
addStyling: jest.fn((props) => ({
|
|
21
21
|
properties: {
|
|
22
22
|
styles: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import ErrorBoundary from '@plone/volto/components/theme/Error/ErrorBoundary';
|
|
3
3
|
|
|
4
4
|
export default function withErrorBoundary(WrappedComponent, options = {}) {
|
|
5
5
|
// Handle backward compatibility - if second param is a component, treat as fallback
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
|
-
import
|
|
3
|
+
import ErrorBoundary from '@plone/volto/components/theme/Error/ErrorBoundary';
|
|
4
4
|
import withErrorBoundary from './withErrorBoundary';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
return children;
|
|
11
|
-
} catch (error) {
|
|
12
|
-
if (onError) onError(error, { componentStack: 'test-stack' });
|
|
13
|
-
return fallback || <div>Error occurred</div>;
|
|
14
|
-
}
|
|
15
|
-
}),
|
|
6
|
+
jest.mock('@plone/volto/components/theme/Error/ErrorBoundary', () => ({
|
|
7
|
+
__esModule: true,
|
|
8
|
+
default: jest.fn(({ children, fallback }) => children || fallback || null),
|
|
16
9
|
}));
|
|
17
10
|
|
|
18
11
|
// Test components
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { connect, useDispatch } from 'react-redux';
|
|
3
|
-
import { getBaseUrl
|
|
4
|
-
import {
|
|
3
|
+
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
4
|
+
import { hasApiExpander } from '@plone/volto/helpers/Utils/Utils';
|
|
5
|
+
import { getNavigation } from '@plone/volto/actions/navigation/navigation';
|
|
5
6
|
import config from '@plone/volto/registry';
|
|
6
7
|
|
|
7
8
|
export default function withRootNavigation(WrappedComponent) {
|
|
@@ -4,24 +4,28 @@ import configureStore from 'redux-mock-store';
|
|
|
4
4
|
import thunk from 'redux-thunk'; // ✅ Add redux-thunk middleware
|
|
5
5
|
import { render } from '@testing-library/react';
|
|
6
6
|
import withRootNavigation from './withRootNavigation';
|
|
7
|
-
import { getNavigation } from '@plone/volto/actions';
|
|
8
|
-
import { getBaseUrl
|
|
7
|
+
import { getNavigation } from '@plone/volto/actions/navigation/navigation';
|
|
8
|
+
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
9
|
+
import { hasApiExpander } from '@plone/volto/helpers/Utils/Utils';
|
|
9
10
|
import config from '@plone/volto/registry';
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
jest.
|
|
13
|
-
getNavigation: jest.fn(() => ({ type: 'GET_NAVIGATION' })), // ✅ Ensure it returns a plain object
|
|
12
|
+
jest.mock('@plone/volto/actions/navigation/navigation', () => ({
|
|
13
|
+
getNavigation: jest.fn(() => ({ type: 'GET_NAVIGATION' })),
|
|
14
14
|
}));
|
|
15
|
-
jest.mock('@plone/volto/helpers', () => ({
|
|
15
|
+
jest.mock('@plone/volto/helpers/Url/Url', () => ({
|
|
16
16
|
getBaseUrl: jest.fn(() => '/en'),
|
|
17
|
+
}));
|
|
18
|
+
jest.mock('@plone/volto/helpers/Utils/Utils', () => ({
|
|
17
19
|
hasApiExpander: jest.fn(() => false),
|
|
18
20
|
}));
|
|
19
21
|
jest.mock('@plone/volto/registry', () => ({
|
|
20
|
-
|
|
22
|
+
__esModule: true,
|
|
23
|
+
default: {
|
|
24
|
+
settings: { navDepth: 2 },
|
|
25
|
+
},
|
|
21
26
|
}));
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
const mockStore = configureStore([thunk]); // Add thunk to support async actions
|
|
28
|
+
const mockStore = configureStore([thunk]);
|
|
25
29
|
|
|
26
30
|
const initialState = {
|
|
27
31
|
navigation: { items: [{ title: 'Home', url: '/' }] },
|
|
@@ -51,13 +55,13 @@ describe('withRootNavigation HOC', () => {
|
|
|
51
55
|
</Provider>,
|
|
52
56
|
);
|
|
53
57
|
|
|
54
|
-
expect(getBaseUrl).toHaveBeenCalledWith('/en');
|
|
55
|
-
expect(hasApiExpander).toHaveBeenCalledWith('navigation', '/en');
|
|
56
|
-
expect(getNavigation).toHaveBeenCalledWith('/en', config.settings.navDepth);
|
|
58
|
+
expect(getBaseUrl).toHaveBeenCalledWith('/en');
|
|
59
|
+
expect(hasApiExpander).toHaveBeenCalledWith('navigation', '/en');
|
|
60
|
+
expect(getNavigation).toHaveBeenCalledWith('/en', config.settings.navDepth);
|
|
57
61
|
});
|
|
58
62
|
|
|
59
63
|
test('does not call getNavigation if API expander is already set', () => {
|
|
60
|
-
hasApiExpander.mockReturnValue(true);
|
|
64
|
+
hasApiExpander.mockReturnValue(true);
|
|
61
65
|
|
|
62
66
|
render(
|
|
63
67
|
<Provider store={store}>
|
|
@@ -65,6 +69,6 @@ describe('withRootNavigation HOC', () => {
|
|
|
65
69
|
</Provider>,
|
|
66
70
|
);
|
|
67
71
|
|
|
68
|
-
expect(getNavigation).not.toHaveBeenCalled();
|
|
72
|
+
expect(getNavigation).not.toHaveBeenCalled();
|
|
69
73
|
});
|
|
70
74
|
});
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { v4 as uuid } from 'uuid';
|
|
3
|
-
import
|
|
3
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
4
4
|
import { default as TokenWidgetEdit } from '@plone/volto/components/manage/Widgets/TokenWidget';
|
|
5
5
|
import { serializeNodesToText } from '@plone/volto-slate/editor/render';
|
|
6
6
|
import TableBlockEdit from '@plone/volto-slate/blocks/Table/TableBlockEdit';
|
|
@@ -396,8 +396,8 @@ const applyConfig = (config) => {
|
|
|
396
396
|
return override_toc && level
|
|
397
397
|
? [parseInt(level.slice(1)), entry_text]
|
|
398
398
|
: config.settings.slate.topLevelTargetElements.includes(type)
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
? [parseInt(type.slice(1)), plaintext]
|
|
400
|
+
: null;
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
// Apply accordion block customization
|
package/src/slate.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
BlockButton,
|
|
7
7
|
} from '@plone/volto-slate/editor/ui';
|
|
8
8
|
import installCallout from '@plone/volto-slate/editor/plugins/Callout';
|
|
9
|
-
import
|
|
9
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
10
10
|
import { Editor, Transforms, Text } from 'slate';
|
|
11
11
|
import { useSlate } from 'slate-react';
|
|
12
12
|
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { defineMessages, useIntl } from 'react-intl';
|
|
2
|
-
import { Icon } from '@plone/volto/components';
|
|
3
|
-
import { Button } from 'semantic-ui-react';
|
|
4
|
-
import imageLeftSVG from '@plone/volto/icons/image-left.svg';
|
|
5
|
-
import imageRightSVG from '@plone/volto/icons/image-right.svg';
|
|
6
|
-
import imageFitSVG from '@plone/volto/icons/image-fit.svg';
|
|
7
|
-
import imageWideSVG from '@plone/volto/icons/image-wide.svg';
|
|
8
|
-
import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
9
|
-
|
|
10
|
-
const messages = defineMessages({
|
|
11
|
-
left: {
|
|
12
|
-
id: 'Left',
|
|
13
|
-
defaultMessage: 'Left',
|
|
14
|
-
},
|
|
15
|
-
right: {
|
|
16
|
-
id: 'Right',
|
|
17
|
-
defaultMessage: 'Right',
|
|
18
|
-
},
|
|
19
|
-
center: {
|
|
20
|
-
id: 'Center',
|
|
21
|
-
defaultMessage: 'Center',
|
|
22
|
-
},
|
|
23
|
-
wide: {
|
|
24
|
-
id: 'Wide',
|
|
25
|
-
defaultMessage: 'Wide',
|
|
26
|
-
},
|
|
27
|
-
full: {
|
|
28
|
-
id: 'Full',
|
|
29
|
-
defaultMessage: 'Full',
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const AlignChooser = ({
|
|
34
|
-
align,
|
|
35
|
-
onChangeBlock,
|
|
36
|
-
data,
|
|
37
|
-
block,
|
|
38
|
-
actions = ['left', 'right', 'center', 'full'],
|
|
39
|
-
}) => {
|
|
40
|
-
const intl = useIntl();
|
|
41
|
-
|
|
42
|
-
const ICON_MAP = {
|
|
43
|
-
left: imageLeftSVG,
|
|
44
|
-
right: imageRightSVG,
|
|
45
|
-
center: imageFitSVG,
|
|
46
|
-
wide: imageWideSVG,
|
|
47
|
-
full: imageFullSVG,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
function onAlignBlock(align) {
|
|
51
|
-
onChangeBlock(block, {
|
|
52
|
-
...data,
|
|
53
|
-
copyrightPosition: align,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div className="align-buttons">
|
|
59
|
-
{actions.map((action) => (
|
|
60
|
-
<Button.Group key={action}>
|
|
61
|
-
<Button
|
|
62
|
-
icon
|
|
63
|
-
basic
|
|
64
|
-
aria-label={intl.formatMessage(messages[action])}
|
|
65
|
-
onClick={() => onAlignBlock(action)}
|
|
66
|
-
active={data.copyrightPosition === action}
|
|
67
|
-
>
|
|
68
|
-
<Icon name={ICON_MAP[action]} size="24px" />
|
|
69
|
-
</Button>
|
|
70
|
-
</Button.Group>
|
|
71
|
-
))}
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default AlignChooser;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import configureStore from 'redux-mock-store';
|
|
3
|
-
import { Provider } from 'react-intl-redux';
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
import AlignChooser from './AlignChooser';
|
|
6
|
-
|
|
7
|
-
const mockStore = configureStore();
|
|
8
|
-
|
|
9
|
-
describe('AlignChooser', () => {
|
|
10
|
-
const props = {
|
|
11
|
-
align: 'left',
|
|
12
|
-
onChangeBlock: jest.fn(),
|
|
13
|
-
data: { copyrightPosition: 'left' },
|
|
14
|
-
block: '123',
|
|
15
|
-
actions: ['left', 'right', 'center', 'full'],
|
|
16
|
-
};
|
|
17
|
-
const store = mockStore({
|
|
18
|
-
intl: {
|
|
19
|
-
locale: 'en',
|
|
20
|
-
messages: {},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('renders the align buttons', () => {
|
|
25
|
-
const { container } = render(
|
|
26
|
-
<Provider store={store}>
|
|
27
|
-
<AlignChooser {...props} />
|
|
28
|
-
</Provider>,
|
|
29
|
-
);
|
|
30
|
-
expect(container).toMatchSnapshot();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('calls onChangeBlock when an align button is clicked', () => {
|
|
34
|
-
const { container } = render(
|
|
35
|
-
<Provider store={store}>
|
|
36
|
-
<AlignChooser {...props} />
|
|
37
|
-
</Provider>,
|
|
38
|
-
);
|
|
39
|
-
expect(container).toMatchSnapshot();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('marks the active align button as active', () => {
|
|
43
|
-
const { container } = render(
|
|
44
|
-
<Provider store={store}>
|
|
45
|
-
<AlignChooser {...props} />
|
|
46
|
-
</Provider>,
|
|
47
|
-
);
|
|
48
|
-
expect(container).toMatchSnapshot();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// Check this https://github.com/plone/volto/pull/5520
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Portal } from 'react-portal';
|
|
4
|
-
import { CSSTransition } from 'react-transition-group';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { doesNodeContainClick } from 'semantic-ui-react/dist/commonjs/lib';
|
|
7
|
-
|
|
8
|
-
const DEFAULT_TIMEOUT = 500;
|
|
9
|
-
|
|
10
|
-
const SidebarPopup = (props) => {
|
|
11
|
-
const { children, open, onClose, overlay } = props;
|
|
12
|
-
|
|
13
|
-
const asideElement = React.useRef();
|
|
14
|
-
|
|
15
|
-
const handleClickOutside = (e) => {
|
|
16
|
-
if (asideElement && doesNodeContainClick(asideElement.current, e)) return;
|
|
17
|
-
onClose();
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
React.useEffect(() => {
|
|
21
|
-
document.addEventListener('mousedown', handleClickOutside, false);
|
|
22
|
-
return () => {
|
|
23
|
-
document.removeEventListener('mousedown', handleClickOutside, false);
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<>
|
|
29
|
-
{overlay && (
|
|
30
|
-
<CSSTransition
|
|
31
|
-
in={open}
|
|
32
|
-
timeout={DEFAULT_TIMEOUT}
|
|
33
|
-
classNames="overlay-container"
|
|
34
|
-
unmountOnExit
|
|
35
|
-
>
|
|
36
|
-
<Portal node={document?.body}>
|
|
37
|
-
<div className="overlay-container"></div>
|
|
38
|
-
</Portal>
|
|
39
|
-
</CSSTransition>
|
|
40
|
-
)}
|
|
41
|
-
<CSSTransition
|
|
42
|
-
in={open}
|
|
43
|
-
timeout={DEFAULT_TIMEOUT}
|
|
44
|
-
classNames="sidebar-container"
|
|
45
|
-
unmountOnExit
|
|
46
|
-
>
|
|
47
|
-
<Portal>
|
|
48
|
-
<aside
|
|
49
|
-
id="test"
|
|
50
|
-
role="presentation"
|
|
51
|
-
onClick={(e) => {
|
|
52
|
-
e.stopPropagation();
|
|
53
|
-
}}
|
|
54
|
-
onKeyDown={(e) => {
|
|
55
|
-
e.stopPropagation();
|
|
56
|
-
}}
|
|
57
|
-
ref={asideElement}
|
|
58
|
-
key="sidebarpopup"
|
|
59
|
-
className="sidebar-container"
|
|
60
|
-
style={{ overflowY: 'auto' }}
|
|
61
|
-
>
|
|
62
|
-
{children}
|
|
63
|
-
</aside>
|
|
64
|
-
</Portal>
|
|
65
|
-
</CSSTransition>
|
|
66
|
-
</>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
SidebarPopup.propTypes = {
|
|
71
|
-
open: PropTypes.bool,
|
|
72
|
-
onClose: PropTypes.func,
|
|
73
|
-
overlay: PropTypes.bool,
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
SidebarPopup.defaultProps = {
|
|
77
|
-
open: false,
|
|
78
|
-
onClose: () => {},
|
|
79
|
-
overlay: false,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default SidebarPopup;
|