@eeacms/volto-eea-website-policy 0.3.3 → 0.4.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/package.json +1 -1
- package/src/index.js +4 -8
- package/src/components/Blocks/Item/Edit.jsx +0 -98
- package/src/components/Blocks/Item/Item.jsx +0 -50
- package/src/components/Blocks/Item/View.jsx +0 -9
- package/src/components/Blocks/Item/index.js +0 -32
- package/src/components/Blocks/Item/schema.js +0 -110
- package/src/components/Blocks/Teaser/Card.jsx +0 -79
- package/src/components/Blocks/Teaser/Schema.js +0 -70
- package/src/components/Blocks/Teaser/index.js +0 -26
- package/src/components/Blocks/Teaser/utils.js +0 -18
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { runtimeConfig } from '@plone/volto/runtime_config';
|
|
2
2
|
import installCallout from 'volto-slate/editor/plugins/Callout';
|
|
3
|
-
import installItemBlock from '@eeacms/volto-eea-website-policy/components/Blocks/Item';
|
|
4
|
-
import customizeTeaserBlock from '@eeacms/volto-eea-website-policy/components/Blocks/Teaser';
|
|
5
3
|
import installContextNavigationBlock from '@eeacms/volto-eea-website-policy/components/Blocks/ContextNavigation';
|
|
6
4
|
|
|
7
5
|
const applyConfig = (config) => {
|
|
@@ -100,12 +98,10 @@ const applyConfig = (config) => {
|
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
// Custom blocks
|
|
103
|
-
config = [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
].reduce((acc, apply) => apply(acc), config);
|
|
108
|
-
config.blocks.blocksConfig.item.mostUsed = true;
|
|
101
|
+
config = [installContextNavigationBlock].reduce(
|
|
102
|
+
(acc, apply) => apply(acc),
|
|
103
|
+
config,
|
|
104
|
+
);
|
|
109
105
|
|
|
110
106
|
// Disable some blocks
|
|
111
107
|
if (config.blocks.blocksConfig.imagecards) {
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { connect } from 'react-redux';
|
|
3
|
-
import config from '@plone/volto/registry';
|
|
4
|
-
import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
|
|
5
|
-
import SlateEditor from 'volto-slate/editor/SlateEditor';
|
|
6
|
-
import { handleKey } from 'volto-slate/blocks/Text/keyboard';
|
|
7
|
-
import { uploadContent, saveSlateBlockSelection } from 'volto-slate/actions';
|
|
8
|
-
|
|
9
|
-
import { createSlateParagraph } from '@eeacms/volto-eea-website-policy/helpers';
|
|
10
|
-
|
|
11
|
-
import Item from './Item';
|
|
12
|
-
import getSchema from './schema';
|
|
13
|
-
|
|
14
|
-
const Edit = (props) => {
|
|
15
|
-
const { slate } = config.settings;
|
|
16
|
-
const {
|
|
17
|
-
data = {},
|
|
18
|
-
block = null,
|
|
19
|
-
selected = false,
|
|
20
|
-
index,
|
|
21
|
-
properties,
|
|
22
|
-
onChangeBlock,
|
|
23
|
-
onSelectBlock,
|
|
24
|
-
} = props;
|
|
25
|
-
const { description } = data;
|
|
26
|
-
const schema = React.useMemo(() => getSchema(props), [props]);
|
|
27
|
-
|
|
28
|
-
const withBlockProperties = React.useCallback(
|
|
29
|
-
(editor) => {
|
|
30
|
-
editor.getBlockProps = () => props;
|
|
31
|
-
return editor;
|
|
32
|
-
},
|
|
33
|
-
[props],
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const handleFocus = React.useCallback(() => {
|
|
37
|
-
if (!selected) {
|
|
38
|
-
onSelectBlock(block);
|
|
39
|
-
}
|
|
40
|
-
}, [onSelectBlock, selected, block]);
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<>
|
|
44
|
-
<Item {...data} mode="edit">
|
|
45
|
-
<SlateEditor
|
|
46
|
-
index={index}
|
|
47
|
-
properties={properties}
|
|
48
|
-
extensions={slate.textblockExtensions}
|
|
49
|
-
renderExtensions={[withBlockProperties]}
|
|
50
|
-
value={createSlateParagraph(description)}
|
|
51
|
-
onChange={(description) => {
|
|
52
|
-
onChangeBlock(block, {
|
|
53
|
-
...data,
|
|
54
|
-
description,
|
|
55
|
-
});
|
|
56
|
-
}}
|
|
57
|
-
block={block}
|
|
58
|
-
onFocus={handleFocus}
|
|
59
|
-
onKeyDown={handleKey}
|
|
60
|
-
selected={selected}
|
|
61
|
-
placeholder="Add item description..."
|
|
62
|
-
slateSettings={slate}
|
|
63
|
-
/>
|
|
64
|
-
</Item>
|
|
65
|
-
<SidebarPortal selected={selected}>
|
|
66
|
-
<BlockDataForm
|
|
67
|
-
block={block}
|
|
68
|
-
schema={schema}
|
|
69
|
-
title={schema.title}
|
|
70
|
-
onChangeField={(id, value) => {
|
|
71
|
-
onChangeBlock(block, {
|
|
72
|
-
...data,
|
|
73
|
-
[id]: value,
|
|
74
|
-
});
|
|
75
|
-
}}
|
|
76
|
-
formData={data}
|
|
77
|
-
/>
|
|
78
|
-
</SidebarPortal>
|
|
79
|
-
</>
|
|
80
|
-
);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export default connect(
|
|
84
|
-
(state, props) => {
|
|
85
|
-
const blockId = props.block;
|
|
86
|
-
return {
|
|
87
|
-
defaultSelection: blockId
|
|
88
|
-
? state.slate_block_selections?.[blockId]
|
|
89
|
-
: null,
|
|
90
|
-
uploadRequest: state.upload_content?.[props.block]?.upload || {},
|
|
91
|
-
uploadedContent: state.upload_content?.[props.block]?.data || {},
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
uploadContent,
|
|
96
|
-
saveSlateBlockSelection, // needed as editor blockProps
|
|
97
|
-
},
|
|
98
|
-
)(Edit);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import cx from 'classnames';
|
|
2
|
-
import { Item as UiItem, Icon } from 'semantic-ui-react';
|
|
3
|
-
import { serializeText } from '@eeacms/volto-eea-website-policy/helpers';
|
|
4
|
-
|
|
5
|
-
function Item({
|
|
6
|
-
assetType,
|
|
7
|
-
children,
|
|
8
|
-
description,
|
|
9
|
-
extra,
|
|
10
|
-
header,
|
|
11
|
-
icon,
|
|
12
|
-
iconSize = 'huge',
|
|
13
|
-
iconTheme,
|
|
14
|
-
image,
|
|
15
|
-
imageSize = 'tile',
|
|
16
|
-
meta,
|
|
17
|
-
mode = 'view',
|
|
18
|
-
styles = {},
|
|
19
|
-
}) {
|
|
20
|
-
const { verticalAlign } = styles;
|
|
21
|
-
return (
|
|
22
|
-
<UiItem.Group unstackable className="row">
|
|
23
|
-
<UiItem className={cx(styles?.theme)}>
|
|
24
|
-
{assetType === 'image' && image && (
|
|
25
|
-
<UiItem.Image
|
|
26
|
-
src={`${image}/@@images/image/preview`}
|
|
27
|
-
className={cx('ui', imageSize)}
|
|
28
|
-
alt={header || 'Item image'}
|
|
29
|
-
/>
|
|
30
|
-
)}
|
|
31
|
-
{assetType === 'icon' && icon && (
|
|
32
|
-
<Icon className={cx(icon, iconTheme)} size={iconSize} />
|
|
33
|
-
)}
|
|
34
|
-
<UiItem.Content verticalAlign={verticalAlign}>
|
|
35
|
-
{header && <UiItem.Header>{header}</UiItem.Header>}
|
|
36
|
-
{meta && <UiItem.Meta>{meta}</UiItem.Meta>}
|
|
37
|
-
{description && mode === 'view' && (
|
|
38
|
-
<UiItem.Description>
|
|
39
|
-
{serializeText(description)}
|
|
40
|
-
</UiItem.Description>
|
|
41
|
-
)}
|
|
42
|
-
{mode === 'edit' && children}
|
|
43
|
-
{extra && <UiItem.Extra>{extra}</UiItem.Extra>}
|
|
44
|
-
</UiItem.Content>
|
|
45
|
-
</UiItem>
|
|
46
|
-
</UiItem.Group>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default Item;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import codeSVG from '@plone/volto/icons/code.svg';
|
|
2
|
-
import ItemEdit from './Edit';
|
|
3
|
-
import ItemView from './View';
|
|
4
|
-
import { stylingSchema } from './schema';
|
|
5
|
-
|
|
6
|
-
export default (config) => {
|
|
7
|
-
config.blocks.blocksConfig.item = {
|
|
8
|
-
id: 'item',
|
|
9
|
-
title: 'Item',
|
|
10
|
-
icon: codeSVG,
|
|
11
|
-
group: 'common',
|
|
12
|
-
edit: ItemEdit,
|
|
13
|
-
view: ItemView,
|
|
14
|
-
blockHasOwnFocusManagement: true,
|
|
15
|
-
stylesSchema: stylingSchema,
|
|
16
|
-
enableStyling: true,
|
|
17
|
-
restricted: false,
|
|
18
|
-
mostUsed: false,
|
|
19
|
-
sidebarTab: 1,
|
|
20
|
-
security: {
|
|
21
|
-
addPermission: [],
|
|
22
|
-
view: [],
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
config.settings.blocksWithFootnotesSupport = {
|
|
27
|
-
...(config.settings.blocksWithFootnotesSupport || {}),
|
|
28
|
-
item: ['description'],
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return config;
|
|
32
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
export default ({ data }) => {
|
|
2
|
-
const { assetType = 'image' } = data;
|
|
3
|
-
return {
|
|
4
|
-
title: 'Item',
|
|
5
|
-
fieldsets: [
|
|
6
|
-
{
|
|
7
|
-
id: 'default',
|
|
8
|
-
title: 'Default',
|
|
9
|
-
fields: ['assetType'],
|
|
10
|
-
},
|
|
11
|
-
...(assetType === 'image'
|
|
12
|
-
? [{ id: 'image', title: 'Image', fields: ['image', 'imageSize'] }]
|
|
13
|
-
: []),
|
|
14
|
-
...(assetType === 'icon'
|
|
15
|
-
? [
|
|
16
|
-
{
|
|
17
|
-
id: 'icon',
|
|
18
|
-
title: 'Icon',
|
|
19
|
-
fields: ['icon', 'iconSize', 'iconTheme'],
|
|
20
|
-
},
|
|
21
|
-
]
|
|
22
|
-
: []),
|
|
23
|
-
],
|
|
24
|
-
properties: {
|
|
25
|
-
assetType: {
|
|
26
|
-
title: 'Asset type',
|
|
27
|
-
choices: [
|
|
28
|
-
['image', 'Image'],
|
|
29
|
-
['icon', 'Icon'],
|
|
30
|
-
],
|
|
31
|
-
default: 'image',
|
|
32
|
-
},
|
|
33
|
-
image: {
|
|
34
|
-
title: 'Image',
|
|
35
|
-
widget: 'attachedimage',
|
|
36
|
-
},
|
|
37
|
-
imageSize: {
|
|
38
|
-
title: 'Image size',
|
|
39
|
-
choices: [
|
|
40
|
-
// commented as they were too small to use as item icons
|
|
41
|
-
// ['mini', 'Mini'],
|
|
42
|
-
// ['tile', 'Tile'],
|
|
43
|
-
// ['tiny', 'Tiny'],
|
|
44
|
-
// ['small', 'Small'],
|
|
45
|
-
['large', 'Large'],
|
|
46
|
-
['big', 'Big'],
|
|
47
|
-
['huge', 'Huge'],
|
|
48
|
-
['massive', 'Massive'],
|
|
49
|
-
],
|
|
50
|
-
default: 'tile',
|
|
51
|
-
},
|
|
52
|
-
icon: {
|
|
53
|
-
title: 'Icon name',
|
|
54
|
-
},
|
|
55
|
-
iconSize: {
|
|
56
|
-
title: 'Icon size',
|
|
57
|
-
choices: [
|
|
58
|
-
['mini', 'Mini'],
|
|
59
|
-
['tiny', 'Tiny'],
|
|
60
|
-
['small', 'Small'],
|
|
61
|
-
['large', 'Large'],
|
|
62
|
-
['big', 'Big'],
|
|
63
|
-
['huge', 'Huge'],
|
|
64
|
-
['massive', 'Massive'],
|
|
65
|
-
],
|
|
66
|
-
default: 'huge',
|
|
67
|
-
},
|
|
68
|
-
iconTheme: {
|
|
69
|
-
title: 'Icon theme',
|
|
70
|
-
choices: [
|
|
71
|
-
['primary', 'Primary'],
|
|
72
|
-
['secondary', 'Secondary'],
|
|
73
|
-
['tertiary', 'Tertiary'],
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
required: [],
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const stylingSchema = ({ intl }) => ({
|
|
82
|
-
title: 'Item style',
|
|
83
|
-
block: 'item',
|
|
84
|
-
fieldsets: [
|
|
85
|
-
{
|
|
86
|
-
id: 'default',
|
|
87
|
-
title: 'Default',
|
|
88
|
-
fields: ['theme', 'verticalAlign'],
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
properties: {
|
|
92
|
-
theme: {
|
|
93
|
-
title: 'Theme',
|
|
94
|
-
choices: [
|
|
95
|
-
['primary', 'Primary'],
|
|
96
|
-
['secondary', 'Secondary'],
|
|
97
|
-
['tertiary', 'Tertiary'],
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
verticalAlign: {
|
|
101
|
-
title: 'Vertical align',
|
|
102
|
-
choices: [
|
|
103
|
-
['top', 'Top'],
|
|
104
|
-
['middle', 'Middle'],
|
|
105
|
-
['bottom', 'Bottom'],
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
required: [],
|
|
110
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Message } from 'semantic-ui-react';
|
|
4
|
-
import { defineMessages, useIntl } from 'react-intl';
|
|
5
|
-
import imageBlockSVG from '@plone/volto/components/manage/Blocks/Image/block-image.svg';
|
|
6
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
7
|
-
import { getTeaserImageURL } from './utils';
|
|
8
|
-
import { MaybeWrap } from '@plone/volto/components';
|
|
9
|
-
import { UniversalLink } from '@plone/volto/components';
|
|
10
|
-
import cx from 'classnames';
|
|
11
|
-
|
|
12
|
-
const messages = defineMessages({
|
|
13
|
-
PleaseChooseContent: {
|
|
14
|
-
id: 'Please choose an existing content as source for this element',
|
|
15
|
-
defaultMessage:
|
|
16
|
-
'Please choose an existing content as source for this element',
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const TeaserCardTemplate = (props) => {
|
|
21
|
-
const { data, isEditMode } = props;
|
|
22
|
-
const intl = useIntl();
|
|
23
|
-
const href = data.href?.[0];
|
|
24
|
-
const image = data.preview_image?.[0];
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
{!href && isEditMode && (
|
|
29
|
-
<Message>
|
|
30
|
-
<div className="grid-teaser-item placeholder">
|
|
31
|
-
<img src={imageBlockSVG} alt="" />
|
|
32
|
-
<p>{intl.formatMessage(messages.PleaseChooseContent)}</p>
|
|
33
|
-
</div>
|
|
34
|
-
</Message>
|
|
35
|
-
)}
|
|
36
|
-
{href && (
|
|
37
|
-
<MaybeWrap
|
|
38
|
-
condition={!isEditMode}
|
|
39
|
-
as={UniversalLink}
|
|
40
|
-
href={href['@id']}
|
|
41
|
-
target={data.openLinkInNewTab ? '_blank' : null}
|
|
42
|
-
>
|
|
43
|
-
<div
|
|
44
|
-
className={cx(
|
|
45
|
-
'ui fluid card',
|
|
46
|
-
data?.styles?.theme,
|
|
47
|
-
data?.styles?.rounded ? 'rounded big' : '',
|
|
48
|
-
)}
|
|
49
|
-
>
|
|
50
|
-
{(href.hasPreviewImage || href.image_field || image) && (
|
|
51
|
-
<div className="image">
|
|
52
|
-
<img
|
|
53
|
-
src={flattenToAppURL(getTeaserImageURL(href, image))}
|
|
54
|
-
alt="a"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
)}
|
|
58
|
-
<div className="content">
|
|
59
|
-
{data?.head_title && (
|
|
60
|
-
<div className="meta">{data?.head_title}</div>
|
|
61
|
-
)}
|
|
62
|
-
<div className="header">{data?.title}</div>
|
|
63
|
-
{!data.hide_description && (
|
|
64
|
-
<p className="description">{data?.description}</p>
|
|
65
|
-
)}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
</MaybeWrap>
|
|
69
|
-
)}
|
|
70
|
-
</>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
TeaserCardTemplate.propTypes = {
|
|
75
|
-
data: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
76
|
-
isEditMode: PropTypes.bool,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default TeaserCardTemplate;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
|
|
3
|
-
const messages = defineMessages({
|
|
4
|
-
Type: {
|
|
5
|
-
id: 'Teaser',
|
|
6
|
-
defaultMessage: 'Teaser',
|
|
7
|
-
},
|
|
8
|
-
Theme: {
|
|
9
|
-
id: 'Theme',
|
|
10
|
-
defaultMessage: 'Theme',
|
|
11
|
-
},
|
|
12
|
-
ThemeHelp: {
|
|
13
|
-
id: 'Theme',
|
|
14
|
-
defaultMessage: 'Theme',
|
|
15
|
-
},
|
|
16
|
-
ThemeDefault: {
|
|
17
|
-
id: 'Default',
|
|
18
|
-
defaultMessage: 'Default',
|
|
19
|
-
},
|
|
20
|
-
ThemePrimary: {
|
|
21
|
-
id: 'Primary',
|
|
22
|
-
defaultMessage: 'Primary',
|
|
23
|
-
},
|
|
24
|
-
ThemeSecondary: {
|
|
25
|
-
id: 'Secondary',
|
|
26
|
-
defaultMessage: 'Secondary',
|
|
27
|
-
},
|
|
28
|
-
ThemeTertiary: {
|
|
29
|
-
id: 'Tertiary',
|
|
30
|
-
defaultMessage: 'Tertiary',
|
|
31
|
-
},
|
|
32
|
-
Rounded: {
|
|
33
|
-
id: 'Rounded',
|
|
34
|
-
defaultMessage: 'Rounded',
|
|
35
|
-
},
|
|
36
|
-
RoundedHelp: {
|
|
37
|
-
id: 'Rounded Image',
|
|
38
|
-
defaultMessage: 'Rounded Image',
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const StylingSchema = ({ intl }) => ({
|
|
43
|
-
title: intl.formatMessage(messages.Type),
|
|
44
|
-
block: 'teaserGrid',
|
|
45
|
-
fieldsets: [
|
|
46
|
-
{
|
|
47
|
-
id: 'default',
|
|
48
|
-
title: 'Default',
|
|
49
|
-
fields: ['theme', 'rounded'],
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
properties: {
|
|
53
|
-
theme: {
|
|
54
|
-
title: intl.formatMessage(messages.Theme),
|
|
55
|
-
description: intl.formatMessage(messages.ThemeHelp),
|
|
56
|
-
choices: [
|
|
57
|
-
['', intl.formatMessage(messages.ThemeDefault)],
|
|
58
|
-
['primary', intl.formatMessage(messages.ThemePrimary)],
|
|
59
|
-
['secondary', intl.formatMessage(messages.ThemeSecondary)],
|
|
60
|
-
['tertiary', intl.formatMessage(messages.ThemeTertiary)],
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
rounded: {
|
|
64
|
-
title: intl.formatMessage(messages.Rounded),
|
|
65
|
-
description: intl.formatMessage(messages.RoundedHelp),
|
|
66
|
-
type: 'boolean',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
required: [],
|
|
70
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import TeaserCardTemplate from './Card';
|
|
2
|
-
import { StylingSchema } from './Schema';
|
|
3
|
-
|
|
4
|
-
export default (config) => {
|
|
5
|
-
// Teaser
|
|
6
|
-
if (config.blocks.blocksConfig.teaser) {
|
|
7
|
-
config.blocks.blocksConfig.teaser.variations = [
|
|
8
|
-
...(config.blocks.blocksConfig.teaser.variations || []),
|
|
9
|
-
{
|
|
10
|
-
id: 'card',
|
|
11
|
-
isDefault: true,
|
|
12
|
-
title: 'Card (top image)',
|
|
13
|
-
template: TeaserCardTemplate,
|
|
14
|
-
},
|
|
15
|
-
];
|
|
16
|
-
config.blocks.blocksConfig.teaser.enableStyling = true;
|
|
17
|
-
config.blocks.blocksConfig.teaser.stylesSchema = StylingSchema;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Teaser Grid
|
|
21
|
-
if (config.blocks.blocksConfig.teaserGrid) {
|
|
22
|
-
config.blocks.blocksConfig.teaserGrid.title = 'Teaser (Cards)';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return config;
|
|
26
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { isInternalURL } from '@plone/volto/helpers';
|
|
2
|
-
import config from '@plone/volto/registry';
|
|
3
|
-
|
|
4
|
-
export function getTeaserImageURL(href, image) {
|
|
5
|
-
const imageScale =
|
|
6
|
-
config.blocks.blocksConfig['teaser'].imageScale || 'preview';
|
|
7
|
-
if (image) {
|
|
8
|
-
if (isInternalURL(image['@id'])) {
|
|
9
|
-
return `${image['@id']}/@@images/image/${imageScale}`;
|
|
10
|
-
} else {
|
|
11
|
-
return image['@id'];
|
|
12
|
-
}
|
|
13
|
-
} else {
|
|
14
|
-
return `${href['@id']}/@@images/${
|
|
15
|
-
href.image_field || 'preview_image'
|
|
16
|
-
}/${imageScale}`;
|
|
17
|
-
}
|
|
18
|
-
}
|