@eeacms/volto-eea-website-policy 1.3.4 → 1.5.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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,37 @@ 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
|
+
### [1.5.0](https://github.com/eea/volto-eea-website-policy/compare/1.4.0...1.5.0) - 24 March 2023
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix(anchors): Keep anchor links internal - refs #142686 [Alin Voinea - [`402fb9b`](https://github.com/eea/volto-eea-website-policy/commit/402fb9b36333d80cd3c21337c0c079cb642d12b8)]
|
|
12
|
+
|
|
13
|
+
#### :house: Internal changes
|
|
14
|
+
|
|
15
|
+
- chore(cleanup): Remove Volto core customizations as the issues were fixed in Volto Core 16.18.0 - refs #142686 [Alin Voinea - [`d0824b2`](https://github.com/eea/volto-eea-website-policy/commit/d0824b2e14d2a18bfb161946c6d0090e11261a53)]
|
|
16
|
+
|
|
17
|
+
#### :hammer_and_wrench: Others
|
|
18
|
+
|
|
19
|
+
- Release 1.5.0 [Alin Voinea - [`a3dea8e`](https://github.com/eea/volto-eea-website-policy/commit/a3dea8ea15cb8d2a876dc10da926ece3a5707ea9)]
|
|
20
|
+
- test(Jenkinsfile): Use latest stable volto for testing [Alin Voinea - [`a8f7123`](https://github.com/eea/volto-eea-website-policy/commit/a8f712364187f9638886667c249fa102cb49b5c0)]
|
|
21
|
+
### [1.4.0](https://github.com/eea/volto-eea-website-policy/compare/1.3.4...1.4.0) - 21 February 2023
|
|
22
|
+
|
|
23
|
+
#### :rocket: New Features
|
|
24
|
+
|
|
25
|
+
- feat(contact-form): Redirect to /en/about/contact-us - refs #160689 [Alin Voinea - [`14ae1f0`](https://github.com/eea/volto-eea-website-policy/commit/14ae1f01c34f9b146207daee538f5988e1df821e)]
|
|
26
|
+
|
|
27
|
+
#### :bug: Bug Fixes
|
|
28
|
+
|
|
29
|
+
- fix(logout): Fix login / logout redirect loop on demo-www [Alin Voinea - [`ab3d0fe`](https://github.com/eea/volto-eea-website-policy/commit/ab3d0fe4a79ed29b63bb0673f748481439d61b3d)]
|
|
30
|
+
|
|
31
|
+
#### :nail_care: Enhancements
|
|
32
|
+
|
|
33
|
+
- refactor(contact-form): Moved to volto-eea-website-theme - refs #160689 [Alin Voinea - [`e7c2e18`](https://github.com/eea/volto-eea-website-policy/commit/e7c2e1851d2db95055ad11bfdd9c7ccf123195f6)]
|
|
34
|
+
|
|
35
|
+
#### :hammer_and_wrench: Others
|
|
36
|
+
|
|
37
|
+
- Release 1.4.0 [Alin Voinea - [`8add7f3`](https://github.com/eea/volto-eea-website-policy/commit/8add7f353887ade8399ab3ad56c96b9dcaba461b)]
|
|
7
38
|
### [1.3.4](https://github.com/eea/volto-eea-website-policy/compare/1.3.3...1.3.4) - 17 February 2023
|
|
8
39
|
|
|
9
40
|
#### :bug: Bug Fixes
|
|
@@ -66,7 +97,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
66
97
|
#### :hammer_and_wrench: Others
|
|
67
98
|
|
|
68
99
|
- Release 1.1.0 [Alin Voinea - [`0291b3b`](https://github.com/eea/volto-eea-website-policy/commit/0291b3bb7b4c6ab09ca98728885cea4051eac8e3)]
|
|
69
|
-
- yarn 3 [Alin Voinea - [`593aa58`](https://github.com/eea/volto-eea-website-policy/commit/593aa58eaa4d28aced0603b7f7dd125c857a6f54)]
|
|
70
100
|
### [1.0.4](https://github.com/eea/volto-eea-website-policy/compare/1.0.3...1.0.4) - 22 November 2022
|
|
71
101
|
|
|
72
102
|
#### :nail_care: Enhancements
|
|
@@ -112,7 +142,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
112
142
|
|
|
113
143
|
#### :hammer_and_wrench: Others
|
|
114
144
|
|
|
115
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`d153f54`](https://github.com/eea/volto-eea-website-policy/commit/d153f54e55e918fa4746e05488c734624eaf14a9)]
|
|
116
145
|
### [0.4.0](https://github.com/eea/volto-eea-website-policy/compare/0.3.3...0.4.0) - 19 September 2022
|
|
117
146
|
|
|
118
147
|
#### :hammer_and_wrench: Others
|
|
@@ -188,7 +217,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
188
217
|
- format index.js [Andrei Grigore - [`db4481a`](https://github.com/eea/volto-eea-website-policy/commit/db4481aeeba59a769272659f33278c902fc69bec)]
|
|
189
218
|
- Update index.js [Alexandru Ghica - [`dc09886`](https://github.com/eea/volto-eea-website-policy/commit/dc0988640a76a9914381b120f58bb61a9ab1eb39)]
|
|
190
219
|
- Added externalRoutes [Alexandru Ghica - [`b68135b`](https://github.com/eea/volto-eea-website-policy/commit/b68135b013fafa93a41ea602ea2fad30879abe0f)]
|
|
191
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`575cca6`](https://github.com/eea/volto-eea-website-policy/commit/575cca674602ca2e1c2a41300c47ba594ff49aa0)]
|
|
192
220
|
### [0.1.1](https://github.com/eea/volto-eea-website-policy/compare/0.1.0...0.1.1) - 4 March 2022
|
|
193
221
|
|
|
194
222
|
#### :hammer_and_wrench: Others
|
|
@@ -201,5 +229,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
201
229
|
|
|
202
230
|
#### :hammer_and_wrench: Others
|
|
203
231
|
|
|
204
|
-
- yarn bootstrap [Alin Voinea - [`9b4d197`](https://github.com/eea/volto-eea-website-policy/commit/9b4d197cbc7992566cb36524d190078d5ad21a44)]
|
|
205
232
|
- Initial commit [Alin Voinea - [`3800692`](https://github.com/eea/volto-eea-website-policy/commit/3800692f7a4de6460815bd6061facacb986cbef0)]
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { addStylingFieldsetSchemaEnhancer } from '@eeacms/volto-eea-website-poli
|
|
|
5
5
|
|
|
6
6
|
const applyConfig = (config) => {
|
|
7
7
|
// #158717#note-25 any path that isn't static, en or controlpanel is treated as external
|
|
8
|
-
const notInEN = /^(?!.*(
|
|
8
|
+
const notInEN = /^(?!.*(#|\/en|\/static|\/controlpanel|\/cypress|\/login|\/logout|\/contact-form)).*$/;
|
|
9
9
|
config.settings.externalRoutes = [
|
|
10
10
|
...(config.settings.externalRoutes || []),
|
|
11
11
|
{
|
|
@@ -17,6 +17,9 @@ const applyConfig = (config) => {
|
|
|
17
17
|
},
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
+
// #160689 Redirect contact-form to contact-us
|
|
21
|
+
config.settings.contactForm = '/en/about/contact-us';
|
|
22
|
+
|
|
20
23
|
// #137187 Keycloak integration
|
|
21
24
|
if (runtimeConfig['RAZZLE_KEYCLOAK'] === 'Yes') {
|
|
22
25
|
config.settings.externalRoutes = [
|
|
@@ -1,625 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Toolbar component.
|
|
3
|
-
* @module components/manage/Toolbar/Toolbar
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { Component } from 'react';
|
|
7
|
-
import { defineMessages, injectIntl } from 'react-intl';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import { Link } from 'react-router-dom';
|
|
10
|
-
import jwtDecode from 'jwt-decode';
|
|
11
|
-
import { connect } from 'react-redux';
|
|
12
|
-
import { compose } from 'redux';
|
|
13
|
-
import { doesNodeContainClick } from 'semantic-ui-react/dist/commonjs/lib';
|
|
14
|
-
import { withCookies } from 'react-cookie';
|
|
15
|
-
import { filter, find } from 'lodash';
|
|
16
|
-
import cx from 'classnames';
|
|
17
|
-
import config from '@plone/volto/registry';
|
|
18
|
-
|
|
19
|
-
import More from '@plone/volto/components/manage/Toolbar/More';
|
|
20
|
-
import PersonalTools from '@plone/volto/components/manage/Toolbar/PersonalTools';
|
|
21
|
-
import Types from '@plone/volto/components/manage/Toolbar/Types';
|
|
22
|
-
import PersonalInformation from '@plone/volto/components/manage/Preferences/PersonalInformation';
|
|
23
|
-
import PersonalPreferences from '@plone/volto/components/manage/Preferences/PersonalPreferences';
|
|
24
|
-
import StandardWrapper from '@plone/volto/components/manage/Toolbar/StandardWrapper';
|
|
25
|
-
import {
|
|
26
|
-
getTypes,
|
|
27
|
-
listActions,
|
|
28
|
-
setExpandedToolbar,
|
|
29
|
-
unlockContent,
|
|
30
|
-
} from '@plone/volto/actions';
|
|
31
|
-
import { Icon } from '@plone/volto/components';
|
|
32
|
-
import {
|
|
33
|
-
BodyClass,
|
|
34
|
-
getBaseUrl,
|
|
35
|
-
getCookieOptions,
|
|
36
|
-
hasApiExpander,
|
|
37
|
-
} from '@plone/volto/helpers';
|
|
38
|
-
import { Pluggable } from '@plone/volto/components/manage/Pluggable';
|
|
39
|
-
|
|
40
|
-
import penSVG from '@plone/volto/icons/pen.svg';
|
|
41
|
-
import unlockSVG from '@plone/volto/icons/unlock.svg';
|
|
42
|
-
import folderSVG from '@plone/volto/icons/folder.svg';
|
|
43
|
-
import addSVG from '@plone/volto/icons/add-document.svg';
|
|
44
|
-
import moreSVG from '@plone/volto/icons/more.svg';
|
|
45
|
-
import userSVG from '@plone/volto/icons/user.svg';
|
|
46
|
-
import backSVG from '@plone/volto/icons/back.svg';
|
|
47
|
-
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
48
|
-
|
|
49
|
-
const messages = defineMessages({
|
|
50
|
-
edit: {
|
|
51
|
-
id: 'Edit',
|
|
52
|
-
defaultMessage: 'Edit',
|
|
53
|
-
},
|
|
54
|
-
contents: {
|
|
55
|
-
id: 'Contents',
|
|
56
|
-
defaultMessage: 'Contents',
|
|
57
|
-
},
|
|
58
|
-
add: {
|
|
59
|
-
id: 'Add',
|
|
60
|
-
defaultMessage: 'Add',
|
|
61
|
-
},
|
|
62
|
-
more: {
|
|
63
|
-
id: 'More',
|
|
64
|
-
defaultMessage: 'More',
|
|
65
|
-
},
|
|
66
|
-
personalTools: {
|
|
67
|
-
id: 'Personal tools',
|
|
68
|
-
defaultMessage: 'Personal tools',
|
|
69
|
-
},
|
|
70
|
-
shrinkToolbar: {
|
|
71
|
-
id: 'Shrink toolbar',
|
|
72
|
-
defaultMessage: 'Shrink toolbar',
|
|
73
|
-
},
|
|
74
|
-
personalInformation: {
|
|
75
|
-
id: 'Personal Information',
|
|
76
|
-
defaultMessage: 'Personal Information',
|
|
77
|
-
},
|
|
78
|
-
personalPreferences: {
|
|
79
|
-
id: 'Personal Preferences',
|
|
80
|
-
defaultMessage: 'Personal Preferences',
|
|
81
|
-
},
|
|
82
|
-
collection: {
|
|
83
|
-
id: 'Collection',
|
|
84
|
-
defaultMessage: 'Collection',
|
|
85
|
-
},
|
|
86
|
-
file: {
|
|
87
|
-
id: 'File',
|
|
88
|
-
defaultMessage: 'File',
|
|
89
|
-
},
|
|
90
|
-
link: {
|
|
91
|
-
id: 'Link',
|
|
92
|
-
defaultMessage: 'Link',
|
|
93
|
-
},
|
|
94
|
-
newsItem: {
|
|
95
|
-
id: 'News Item',
|
|
96
|
-
defaultMessage: 'News Item',
|
|
97
|
-
},
|
|
98
|
-
page: {
|
|
99
|
-
id: 'Page',
|
|
100
|
-
defaultMessage: 'Page',
|
|
101
|
-
},
|
|
102
|
-
back: {
|
|
103
|
-
id: 'Back',
|
|
104
|
-
defaultMessage: 'Back',
|
|
105
|
-
},
|
|
106
|
-
unlock: {
|
|
107
|
-
id: 'Unlock',
|
|
108
|
-
defaultMessage: 'Unlock',
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
let toolbarComponents = {
|
|
113
|
-
personalTools: { component: PersonalTools, wrapper: null },
|
|
114
|
-
more: { component: More, wrapper: null },
|
|
115
|
-
types: { component: Types, wrapper: null, contentAsProps: true },
|
|
116
|
-
profile: {
|
|
117
|
-
component: PersonalInformation,
|
|
118
|
-
wrapper: StandardWrapper,
|
|
119
|
-
wrapperTitle: messages.personalInformation,
|
|
120
|
-
hideToolbarBody: true,
|
|
121
|
-
},
|
|
122
|
-
preferences: {
|
|
123
|
-
component: PersonalPreferences,
|
|
124
|
-
wrapper: StandardWrapper,
|
|
125
|
-
wrapperTitle: messages.personalPreferences,
|
|
126
|
-
hideToolbarBody: true,
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Toolbar container class.
|
|
132
|
-
* @class Toolbar
|
|
133
|
-
* @extends Component
|
|
134
|
-
*/
|
|
135
|
-
class Toolbar extends Component {
|
|
136
|
-
/**
|
|
137
|
-
* Property types.
|
|
138
|
-
* @property {Object} propTypes Property types.
|
|
139
|
-
* @static
|
|
140
|
-
*/
|
|
141
|
-
static propTypes = {
|
|
142
|
-
actions: PropTypes.shape({
|
|
143
|
-
object: PropTypes.arrayOf(PropTypes.object),
|
|
144
|
-
object_buttons: PropTypes.arrayOf(PropTypes.object),
|
|
145
|
-
user: PropTypes.arrayOf(PropTypes.object),
|
|
146
|
-
}),
|
|
147
|
-
token: PropTypes.string,
|
|
148
|
-
userId: PropTypes.string,
|
|
149
|
-
pathname: PropTypes.string.isRequired,
|
|
150
|
-
content: PropTypes.shape({
|
|
151
|
-
'@type': PropTypes.string,
|
|
152
|
-
is_folderish: PropTypes.bool,
|
|
153
|
-
review_state: PropTypes.string,
|
|
154
|
-
}),
|
|
155
|
-
getTypes: PropTypes.func.isRequired,
|
|
156
|
-
types: PropTypes.arrayOf(
|
|
157
|
-
PropTypes.shape({
|
|
158
|
-
'@id': PropTypes.string,
|
|
159
|
-
addable: PropTypes.bool,
|
|
160
|
-
title: PropTypes.string,
|
|
161
|
-
}),
|
|
162
|
-
),
|
|
163
|
-
listActions: PropTypes.func.isRequired,
|
|
164
|
-
unlockContent: PropTypes.func,
|
|
165
|
-
unlockRequest: PropTypes.objectOf(PropTypes.any),
|
|
166
|
-
inner: PropTypes.element.isRequired,
|
|
167
|
-
hideDefaultViewButtons: PropTypes.bool,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Default properties.
|
|
172
|
-
* @property {Object} defaultProps Default properties.
|
|
173
|
-
* @static
|
|
174
|
-
*/
|
|
175
|
-
static defaultProps = {
|
|
176
|
-
actions: null,
|
|
177
|
-
token: null,
|
|
178
|
-
userId: null,
|
|
179
|
-
content: null,
|
|
180
|
-
hideDefaultViewButtons: false,
|
|
181
|
-
types: [],
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
toolbarWindow = React.createRef();
|
|
185
|
-
|
|
186
|
-
constructor(props) {
|
|
187
|
-
super(props);
|
|
188
|
-
const { cookies } = props;
|
|
189
|
-
this.state = {
|
|
190
|
-
expanded: cookies.get('toolbar_expanded') !== 'false',
|
|
191
|
-
showMenu: false,
|
|
192
|
-
menuStyle: {},
|
|
193
|
-
menuComponents: [],
|
|
194
|
-
loadedComponents: [],
|
|
195
|
-
hideToolbarBody: false,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Component will mount
|
|
201
|
-
* @method componentDidMount
|
|
202
|
-
* @returns {undefined}
|
|
203
|
-
*/
|
|
204
|
-
componentDidMount() {
|
|
205
|
-
// Do not trigger the actions action if the expander is present
|
|
206
|
-
if (!hasApiExpander('actions', getBaseUrl(this.props.pathname))) {
|
|
207
|
-
this.props.listActions(getBaseUrl(this.props.pathname));
|
|
208
|
-
}
|
|
209
|
-
// Do not trigger the types action if the expander is present
|
|
210
|
-
if (!hasApiExpander('types', getBaseUrl(this.props.pathname))) {
|
|
211
|
-
this.props.getTypes(getBaseUrl(this.props.pathname));
|
|
212
|
-
}
|
|
213
|
-
toolbarComponents = {
|
|
214
|
-
...(config.settings
|
|
215
|
-
? config.settings.additionalToolbarComponents || {}
|
|
216
|
-
: {}),
|
|
217
|
-
...toolbarComponents,
|
|
218
|
-
};
|
|
219
|
-
this.props.setExpandedToolbar(this.state.expanded);
|
|
220
|
-
document.addEventListener('mousedown', this.handleClickOutside, false);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Component will receive props
|
|
225
|
-
* @method componentWillReceiveProps
|
|
226
|
-
* @param {Object} nextProps Next properties
|
|
227
|
-
* @returns {undefined}
|
|
228
|
-
*/
|
|
229
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
230
|
-
if (nextProps.pathname !== this.props.pathname) {
|
|
231
|
-
// Do not trigger the actions action if the expander is present
|
|
232
|
-
if (!hasApiExpander('actions', getBaseUrl(nextProps.pathname))) {
|
|
233
|
-
this.props.listActions(getBaseUrl(nextProps.pathname));
|
|
234
|
-
}
|
|
235
|
-
// Do not trigger the types action if the expander is present
|
|
236
|
-
if (!hasApiExpander('types', getBaseUrl(nextProps.pathname))) {
|
|
237
|
-
this.props.getTypes(getBaseUrl(nextProps.pathname));
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// Unlock
|
|
242
|
-
if (this.props.unlockRequest.loading && nextProps.unlockRequest.loaded) {
|
|
243
|
-
this.props.listActions(getBaseUrl(nextProps.pathname));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Component will receive props
|
|
249
|
-
* @method componentWillUnmount
|
|
250
|
-
* @returns {undefined}
|
|
251
|
-
*/
|
|
252
|
-
componentWillUnmount() {
|
|
253
|
-
document.removeEventListener('mousedown', this.handleClickOutside, false);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
handleShrink = () => {
|
|
257
|
-
const { cookies } = this.props;
|
|
258
|
-
cookies.set('toolbar_expanded', !this.state.expanded, getCookieOptions());
|
|
259
|
-
this.setState(
|
|
260
|
-
(state) => ({ expanded: !state.expanded }),
|
|
261
|
-
() => this.props.setExpandedToolbar(this.state.expanded),
|
|
262
|
-
);
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
closeMenu = () =>
|
|
266
|
-
this.setState(() => ({ showMenu: false, loadedComponents: [] }));
|
|
267
|
-
|
|
268
|
-
loadComponent = (type) => {
|
|
269
|
-
const { loadedComponents } = this.state;
|
|
270
|
-
if (!this.state.loadedComponents.includes(type)) {
|
|
271
|
-
this.setState({
|
|
272
|
-
loadedComponents: [...loadedComponents, type],
|
|
273
|
-
hideToolbarBody: toolbarComponents[type].hideToolbarBody || false,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
unloadComponent = () => {
|
|
279
|
-
this.setState((state) => ({
|
|
280
|
-
loadedComponents: state.loadedComponents.slice(0, -1),
|
|
281
|
-
hideToolbarBody:
|
|
282
|
-
toolbarComponents[
|
|
283
|
-
state.loadedComponents[state.loadedComponents.length - 2]
|
|
284
|
-
].hideToolbarBody || false,
|
|
285
|
-
}));
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
toggleMenu = (e, selector) => {
|
|
289
|
-
if (this.state.showMenu) {
|
|
290
|
-
this.closeMenu();
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
// PersonalTools always shows at bottom
|
|
294
|
-
if (selector === 'personalTools') {
|
|
295
|
-
this.setState((state) => ({
|
|
296
|
-
showMenu: !state.showMenu,
|
|
297
|
-
menuStyle: { bottom: 0 },
|
|
298
|
-
}));
|
|
299
|
-
} else if (selector === 'more') {
|
|
300
|
-
this.setState((state) => ({
|
|
301
|
-
showMenu: !state.showMenu,
|
|
302
|
-
menuStyle: {
|
|
303
|
-
overflow: 'visible',
|
|
304
|
-
top: 0,
|
|
305
|
-
},
|
|
306
|
-
}));
|
|
307
|
-
} else {
|
|
308
|
-
this.setState((state) => ({
|
|
309
|
-
showMenu: !state.showMenu,
|
|
310
|
-
menuStyle: { top: 0 },
|
|
311
|
-
}));
|
|
312
|
-
}
|
|
313
|
-
this.loadComponent(selector);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
handleClickOutside = (e) => {
|
|
317
|
-
if (this.pusher && doesNodeContainClick(this.pusher, e)) return;
|
|
318
|
-
this.closeMenu();
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
unlock = (e) => {
|
|
322
|
-
this.props.unlockContent(getBaseUrl(this.props.pathname), true);
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Render method.
|
|
327
|
-
* @method render
|
|
328
|
-
* @returns {string} Markup for the component.
|
|
329
|
-
*/
|
|
330
|
-
render() {
|
|
331
|
-
const path = getBaseUrl(this.props.pathname);
|
|
332
|
-
const lock = this.props.content?.lock;
|
|
333
|
-
const unlockAction =
|
|
334
|
-
lock?.locked && lock?.stealable && lock?.creator !== this.props.userId;
|
|
335
|
-
const editAction =
|
|
336
|
-
!unlockAction && find(this.props.actions.object, { id: 'edit' });
|
|
337
|
-
const folderContentsAction = find(this.props.actions.object, {
|
|
338
|
-
id: 'folderContents',
|
|
339
|
-
});
|
|
340
|
-
const { expanded } = this.state;
|
|
341
|
-
|
|
342
|
-
return (
|
|
343
|
-
this.props.token && (
|
|
344
|
-
<>
|
|
345
|
-
<BodyClass
|
|
346
|
-
className={expanded ? 'has-toolbar' : 'has-toolbar-collapsed'}
|
|
347
|
-
/>
|
|
348
|
-
<div
|
|
349
|
-
style={this.state.menuStyle}
|
|
350
|
-
className={
|
|
351
|
-
this.state.showMenu ? 'toolbar-content show' : 'toolbar-content'
|
|
352
|
-
}
|
|
353
|
-
ref={this.toolbarWindow}
|
|
354
|
-
>
|
|
355
|
-
{this.state.showMenu && (
|
|
356
|
-
// This sets the scroll locker in the body tag in mobile
|
|
357
|
-
<BodyClass className="has-toolbar-menu-open" />
|
|
358
|
-
)}
|
|
359
|
-
<div
|
|
360
|
-
className="pusher-puller"
|
|
361
|
-
ref={(node) => (this.pusher = node)}
|
|
362
|
-
style={{
|
|
363
|
-
transform: this.toolbarWindow.current
|
|
364
|
-
? `translateX(-${
|
|
365
|
-
(this.state.loadedComponents.length - 1) *
|
|
366
|
-
this.toolbarWindow.current.getBoundingClientRect().width
|
|
367
|
-
}px)`
|
|
368
|
-
: null,
|
|
369
|
-
}}
|
|
370
|
-
>
|
|
371
|
-
{this.state.loadedComponents.map((component, index) =>
|
|
372
|
-
(() => {
|
|
373
|
-
const ToolbarComponent =
|
|
374
|
-
toolbarComponents[component].component;
|
|
375
|
-
const WrapperComponent = toolbarComponents[component].wrapper;
|
|
376
|
-
const haveActions =
|
|
377
|
-
toolbarComponents[component].hideToolbarBody;
|
|
378
|
-
const title =
|
|
379
|
-
toolbarComponents[component].wrapperTitle &&
|
|
380
|
-
this.props.intl.formatMessage(
|
|
381
|
-
toolbarComponents[component].wrapperTitle,
|
|
382
|
-
);
|
|
383
|
-
if (WrapperComponent) {
|
|
384
|
-
return (
|
|
385
|
-
<WrapperComponent
|
|
386
|
-
componentName={component}
|
|
387
|
-
componentTitle={title}
|
|
388
|
-
pathname={this.props.pathname}
|
|
389
|
-
loadComponent={this.loadComponent}
|
|
390
|
-
unloadComponent={this.unloadComponent}
|
|
391
|
-
componentIndex={index}
|
|
392
|
-
theToolbar={this.toolbarWindow}
|
|
393
|
-
key={`personalToolsComponent-${index}`}
|
|
394
|
-
closeMenu={this.closeMenu}
|
|
395
|
-
hasActions={haveActions}
|
|
396
|
-
>
|
|
397
|
-
<ToolbarComponent
|
|
398
|
-
pathname={this.props.pathname}
|
|
399
|
-
loadComponent={this.loadComponent}
|
|
400
|
-
unloadComponent={this.unloadComponent}
|
|
401
|
-
componentIndex={index}
|
|
402
|
-
theToolbar={this.toolbarWindow}
|
|
403
|
-
closeMenu={this.closeMenu}
|
|
404
|
-
isToolbarEmbedded
|
|
405
|
-
/>
|
|
406
|
-
</WrapperComponent>
|
|
407
|
-
);
|
|
408
|
-
} else {
|
|
409
|
-
return (
|
|
410
|
-
<ToolbarComponent
|
|
411
|
-
pathname={this.props.pathname}
|
|
412
|
-
loadComponent={this.loadComponent}
|
|
413
|
-
unloadComponent={this.unloadComponent}
|
|
414
|
-
componentIndex={index}
|
|
415
|
-
theToolbar={this.toolbarWindow}
|
|
416
|
-
key={`personalToolsComponent-${index}`}
|
|
417
|
-
closeMenu={this.closeMenu}
|
|
418
|
-
content={
|
|
419
|
-
toolbarComponents[component].contentAsProps
|
|
420
|
-
? this.props.content
|
|
421
|
-
: null
|
|
422
|
-
}
|
|
423
|
-
/>
|
|
424
|
-
);
|
|
425
|
-
}
|
|
426
|
-
})(),
|
|
427
|
-
)}
|
|
428
|
-
</div>
|
|
429
|
-
</div>
|
|
430
|
-
<div className={this.state.expanded ? 'toolbar expanded' : 'toolbar'}>
|
|
431
|
-
<div className="toolbar-body">
|
|
432
|
-
<div className="toolbar-actions">
|
|
433
|
-
{this.props.hideDefaultViewButtons && this.props.inner && (
|
|
434
|
-
<>{this.props.inner}</>
|
|
435
|
-
)}
|
|
436
|
-
{!this.props.hideDefaultViewButtons && (
|
|
437
|
-
<>
|
|
438
|
-
{unlockAction && (
|
|
439
|
-
<button
|
|
440
|
-
aria-label={this.props.intl.formatMessage(
|
|
441
|
-
messages.unlock,
|
|
442
|
-
)}
|
|
443
|
-
className="unlock"
|
|
444
|
-
onClick={(e) => this.unlock(e)}
|
|
445
|
-
tabIndex={0}
|
|
446
|
-
>
|
|
447
|
-
<Icon
|
|
448
|
-
name={unlockSVG}
|
|
449
|
-
size="30px"
|
|
450
|
-
className="unlock"
|
|
451
|
-
title={this.props.intl.formatMessage(messages.unlock)}
|
|
452
|
-
/>
|
|
453
|
-
</button>
|
|
454
|
-
)}
|
|
455
|
-
|
|
456
|
-
{editAction && (
|
|
457
|
-
<Link
|
|
458
|
-
aria-label={this.props.intl.formatMessage(
|
|
459
|
-
messages.edit,
|
|
460
|
-
)}
|
|
461
|
-
className="edit"
|
|
462
|
-
to={`${path}/edit`}
|
|
463
|
-
>
|
|
464
|
-
<Icon
|
|
465
|
-
name={penSVG}
|
|
466
|
-
size="30px"
|
|
467
|
-
className="circled"
|
|
468
|
-
title={this.props.intl.formatMessage(messages.edit)}
|
|
469
|
-
/>
|
|
470
|
-
</Link>
|
|
471
|
-
)}
|
|
472
|
-
{this.props.content &&
|
|
473
|
-
this.props.content.is_folderish &&
|
|
474
|
-
folderContentsAction &&
|
|
475
|
-
!this.props.pathname.endsWith('/contents') && (
|
|
476
|
-
<Link
|
|
477
|
-
aria-label={this.props.intl.formatMessage(
|
|
478
|
-
messages.contents,
|
|
479
|
-
)}
|
|
480
|
-
to={`${path}/contents`}
|
|
481
|
-
>
|
|
482
|
-
<Icon
|
|
483
|
-
name={folderSVG}
|
|
484
|
-
size="30px"
|
|
485
|
-
title={this.props.intl.formatMessage(
|
|
486
|
-
messages.contents,
|
|
487
|
-
)}
|
|
488
|
-
/>
|
|
489
|
-
</Link>
|
|
490
|
-
)}
|
|
491
|
-
{this.props.content &&
|
|
492
|
-
this.props.content.is_folderish &&
|
|
493
|
-
folderContentsAction &&
|
|
494
|
-
this.props.pathname.endsWith('/contents') && (
|
|
495
|
-
<Link
|
|
496
|
-
to={`${path}`}
|
|
497
|
-
aria-label={this.props.intl.formatMessage(
|
|
498
|
-
messages.back,
|
|
499
|
-
)}
|
|
500
|
-
>
|
|
501
|
-
<Icon
|
|
502
|
-
name={backSVG}
|
|
503
|
-
className="circled"
|
|
504
|
-
size="30px"
|
|
505
|
-
title={this.props.intl.formatMessage(messages.back)}
|
|
506
|
-
/>
|
|
507
|
-
</Link>
|
|
508
|
-
)}
|
|
509
|
-
{this.props.content &&
|
|
510
|
-
((this.props.content.is_folderish &&
|
|
511
|
-
this.props.types.length > 0) ||
|
|
512
|
-
(config.settings.isMultilingual &&
|
|
513
|
-
this.props.content['@components']?.translations)) && (
|
|
514
|
-
<button
|
|
515
|
-
className="add"
|
|
516
|
-
aria-label={this.props.intl.formatMessage(
|
|
517
|
-
messages.add,
|
|
518
|
-
)}
|
|
519
|
-
onClick={(e) => this.toggleMenu(e, 'types')}
|
|
520
|
-
tabIndex={0}
|
|
521
|
-
id="toolbar-add"
|
|
522
|
-
>
|
|
523
|
-
<Icon
|
|
524
|
-
name={addSVG}
|
|
525
|
-
size="30px"
|
|
526
|
-
title={this.props.intl.formatMessage(messages.add)}
|
|
527
|
-
/>
|
|
528
|
-
</button>
|
|
529
|
-
)}
|
|
530
|
-
<div className="toolbar-button-spacer" />
|
|
531
|
-
<button
|
|
532
|
-
className="more"
|
|
533
|
-
aria-label={this.props.intl.formatMessage(messages.more)}
|
|
534
|
-
onClick={(e) => this.toggleMenu(e, 'more')}
|
|
535
|
-
tabIndex={0}
|
|
536
|
-
id="toolbar-more"
|
|
537
|
-
>
|
|
538
|
-
<Icon
|
|
539
|
-
className="mobile hidden"
|
|
540
|
-
name={moreSVG}
|
|
541
|
-
size="30px"
|
|
542
|
-
title={this.props.intl.formatMessage(messages.more)}
|
|
543
|
-
/>
|
|
544
|
-
{this.state.showMenu ? (
|
|
545
|
-
<Icon
|
|
546
|
-
className="mobile only"
|
|
547
|
-
name={clearSVG}
|
|
548
|
-
size="30px"
|
|
549
|
-
/>
|
|
550
|
-
) : (
|
|
551
|
-
<Icon
|
|
552
|
-
className="mobile only"
|
|
553
|
-
name={moreSVG}
|
|
554
|
-
size="30px"
|
|
555
|
-
/>
|
|
556
|
-
)}
|
|
557
|
-
</button>
|
|
558
|
-
</>
|
|
559
|
-
)}
|
|
560
|
-
<Pluggable name="main.toolbar.top" />
|
|
561
|
-
</div>
|
|
562
|
-
<div className="toolbar-bottom">
|
|
563
|
-
<Pluggable
|
|
564
|
-
name="main.toolbar.bottom"
|
|
565
|
-
params={{ onClickHandler: this.toggleMenu }}
|
|
566
|
-
/>
|
|
567
|
-
{!this.props.hideDefaultViewButtons && (
|
|
568
|
-
<button
|
|
569
|
-
className="user"
|
|
570
|
-
aria-label={this.props.intl.formatMessage(
|
|
571
|
-
messages.personalTools,
|
|
572
|
-
)}
|
|
573
|
-
onClick={(e) => this.toggleMenu(e, 'personalTools')}
|
|
574
|
-
tabIndex={0}
|
|
575
|
-
id="toolbar-personal"
|
|
576
|
-
>
|
|
577
|
-
<Icon
|
|
578
|
-
name={userSVG}
|
|
579
|
-
size="30px"
|
|
580
|
-
title={this.props.intl.formatMessage(
|
|
581
|
-
messages.personalTools,
|
|
582
|
-
)}
|
|
583
|
-
/>
|
|
584
|
-
</button>
|
|
585
|
-
)}
|
|
586
|
-
</div>
|
|
587
|
-
</div>
|
|
588
|
-
<div className="toolbar-handler">
|
|
589
|
-
<button
|
|
590
|
-
aria-label={this.props.intl.formatMessage(
|
|
591
|
-
messages.shrinkToolbar,
|
|
592
|
-
)}
|
|
593
|
-
className={cx({
|
|
594
|
-
[this.props.content?.review_state]: this.props.content
|
|
595
|
-
?.review_state,
|
|
596
|
-
})}
|
|
597
|
-
onClick={this.handleShrink}
|
|
598
|
-
/>
|
|
599
|
-
</div>
|
|
600
|
-
</div>
|
|
601
|
-
<div className="pusher" />
|
|
602
|
-
</>
|
|
603
|
-
)
|
|
604
|
-
);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
export default compose(
|
|
609
|
-
injectIntl,
|
|
610
|
-
withCookies,
|
|
611
|
-
connect(
|
|
612
|
-
(state, props) => ({
|
|
613
|
-
actions: state.actions.actions,
|
|
614
|
-
token: state.userSession.token,
|
|
615
|
-
userId: state.userSession.token
|
|
616
|
-
? jwtDecode(state.userSession.token).sub
|
|
617
|
-
: '',
|
|
618
|
-
content: state.content.data,
|
|
619
|
-
pathname: props.pathname,
|
|
620
|
-
types: filter(state.types.types, 'addable'),
|
|
621
|
-
unlockRequest: state.content.unlock,
|
|
622
|
-
}),
|
|
623
|
-
{ getTypes, listActions, setExpandedToolbar, unlockContent },
|
|
624
|
-
),
|
|
625
|
-
)(Toolbar);
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Link View.
|
|
3
|
-
* @module components/theme/View/LinkView
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { Component } from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
|
|
9
|
-
import { Container } from 'semantic-ui-react';
|
|
10
|
-
import { UniversalLink } from '@plone/volto/components';
|
|
11
|
-
import { FormattedMessage } from 'react-intl';
|
|
12
|
-
import config from '@plone/volto/registry';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* View container class.
|
|
16
|
-
* @class View
|
|
17
|
-
* @extends Component
|
|
18
|
-
*/
|
|
19
|
-
class LinkView extends Component {
|
|
20
|
-
/**
|
|
21
|
-
* Property types.
|
|
22
|
-
* @property {Object} propTypes Property types.
|
|
23
|
-
* @static
|
|
24
|
-
*/
|
|
25
|
-
static propTypes = {
|
|
26
|
-
content: PropTypes.shape({
|
|
27
|
-
title: PropTypes.string,
|
|
28
|
-
description: PropTypes.string,
|
|
29
|
-
remoteUrl: PropTypes.string,
|
|
30
|
-
}),
|
|
31
|
-
token: PropTypes.string,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Default properties.
|
|
36
|
-
* @property {Object} defaultProps Default properties.
|
|
37
|
-
* @static
|
|
38
|
-
*/
|
|
39
|
-
static defaultProps = {
|
|
40
|
-
content: null,
|
|
41
|
-
token: null,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
componentDidMount() {
|
|
45
|
-
if (!this.props.token) {
|
|
46
|
-
const { remoteUrl } = this.props.content;
|
|
47
|
-
if (isInternalURL(remoteUrl) && remoteUrl.includes('/en/')) {
|
|
48
|
-
this.props.history.replace(flattenToAppURL(remoteUrl));
|
|
49
|
-
} else if (!__SERVER__) {
|
|
50
|
-
window.location.replace(flattenToAppURL(remoteUrl));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Render method.
|
|
57
|
-
* @method render
|
|
58
|
-
* @returns {string} Markup for the component.
|
|
59
|
-
*/
|
|
60
|
-
render() {
|
|
61
|
-
const { remoteUrl } = this.props.content;
|
|
62
|
-
const { openExternalLinkInNewTab } = config.settings;
|
|
63
|
-
return (
|
|
64
|
-
<Container id="page-document">
|
|
65
|
-
<h1 className="documentFirstHeading">{this.props.content.title}</h1>
|
|
66
|
-
{this.props.content.description && (
|
|
67
|
-
<p className="documentDescription">
|
|
68
|
-
{this.props.content.description}
|
|
69
|
-
</p>
|
|
70
|
-
)}
|
|
71
|
-
{remoteUrl && (
|
|
72
|
-
<p>
|
|
73
|
-
<FormattedMessage
|
|
74
|
-
id="The link address is:"
|
|
75
|
-
defaultMessage="The link address is:"
|
|
76
|
-
/>{' '}
|
|
77
|
-
<UniversalLink
|
|
78
|
-
href={remoteUrl}
|
|
79
|
-
openLinkInNewTab={
|
|
80
|
-
openExternalLinkInNewTab && !isInternalURL(remoteUrl)
|
|
81
|
-
}
|
|
82
|
-
>
|
|
83
|
-
{flattenToAppURL(remoteUrl)}
|
|
84
|
-
</UniversalLink>
|
|
85
|
-
</p>
|
|
86
|
-
)}
|
|
87
|
-
</Container>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export default LinkView;
|