@eeacms/volto-hero-block 5.0.0 → 5.2.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,7 +4,20 @@ 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.0.0](https://github.com/eea/volto-hero-block/compare/4.0.0...5.0.0) - 7 March 2023
7
+ ### [5.2.0](https://github.com/eea/volto-hero-block/compare/5.1.0...5.2.0) - 24 March 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Release 5.2.0 [Alin Voinea - [`b0dfa0c`](https://github.com/eea/volto-hero-block/commit/b0dfa0c46f5f697d9e2419522ce04ead9353272d)]
12
+ - update [Miu Razvan - [`2a9e854`](https://github.com/eea/volto-hero-block/commit/2a9e8540853cd49e7461ac4de9fef2109874dcdd)]
13
+ - import schema from blocksConfig [Miu Razvan - [`196a003`](https://github.com/eea/volto-hero-block/commit/196a003957676b562987ef6509cf2b73ea2e77d2)]
14
+ ### [5.1.0](https://github.com/eea/volto-hero-block/compare/5.0.0...5.1.0) - 24 March 2023
15
+
16
+ #### :hammer_and_wrench: Others
17
+
18
+ - Release 5.1.0 [Alin Voinea - [`7cd1d6c`](https://github.com/eea/volto-hero-block/commit/7cd1d6c3194b59f9645a716be8364b39136ac6fc)]
19
+ - use stable volto in jenkins [Miu Razvan - [`5459e18`](https://github.com/eea/volto-hero-block/commit/5459e18001486ff05b1e7535685926ef41a233e3)]
20
+ ## [5.0.0](https://github.com/eea/volto-hero-block/compare/4.0.0...5.0.0) - 7 March 2023
8
21
 
9
22
  #### :nail_care: Enhancements
10
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-hero-block",
3
- "version": "5.0.0",
3
+ "version": "5.2.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",
@@ -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 {
@@ -8,6 +9,7 @@ import {
8
9
  SidebarPortal,
9
10
  UniversalLink,
10
11
  } from '@plone/volto/components';
12
+ import { BodyClass } from '@plone/volto/helpers';
11
13
  import SlateEditor from '@plone/volto-slate/editor/SlateEditor';
12
14
  import { handleKey } from '@plone/volto-slate/blocks/Text/keyboard';
13
15
  import {
@@ -19,7 +21,6 @@ import { createSlateHeader } from '@eeacms/volto-hero-block/helpers';
19
21
 
20
22
  import Copyright from './Copyright';
21
23
  import Hero from './Hero';
22
- import getSchema from './schema';
23
24
 
24
25
  const Metadata = ({ buttonLabel, buttonLink, inverted, styles }) => {
25
26
  const { buttonVariant } = styles || {};
@@ -48,7 +49,13 @@ const Edit = (props) => {
48
49
  onSelectBlock,
49
50
  } = props;
50
51
  const { text, copyright, copyrightIcon, copyrightPosition } = data;
51
- const schema = React.useMemo(() => getSchema(props), [props]);
52
+ const schema = React.useMemo(() => {
53
+ const blockSchema = config.blocks.blocksConfig.hero.schema;
54
+ if (isFunction(blockSchema)) {
55
+ return blockSchema(props);
56
+ }
57
+ return blockSchema;
58
+ }, [props]);
52
59
 
53
60
  const withBlockProperties = React.useCallback(
54
61
  (editor) => {
@@ -66,6 +73,7 @@ const Edit = (props) => {
66
73
 
67
74
  return (
68
75
  <>
76
+ <BodyClass className="with-hero-block" />
69
77
  <Hero {...data}>
70
78
  <Hero.Text {...data}>
71
79
  <SlateEditor
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { Icon } from 'semantic-ui-react';
4
4
  import { UniversalLink } from '@plone/volto/components';
5
+ import { BodyClass } from '@plone/volto/helpers';
5
6
  import Hero from './Hero';
6
7
  import Copyright from './Copyright';
7
8
  import { serializeText } from '@eeacms/volto-hero-block/helpers';
@@ -25,22 +26,25 @@ const View = (props) => {
25
26
  const { data = {} } = props;
26
27
  const { text, copyright, copyrightIcon, copyrightPosition } = data;
27
28
  return (
28
- <Hero {...data}>
29
- <Hero.Text {...data}>{serializeText(text)}</Hero.Text>
30
- <Hero.Meta {...data}>
31
- <Metadata {...data} />
32
- </Hero.Meta>
33
- {copyright ? (
34
- <Copyright copyrightPosition={copyrightPosition}>
35
- <Copyright.Icon>
36
- <Icon className={copyrightIcon} />
37
- </Copyright.Icon>
38
- <Copyright.Text>{copyright}</Copyright.Text>
39
- </Copyright>
40
- ) : (
41
- ''
42
- )}
43
- </Hero>
29
+ <React.Fragment>
30
+ <BodyClass className="with-hero-block" />
31
+ <Hero {...data}>
32
+ <Hero.Text {...data}>{serializeText(text)}</Hero.Text>
33
+ <Hero.Meta {...data}>
34
+ <Metadata {...data} />
35
+ </Hero.Meta>
36
+ {copyright ? (
37
+ <Copyright copyrightPosition={copyrightPosition}>
38
+ <Copyright.Icon>
39
+ <Icon className={copyrightIcon} />
40
+ </Copyright.Icon>
41
+ <Copyright.Text>{copyright}</Copyright.Text>
42
+ </Copyright>
43
+ ) : (
44
+ ''
45
+ )}
46
+ </Hero>
47
+ </React.Fragment>
44
48
  );
45
49
  };
46
50
 
@@ -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 = {
@@ -20,6 +20,7 @@ export default (config) => {
20
20
  addPermission: [],
21
21
  view: [],
22
22
  },
23
+ schema,
23
24
  };
24
25
 
25
26
  config.settings.blocksWithFootnotesSupport = {