@eeacms/volto-eea-website-theme 0.7.2 → 0.7.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 +17 -1
- package/package.json +1 -1
- package/src/components/theme/CustomCSS/CustomCSS.jsx +0 -1
- package/src/helpers/index.js +34 -0
- package/src/index.js +40 -0
- package/src/middleware/voltoCustom.js +37 -0
package/CHANGELOG.md
CHANGED
@@ -4,11 +4,27 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
4
4
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
6
6
|
|
7
|
+
### [0.7.4](https://github.com/eea/volto-eea-website-theme/compare/0.7.3...0.7.4) - 27 September 2022
|
8
|
+
|
9
|
+
#### :bug: Bug Fixes
|
10
|
+
|
11
|
+
- fix(voltoCustom.css): Better handle missing file on backend [Alin Voinea - [`679dcc8`](https://github.com/eea/volto-eea-website-theme/commit/679dcc8cbc94dcadec9e7b8c68f654d2d135186f)]
|
12
|
+
- fix(voltoCustom.css): resource.get(header) [Alin Voinea - [`708de42`](https://github.com/eea/volto-eea-website-theme/commit/708de42309043c72aea702acaa4a580cd0caea0f)]
|
13
|
+
|
14
|
+
#### :hammer_and_wrench: Others
|
15
|
+
|
16
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
|
17
|
+
### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
|
18
|
+
|
19
|
+
#### :hammer_and_wrench: Others
|
20
|
+
|
21
|
+
- Set slate StyleMenu if defined [Miu Razvan - [`6e2d8a3`](https://github.com/eea/volto-eea-website-theme/commit/6e2d8a34824f7cffc51680758e16c91c70cbcfe7)]
|
22
|
+
- Add slate StyleMenu styles [Miu Razvan - [`2863524`](https://github.com/eea/volto-eea-website-theme/commit/286352490e3413a8cbc4672c0a08d9fb9b2ac4c1)]
|
23
|
+
- Revert "fix(voltoCustom.css): Fix to work with seamless mode - refs #148213" [Alin Voinea - [`f954e02`](https://github.com/eea/volto-eea-website-theme/commit/f954e024a739c67ae390d3d5a4e397f076534388)]
|
7
24
|
### [0.7.2](https://github.com/eea/volto-eea-website-theme/compare/0.7.1...0.7.2) - 19 September 2022
|
8
25
|
|
9
26
|
#### :bug: Bug Fixes
|
10
27
|
|
11
|
-
- fix(header): Apply changes from design system - refs #147798 [Alin Voinea - [`d28fa61`](https://github.com/eea/volto-eea-website-theme/commit/d28fa61a3d4c335cedabfa957969da5b5d9d75e0)]
|
12
28
|
- fix(header): letter case of know [David Ichim - [`ace90d9`](https://github.com/eea/volto-eea-website-theme/commit/ace90d97ad8bc4e7392f81635536631b8a9563c4)]
|
13
29
|
- fix(Header): language list output proper html code (ul, li) [Alin Voinea - [`6405531`](https://github.com/eea/volto-eea-website-theme/commit/6405531bd2480d3e109ac7f0581738310f662829)]
|
14
30
|
|
package/package.json
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
import superagent from 'superagent';
|
2
|
+
import config from '@plone/volto/registry';
|
3
|
+
import { addHeadersFactory } from '@plone/volto/helpers/Proxy/Proxy';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Get a resource image/file with authenticated (if token exist) API headers
|
7
|
+
* @function getBackendResourceWithAuth
|
8
|
+
* @param {Object} req Request object
|
9
|
+
* @return {string} The response with the image
|
10
|
+
*/
|
11
|
+
export const getBackendResourceWithAuth = (req) =>
|
12
|
+
new Promise((resolve, reject) => {
|
13
|
+
const { settings } = config;
|
14
|
+
|
15
|
+
let apiPath = '';
|
16
|
+
if (settings.internalApiPath && __SERVER__) {
|
17
|
+
apiPath = settings.internalApiPath;
|
18
|
+
} else if (__DEVELOPMENT__ && settings.devProxyToApiPath) {
|
19
|
+
apiPath = settings.devProxyToApiPath;
|
20
|
+
} else {
|
21
|
+
apiPath = settings.apiPath;
|
22
|
+
}
|
23
|
+
const backendURL = `${apiPath}${req.path}`;
|
24
|
+
const request = superagent
|
25
|
+
.get(backendURL)
|
26
|
+
.maxResponseSize(settings.maxResponseSize)
|
27
|
+
.responseType('blob');
|
28
|
+
const authToken = req.universalCookies.get('auth_token');
|
29
|
+
if (authToken) {
|
30
|
+
request.set('Authorization', `Bearer ${authToken}`);
|
31
|
+
}
|
32
|
+
request.use(addHeadersFactory(req));
|
33
|
+
request.then(resolve).catch(reject);
|
34
|
+
});
|
package/src/index.js
CHANGED
@@ -7,7 +7,9 @@ import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Wi
|
|
7
7
|
import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
|
8
8
|
import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
|
9
9
|
import { Icon } from '@plone/volto/components';
|
10
|
+
import paintSVG from '@plone/volto/icons/paint.svg';
|
10
11
|
import contentBoxSVG from './icons/content-box.svg';
|
12
|
+
import voltoCustomMiddleware from './middleware/voltoCustom';
|
11
13
|
|
12
14
|
const applyConfig = (config) => {
|
13
15
|
// EEA specific settings
|
@@ -48,6 +50,15 @@ const applyConfig = (config) => {
|
|
48
50
|
config.widgets.views.widget.tags = TokenWidget;
|
49
51
|
}
|
50
52
|
|
53
|
+
// voltoCustom.css express-middleware
|
54
|
+
if (__SERVER__) {
|
55
|
+
const express = require('express');
|
56
|
+
config.settings.expressMiddleware = [
|
57
|
+
...(config.settings.expressMiddleware || []),
|
58
|
+
voltoCustomMiddleware(express),
|
59
|
+
];
|
60
|
+
}
|
61
|
+
|
51
62
|
// InPage navigation, Custom CSS voltoCustom.css and Draft Background
|
52
63
|
config.settings.appExtras = [
|
53
64
|
...(config.settings.appExtras || []),
|
@@ -65,6 +76,35 @@ const applyConfig = (config) => {
|
|
65
76
|
},
|
66
77
|
];
|
67
78
|
|
79
|
+
// Slate StyleMenu configuration
|
80
|
+
if (config.settings.slate) {
|
81
|
+
config.settings.slate.styleMenu = {
|
82
|
+
...(config.settings.slate.styleMenu || {}),
|
83
|
+
blockStyles: [
|
84
|
+
{
|
85
|
+
cssClass: 'primary',
|
86
|
+
label: 'Primary',
|
87
|
+
icon: () => <Icon name={paintSVG} size="18px" />,
|
88
|
+
},
|
89
|
+
{
|
90
|
+
cssClass: 'secondary',
|
91
|
+
label: 'Secondary',
|
92
|
+
icon: () => <Icon name={paintSVG} size="18px" />,
|
93
|
+
},
|
94
|
+
{
|
95
|
+
cssClass: 'tertiary',
|
96
|
+
label: 'Tertiary',
|
97
|
+
icon: () => <Icon name={paintSVG} size="18px" />,
|
98
|
+
},
|
99
|
+
{
|
100
|
+
cssClass: 'bordered',
|
101
|
+
label: 'Bordered',
|
102
|
+
icon: () => <Icon name={paintSVG} size="18px" />,
|
103
|
+
},
|
104
|
+
],
|
105
|
+
};
|
106
|
+
}
|
107
|
+
|
68
108
|
// Custom block styles
|
69
109
|
config.settings.previewText = '';
|
70
110
|
config.settings.pluggableStyles = [
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { getBackendResourceWithAuth } from '@eeacms/volto-eea-website-theme/helpers';
|
2
|
+
|
3
|
+
const HEADERS = [
|
4
|
+
'Accept-Ranges',
|
5
|
+
'Cache-Control',
|
6
|
+
'Content-Disposition',
|
7
|
+
'Content-Range',
|
8
|
+
'Content-Type',
|
9
|
+
];
|
10
|
+
|
11
|
+
function voltoCustomMiddleware(req, res, next) {
|
12
|
+
getBackendResourceWithAuth(req)
|
13
|
+
.then((resource) => {
|
14
|
+
// Just forward the headers that we need
|
15
|
+
HEADERS.forEach((header) => {
|
16
|
+
if (resource?.get?.(header)) {
|
17
|
+
res.set(header, resource.get(header));
|
18
|
+
}
|
19
|
+
});
|
20
|
+
res.status(resource.statusCode);
|
21
|
+
res.send(resource.body);
|
22
|
+
})
|
23
|
+
.catch(() => {
|
24
|
+
res.set('Content-Type', 'text/css; charset=utf-8');
|
25
|
+
res.status(200);
|
26
|
+
res.send(
|
27
|
+
'/* Override this by adding a File called voltoCustom.css to backend at portal_skins/custom/manage_main */',
|
28
|
+
);
|
29
|
+
});
|
30
|
+
}
|
31
|
+
|
32
|
+
export default function (express) {
|
33
|
+
const middleware = express.Router();
|
34
|
+
middleware.all(['**/voltoCustom.css$'], voltoCustomMiddleware);
|
35
|
+
middleware.id = 'voltoCustom.css';
|
36
|
+
return middleware;
|
37
|
+
}
|