@kitconcept/volto-light-theme 8.0.0-alpha.2 → 8.0.0-alpha.21
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/.changelog.draft +3 -4
- package/CHANGELOG.md +232 -0
- package/locales/de/LC_MESSAGES/volto.po +30 -115
- package/locales/en/LC_MESSAGES/volto.po +30 -115
- package/locales/es/LC_MESSAGES/volto.po +31 -116
- package/locales/eu/LC_MESSAGES/volto.po +58 -124
- package/locales/pt_BR/LC_MESSAGES/volto.po +38 -123
- package/locales/volto.pot +31 -116
- package/package.json +7 -4
- package/src/__mocks__/semantic-ui-react.ts +31 -0
- package/src/components/Blocks/Block/Edit.jsx +14 -6
- package/src/components/Blocks/Block/EditBlockWrapper.jsx +9 -3
- package/src/components/Blocks/Block/ErrorBoundary.test.tsx +55 -0
- package/src/components/Blocks/Block/ErrorBoundary.tsx +92 -0
- package/src/components/Blocks/Block/ErrorBoundaryMessage.tsx +66 -0
- package/src/components/Blocks/EventCalendar/Search/components/EventTemplate.tsx +1 -1
- package/src/components/Blocks/Image/Edit.jsx +1 -0
- package/src/components/Blocks/Listing/DefaultTemplate.jsx +12 -6
- package/src/components/Blocks/Listing/GridTemplate.jsx +16 -7
- package/src/components/Blocks/Listing/ListingBody.jsx +4 -1
- package/src/components/Blocks/Listing/SummaryTemplate.jsx +16 -7
- package/src/components/Blocks/Teaser/DefaultBody.tsx +25 -5
- package/src/components/Blocks/schema.ts +69 -0
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +128 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +117 -0
- package/src/components/Caption/Caption.test.tsx +31 -0
- package/src/components/Caption/{Caption.jsx → Caption.tsx} +14 -21
- package/src/components/Footer/ColumnLinks.tsx +2 -2
- package/src/components/Footer/slots/Colophon.tsx +13 -1
- package/src/components/Footer/slots/CoreFooter.tsx +4 -2
- package/src/components/Header/Header.tsx +3 -3
- package/src/components/LanguageSelector/LanguageSelector.tsx +91 -0
- package/src/components/MobileNavigation/MobileNavigation.jsx +11 -9
- package/src/components/Navigation/Navigation.test.tsx +176 -0
- package/src/components/Navigation/{Navigation.jsx → Navigation.tsx} +77 -37
- package/src/components/StickyMenu/MobileCarouselArrowButton.tsx +81 -0
- package/src/components/StickyMenu/MobileStickyMenu.tsx +76 -0
- package/src/components/Summary/DefaultSummary.tsx +10 -3
- package/src/components/Summary/EventSummary.tsx +10 -3
- package/src/components/Summary/FileSummary.tsx +10 -3
- package/src/components/Summary/NewsItemSummary.tsx +10 -3
- package/src/components/Summary/PersonSummary.tsx +10 -3
- package/src/components/Summary/Summary.stories.tsx +46 -30
- package/src/components/Tags/Tags.test.tsx +71 -0
- package/src/components/Tags/{Tags.jsx → Tags.tsx} +9 -25
- package/src/components/Theme/EventView.jsx +4 -4
- package/src/components/Theme/NewsItemView.jsx +4 -4
- package/src/components/Theme/RenderBlocks.jsx +45 -37
- package/src/components/Theme/RenderBlocksV2.jsx +51 -20
- package/src/components/Widgets/ColorSwatch.stories.tsx +197 -0
- package/src/components/Widgets/ColorSwatch.test.tsx +188 -0
- package/src/components/Widgets/ColorSwatch.tsx +77 -39
- package/src/components/Widgets/SoftTextWidget.tsx +129 -0
- package/src/components/Widgets/SoftTextareaWidget.tsx +118 -0
- package/src/components/Widgets/ThemeColorSwatch.tsx +5 -9
- package/src/config/blocks.tsx +21 -29
- package/src/config/slots.ts +7 -0
- package/src/config/widgets.ts +5 -9
- package/src/customizations/volto/components/manage/DragDropList/DragDropList.jsx +263 -0
- package/src/customizations/volto/components/theme/LanguageSelector/LanguageSelector.tsx +10 -0
- package/src/helpers/styleDefinitions.test.tsx +30 -0
- package/src/helpers/styleDefinitions.ts +49 -0
- package/src/internalChecks.test.ts +94 -0
- package/src/primitives/Card/Card.stories.tsx +4 -1
- package/src/primitives/Card/Card.test.tsx +11 -33
- package/src/primitives/Card/Card.tsx +33 -43
- package/src/primitives/IconLinkList.tsx +53 -52
- package/src/theme/_bgcolor-blocks-layout.scss +43 -45
- package/src/theme/_content.scss +12 -13
- package/src/theme/_export_import.scss +94 -0
- package/src/theme/_footer.scss +64 -19
- package/src/theme/_header.scss +21 -4
- package/src/theme/_insets.scss +1 -1
- package/src/theme/_layout.scss +34 -15
- package/src/theme/_mobile-sticky-menu.scss +92 -0
- package/src/theme/_search-page.scss +249 -0
- package/src/theme/_typo-custom.scss +16 -5
- package/src/theme/_variables.scss +19 -4
- package/src/theme/_widgets.scss +15 -27
- package/src/theme/blocks/_accordion.scss +11 -4
- package/src/theme/blocks/_grid.scss +9 -77
- package/src/theme/blocks/_listing.scss +60 -126
- package/src/theme/blocks/_search.scss +3 -4
- package/src/theme/blocks/_table.scss +1 -0
- package/src/theme/blocks/_teaser.scss +7 -117
- package/src/theme/blocks/error-boundary.scss +11 -0
- package/src/theme/card.scss +107 -70
- package/src/theme/main.scss +5 -0
- package/src/theme/notfound.scss +27 -0
- package/src/theme/person.scss +28 -12
- package/src/theme/sticky-menu.scss +7 -5
- package/src/types.d.ts +1 -0
- package/vitest.config.mjs +4 -0
- package/razzle.extend.js +0 -38
- package/src/components/Blocks/schema.js +0 -44
- package/src/components/Breadcrumbs/Breadcrumbs.jsx +0 -118
- package/src/components/Widgets/AlignWidget.tsx +0 -84
- package/src/components/Widgets/BlockAlignment.tsx +0 -88
- package/src/components/Widgets/BlockWidth.tsx +0 -101
- package/src/components/Widgets/Buttons.tsx +0 -144
- package/src/components/Widgets/Size.tsx +0 -78
|
@@ -22,15 +22,17 @@ type Story = StoryObj<typeof meta>;
|
|
|
22
22
|
|
|
23
23
|
export const Summary: Story = {
|
|
24
24
|
render: (args) => (
|
|
25
|
-
<div style={{ width: '300px' }}>
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
25
|
+
<div className="card" style={{ width: '300px' }}>
|
|
26
|
+
<div className="card-summary">
|
|
27
|
+
<Wrapper>
|
|
28
|
+
<DefaultSummary {...args} />
|
|
29
|
+
</Wrapper>
|
|
30
|
+
</div>
|
|
29
31
|
</div>
|
|
30
32
|
),
|
|
31
33
|
args: {
|
|
32
34
|
item: {
|
|
33
|
-
title: '
|
|
35
|
+
title: 'Summary',
|
|
34
36
|
description:
|
|
35
37
|
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea.',
|
|
36
38
|
head_title: 'Simple Card',
|
|
@@ -40,15 +42,17 @@ export const Summary: Story = {
|
|
|
40
42
|
|
|
41
43
|
export const SummaryWithLink: Story = {
|
|
42
44
|
render: (args) => (
|
|
43
|
-
<div style={{ width: '300px' }}>
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
|
|
45
|
+
<div className="card" style={{ width: '300px' }}>
|
|
46
|
+
<div className="card-summary">
|
|
47
|
+
<Wrapper>
|
|
48
|
+
<DefaultSummary {...args} />
|
|
49
|
+
</Wrapper>
|
|
50
|
+
</div>
|
|
47
51
|
</div>
|
|
48
52
|
),
|
|
49
53
|
args: {
|
|
50
54
|
item: {
|
|
51
|
-
title: '
|
|
55
|
+
title: 'Summary',
|
|
52
56
|
description:
|
|
53
57
|
'[Lorem ipsum](https://example.com) dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea.',
|
|
54
58
|
head_title: 'Simple Card',
|
|
@@ -58,15 +62,17 @@ export const SummaryWithLink: Story = {
|
|
|
58
62
|
|
|
59
63
|
export const SummaryHideDescription: Story = {
|
|
60
64
|
render: (args) => (
|
|
61
|
-
<div style={{ width: '300px' }}>
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
+
<div className="card" style={{ width: '300px' }}>
|
|
66
|
+
<div className="card-summary">
|
|
67
|
+
<Wrapper>
|
|
68
|
+
<DefaultSummary {...args} />
|
|
69
|
+
</Wrapper>
|
|
70
|
+
</div>
|
|
65
71
|
</div>
|
|
66
72
|
),
|
|
67
73
|
args: {
|
|
68
74
|
item: {
|
|
69
|
-
title: '
|
|
75
|
+
title: 'Summary',
|
|
70
76
|
description:
|
|
71
77
|
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea.',
|
|
72
78
|
head_title: 'Simple Card',
|
|
@@ -77,15 +83,17 @@ export const SummaryHideDescription: Story = {
|
|
|
77
83
|
|
|
78
84
|
export const NewsItemSummary: Story = {
|
|
79
85
|
render: (args) => (
|
|
80
|
-
<div style={{ width: '300px' }}>
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
|
|
86
|
+
<div className="card" style={{ width: '300px' }}>
|
|
87
|
+
<div className="card-summary">
|
|
88
|
+
<Wrapper>
|
|
89
|
+
<NewsItemSummaryComponent {...args} />
|
|
90
|
+
</Wrapper>
|
|
91
|
+
</div>
|
|
84
92
|
</div>
|
|
85
93
|
),
|
|
86
94
|
args: {
|
|
87
95
|
item: {
|
|
88
|
-
title: '
|
|
96
|
+
title: 'Summary',
|
|
89
97
|
description:
|
|
90
98
|
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea.',
|
|
91
99
|
head_title: 'Simple Card',
|
|
@@ -98,15 +106,17 @@ export const NewsItemSummary: Story = {
|
|
|
98
106
|
|
|
99
107
|
export const EventSummary: Story = {
|
|
100
108
|
render: (args) => (
|
|
101
|
-
<div style={{ width: '300px' }}>
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
|
|
109
|
+
<div className="card" style={{ width: '300px' }}>
|
|
110
|
+
<div className="card-summary">
|
|
111
|
+
<Wrapper>
|
|
112
|
+
<EventSummaryComponent {...args} />
|
|
113
|
+
</Wrapper>
|
|
114
|
+
</div>
|
|
105
115
|
</div>
|
|
106
116
|
),
|
|
107
117
|
args: {
|
|
108
118
|
item: {
|
|
109
|
-
title: '
|
|
119
|
+
title: 'Summary',
|
|
110
120
|
description:
|
|
111
121
|
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea.',
|
|
112
122
|
head_title: 'Simple Card',
|
|
@@ -119,17 +129,23 @@ export const EventSummary: Story = {
|
|
|
119
129
|
|
|
120
130
|
export const FileSummary: Story = {
|
|
121
131
|
render: (args) => (
|
|
122
|
-
<div style={{ width: '300px' }}>
|
|
123
|
-
<
|
|
124
|
-
<
|
|
125
|
-
|
|
132
|
+
<div className="card" style={{ width: '300px' }}>
|
|
133
|
+
<div className="card-summary">
|
|
134
|
+
<Wrapper>
|
|
135
|
+
<div className="file-teaser">
|
|
136
|
+
<FileSummaryComponent {...args} />
|
|
137
|
+
</div>
|
|
138
|
+
</Wrapper>
|
|
139
|
+
</div>
|
|
126
140
|
</div>
|
|
127
141
|
),
|
|
128
142
|
args: {
|
|
129
143
|
item: {
|
|
130
|
-
title: '
|
|
144
|
+
title: 'Summary',
|
|
131
145
|
description:
|
|
132
146
|
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea.',
|
|
147
|
+
getObjSize: '72.7 KB',
|
|
148
|
+
mime_type: 'application/pdf',
|
|
133
149
|
head_title: 'Simple Card',
|
|
134
150
|
start: '2023-01-01T11:00:00+00:00',
|
|
135
151
|
end: '2023-12-31T12:00:00+00:00',
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, it, beforeEach, expect, vi } from 'vitest';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
import Tags from './Tags';
|
|
7
|
+
import type { Content } from '@plone/types';
|
|
8
|
+
|
|
9
|
+
const mockConfig = vi.hoisted(() => ({
|
|
10
|
+
getComponent: vi.fn(() => ({
|
|
11
|
+
component: ({ children }: { children: React.ReactNode }) => (
|
|
12
|
+
<div data-testid="container">{children}</div>
|
|
13
|
+
),
|
|
14
|
+
})),
|
|
15
|
+
settings: {
|
|
16
|
+
showTags: true,
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
vi.mock('@plone/registry', () => ({
|
|
21
|
+
__esModule: true,
|
|
22
|
+
default: mockConfig,
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
const mockUseLiveData = vi.fn();
|
|
26
|
+
|
|
27
|
+
vi.mock('@kitconcept/volto-light-theme/helpers/useLiveData', () => ({
|
|
28
|
+
useLiveData: (content: unknown, behavior: unknown, field: string) =>
|
|
29
|
+
mockUseLiveData(content, behavior, field),
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
describe('Tags', () => {
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
vi.clearAllMocks();
|
|
35
|
+
mockConfig.settings.showTags = true;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('renders tag links when enabled', () => {
|
|
39
|
+
mockUseLiveData.mockReturnValue(['React', 'Volto']);
|
|
40
|
+
render(
|
|
41
|
+
<MemoryRouter>
|
|
42
|
+
<Tags content={{ subjects: ['React', 'Volto'] } as Content} />
|
|
43
|
+
</MemoryRouter>,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const links = screen.getAllByRole('link');
|
|
47
|
+
expect(links).toHaveLength(2);
|
|
48
|
+
expect(links[0]).toHaveAttribute('href', '/search?Subject=React');
|
|
49
|
+
expect(links[1]).toHaveTextContent('Volto');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('returns null when tags are hidden or empty', () => {
|
|
53
|
+
mockConfig.settings.showTags = false;
|
|
54
|
+
mockUseLiveData.mockReturnValue(['React']);
|
|
55
|
+
const { container: hidden } = render(
|
|
56
|
+
<MemoryRouter>
|
|
57
|
+
<Tags />
|
|
58
|
+
</MemoryRouter>,
|
|
59
|
+
);
|
|
60
|
+
expect(hidden.firstChild).toBeNull();
|
|
61
|
+
|
|
62
|
+
mockConfig.settings.showTags = true;
|
|
63
|
+
mockUseLiveData.mockReturnValue([]);
|
|
64
|
+
const { container: empty } = render(
|
|
65
|
+
<MemoryRouter>
|
|
66
|
+
<Tags />
|
|
67
|
+
</MemoryRouter>,
|
|
68
|
+
);
|
|
69
|
+
expect(empty.firstChild).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Link } from 'react-router-dom';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
3
|
import { Container as SemanticContainer } from 'semantic-ui-react';
|
|
4
4
|
import config from '@plone/registry';
|
|
5
5
|
import { useLiveData } from '@kitconcept/volto-light-theme/helpers/useLiveData';
|
|
6
|
+
import type { Content } from '@plone/types';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
type TagsProps = {
|
|
9
|
+
content?: Content;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Tags: React.FC<TagsProps> = ({ content }) => {
|
|
13
|
+
const safeContent = content ?? ({ subjects: [] } as Content);
|
|
14
|
+
const tags = useLiveData<string[]>(safeContent, undefined, 'subjects') || [];
|
|
9
15
|
const Container =
|
|
10
16
|
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
|
11
17
|
|
|
@@ -22,26 +28,4 @@ const Tags = ({ content }) => {
|
|
|
22
28
|
);
|
|
23
29
|
};
|
|
24
30
|
|
|
25
|
-
/**
|
|
26
|
-
* Property types.
|
|
27
|
-
* @property {Object} propTypes Property types.
|
|
28
|
-
* @static
|
|
29
|
-
*/
|
|
30
|
-
Tags.propTypes = {
|
|
31
|
-
content: PropTypes.shape({
|
|
32
|
-
subjects: PropTypes.arrayOf(PropTypes.string),
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Default properties.
|
|
38
|
-
* @property {Object} defaultProps Default properties.
|
|
39
|
-
* @static
|
|
40
|
-
*/
|
|
41
|
-
Tags.defaultProps = {
|
|
42
|
-
content: {
|
|
43
|
-
subjects: [],
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
31
|
export default Tags;
|
|
@@ -73,14 +73,14 @@ const EventView = (props) => {
|
|
|
73
73
|
return (
|
|
74
74
|
<Container id="page-document" className="view-wrapper event-view">
|
|
75
75
|
<div className="dates">
|
|
76
|
-
{content?.head_title && (
|
|
77
|
-
<span className="head-title"> {content?.head_title}</span>
|
|
78
|
-
)}{' '}
|
|
79
76
|
{formattedDate ? (
|
|
80
77
|
<span className="day" suppressHydrationWarning>
|
|
81
78
|
{formattedDate}
|
|
82
79
|
</span>
|
|
83
|
-
) : null}
|
|
80
|
+
) : null}{' '}
|
|
81
|
+
{content?.head_title && (
|
|
82
|
+
<span className="head-title"> {content?.head_title}</span>
|
|
83
|
+
)}
|
|
84
84
|
</div>
|
|
85
85
|
{hasBlocksData(content) ? (
|
|
86
86
|
<>
|
|
@@ -21,9 +21,6 @@ const NewsItemView = ({ content }) => {
|
|
|
21
21
|
return (
|
|
22
22
|
<Container id="page-document" className="view-wrapper newsitem-view">
|
|
23
23
|
<div className="dates">
|
|
24
|
-
{content?.head_title && (
|
|
25
|
-
<span className="head-title"> {content?.head_title}</span>
|
|
26
|
-
)}{' '}
|
|
27
24
|
{content.effective ? (
|
|
28
25
|
<FormattedDate
|
|
29
26
|
key="day"
|
|
@@ -35,7 +32,10 @@ const NewsItemView = ({ content }) => {
|
|
|
35
32
|
}}
|
|
36
33
|
className="day"
|
|
37
34
|
/>
|
|
38
|
-
) : null}
|
|
35
|
+
) : null}{' '}
|
|
36
|
+
{content?.head_title && (
|
|
37
|
+
<span className="head-title"> {content?.head_title}</span>
|
|
38
|
+
)}
|
|
39
39
|
</div>
|
|
40
40
|
<RenderBlocks content={content} />
|
|
41
41
|
</Container>
|
|
@@ -12,6 +12,7 @@ import config from '@plone/volto/registry';
|
|
|
12
12
|
import ViewDefaultBlock from '@plone/volto/components/manage/Blocks/Block/DefaultView';
|
|
13
13
|
import MaybeWrap from '@plone/volto/components/manage/MaybeWrap/MaybeWrap';
|
|
14
14
|
import RenderEmptyBlock from '@plone/volto/components/theme/View/RenderEmptyBlock';
|
|
15
|
+
import ErrorBoundary from '../Blocks/Block/ErrorBoundary';
|
|
15
16
|
|
|
16
17
|
import StyleWrapperV3 from './StyleWrapperV3';
|
|
17
18
|
import RenderBlocksV2 from './RenderBlocksV2';
|
|
@@ -69,48 +70,55 @@ const RenderBlocks = (props) => {
|
|
|
69
70
|
|
|
70
71
|
if (Block) {
|
|
71
72
|
return (
|
|
72
|
-
<
|
|
73
|
-
key={block}
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
<ErrorBoundary
|
|
74
|
+
key={`error-boundary-block-${block}`}
|
|
75
|
+
name={`blockId-${block}-type-${content[blocksFieldname]?.[block]?.['@type']}`}
|
|
76
|
+
block={block}
|
|
77
|
+
type={content[blocksFieldname]?.[block]?.['@type']}
|
|
76
78
|
>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
id={block}
|
|
87
|
-
metadata={metadata}
|
|
88
|
-
properties={content}
|
|
79
|
+
<MaybeWrap
|
|
80
|
+
key={block}
|
|
81
|
+
condition={blockWrapperTag}
|
|
82
|
+
as={blockWrapperTag}
|
|
83
|
+
>
|
|
84
|
+
{currentBlockModel === 3 ? (
|
|
85
|
+
<StyleWrapperV3
|
|
86
|
+
block={block}
|
|
87
|
+
content={content}
|
|
89
88
|
data={blockData}
|
|
90
|
-
path={getBaseUrl(location?.pathname || '')}
|
|
91
89
|
blocksConfig={blocksConfig}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
isContainer={isContainer}
|
|
91
|
+
>
|
|
92
|
+
<Block
|
|
93
|
+
id={block}
|
|
94
|
+
metadata={metadata}
|
|
95
|
+
properties={content}
|
|
96
|
+
data={blockData}
|
|
97
|
+
path={getBaseUrl(location?.pathname || '')}
|
|
98
|
+
blocksConfig={blocksConfig}
|
|
99
|
+
/>
|
|
100
|
+
</StyleWrapperV3>
|
|
101
|
+
) : (
|
|
102
|
+
<StyleWrapper
|
|
103
|
+
key={block}
|
|
104
|
+
{...props}
|
|
104
105
|
id={block}
|
|
105
|
-
|
|
106
|
-
properties={content}
|
|
106
|
+
block={block}
|
|
107
107
|
data={blockData}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
isContainer={isContainer}
|
|
109
|
+
>
|
|
110
|
+
<Block
|
|
111
|
+
id={block}
|
|
112
|
+
metadata={metadata}
|
|
113
|
+
properties={content}
|
|
114
|
+
data={blockData}
|
|
115
|
+
path={getBaseUrl(location?.pathname || '')}
|
|
116
|
+
blocksConfig={blocksConfig}
|
|
117
|
+
/>
|
|
118
|
+
</StyleWrapper>
|
|
119
|
+
)}
|
|
120
|
+
</MaybeWrap>
|
|
121
|
+
</ErrorBoundary>
|
|
114
122
|
);
|
|
115
123
|
}
|
|
116
124
|
|
|
@@ -15,6 +15,8 @@ import MaybeWrap from '@plone/volto/components/manage/MaybeWrap/MaybeWrap';
|
|
|
15
15
|
import RenderEmptyBlock from '@plone/volto/components/theme/View/RenderEmptyBlock';
|
|
16
16
|
import cx from 'classnames';
|
|
17
17
|
import { groupByBGColor } from '../../helpers/grouping';
|
|
18
|
+
import ErrorBoundary from '../Blocks/Block/ErrorBoundary';
|
|
19
|
+
import StyleWrapperV3 from './StyleWrapperV3';
|
|
18
20
|
|
|
19
21
|
const messages = defineMessages({
|
|
20
22
|
unknownBlock: {
|
|
@@ -67,6 +69,9 @@ const RenderBlocks = (props) => {
|
|
|
67
69
|
}
|
|
68
70
|
>
|
|
69
71
|
{group.map((block) => {
|
|
72
|
+
const currentBlockModel =
|
|
73
|
+
blocksConfig[content[blocksFieldname]?.[block]?.['@type']]
|
|
74
|
+
?.blockModel;
|
|
70
75
|
const Block =
|
|
71
76
|
blocksConfig[content[blocksFieldname]?.[block]?.['@type']]
|
|
72
77
|
?.view || ViewDefaultBlock;
|
|
@@ -92,29 +97,55 @@ const RenderBlocks = (props) => {
|
|
|
92
97
|
|
|
93
98
|
if (Block) {
|
|
94
99
|
return (
|
|
95
|
-
<
|
|
96
|
-
key={block}
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
<ErrorBoundary
|
|
101
|
+
key={`error-boundary-block-${block}`}
|
|
102
|
+
name={`blockId-${block}-type-${content[blocksFieldname]?.[block]?.['@type']}`}
|
|
103
|
+
block={block}
|
|
104
|
+
type={content[blocksFieldname]?.[block]?.['@type']}
|
|
99
105
|
>
|
|
100
|
-
<
|
|
106
|
+
<MaybeWrap
|
|
101
107
|
key={block}
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
block={block}
|
|
105
|
-
data={blockData}
|
|
106
|
-
isContainer={isContainer}
|
|
108
|
+
condition={blockWrapperTag}
|
|
109
|
+
as={blockWrapperTag}
|
|
107
110
|
>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
{currentBlockModel === 3 ? (
|
|
112
|
+
<StyleWrapperV3
|
|
113
|
+
block={block}
|
|
114
|
+
content={content}
|
|
115
|
+
data={blockData}
|
|
116
|
+
blocksConfig={blocksConfig}
|
|
117
|
+
isContainer={isContainer}
|
|
118
|
+
>
|
|
119
|
+
<Block
|
|
120
|
+
id={block}
|
|
121
|
+
metadata={metadata}
|
|
122
|
+
properties={content}
|
|
123
|
+
data={blockData}
|
|
124
|
+
path={getBaseUrl(location?.pathname || '')}
|
|
125
|
+
blocksConfig={blocksConfig}
|
|
126
|
+
/>
|
|
127
|
+
</StyleWrapperV3>
|
|
128
|
+
) : (
|
|
129
|
+
<StyleWrapper
|
|
130
|
+
key={block}
|
|
131
|
+
{...props}
|
|
132
|
+
id={block}
|
|
133
|
+
block={block}
|
|
134
|
+
data={blockData}
|
|
135
|
+
isContainer={isContainer}
|
|
136
|
+
>
|
|
137
|
+
<Block
|
|
138
|
+
id={block}
|
|
139
|
+
metadata={metadata}
|
|
140
|
+
properties={content}
|
|
141
|
+
data={blockData}
|
|
142
|
+
path={getBaseUrl(location?.pathname || '')}
|
|
143
|
+
blocksConfig={blocksConfig}
|
|
144
|
+
/>
|
|
145
|
+
</StyleWrapper>
|
|
146
|
+
)}
|
|
147
|
+
</MaybeWrap>
|
|
148
|
+
</ErrorBoundary>
|
|
118
149
|
);
|
|
119
150
|
}
|
|
120
151
|
|