@eeacms/volto-eea-website-policy 1.4.0 → 1.6.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 +28 -0
- package/package.json +1 -1
- package/src/index.js +8 -56
- package/src/components/Blocks/LayoutSettings/LayoutSettingsEdit.jsx +0 -32
- package/src/components/Blocks/LayoutSettings/LayoutSettingsView.jsx +0 -15
- package/src/components/Blocks/LayoutSettings/edit.less +0 -4
- package/src/components/Blocks/LayoutSettings/index.js +0 -24
- package/src/components/Blocks/LayoutSettings/schema.js +0 -31
- package/src/components/Blocks/icons/image-narrow.svg +0 -5
- package/src/components/Blocks/schema-utils.js +0 -16
- package/src/components/Blocks/schema.js +0 -51
- package/src/customizations/volto/components/manage/Toolbar/Toolbar.jsx +0 -625
- package/src/customizations/volto/components/theme/View/LinkView.jsx +0 -92
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@ 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.6.0](https://github.com/eea/volto-eea-website-policy/compare/1.5.0...1.6.0) - 22 May 2023
|
|
8
|
+
|
|
9
|
+
#### :nail_care: Enhancements
|
|
10
|
+
|
|
11
|
+
- change(blocks): moved most used block config within eea-website-theme [David Ichim - [`b18d5ce`](https://github.com/eea/volto-eea-website-policy/commit/b18d5ce958c7e7f814969df8051d65c49133ca88)]
|
|
12
|
+
- change(blocks): moved layout settings block within volto-eea-website-theme #48 from eea/252559-policy-refactoring [ichim-david - [`45fee8e`](https://github.com/eea/volto-eea-website-policy/commit/45fee8e68d1a18d7be77f33a8207524ae6f7d220)]
|
|
13
|
+
- change(blocks): moved layout settings block from volto-eea-policy to volto-eea-website-theme [David Ichim - [`37bc97d`](https://github.com/eea/volto-eea-website-policy/commit/37bc97d0a3db77fa8f31e750be179cb287814217)]
|
|
14
|
+
|
|
15
|
+
#### :hammer_and_wrench: Others
|
|
16
|
+
|
|
17
|
+
- Increased package version [Alexandru Ghica - [`174b77e`](https://github.com/eea/volto-eea-website-policy/commit/174b77eccf7ba80286edee8ea30c1a3f2523b200)]
|
|
18
|
+
- prettier fix [Miu Razvan - [`eef9199`](https://github.com/eea/volto-eea-website-policy/commit/eef91996a480b371da69506700285c12adb69167)]
|
|
19
|
+
- prettier fix [Miu Razvan - [`0a3bf2d`](https://github.com/eea/volto-eea-website-policy/commit/0a3bf2de5103fd898e68491207751d39c8510d08)]
|
|
20
|
+
- other: disable tableau and map embed blocks [Miu Razvan - [`a032766`](https://github.com/eea/volto-eea-website-policy/commit/a0327664c25c55beb544dd22ca2e9d5cc6380acd)]
|
|
21
|
+
### [1.5.0](https://github.com/eea/volto-eea-website-policy/compare/1.4.0...1.5.0) - 24 March 2023
|
|
22
|
+
|
|
23
|
+
#### :bug: Bug Fixes
|
|
24
|
+
|
|
25
|
+
- fix(anchors): Keep anchor links internal - refs #142686 [Alin Voinea - [`402fb9b`](https://github.com/eea/volto-eea-website-policy/commit/402fb9b36333d80cd3c21337c0c079cb642d12b8)]
|
|
26
|
+
|
|
27
|
+
#### :house: Internal changes
|
|
28
|
+
|
|
29
|
+
- 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)]
|
|
30
|
+
|
|
31
|
+
#### :hammer_and_wrench: Others
|
|
32
|
+
|
|
33
|
+
- Release 1.5.0 [Alin Voinea - [`a3dea8e`](https://github.com/eea/volto-eea-website-policy/commit/a3dea8ea15cb8d2a876dc10da926ece3a5707ea9)]
|
|
34
|
+
- test(Jenkinsfile): Use latest stable volto for testing [Alin Voinea - [`a8f7123`](https://github.com/eea/volto-eea-website-policy/commit/a8f712364187f9638886667c249fa102cb49b5c0)]
|
|
7
35
|
### [1.4.0](https://github.com/eea/volto-eea-website-policy/compare/1.3.4...1.4.0) - 21 February 2023
|
|
8
36
|
|
|
9
37
|
#### :rocket: New Features
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { runtimeConfig } from '@plone/volto/runtime_config';
|
|
2
2
|
import installContextNavigationBlock from '@eeacms/volto-eea-website-policy/components/Blocks/ContextNavigation';
|
|
3
|
-
import installLayoutSettingsBlock from '@eeacms/volto-eea-website-policy/components/Blocks/LayoutSettings';
|
|
4
|
-
import { addStylingFieldsetSchemaEnhancer } from '@eeacms/volto-eea-website-policy/components/Blocks/schema';
|
|
5
3
|
|
|
6
4
|
const applyConfig = (config) => {
|
|
7
5
|
// #158717#note-25 any path that isn't static, en or controlpanel is treated as external
|
|
8
|
-
const notInEN = /^(?!.*(
|
|
6
|
+
const notInEN = /^(?!.*(#|\/en|\/static|\/controlpanel|\/cypress|\/login|\/logout|\/contact-form)).*$/;
|
|
9
7
|
config.settings.externalRoutes = [
|
|
10
8
|
...(config.settings.externalRoutes || []),
|
|
11
9
|
{
|
|
@@ -59,53 +57,6 @@ const applyConfig = (config) => {
|
|
|
59
57
|
config.settings.eea.logoTargetUrl = '/en';
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
// Block chooser
|
|
63
|
-
config.blocks.blocksConfig.image.mostUsed = false;
|
|
64
|
-
config.blocks.blocksConfig.video.mostUsed = false;
|
|
65
|
-
|
|
66
|
-
// Grid/Teaser block (kitconcept)
|
|
67
|
-
if (config.blocks.blocksConfig.__grid) {
|
|
68
|
-
config.blocks.blocksConfig.__grid.restricted = true;
|
|
69
|
-
}
|
|
70
|
-
if (config.blocks.blocksConfig.imagesGrid) {
|
|
71
|
-
config.blocks.blocksConfig.imagesGrid.restricted = true;
|
|
72
|
-
}
|
|
73
|
-
if (config.blocks.blocksConfig.teaser) {
|
|
74
|
-
config.blocks.blocksConfig.teaser.restricted = true;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Divider
|
|
78
|
-
if (config.blocks.blocksConfig.dividerBlock) {
|
|
79
|
-
config.blocks.blocksConfig.dividerBlock.mostUsed = true;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Call to Action
|
|
83
|
-
if (config.blocks.blocksConfig.callToActionBlock) {
|
|
84
|
-
config.blocks.blocksConfig.callToActionBlock.mostUsed = true;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Group
|
|
88
|
-
if (config.blocks.blocksConfig.group) {
|
|
89
|
-
config.blocks.blocksConfig.group.schemaEnhancer = addStylingFieldsetSchemaEnhancer;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Columns
|
|
93
|
-
if (config.blocks.blocksConfig.columnsBlock) {
|
|
94
|
-
config.blocks.blocksConfig.columnsBlock.mostUsed = true;
|
|
95
|
-
config.blocks.blocksConfig.columnsBlock.schemaEnhancer = addStylingFieldsetSchemaEnhancer;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Accordion
|
|
99
|
-
if (config.blocks.blocksConfig.accordion) {
|
|
100
|
-
config.blocks.blocksConfig.accordion.mostUsed = true;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Listing
|
|
104
|
-
if (config.blocks.blocksConfig.listing) {
|
|
105
|
-
config.blocks.blocksConfig.listing.title = 'Listing (Content)';
|
|
106
|
-
config.blocks.blocksConfig.listing.schemaEnhancer = addStylingFieldsetSchemaEnhancer;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
60
|
// Custom blocks
|
|
110
61
|
// context navigation
|
|
111
62
|
config = [installContextNavigationBlock].reduce(
|
|
@@ -113,17 +64,18 @@ const applyConfig = (config) => {
|
|
|
113
64
|
config,
|
|
114
65
|
);
|
|
115
66
|
|
|
116
|
-
// layout settings
|
|
117
|
-
config = [installLayoutSettingsBlock].reduce(
|
|
118
|
-
(acc, apply) => apply(acc),
|
|
119
|
-
config,
|
|
120
|
-
);
|
|
121
|
-
|
|
122
67
|
// Disable some blocks
|
|
123
68
|
if (config.blocks.blocksConfig.imagecards) {
|
|
124
69
|
config.blocks.blocksConfig.imagecards.restricted = true;
|
|
125
70
|
}
|
|
126
71
|
|
|
72
|
+
if (config.blocks.blocksConfig.embed_eea_tableau_block) {
|
|
73
|
+
config.blocks.blocksConfig.embed_eea_tableau_block.restricted = true;
|
|
74
|
+
}
|
|
75
|
+
if (config.blocks.blocksConfig.embed_eea_map_block) {
|
|
76
|
+
config.blocks.blocksConfig.embed_eea_map_block.restricted = true;
|
|
77
|
+
}
|
|
78
|
+
|
|
127
79
|
config.settings.apiExpanders = [
|
|
128
80
|
...config.settings.apiExpanders,
|
|
129
81
|
{
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditSchema } from '@eeacms/volto-eea-website-policy/components/Blocks/LayoutSettings/schema';
|
|
3
|
-
import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
|
|
4
|
-
import LayoutSettingsView from '@eeacms/volto-eea-website-policy/components/Blocks/LayoutSettings/LayoutSettingsView';
|
|
5
|
-
import '@eeacms/volto-eea-website-policy/components/Blocks/LayoutSettings/edit.less';
|
|
6
|
-
|
|
7
|
-
const LayoutSettingsEdit = (props) => {
|
|
8
|
-
const schema = EditSchema();
|
|
9
|
-
return (
|
|
10
|
-
<>
|
|
11
|
-
<h3>Page layout settings</h3>
|
|
12
|
-
<LayoutSettingsView {...props} />
|
|
13
|
-
<SidebarPortal selected={props.selected}>
|
|
14
|
-
{props.selected && (
|
|
15
|
-
<BlockDataForm
|
|
16
|
-
title={schema.title}
|
|
17
|
-
schema={schema}
|
|
18
|
-
formData={props.data}
|
|
19
|
-
onChangeField={(id, value) => {
|
|
20
|
-
props.onChangeBlock(props.block, {
|
|
21
|
-
...props.data,
|
|
22
|
-
[id]: value,
|
|
23
|
-
});
|
|
24
|
-
}}
|
|
25
|
-
/>
|
|
26
|
-
)}
|
|
27
|
-
</SidebarPortal>
|
|
28
|
-
</>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default LayoutSettingsEdit;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BodyClass } from '@plone/volto/helpers';
|
|
3
|
-
import { getVoltoStyles } from '@eeacms/volto-eea-website-policy/components/Blocks/schema-utils';
|
|
4
|
-
import cx from 'classnames';
|
|
5
|
-
|
|
6
|
-
const LayoutSettingsView = (props) => {
|
|
7
|
-
const classNames = getVoltoStyles(props.data);
|
|
8
|
-
return <BodyClass className={cx(classNames)} />;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
function propsAreEqual(prevProps, nextProps) {
|
|
12
|
-
return prevProps.data === nextProps.data;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default React.memo(LayoutSettingsView, propsAreEqual);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import codeSVG from '@plone/volto/icons/code.svg';
|
|
2
|
-
import LayoutSettingsView from './LayoutSettingsView';
|
|
3
|
-
import LayoutSettingsEdit from './LayoutSettingsEdit';
|
|
4
|
-
import BlockSettingsSchema from '@plone/volto/components/manage/Blocks/Block/Schema';
|
|
5
|
-
|
|
6
|
-
export default (config) => {
|
|
7
|
-
config.blocks.blocksConfig.layoutSettings = {
|
|
8
|
-
id: 'layoutSettings',
|
|
9
|
-
title: 'Layout settings',
|
|
10
|
-
icon: codeSVG,
|
|
11
|
-
group: 'common',
|
|
12
|
-
view: LayoutSettingsView,
|
|
13
|
-
edit: LayoutSettingsEdit,
|
|
14
|
-
schema: BlockSettingsSchema,
|
|
15
|
-
restricted: ({ properties }) => {
|
|
16
|
-
return !!properties['@type'];
|
|
17
|
-
},
|
|
18
|
-
mostUsed: true,
|
|
19
|
-
blockHasOwnFocusManagement: true,
|
|
20
|
-
sidebarTab: 1,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return config;
|
|
24
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import imageNarrowSVG from '@eeacms/volto-eea-website-policy/components/Blocks/icons/image-narrow.svg';
|
|
2
|
-
import imageFitSVG from '@plone/volto/icons/image-fit.svg';
|
|
3
|
-
import imageWideSVG from '@plone/volto/icons/image-wide.svg';
|
|
4
|
-
|
|
5
|
-
export const ALIGN_INFO_MAP = {
|
|
6
|
-
narrow_view: [imageNarrowSVG, 'Narrow width'],
|
|
7
|
-
container_view: [imageFitSVG, 'Container width'],
|
|
8
|
-
wide_view: [imageWideSVG, 'Wide width'],
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const EditSchema = () => {
|
|
12
|
-
return {
|
|
13
|
-
title: 'Page layout settings',
|
|
14
|
-
fieldsets: [
|
|
15
|
-
{
|
|
16
|
-
id: 'default',
|
|
17
|
-
title: 'Default',
|
|
18
|
-
fields: ['layout_size'],
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
required: [],
|
|
22
|
-
properties: {
|
|
23
|
-
layout_size: {
|
|
24
|
-
widget: 'style_align',
|
|
25
|
-
title: 'Layout size',
|
|
26
|
-
actions: Object.keys(ALIGN_INFO_MAP),
|
|
27
|
-
actionsInfoMap: ALIGN_INFO_MAP,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg width="36" height="36" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M10 13L11.9333 11V25L10 23H26L24.0667 25V11L26 13H10ZM26 11V18V21.5V23.5V25H10V11H26Z" fill="black"/>
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 31H29V29H7V31Z"/>
|
|
4
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 7H29V5H7V7Z"/>
|
|
5
|
-
</svg>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const getVoltoStyles = (props) => {
|
|
2
|
-
// return an object with same key and value for cx class setting
|
|
3
|
-
const styles = props ? props : {};
|
|
4
|
-
const output = {};
|
|
5
|
-
for (const [key, value] of Object.entries(styles)) {
|
|
6
|
-
if (key === '@type') {
|
|
7
|
-
continue;
|
|
8
|
-
}
|
|
9
|
-
if (styles[key] === true) {
|
|
10
|
-
output[key] = key;
|
|
11
|
-
} else {
|
|
12
|
-
output[value] = value;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return output;
|
|
16
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { cloneDeep } from 'lodash';
|
|
2
|
-
import imageNarrowSVG from '@eeacms/volto-eea-website-policy/components/Blocks/icons/image-narrow.svg';
|
|
3
|
-
import imageFitSVG from '@plone/volto/icons/image-fit.svg';
|
|
4
|
-
import imageWideSVG from '@plone/volto/icons/image-wide.svg';
|
|
5
|
-
import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
6
|
-
|
|
7
|
-
export const ALIGN_INFO_MAP = {
|
|
8
|
-
narrow_width: [imageNarrowSVG, 'Narrow width'],
|
|
9
|
-
container_width: [imageFitSVG, 'Container width'],
|
|
10
|
-
wide_width: [imageWideSVG, 'Wide width'],
|
|
11
|
-
full: [imageFullSVG, 'Full width'],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const addStylingFieldsetSchemaEnhancer = ({ schema }) => {
|
|
15
|
-
const applied = schema?.properties?.styles;
|
|
16
|
-
|
|
17
|
-
if (!applied) {
|
|
18
|
-
const resSchema = cloneDeep(schema);
|
|
19
|
-
|
|
20
|
-
resSchema.fieldsets.push({
|
|
21
|
-
id: 'styling',
|
|
22
|
-
fields: ['styles'],
|
|
23
|
-
title: 'Styling',
|
|
24
|
-
});
|
|
25
|
-
resSchema.properties.styles = {
|
|
26
|
-
widget: 'object',
|
|
27
|
-
title: 'Styling',
|
|
28
|
-
schema: {
|
|
29
|
-
fieldsets: [
|
|
30
|
-
{
|
|
31
|
-
id: 'default',
|
|
32
|
-
title: 'Default',
|
|
33
|
-
fields: ['size'],
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
properties: {
|
|
37
|
-
size: {
|
|
38
|
-
widget: 'style_align',
|
|
39
|
-
title: 'Section size',
|
|
40
|
-
actions: Object.keys(ALIGN_INFO_MAP),
|
|
41
|
-
actionsInfoMap: ALIGN_INFO_MAP,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
required: [],
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
return resSchema;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return schema;
|
|
51
|
-
};
|
|
@@ -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;
|