@eeacms/volto-hero-block 5.1.0 → 5.3.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,11 +4,23 @@ 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
- ### [5.1.0](https://github.com/eea/volto-hero-block/compare/5.0.0...5.1.0) - 24 March 2023
7
+ ### [5.3.0](https://github.com/eea/volto-hero-block/compare/5.2.0...5.3.0) - 27 March 2023
8
8
 
9
9
  #### :rocket: New Features
10
10
 
11
- - feat: add 'with-hero-block' class to body [Miu Razvan - [`12e60a3`](https://github.com/eea/volto-hero-block/commit/12e60a352e60f647346fa00ba3aa8f54f2b8623c)]
11
+ - feat(copyright): Possibility to arbitrary add prefix text to copyright info - refs #250724 [Alin Voinea - [`f0b9944`](https://github.com/eea/volto-hero-block/commit/f0b994458d737b2c23bcf0b73e39b8dfbbcc321e)]
12
+
13
+ #### :house: Internal changes
14
+
15
+ - chore(Hero): Keep Hero block backward compatible if no copyrightPrefix provided - refs #250724 [Alin Voinea - [`2b17631`](https://github.com/eea/volto-hero-block/commit/2b176317c94856dd9424dcd92699c93d2f0dc066)]
16
+
17
+ ### [5.2.0](https://github.com/eea/volto-hero-block/compare/5.1.0...5.2.0) - 24 March 2023
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - Release 5.2.0 [Alin Voinea - [`b0dfa0c`](https://github.com/eea/volto-hero-block/commit/b0dfa0c46f5f697d9e2419522ce04ead9353272d)]
22
+ - update [Miu Razvan - [`2a9e854`](https://github.com/eea/volto-hero-block/commit/2a9e8540853cd49e7461ac4de9fef2109874dcdd)]
23
+ ### [5.1.0](https://github.com/eea/volto-hero-block/compare/5.0.0...5.1.0) - 24 March 2023
12
24
 
13
25
  #### :hammer_and_wrench: Others
14
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-hero-block",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "description": "@eeacms/volto-hero-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -13,6 +13,15 @@ function Copyright({ children, ...rest }) {
13
13
  );
14
14
  }
15
15
 
16
+ Copyright.Prefix = ({ children, ...rest }) =>
17
+ children ? (
18
+ <span {...rest} className={'icon-prefix'}>
19
+ {children}
20
+ </span>
21
+ ) : (
22
+ ''
23
+ );
24
+
16
25
  Copyright.Icon = ({ children, ...rest }) => (
17
26
  <span {...rest} className={'icon-wrapper'}>
18
27
  {children}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { connect } from 'react-redux';
4
+ import isFunction from 'lodash/isFunction';
4
5
  import { Icon } from 'semantic-ui-react';
5
6
  import config from '@plone/volto/registry';
6
7
  import {
@@ -20,7 +21,6 @@ import { createSlateHeader } from '@eeacms/volto-hero-block/helpers';
20
21
 
21
22
  import Copyright from './Copyright';
22
23
  import Hero from './Hero';
23
- import getSchema from './schema';
24
24
 
25
25
  const Metadata = ({ buttonLabel, buttonLink, inverted, styles }) => {
26
26
  const { buttonVariant } = styles || {};
@@ -49,7 +49,14 @@ const Edit = (props) => {
49
49
  onSelectBlock,
50
50
  } = props;
51
51
  const { text, copyright, copyrightIcon, copyrightPosition } = data;
52
- const schema = React.useMemo(() => getSchema(props), [props]);
52
+ const copyrightPrefix = config.blocks.blocksConfig.hero.copyrightPrefix || '';
53
+ const schema = React.useMemo(() => {
54
+ const blockSchema = config.blocks.blocksConfig.hero.schema;
55
+ if (isFunction(blockSchema)) {
56
+ return blockSchema(props);
57
+ }
58
+ return blockSchema;
59
+ }, [props]);
53
60
 
54
61
  const withBlockProperties = React.useCallback(
55
62
  (editor) => {
@@ -95,6 +102,7 @@ const Edit = (props) => {
95
102
  </Hero.Meta>
96
103
  {copyright ? (
97
104
  <Copyright copyrightPosition={copyrightPosition}>
105
+ <Copyright.Prefix>{copyrightPrefix}</Copyright.Prefix>
98
106
  <Copyright.Icon>
99
107
  <Icon className={copyrightIcon} />
100
108
  </Copyright.Icon>
@@ -6,6 +6,7 @@ import { BodyClass } from '@plone/volto/helpers';
6
6
  import Hero from './Hero';
7
7
  import Copyright from './Copyright';
8
8
  import { serializeText } from '@eeacms/volto-hero-block/helpers';
9
+ import config from '@plone/volto/registry';
9
10
 
10
11
  const Metadata = ({ buttonLabel, buttonLink, inverted, styles }) => {
11
12
  const { buttonVariant = 'white' } = styles || {};
@@ -25,6 +26,7 @@ const Metadata = ({ buttonLabel, buttonLink, inverted, styles }) => {
25
26
  const View = (props) => {
26
27
  const { data = {} } = props;
27
28
  const { text, copyright, copyrightIcon, copyrightPosition } = data;
29
+ const copyrightPrefix = config.blocks.blocksConfig.hero.copyrightPrefix || '';
28
30
  return (
29
31
  <React.Fragment>
30
32
  <BodyClass className="with-hero-block" />
@@ -35,6 +37,7 @@ const View = (props) => {
35
37
  </Hero.Meta>
36
38
  {copyright ? (
37
39
  <Copyright copyrightPosition={copyrightPosition}>
40
+ <Copyright.Prefix>{copyrightPrefix}</Copyright.Prefix>
38
41
  <Copyright.Icon>
39
42
  <Icon className={copyrightIcon} />
40
43
  </Copyright.Icon>
@@ -1,7 +1,7 @@
1
1
  import codeSVG from '@plone/volto/icons/code.svg';
2
2
  import HeroEdit from './Edit';
3
3
  import HeroView from './View';
4
- import { stylingSchema } from './schema';
4
+ import schema, { stylingSchema } from './schema';
5
5
 
6
6
  export default (config) => {
7
7
  config.blocks.blocksConfig.hero = {
@@ -16,10 +16,12 @@ export default (config) => {
16
16
  restricted: false,
17
17
  mostUsed: false,
18
18
  sidebarTab: 1,
19
+ copyrightPrefix: '',
19
20
  security: {
20
21
  addPermission: [],
21
22
  view: [],
22
23
  },
24
+ schema,
23
25
  };
24
26
 
25
27
  config.settings.blocksWithFootnotesSupport = {