@eeacms/volto-eea-website-theme 1.4.1 → 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 +11 -9
- package/package.json +1 -1
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx +408 -0
- package/src/customizations/volto/components/manage/Blocks/Image/View.jsx +111 -0
- package/src/customizations/volto/components/manage/Blocks/Image/schema.js +121 -0
- package/src/customizations/volto/components/manage/Blocks/Image/style.less +12 -0
- package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.jsx +76 -0
- package/src/customizations/volto/components/manage/Blocks/LeadImage/Edit.jsx +141 -0
- package/src/customizations/volto/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +296 -0
- package/src/customizations/volto/components/manage/Blocks/LeadImage/View.jsx +86 -0
- package/src/customizations/volto/components/manage/Blocks/LeadImage/style.less +12 -0
- package/src/customizations/volto/components/manage/Form/Form.jsx +15 -2
- package/src/customizations/volto/components/manage/Sidebar/ObjectBrowserNav.jsx +5 -2
- package/src/customizations/volto/components/theme/Header/Header.jsx +2 -1
- package/theme/site/imageicons/imageicons.less +0 -5
@@ -0,0 +1,86 @@
|
|
1
|
+
/**
|
2
|
+
* View image block.
|
3
|
+
* @module components/manage/Blocks/Image/View
|
4
|
+
*/
|
5
|
+
|
6
|
+
import React from 'react';
|
7
|
+
import PropTypes from 'prop-types';
|
8
|
+
import { UniversalLink } from '@plone/volto/components';
|
9
|
+
import cx from 'classnames';
|
10
|
+
import { Copyright } from '@eeacms/volto-eea-design-system/ui';
|
11
|
+
import './style.less';
|
12
|
+
import { Icon } from 'semantic-ui-react';
|
13
|
+
import { flattenToAppURL } from '@plone/volto/helpers';
|
14
|
+
|
15
|
+
/**
|
16
|
+
* View image block class.
|
17
|
+
* @class View
|
18
|
+
* @extends Component
|
19
|
+
*/
|
20
|
+
const View = ({ data, properties }) => {
|
21
|
+
const { copyright, copyrightIcon, copyrightPosition } = data;
|
22
|
+
|
23
|
+
return (
|
24
|
+
<p
|
25
|
+
className={cx(
|
26
|
+
'block image align',
|
27
|
+
{
|
28
|
+
center: !Boolean(data.align),
|
29
|
+
},
|
30
|
+
data.align,
|
31
|
+
)}
|
32
|
+
>
|
33
|
+
{properties.image && (
|
34
|
+
<>
|
35
|
+
{(() => {
|
36
|
+
const image = (
|
37
|
+
<div className="image-block">
|
38
|
+
<img
|
39
|
+
className={cx({ 'full-width': data.align === 'full' })}
|
40
|
+
src={flattenToAppURL(properties.image.download)}
|
41
|
+
alt={properties.image_caption || ''}
|
42
|
+
/>
|
43
|
+
<div className="copyright-image">
|
44
|
+
{copyright ? (
|
45
|
+
<Copyright copyrightPosition={copyrightPosition}>
|
46
|
+
<Copyright.Icon>
|
47
|
+
<Icon className={copyrightIcon} />
|
48
|
+
</Copyright.Icon>
|
49
|
+
<Copyright.Text>{copyright}</Copyright.Text>
|
50
|
+
</Copyright>
|
51
|
+
) : (
|
52
|
+
''
|
53
|
+
)}
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
);
|
57
|
+
if (data.href) {
|
58
|
+
return (
|
59
|
+
<UniversalLink
|
60
|
+
href={data.href}
|
61
|
+
openLinkInNewTab={data.openLinkInNewTab}
|
62
|
+
>
|
63
|
+
{image}
|
64
|
+
</UniversalLink>
|
65
|
+
);
|
66
|
+
} else {
|
67
|
+
return image;
|
68
|
+
}
|
69
|
+
})()}
|
70
|
+
</>
|
71
|
+
)}
|
72
|
+
</p>
|
73
|
+
);
|
74
|
+
};
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Property types.
|
78
|
+
* @property {Object} propTypes Property types.
|
79
|
+
* @static
|
80
|
+
*/
|
81
|
+
View.propTypes = {
|
82
|
+
data: PropTypes.objectOf(PropTypes.any).isRequired,
|
83
|
+
properties: PropTypes.objectOf(PropTypes.any).isRequired,
|
84
|
+
};
|
85
|
+
|
86
|
+
export default View;
|
@@ -201,6 +201,8 @@ class Form extends Component {
|
|
201
201
|
selected: selectedBlock,
|
202
202
|
multiSelected: [],
|
203
203
|
isClient: false,
|
204
|
+
// Ensure focus remain in field after change
|
205
|
+
inFocus: {},
|
204
206
|
};
|
205
207
|
this.onChangeField = this.onChangeField.bind(this);
|
206
208
|
this.onSelectBlock = this.onSelectBlock.bind(this);
|
@@ -324,6 +326,13 @@ class Form extends Component {
|
|
324
326
|
[id]:
|
325
327
|
value || (value !== undefined && isBoolean(value)) ? value : null,
|
326
328
|
},
|
329
|
+
// Changing the form data re-renders the select widget which causes the
|
330
|
+
// focus to get lost. To circumvent this, we set the focus back to
|
331
|
+
// the input.
|
332
|
+
// This could fix other widgets too but currently targeted
|
333
|
+
// against the select widget only.
|
334
|
+
// Ensure field to be in focus after the change
|
335
|
+
inFocus: { [id]: true },
|
327
336
|
};
|
328
337
|
});
|
329
338
|
}
|
@@ -441,7 +450,11 @@ class Form extends Component {
|
|
441
450
|
() => {
|
442
451
|
Object.keys(errors).forEach((err) =>
|
443
452
|
toast.error(
|
444
|
-
<Toast
|
453
|
+
<Toast
|
454
|
+
error
|
455
|
+
title={this.props.schema.properties[err].title || err}
|
456
|
+
content={errors[err].join(', ')}
|
457
|
+
/>,
|
445
458
|
),
|
446
459
|
);
|
447
460
|
},
|
@@ -603,7 +616,7 @@ class Form extends Component {
|
|
603
616
|
id={field}
|
604
617
|
fieldSet={item.title.toLowerCase()}
|
605
618
|
formData={this.state.formData}
|
606
|
-
focus={
|
619
|
+
focus={this.state.inFocus[field]}
|
607
620
|
value={this.state.formData?.[field]}
|
608
621
|
required={schema.required.indexOf(field) !== -1}
|
609
622
|
onChange={this.onChangeField}
|
@@ -6,7 +6,6 @@ import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
6
6
|
import { flattenToAppURL, getContentIcon } from '@plone/volto/helpers';
|
7
7
|
import { Image } from 'semantic-ui-react';
|
8
8
|
import config from '@plone/volto/registry';
|
9
|
-
import '@eeacms/volto-eea-website-theme/../theme/site/imageicons/imageicons.less';
|
10
9
|
|
11
10
|
import rightArrowSVG from '@plone/volto/icons/right-key.svg';
|
12
11
|
import homeSVG from '@plone/volto/icons/home.svg';
|
@@ -84,7 +83,11 @@ const ObjectBrowserNav = ({
|
|
84
83
|
{item['@type'] === 'Image' ? (
|
85
84
|
<Image
|
86
85
|
src={`${item?.getURL}/@@images/image`}
|
87
|
-
|
86
|
+
style={{
|
87
|
+
marginRight: '10px',
|
88
|
+
maxHeight: '24px',
|
89
|
+
maxWidth: '24px',
|
90
|
+
}}
|
88
91
|
/>
|
89
92
|
) : (
|
90
93
|
<Icon
|
@@ -53,7 +53,8 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
|
|
53
53
|
(__CLIENT__ && document.body.classList.contains('homepage-inverse'));
|
54
54
|
return (
|
55
55
|
has_home_layout &&
|
56
|
-
(pathname === router_pathname ||
|
56
|
+
(removeTrailingSlash(pathname) === router_pathname ||
|
57
|
+
router_pathname.endsWith('/edit'))
|
57
58
|
);
|
58
59
|
});
|
59
60
|
|