@plone/volto 16.21.3 → 16.22.1
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 +21 -4
- package/.gitignore~ +71 -0
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +60 -1
- package/cypress/support/commands.js +17 -0
- package/locales/ca/LC_MESSAGES/volto.po +37 -2
- package/locales/ca.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +38 -3
- package/locales/de.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +37 -2
- package/locales/en.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +37 -2
- package/locales/es.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +37 -2
- package/locales/eu.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +37 -2
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +37 -2
- package/locales/fr.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +229 -194
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +37 -2
- package/locales/ja.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +37 -2
- package/locales/nl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +37 -2
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +37 -2
- package/locales/pt_BR.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +37 -2
- package/locales/ro.json +1 -1
- package/locales/volto.pot +38 -3
- package/locales/volto.pot~ +4705 -0
- package/locales/zh_CN/LC_MESSAGES/volto.po +37 -2
- package/locales/zh_CN.json +1 -1
- package/news/4547.breaking~ +1 -0
- package/package.json +1 -1
- package/package.json~ +444 -0
- package/packages/volto-slate/package.json +1 -1
- package/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx +21 -212
- package/packages/volto-slate/src/blocks/Table/schema.js +122 -0
- package/packages/volto-slate/src/editor/plugins/StyleMenu/utils.js +14 -5
- package/packages/volto-slate/src/utils/blocks.js +7 -0
- package/packages/volto-slate/src/widgets/RichTextWidget.jsx +15 -8
- package/src/components/manage/Blocks/Image/schema.js +5 -1
- package/src/components/manage/Blocks/Search/components/Facets.jsx +6 -2
- package/src/components/manage/Blocks/Search/components/SearchInput.jsx +9 -2
- package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +12 -1
- package/src/components/manage/Blocks/ToC/Schema.jsx +40 -7
- package/src/components/manage/Blocks/ToC/variations/HorizontalMenu.jsx +142 -8
- package/src/components/manage/Contents/Contents.jsx +8 -6
- package/src/components/manage/Contents/ContentsPropertiesModal.jsx +1 -13
- package/src/components/manage/Controlpanels/Groups/RenderGroups.jsx +2 -2
- package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +2 -2
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +25 -10
- package/src/components/manage/UniversalLink/UniversalLink.jsx +2 -6
- package/src/components/manage/UniversalLink/UniversalLink.test.jsx +36 -0
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +1 -1
- package/src/components/manage/Widgets/SelectUtils.js +1 -1
- package/src/components/theme/Error/ServerError.jsx +29 -0
- package/src/components/theme/Login/Login.jsx +1 -1
- package/src/components/theme/View/AlbumView.jsx +9 -1
- package/src/components/theme/View/EventView.jsx +6 -2
- package/src/components/theme/View/FileView.jsx +23 -18
- package/src/components/theme/View/ImageView.jsx +37 -32
- package/src/components/theme/View/LinkView.jsx +4 -1
- package/src/components/theme/View/ListingView.jsx +33 -27
- package/src/components/theme/View/SummaryView.jsx +47 -38
- package/src/components/theme/View/TabularView.jsx +59 -53
- package/src/config/Views.jsx +2 -0
- package/src/config/index.js +1 -0
- package/src/config/index.js~ +223 -0
- package/src/config/server.js +2 -0
- package/src/express-middleware/files.js +8 -6
- package/src/express-middleware/images.js +7 -1
- package/src/express-middleware/ok.js +16 -0
- package/src/helpers/Url/Url.js +22 -1
- package/src/helpers/Url/Url.test.js +41 -0
- package/src/middleware/api.js +14 -2
- package/src/reducers/actions/actions.js +7 -5
- package/src/reducers/actions/actions.test.js +70 -0
- package/src/server.jsx +9 -0
- package/theme/themes/pastanaga/extras/main.less +2 -1
- package/theme/themes/pastanaga/extras/toc.less +29 -0
- package/packages/volto-slate/build/messages/src/blocks/Table/TableBlockEdit.json +0 -90
- package/packages/volto-slate/build/messages/src/blocks/Text/DefaultTextBlockEditor.json +0 -6
- package/packages/volto-slate/build/messages/src/blocks/Text/DetachedTextBlockEditor.json +0 -6
- package/packages/volto-slate/build/messages/src/blocks/Text/SlashMenu.json +0 -6
- package/packages/volto-slate/build/messages/src/editor/plugins/AdvancedLink/index.json +0 -10
- package/packages/volto-slate/build/messages/src/editor/plugins/Link/index.json +0 -10
- package/packages/volto-slate/build/messages/src/editor/plugins/Table/index.json +0 -30
- package/packages/volto-slate/build/messages/src/elementEditor/messages.json +0 -10
- package/packages/volto-slate/build/messages/src/widgets/HtmlSlateWidget.json +0 -6
- package/packages/volto-slate/build/messages/src/widgets/RichTextWidgetView.json +0 -6
- package/pyvenv.cfg +0 -3
- package/share/man/man1/ttx.1 +0 -225
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { Container } from 'semantic-ui-react';
|
|
8
|
+
import { Container as SemanticContainer } from 'semantic-ui-react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl';
|
|
10
10
|
import prettybytes from 'pretty-bytes';
|
|
11
|
-
|
|
12
11
|
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
12
|
+
import config from '@plone/volto/registry';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Image view component class.
|
|
@@ -17,37 +17,42 @@ import { flattenToAppURL } from '@plone/volto/helpers';
|
|
|
17
17
|
* @params {object} content Content object.
|
|
18
18
|
* @returns {string} Markup of the component.
|
|
19
19
|
*/
|
|
20
|
-
const ImageView = ({ content }) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
defaultMessage="Size: {size}"
|
|
39
|
-
values={{ size: prettybytes(content.image.size) }}
|
|
40
|
-
/>
|
|
41
|
-
—
|
|
42
|
-
<FormattedMessage
|
|
43
|
-
id="Click to download full sized image"
|
|
44
|
-
defaultMessage="Click to download full sized image"
|
|
20
|
+
const ImageView = ({ content }) => {
|
|
21
|
+
const Container =
|
|
22
|
+
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Container className="view-wrapper">
|
|
26
|
+
<h1 className="documentFirstHeading">
|
|
27
|
+
{content.title}
|
|
28
|
+
{content.subtitle && ` - ${content.subtitle}`}
|
|
29
|
+
</h1>
|
|
30
|
+
{content.description && (
|
|
31
|
+
<p className="documentDescription">{content.description}</p>
|
|
32
|
+
)}
|
|
33
|
+
{content?.image?.download && (
|
|
34
|
+
<a href={flattenToAppURL(content.image.download)}>
|
|
35
|
+
<img
|
|
36
|
+
alt={content.title}
|
|
37
|
+
src={flattenToAppURL(content.image.scales.preview.download)}
|
|
45
38
|
/>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
39
|
+
<figcaption>
|
|
40
|
+
<FormattedMessage
|
|
41
|
+
id="Size: {size}"
|
|
42
|
+
defaultMessage="Size: {size}"
|
|
43
|
+
values={{ size: prettybytes(content.image.size) }}
|
|
44
|
+
/>
|
|
45
|
+
—
|
|
46
|
+
<FormattedMessage
|
|
47
|
+
id="Click to download full sized image"
|
|
48
|
+
defaultMessage="Click to download full sized image"
|
|
49
|
+
/>
|
|
50
|
+
</figcaption>
|
|
51
|
+
</a>
|
|
52
|
+
)}
|
|
53
|
+
</Container>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
51
56
|
|
|
52
57
|
/**
|
|
53
58
|
* Property types.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import React, { Component } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
|
|
9
|
-
import { Container } from 'semantic-ui-react';
|
|
9
|
+
import { Container as SemanticContainer } from 'semantic-ui-react';
|
|
10
10
|
import { UniversalLink } from '@plone/volto/components';
|
|
11
11
|
import { FormattedMessage } from 'react-intl';
|
|
12
12
|
import config from '@plone/volto/registry';
|
|
@@ -60,6 +60,9 @@ class LinkView extends Component {
|
|
|
60
60
|
render() {
|
|
61
61
|
const { remoteUrl } = this.props.content;
|
|
62
62
|
const { openExternalLinkInNewTab } = config.settings;
|
|
63
|
+
const Container =
|
|
64
|
+
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
|
65
|
+
|
|
63
66
|
return (
|
|
64
67
|
<Container id="page-document">
|
|
65
68
|
<h1 className="documentFirstHeading">{this.props.content.title}</h1>
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { Segment, Container } from 'semantic-ui-react';
|
|
8
|
+
import { Segment, Container as SemanticContainer } from 'semantic-ui-react';
|
|
9
9
|
import { UniversalLink, PreviewImage } from '@plone/volto/components';
|
|
10
|
+
import config from '@plone/volto/registry';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* List view component class.
|
|
@@ -14,32 +15,37 @@ import { UniversalLink, PreviewImage } from '@plone/volto/components';
|
|
|
14
15
|
* @params {object} content Content object.
|
|
15
16
|
* @returns {string} Markup of the component.
|
|
16
17
|
*/
|
|
17
|
-
const ListingView = ({ content }) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
item
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
const ListingView = ({ content }) => {
|
|
19
|
+
const Container =
|
|
20
|
+
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Container id="page-home">
|
|
24
|
+
<section id="content-core">
|
|
25
|
+
{content.items.map((item) => (
|
|
26
|
+
<Segment key={item.url} className="listing-item">
|
|
27
|
+
<Container>
|
|
28
|
+
<h2>
|
|
29
|
+
<UniversalLink item={item} title={item['@type']}>
|
|
30
|
+
{item.title}
|
|
31
|
+
</UniversalLink>
|
|
32
|
+
</h2>
|
|
33
|
+
{item.description && <p>{item.description}</p>}
|
|
34
|
+
</Container>
|
|
35
|
+
{item.image_field && (
|
|
36
|
+
<PreviewImage
|
|
37
|
+
item={item}
|
|
38
|
+
size="thumb"
|
|
39
|
+
alt={item.image_caption ? item.image_caption : item.title}
|
|
40
|
+
className="ui image"
|
|
41
|
+
/>
|
|
42
|
+
)}
|
|
43
|
+
</Segment>
|
|
44
|
+
))}
|
|
45
|
+
</section>
|
|
46
|
+
</Container>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
43
49
|
|
|
44
50
|
/**
|
|
45
51
|
* Property types.
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { UniversalLink } from '@plone/volto/components';
|
|
9
|
-
import { Container } from 'semantic-ui-react';
|
|
9
|
+
import { Container as SemanticContainer } from 'semantic-ui-react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl';
|
|
11
11
|
import PreviewImage from '../PreviewImage/PreviewImage';
|
|
12
|
+
import config from '@plone/volto/registry';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Summary view component class.
|
|
@@ -16,43 +17,51 @@ import PreviewImage from '../PreviewImage/PreviewImage';
|
|
|
16
17
|
* @param {Object} content Content object.
|
|
17
18
|
* @returns {string} Markup of the component.
|
|
18
19
|
*/
|
|
19
|
-
const SummaryView = ({ content }) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
20
|
+
const SummaryView = ({ content }) => {
|
|
21
|
+
const Container =
|
|
22
|
+
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Container className="view-wrapper summary-view">
|
|
26
|
+
<article id="content">
|
|
27
|
+
<header>
|
|
28
|
+
<h1 className="documentFirstHeading">{content.title}</h1>
|
|
29
|
+
{content.description && (
|
|
30
|
+
<p className="documentDescription">{content.description}</p>
|
|
31
|
+
)}
|
|
32
|
+
</header>
|
|
33
|
+
<section id="content-core">
|
|
34
|
+
{content.items.map((item) => (
|
|
35
|
+
<article key={item.url}>
|
|
36
|
+
<h2>
|
|
37
|
+
<UniversalLink item={item} title={item['@type']}>
|
|
38
|
+
{item.title}
|
|
39
|
+
</UniversalLink>
|
|
40
|
+
</h2>
|
|
41
|
+
{item.image_field && (
|
|
42
|
+
<PreviewImage
|
|
43
|
+
item={item}
|
|
44
|
+
alt={item.image_caption ? item.image_caption : item.title}
|
|
45
|
+
size="thumb"
|
|
46
|
+
className="ui image floated right clear"
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
{item.description && <p>{item.description}</p>}
|
|
50
|
+
<p>
|
|
51
|
+
<UniversalLink item={item}>
|
|
52
|
+
<FormattedMessage
|
|
53
|
+
id="Read More…"
|
|
54
|
+
defaultMessage="Read More…"
|
|
55
|
+
/>
|
|
56
|
+
</UniversalLink>
|
|
57
|
+
</p>
|
|
58
|
+
</article>
|
|
59
|
+
))}
|
|
60
|
+
</section>
|
|
61
|
+
</article>
|
|
62
|
+
</Container>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
56
65
|
|
|
57
66
|
/**
|
|
58
67
|
* Property types.
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { UniversalLink } from '@plone/volto/components';
|
|
9
|
-
import { Container, Table } from 'semantic-ui-react';
|
|
9
|
+
import { Container as SemanticContainer, Table } from 'semantic-ui-react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl';
|
|
11
|
+
import config from '@plone/volto/registry';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Tabular view component class.
|
|
@@ -15,59 +16,64 @@ import { FormattedMessage } from 'react-intl';
|
|
|
15
16
|
* @param {Object} content Content object.
|
|
16
17
|
* @returns {string} Markup of the component.
|
|
17
18
|
*/
|
|
18
|
-
const TabularView = ({ content }) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<Table.
|
|
35
|
-
<
|
|
36
|
-
id="
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<Table.Row key={item.url}>
|
|
51
|
-
<Table.Cell>
|
|
52
|
-
<UniversalLink
|
|
53
|
-
item={item}
|
|
54
|
-
className="summary url"
|
|
55
|
-
title={item['@type']}
|
|
56
|
-
>
|
|
57
|
-
{item.title}
|
|
58
|
-
</UniversalLink>
|
|
59
|
-
</Table.Cell>
|
|
60
|
-
<Table.Cell>{item.description}</Table.Cell>
|
|
61
|
-
<Table.Cell>{item['@type']}</Table.Cell>
|
|
62
|
-
<Table.Cell>{item.review_state}</Table.Cell>
|
|
19
|
+
const TabularView = ({ content }) => {
|
|
20
|
+
const Container =
|
|
21
|
+
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Container className="view-wrapper">
|
|
25
|
+
<article id="content">
|
|
26
|
+
<header>
|
|
27
|
+
<h1 className="documentFirstHeading">{content.title}</h1>
|
|
28
|
+
{content.description && (
|
|
29
|
+
<p className="documentDescription">{content.description}</p>
|
|
30
|
+
)}
|
|
31
|
+
</header>
|
|
32
|
+
<section id="content-core">
|
|
33
|
+
<Table celled padded>
|
|
34
|
+
<Table.Header>
|
|
35
|
+
<Table.Row>
|
|
36
|
+
<Table.HeaderCell>
|
|
37
|
+
<FormattedMessage id="Title" defaultMessage="Title" />
|
|
38
|
+
</Table.HeaderCell>
|
|
39
|
+
<Table.HeaderCell>
|
|
40
|
+
<FormattedMessage
|
|
41
|
+
id="Description"
|
|
42
|
+
defaultMessage="Description"
|
|
43
|
+
/>
|
|
44
|
+
</Table.HeaderCell>
|
|
45
|
+
<Table.HeaderCell>
|
|
46
|
+
<FormattedMessage id="Type" defaultMessage="Type" />
|
|
47
|
+
</Table.HeaderCell>
|
|
48
|
+
<Table.HeaderCell>
|
|
49
|
+
<FormattedMessage id="State" defaultMessage="State" />
|
|
50
|
+
</Table.HeaderCell>
|
|
63
51
|
</Table.Row>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
</Table.Header>
|
|
53
|
+
<Table.Body>
|
|
54
|
+
{content.items.map((item) => (
|
|
55
|
+
<Table.Row key={item.url}>
|
|
56
|
+
<Table.Cell>
|
|
57
|
+
<UniversalLink
|
|
58
|
+
item={item}
|
|
59
|
+
className="summary url"
|
|
60
|
+
title={item['@type']}
|
|
61
|
+
>
|
|
62
|
+
{item.title}
|
|
63
|
+
</UniversalLink>
|
|
64
|
+
</Table.Cell>
|
|
65
|
+
<Table.Cell>{item.description}</Table.Cell>
|
|
66
|
+
<Table.Cell>{item['@type']}</Table.Cell>
|
|
67
|
+
<Table.Cell>{item.review_state}</Table.Cell>
|
|
68
|
+
</Table.Row>
|
|
69
|
+
))}
|
|
70
|
+
</Table.Body>
|
|
71
|
+
</Table>
|
|
72
|
+
</section>
|
|
73
|
+
</article>
|
|
74
|
+
</Container>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
71
77
|
|
|
72
78
|
/**
|
|
73
79
|
* Property types.
|
package/src/config/Views.jsx
CHANGED
|
@@ -16,6 +16,7 @@ import RequestTimeout from '@plone/volto/components/theme/RequestTimeout/Request
|
|
|
16
16
|
import AlbumView from '@plone/volto/components/theme/View/AlbumView';
|
|
17
17
|
import Unauthorized from '@plone/volto/components/theme/Unauthorized/Unauthorized';
|
|
18
18
|
import Forbidden from '@plone/volto/components/theme/Forbidden/Forbidden';
|
|
19
|
+
import ServerError from '@plone/volto/components/theme/Error/ServerError';
|
|
19
20
|
|
|
20
21
|
const EventView = loadable(() =>
|
|
21
22
|
import('@plone/volto/components/theme/View/EventView'),
|
|
@@ -114,6 +115,7 @@ export const errorViews = {
|
|
|
114
115
|
'401': Unauthorized,
|
|
115
116
|
'403': Forbidden,
|
|
116
117
|
'408': RequestTimeout,
|
|
118
|
+
'500': ServerError,
|
|
117
119
|
ECONNREFUSED: ConnectionRefused,
|
|
118
120
|
corsError: CorsError,
|
|
119
121
|
};
|
package/src/config/index.js
CHANGED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config.
|
|
3
|
+
* @module config
|
|
4
|
+
*/
|
|
5
|
+
import { parse as parseUrl } from 'url';
|
|
6
|
+
import { defaultWidget, widgetMapping } from './Widgets';
|
|
7
|
+
import {
|
|
8
|
+
layoutViews,
|
|
9
|
+
contentTypesViews,
|
|
10
|
+
defaultView,
|
|
11
|
+
errorViews,
|
|
12
|
+
layoutViewsNamesMapping,
|
|
13
|
+
} from './Views';
|
|
14
|
+
import { nonContentRoutes } from './NonContentRoutes';
|
|
15
|
+
import {
|
|
16
|
+
groupBlocksOrder,
|
|
17
|
+
requiredBlocks,
|
|
18
|
+
blocksConfig,
|
|
19
|
+
initialBlocks,
|
|
20
|
+
initialBlocksFocus,
|
|
21
|
+
} from './Blocks';
|
|
22
|
+
import { components } from './Components';
|
|
23
|
+
import { loadables } from './Loadables';
|
|
24
|
+
import { workflowMapping } from './Workflows';
|
|
25
|
+
|
|
26
|
+
import { contentIcons } from './ContentIcons';
|
|
27
|
+
import { styleClassNameConverters, styleClassNameExtenders } from './Style';
|
|
28
|
+
import {
|
|
29
|
+
controlPanelsIcons,
|
|
30
|
+
filterControlPanels,
|
|
31
|
+
filterControlPanelsSchema,
|
|
32
|
+
} from './ControlPanels';
|
|
33
|
+
|
|
34
|
+
import { richtextEditorSettings, richtextViewSettings } from './RichTextEditor';
|
|
35
|
+
|
|
36
|
+
import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons';
|
|
37
|
+
|
|
38
|
+
import ConfigRegistry from '@plone/volto/registry';
|
|
39
|
+
|
|
40
|
+
const host = process.env.HOST || 'localhost';
|
|
41
|
+
const port = process.env.PORT || '3000';
|
|
42
|
+
|
|
43
|
+
const apiPath =
|
|
44
|
+
process.env.RAZZLE_API_PATH ||
|
|
45
|
+
(__DEVELOPMENT__ ? `http://${host}:${port}` : '');
|
|
46
|
+
|
|
47
|
+
const getServerURL = (url) => {
|
|
48
|
+
if (!url) return;
|
|
49
|
+
const apiPathURL = parseUrl(url);
|
|
50
|
+
return `${apiPathURL.protocol}//${apiPathURL.hostname}${
|
|
51
|
+
apiPathURL.port ? `:${apiPathURL.port}` : ''
|
|
52
|
+
}`;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Sensible defaults for publicURL
|
|
56
|
+
// if RAZZLE_PUBLIC_URL is present, use it
|
|
57
|
+
// if in DEV, use the host/port combination by default
|
|
58
|
+
// if in PROD, assume it's RAZZLE_API_PATH server name (no /api or alikes) or fallback
|
|
59
|
+
// to DEV settings if RAZZLE_API_PATH is not present
|
|
60
|
+
const publicURL =
|
|
61
|
+
process.env.RAZZLE_PUBLIC_URL ||
|
|
62
|
+
(__DEVELOPMENT__
|
|
63
|
+
? `http://${host}:${port}`
|
|
64
|
+
: getServerURL(process.env.RAZZLE_API_PATH) || `http://${host}:${port}`);
|
|
65
|
+
|
|
66
|
+
const serverConfig =
|
|
67
|
+
typeof __SERVER__ !== 'undefined' && __SERVER__
|
|
68
|
+
? require('./server').default
|
|
69
|
+
: {};
|
|
70
|
+
|
|
71
|
+
let config = {
|
|
72
|
+
settings: {
|
|
73
|
+
host,
|
|
74
|
+
port,
|
|
75
|
+
// The URL Volto is going to be served (see sensible defaults above)
|
|
76
|
+
publicURL,
|
|
77
|
+
apiPath,
|
|
78
|
+
apiExpanders: [
|
|
79
|
+
// Add the following expanders for only issuing a single request.
|
|
80
|
+
// https://6.docs.plone.org/volto/configuration/settings-reference.html#term-apiExpanders
|
|
81
|
+
// {
|
|
82
|
+
// match: '',
|
|
83
|
+
// GET_CONTENT: ['breadcrumbs', 'navigation', 'actions', 'types'],
|
|
84
|
+
// },
|
|
85
|
+
],
|
|
86
|
+
// Internal proxy to bypass CORS *while developing*. NOT intended for production use.
|
|
87
|
+
// In production is recommended you use a Seamless mode deployment using a web server in
|
|
88
|
+
// front of both the frontend and the backend so you can bypass CORS safely.
|
|
89
|
+
// https://6.docs.plone.org/volto/deploying/seamless-mode.html
|
|
90
|
+
devProxyToApiPath:
|
|
91
|
+
process.env.RAZZLE_DEV_PROXY_API_PATH ||
|
|
92
|
+
process.env.RAZZLE_INTERNAL_API_PATH ||
|
|
93
|
+
process.env.RAZZLE_API_PATH ||
|
|
94
|
+
'http://localhost:8080/Plone', // Set it to '' for disabling the proxy
|
|
95
|
+
// proxyRewriteTarget Set it for set a custom target for the proxy or overide the internal VHM rewrite
|
|
96
|
+
// proxyRewriteTarget: '/VirtualHostBase/http/localhost:8080/Plone/VirtualHostRoot/_vh_api'
|
|
97
|
+
// proxyRewriteTarget: 'https://myvoltositeinproduction.com'
|
|
98
|
+
proxyRewriteTarget: process.env.RAZZLE_PROXY_REWRITE_TARGET || undefined,
|
|
99
|
+
// apiPath: process.env.RAZZLE_API_PATH || 'http://localhost:8000', // for Volto reference
|
|
100
|
+
// apiPath: process.env.RAZZLE_API_PATH || 'http://localhost:8081/db/web', // for guillotina
|
|
101
|
+
actions_raising_api_errors: ['GET_CONTENT', 'UPDATE_CONTENT'],
|
|
102
|
+
internalApiPath: process.env.RAZZLE_INTERNAL_API_PATH || undefined,
|
|
103
|
+
websockets: process.env.RAZZLE_WEBSOCKETS || false,
|
|
104
|
+
// TODO: legacyTraverse to be removed when the use of the legacy traverse is deprecated.
|
|
105
|
+
legacyTraverse: process.env.RAZZLE_LEGACY_TRAVERSE || false,
|
|
106
|
+
cookieExpires: 15552000, //in seconds. Default is 6 month (15552000)
|
|
107
|
+
nonContentRoutes,
|
|
108
|
+
richtextEditorSettings, // Part of draftjs support, to be removed
|
|
109
|
+
richtextViewSettings, // Part of draftjs support, to be removed
|
|
110
|
+
imageObjects: ['Image'],
|
|
111
|
+
reservedIds: ['login', 'layout', 'plone', 'zip', 'properties'],
|
|
112
|
+
downloadableObjects: ['File'], //list of content-types for which the direct download of the file will be carried out if the user is not authenticated
|
|
113
|
+
viewableInBrowserObjects: [], //ex: ['File']. List of content-types for which the file will be displayed in browser if the user is not authenticated
|
|
114
|
+
listingPreviewImageField: 'image', // deprecated from Volto 14 onwards
|
|
115
|
+
openExternalLinkInNewTab: false,
|
|
116
|
+
notSupportedBrowsers: ['ie'],
|
|
117
|
+
defaultPageSize: 25,
|
|
118
|
+
isMultilingual: false,
|
|
119
|
+
supportedLanguages: ['en'],
|
|
120
|
+
defaultLanguage: 'en',
|
|
121
|
+
navDepth: 1,
|
|
122
|
+
expressMiddleware: serverConfig.expressMiddleware, // BBB
|
|
123
|
+
defaultBlockType: 'slate',
|
|
124
|
+
verticalFormTabs: false,
|
|
125
|
+
useEmailAsLogin: false,
|
|
126
|
+
persistentReducers: ['blocksClipboard'],
|
|
127
|
+
initialReducersBlacklist: [], // reducers in this list won't be hydrated in windows.__data
|
|
128
|
+
asyncPropsExtenders: [], // per route asyncConnect customizers
|
|
129
|
+
contentIcons: contentIcons,
|
|
130
|
+
loadables,
|
|
131
|
+
lazyBundles: {
|
|
132
|
+
cms: [
|
|
133
|
+
'prettierStandalone',
|
|
134
|
+
'prettierParserHtml',
|
|
135
|
+
'prismCore',
|
|
136
|
+
'toastify',
|
|
137
|
+
'reactSelect',
|
|
138
|
+
'reactBeautifulDnd',
|
|
139
|
+
// 'diffLib',
|
|
140
|
+
],
|
|
141
|
+
draftEditor: [
|
|
142
|
+
'immutableLib',
|
|
143
|
+
'draftJs',
|
|
144
|
+
'draftJsLibIsSoftNewlineEvent',
|
|
145
|
+
'draftJsFilters',
|
|
146
|
+
'draftJsInlineToolbarPlugin',
|
|
147
|
+
'draftJsImportHtml',
|
|
148
|
+
'draftJsBlockBreakoutPlugin',
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
appExtras: [],
|
|
152
|
+
maxResponseSize: 2000000000, // This is superagent default (200 mb)
|
|
153
|
+
serverConfig,
|
|
154
|
+
storeExtenders: [],
|
|
155
|
+
showTags: true,
|
|
156
|
+
controlpanels: [],
|
|
157
|
+
controlPanelsIcons,
|
|
158
|
+
filterControlPanels,
|
|
159
|
+
filterControlPanelsSchema,
|
|
160
|
+
externalRoutes: [
|
|
161
|
+
// URL to be considered as external
|
|
162
|
+
// {
|
|
163
|
+
// match: {
|
|
164
|
+
// path: '/news',
|
|
165
|
+
// exact: false,
|
|
166
|
+
// strict: false,
|
|
167
|
+
// },
|
|
168
|
+
// url(payload) {
|
|
169
|
+
// return payload.location.pathname;
|
|
170
|
+
// },
|
|
171
|
+
// },
|
|
172
|
+
],
|
|
173
|
+
showSelfRegistration: false,
|
|
174
|
+
contentMetadataTagsImageField: 'image',
|
|
175
|
+
hasWorkingCopySupport: false,
|
|
176
|
+
maxUndoLevels: 200, // undo history size for the main form
|
|
177
|
+
addonsInfo: addonsInfo,
|
|
178
|
+
workflowMapping,
|
|
179
|
+
errorHandlers: [], // callables for unhandled errors
|
|
180
|
+
styleClassNameConverters,
|
|
181
|
+
hashLinkSmoothScroll: false,
|
|
182
|
+
styleClassNameExtenders,
|
|
183
|
+
querystringSearchGet: false,
|
|
184
|
+
},
|
|
185
|
+
experimental: {
|
|
186
|
+
addBlockButton: {
|
|
187
|
+
enabled: false,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
widgets: {
|
|
191
|
+
...widgetMapping,
|
|
192
|
+
default: defaultWidget,
|
|
193
|
+
},
|
|
194
|
+
views: {
|
|
195
|
+
layoutViews,
|
|
196
|
+
contentTypesViews,
|
|
197
|
+
defaultView,
|
|
198
|
+
errorViews,
|
|
199
|
+
layoutViewsNamesMapping,
|
|
200
|
+
},
|
|
201
|
+
blocks: {
|
|
202
|
+
requiredBlocks,
|
|
203
|
+
blocksConfig,
|
|
204
|
+
groupBlocksOrder,
|
|
205
|
+
initialBlocks,
|
|
206
|
+
initialBlocksFocus,
|
|
207
|
+
showEditBlocksInBabelView: false,
|
|
208
|
+
},
|
|
209
|
+
addonRoutes: [],
|
|
210
|
+
addonReducers: {},
|
|
211
|
+
components,
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
ConfigRegistry.settings = config.settings;
|
|
215
|
+
ConfigRegistry.experimental = config.experimental;
|
|
216
|
+
ConfigRegistry.blocks = config.blocks;
|
|
217
|
+
ConfigRegistry.views = config.views;
|
|
218
|
+
ConfigRegistry.widgets = config.widgets;
|
|
219
|
+
ConfigRegistry.addonRoutes = config.addonRoutes;
|
|
220
|
+
ConfigRegistry.addonReducers = config.addonReducers;
|
|
221
|
+
ConfigRegistry.components = config.components;
|
|
222
|
+
|
|
223
|
+
applyAddonConfiguration(ConfigRegistry);
|