@plone/volto 19.0.0-alpha.2 → 19.0.0-alpha.4
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.md +65 -0
- package/README.md +0 -2
- package/cypress/downloads/downloads.html +0 -0
- package/cypress/support/commands.js +5 -0
- package/locales/af.json +1 -0
- package/locales/ar.json +1 -0
- package/locales/bg.json +1 -0
- package/locales/bn.json +1 -0
- package/locales/ca/LC_MESSAGES/volto.po +44 -10
- package/locales/ca.json +1 -1
- package/locales/cs.json +1 -0
- package/locales/cy.json +1 -0
- package/locales/da.json +1 -0
- package/locales/de/LC_MESSAGES/volto.po +52 -18
- package/locales/de.json +1 -1
- package/locales/el.json +1 -0
- package/locales/en/LC_MESSAGES/volto.po +45 -11
- package/locales/en.json +1 -1
- package/locales/en_AU.json +1 -0
- package/locales/en_GB.json +1 -0
- package/locales/eo.json +1 -0
- package/locales/es/LC_MESSAGES/volto.po +45 -11
- package/locales/es.json +1 -1
- package/locales/et.json +1 -0
- package/locales/eu/LC_MESSAGES/volto.po +44 -10
- package/locales/eu.json +1 -1
- package/locales/fa.json +1 -0
- package/locales/fi/LC_MESSAGES/volto.po +44 -10
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +45 -11
- package/locales/fr.json +1 -1
- package/locales/fu.json +1 -0
- package/locales/gl.json +1 -0
- package/locales/he.json +1 -0
- package/locales/hi/LC_MESSAGES/volto.po +48 -14
- package/locales/hi.json +1 -1
- package/locales/hr.json +1 -0
- package/locales/hu.json +1 -0
- package/locales/hy.json +1 -0
- package/locales/id.json +1 -0
- package/locales/it/LC_MESSAGES/volto.po +48 -14
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +44 -10
- package/locales/ja.json +1 -1
- package/locales/ka.json +1 -0
- package/locales/kn.json +1 -0
- package/locales/ko.json +1 -0
- package/locales/lt.json +1 -0
- package/locales/lv.json +1 -0
- package/locales/mi.json +1 -0
- package/locales/mk.json +1 -0
- package/locales/my.json +1 -0
- package/locales/nb_NO.json +1 -0
- package/locales/nl/LC_MESSAGES/volto.po +48 -14
- package/locales/nl.json +1 -1
- package/locales/nn.json +1 -0
- package/locales/pl.json +1 -0
- package/locales/pt/LC_MESSAGES/volto.po +44 -10
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +59 -25
- package/locales/pt_BR.json +1 -1
- package/locales/rm.json +1 -0
- package/locales/ro/LC_MESSAGES/volto.po +48 -14
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +48 -14
- package/locales/ru.json +1 -1
- package/locales/sk.json +1 -0
- package/locales/sl.json +1 -0
- package/locales/sm.json +1 -0
- package/locales/sq.json +1 -0
- package/locales/sr.json +1 -0
- package/locales/sr@cyrl.json +1 -0
- package/locales/sr@latn.json +1 -0
- package/locales/sv.json +1 -1
- package/locales/ta.json +1 -0
- package/locales/te.json +1 -0
- package/locales/th.json +1 -0
- package/locales/to.json +1 -0
- package/locales/tr.json +1 -0
- package/locales/uk.json +1 -0
- package/locales/vi.json +1 -0
- package/locales/volto.pot +45 -11
- package/locales/zh_CN/LC_MESSAGES/volto.po +44 -10
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant.json +1 -0
- package/locales/zh_Hant_HK.json +1 -0
- package/package.json +9 -9
- package/src/actions/content/content.js +0 -1
- package/src/actions/controlpanels/controlpanels.js +13 -7
- package/src/actions/controlpanels/controlpanels.test.js +11 -5
- package/src/actions/users/users.js +2 -2
- package/src/components/manage/Add/Add.jsx +5 -6
- package/src/components/manage/Blocks/Block/Edit.jsx +1 -0
- package/src/components/manage/Blocks/Teaser/schema.js +8 -3
- package/src/components/manage/Contents/Contents.jsx +3 -0
- package/src/components/manage/Contents/Contents.test.jsx +7 -0
- package/src/components/manage/Contents/ContentsBreadcrumbs.Multilingual.test.jsx +18 -5
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +20 -26
- package/src/components/manage/Contents/ContentsBreadcrumbs.test.jsx +14 -0
- package/src/components/manage/Contents/ContentsDeleteModal.jsx +258 -206
- package/src/components/manage/Contents/ContentsDeleteModal.stories.jsx +26 -8
- package/src/components/manage/Contents/ContentsItem.jsx +10 -2
- package/src/components/manage/Contents/ContentsUploadModal.test.jsx +13 -22
- package/src/components/manage/Edit/Edit.jsx +2 -3
- package/src/components/manage/Multilingual/CompareLanguages.jsx +2 -5
- package/src/components/manage/Multilingual/ManageTranslations.jsx +4 -2
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +5 -1
- package/src/components/manage/Multilingual/TranslationObject.jsx +1 -1
- package/src/components/manage/Toolbar/More.jsx +4 -1
- package/src/components/manage/Toolbar/More.test.jsx +3 -0
- package/src/components/manage/Toolbar/Toolbar.jsx +3 -4
- package/src/components/manage/Toolbar/Types.jsx +7 -7
- package/src/components/manage/UniversalLink/UniversalLink.tsx +1 -0
- package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +1 -1
- package/src/components/manage/Widgets/SelectAutoComplete.jsx +29 -12
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.jsx +1 -3
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.test.jsx +0 -4
- package/src/components/theme/App/App.jsx +3 -1
- package/src/components/theme/App/App.test.jsx +1 -0
- package/src/components/theme/FormattedDate/FormattedDate.stories.jsx +20 -2
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +9 -7
- package/src/components/theme/LanguageSelector/LanguageSelector.test.jsx +6 -6
- package/src/components/theme/Logo/Logo.Multilingual.test.jsx +0 -5
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +8 -12
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.test.jsx +3 -5
- package/src/components/theme/Navigation/NavItem.jsx +1 -5
- package/src/components/theme/Navigation/Navigation.Multilingual.test.jsx +0 -5
- package/src/components/theme/NotFound/NotFound.jsx +5 -2
- package/src/components/theme/NotFound/NotFound.test.jsx +3 -0
- package/src/components/theme/Sitemap/Sitemap.jsx +6 -5
- package/src/components/theme/Sitemap/Sitemap.test.jsx +0 -1
- package/src/components/theme/View/FileView.jsx +9 -1
- package/src/config/ControlPanels.js +1 -0
- package/src/config/index.js +6 -15
- package/src/express-middleware/devproxy.js +7 -2
- package/src/helpers/Html/Html.jsx +9 -4
- package/src/helpers/LanguageMap/LanguageMap.js +115 -8
- package/src/helpers/Url/bulkFlattenToAppURL.test.ts +122 -0
- package/src/helpers/Url/bulkFlattenToAppURL.ts +24 -0
- package/src/middleware/Api.test.js +4 -0
- package/src/middleware/api.js +74 -25
- package/src/routes.js +1 -1
- package/src/server.jsx +5 -6
- package/src/start-client.jsx +0 -4
- package/test-setup-config.jsx +0 -2
- package/theme/themes/pastanaga/extras/blocks.less +7 -0
- package/theme/themes/pastanaga/extras/contents.less +5 -5
- package/types/components/manage/Blocks/Teaser/schema.d.ts +1 -0
- package/types/components/theme/FormattedDate/FormattedDate.stories.d.ts +1 -1
- package/types/helpers/LanguageMap/LanguageMap.d.ts +428 -4
- package/types/helpers/Url/bulkFlattenToAppURL.d.ts +5 -0
- package/types/middleware/api.d.ts +6 -9
- package/src/actions/content/content.multilingual.test.js +0 -17
|
@@ -3,14 +3,9 @@ import renderer from 'react-test-renderer';
|
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import { MemoryRouter } from 'react-router-dom';
|
|
6
|
-
import config from '@plone/volto/registry';
|
|
7
6
|
|
|
8
7
|
import Navigation from './Navigation';
|
|
9
8
|
|
|
10
|
-
beforeAll(() => {
|
|
11
|
-
config.settings.isMultilingual = true;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
9
|
const mockStore = configureStore();
|
|
15
10
|
|
|
16
11
|
describe('Navigation Multilingual', () => {
|
|
@@ -19,15 +19,18 @@ import config from '@plone/volto/registry';
|
|
|
19
19
|
const NotFound = () => {
|
|
20
20
|
const dispatch = useDispatch();
|
|
21
21
|
const lang = useSelector((state) => state.intl.locale);
|
|
22
|
+
const isMultilingual = useSelector(
|
|
23
|
+
(state) => state.site.data.features?.multilingual,
|
|
24
|
+
);
|
|
22
25
|
|
|
23
26
|
useEffect(() => {
|
|
24
27
|
dispatch(
|
|
25
28
|
getNavigation(
|
|
26
|
-
|
|
29
|
+
isMultilingual ? `/${toBackendLang(lang)}` : '/',
|
|
27
30
|
config.settings.navDepth,
|
|
28
31
|
),
|
|
29
32
|
);
|
|
30
|
-
}, [dispatch, lang]);
|
|
33
|
+
}, [dispatch, lang, isMultilingual]);
|
|
31
34
|
|
|
32
35
|
return (
|
|
33
36
|
<Container className="view-wrapper">
|
|
@@ -36,14 +36,14 @@ function Sitemap(props) {
|
|
|
36
36
|
location: { pathname },
|
|
37
37
|
lang,
|
|
38
38
|
getNavigation,
|
|
39
|
+
isMultilingual,
|
|
39
40
|
} = props;
|
|
40
41
|
|
|
41
42
|
useEffect(() => {
|
|
42
|
-
const
|
|
43
|
-
const language = settings.isMultilingual ? `${toBackendLang(lang)}` : null;
|
|
43
|
+
const language = isMultilingual ? `${toBackendLang(lang)}` : null;
|
|
44
44
|
const path = getSitemapPath(pathname, language);
|
|
45
45
|
getNavigation(path, 4);
|
|
46
|
-
}, [pathname, lang, getNavigation]);
|
|
46
|
+
}, [pathname, lang, getNavigation, isMultilingual]);
|
|
47
47
|
|
|
48
48
|
const renderItems = (items) => {
|
|
49
49
|
return (
|
|
@@ -100,6 +100,7 @@ export default compose(
|
|
|
100
100
|
(state) => ({
|
|
101
101
|
items: state.navigation.items,
|
|
102
102
|
lang: state.intl.locale,
|
|
103
|
+
isMultilingual: state.site.data.features?.multilingual,
|
|
103
104
|
}),
|
|
104
105
|
{ getNavigation },
|
|
105
106
|
),
|
|
@@ -108,10 +109,10 @@ export default compose(
|
|
|
108
109
|
key: 'navigation',
|
|
109
110
|
promise: ({ location, store: { dispatch, getState } }) => {
|
|
110
111
|
if (!__SERVER__) return;
|
|
111
|
-
const
|
|
112
|
+
const state = getState();
|
|
112
113
|
const path = getSitemapPath(
|
|
113
114
|
location.pathname,
|
|
114
|
-
|
|
115
|
+
state.site.data.features?.multilingual
|
|
115
116
|
? toBackendLang(getState().intl.locale)
|
|
116
117
|
: null,
|
|
117
118
|
);
|
|
@@ -7,6 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { Container as SemanticContainer } from 'semantic-ui-react';
|
|
9
9
|
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
10
|
+
import { FormattedMessage } from 'react-intl';
|
|
10
11
|
import config from '@plone/volto/registry';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -30,7 +31,14 @@ const FileView = ({ content }) => {
|
|
|
30
31
|
)}
|
|
31
32
|
{content.file?.download && (
|
|
32
33
|
<a href={flattenToAppURL(content.file.download)}>
|
|
33
|
-
{content.file.filename
|
|
34
|
+
{content.file.filename ? (
|
|
35
|
+
content.file.filename
|
|
36
|
+
) : (
|
|
37
|
+
<FormattedMessage
|
|
38
|
+
id="Download file"
|
|
39
|
+
defaultMessage="Download file"
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
34
42
|
</a>
|
|
35
43
|
)}
|
|
36
44
|
</Container>
|
package/src/config/index.js
CHANGED
|
@@ -25,6 +25,8 @@ import { installDefaultBlocks } from './Blocks';
|
|
|
25
25
|
import { getSiteAsyncPropExtender } from '@plone/volto/helpers/Site';
|
|
26
26
|
import { registerValidators } from './validation';
|
|
27
27
|
|
|
28
|
+
import languages from '@plone/volto/constants/Languages.cjs';
|
|
29
|
+
|
|
28
30
|
const host = process.env.HOST || 'localhost';
|
|
29
31
|
const port = process.env.PORT || '3000';
|
|
30
32
|
|
|
@@ -111,9 +113,7 @@ let config = {
|
|
|
111
113
|
openExternalLinkInNewTab: false,
|
|
112
114
|
notSupportedBrowsers: ['ie'],
|
|
113
115
|
defaultPageSize: 25,
|
|
114
|
-
|
|
115
|
-
supportedLanguages: ['en'],
|
|
116
|
-
defaultLanguage: process.env.SITE_DEFAULT_LANGUAGE || 'en',
|
|
116
|
+
supportedLanguages: Object.keys(languages),
|
|
117
117
|
navDepth: 1,
|
|
118
118
|
expressMiddleware: serverConfig.expressMiddleware, // BBB
|
|
119
119
|
defaultBlockType: 'slate',
|
|
@@ -141,7 +141,7 @@ let config = {
|
|
|
141
141
|
serverConfig,
|
|
142
142
|
storeExtenders: [],
|
|
143
143
|
showTags: true,
|
|
144
|
-
showRelatedItems:
|
|
144
|
+
showRelatedItems: true,
|
|
145
145
|
controlpanels: [],
|
|
146
146
|
controlPanelsIcons,
|
|
147
147
|
filterControlPanels,
|
|
@@ -198,7 +198,8 @@ config.settings.apiExpanders = [
|
|
|
198
198
|
...config.settings.apiExpanders,
|
|
199
199
|
{
|
|
200
200
|
match: '',
|
|
201
|
-
GET_CONTENT: ['breadcrumbs', 'actions', 'types', 'navroot'],
|
|
201
|
+
GET_CONTENT: ['breadcrumbs', 'actions', 'types', 'navroot', 'translations'],
|
|
202
|
+
// Note: translations is removed in the API middleware if the site is not multilingual.
|
|
202
203
|
},
|
|
203
204
|
{
|
|
204
205
|
match: '',
|
|
@@ -232,16 +233,6 @@ Object.entries(slots).forEach(([slotName, components]) => {
|
|
|
232
233
|
});
|
|
233
234
|
});
|
|
234
235
|
|
|
235
|
-
// Make sure that process.env.SITE_DEFAULT_LANGUAGE is set in availableLanguages
|
|
236
|
-
if (
|
|
237
|
-
process.env.SITE_DEFAULT_LANGUAGE &&
|
|
238
|
-
!config.settings.supportedLanguages.includes(
|
|
239
|
-
process.env.SITE_DEFAULT_LANGUAGE,
|
|
240
|
-
)
|
|
241
|
-
) {
|
|
242
|
-
config.settings.supportedLanguages.push(process.env.SITE_DEFAULT_LANGUAGE);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
236
|
registerValidators(ConfigRegistry);
|
|
246
237
|
installDefaultComponents(ConfigRegistry);
|
|
247
238
|
installDefaultWidgets(ConfigRegistry);
|
|
@@ -10,8 +10,13 @@ import querystring from 'querystring';
|
|
|
10
10
|
import { parse as parseUrl } from 'url';
|
|
11
11
|
|
|
12
12
|
const filter = function (pathname, req) {
|
|
13
|
-
//
|
|
14
|
-
|
|
13
|
+
// Check if pathname is defined, there are some corner cases that pathname is null
|
|
14
|
+
if (pathname) {
|
|
15
|
+
// This is the proxy to the API in case the accept header is 'application/json'
|
|
16
|
+
return config.settings.devProxyToApiPath && pathname.startsWith('/++api++');
|
|
17
|
+
} else {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
let _env = null;
|
|
@@ -11,6 +11,7 @@ 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';
|
|
14
|
+
import { bulkFlattenToAppURL } from '../Url/bulkFlattenToAppURL';
|
|
14
15
|
|
|
15
16
|
const CRITICAL_CSS_TEMPLATE = `function alter() {
|
|
16
17
|
document.querySelectorAll("head link[rel='prefetch']").forEach(function(el) { el.rel = 'stylesheet'});
|
|
@@ -122,9 +123,6 @@ class Html extends Component {
|
|
|
122
123
|
...(publicURL && {
|
|
123
124
|
publicURL,
|
|
124
125
|
}),
|
|
125
|
-
...(process.env.SITE_DEFAULT_LANGUAGE && {
|
|
126
|
-
defaultLanguage: process.env.SITE_DEFAULT_LANGUAGE,
|
|
127
|
-
}),
|
|
128
126
|
})};`,
|
|
129
127
|
}}
|
|
130
128
|
/>
|
|
@@ -192,7 +190,14 @@ class Html extends Component {
|
|
|
192
190
|
<script
|
|
193
191
|
dangerouslySetInnerHTML={{
|
|
194
192
|
__html: `window.__data=${serialize(
|
|
195
|
-
loadReducers(
|
|
193
|
+
loadReducers({
|
|
194
|
+
...store.getState(),
|
|
195
|
+
// Flatten the content URLs in initial request in SSR
|
|
196
|
+
// it normalizes the URLs in case the INTERNAL_API_PATH is set
|
|
197
|
+
// and prevents unwanted leaks of INTERNAL_API_PATH in the client
|
|
198
|
+
// (only in the first request)
|
|
199
|
+
content: bulkFlattenToAppURL(store.getState().content),
|
|
200
|
+
}),
|
|
196
201
|
)};`,
|
|
197
202
|
}}
|
|
198
203
|
charSet="UTF-8"
|