@eeacms/volto-hero-block 7.1.0 → 9.0.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 +39 -0
- package/DEVELOP.md +19 -17
- package/README.md +42 -19
- package/docker-compose.yml +1 -1
- package/jest-addon.config.js +23 -4
- package/jest.setup.js +23 -12
- package/locales/de/LC_MESSAGES/volto.po +118 -0
- package/locales/en/LC_MESSAGES/volto.po +118 -0
- package/locales/it/LC_MESSAGES/volto.po +118 -0
- package/locales/ro/LC_MESSAGES/volto.po +118 -0
- package/locales/volto.pot +120 -2
- package/package.json +1 -1
- package/src/components/Blocks/Hero/Copyright.test.jsx +1 -1
- package/src/components/Blocks/Hero/Edit.jsx +3 -15
- package/src/components/Blocks/Hero/Edit.test.jsx +29 -13
- package/src/components/Blocks/Hero/Hero.jsx +34 -33
- package/src/components/Blocks/Hero/Hero.test.jsx +4 -4
- package/src/components/Blocks/Hero/View.jsx +5 -3
- package/src/components/Blocks/Hero/View.test.jsx +4 -2
- package/src/components/Blocks/Hero/schema.js +8 -7
- package/src/components/Blocks/Hero/schema.test.js +66 -0
- package/src/helpers.js +2 -25
- package/src/helpers.test.js +1 -118
- package/src/hooks.test.js +17 -11
- package/test-mocks/voltoFormValidationValidators.js +20 -0
- package/tsconfig.json +10 -0
- package/volto-form-validation-validators.d.ts +34 -0
|
@@ -11,4 +11,122 @@ msgstr ""
|
|
|
11
11
|
"Content-Transfer-Encoding: \n"
|
|
12
12
|
"Plural-Forms: \n"
|
|
13
13
|
|
|
14
|
+
#. Default: "A short hint that describes the expected value within this block"
|
|
15
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
16
|
+
msgid "A short hint that describes the expected value within this block"
|
|
17
|
+
msgstr ""
|
|
18
|
+
|
|
19
|
+
#. Default: "Allow only the following blocks types"
|
|
20
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
21
|
+
msgid "Allow only the following blocks types"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#. Default: "Default"
|
|
25
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
26
|
+
msgid "Default"
|
|
27
|
+
msgstr ""
|
|
28
|
+
|
|
29
|
+
#. Default: "Detailed expected value within this block"
|
|
30
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
31
|
+
msgid "Detailed expected value within this block"
|
|
32
|
+
msgstr ""
|
|
33
|
+
|
|
34
|
+
#. Default: "Disable creation of new blocks after this block"
|
|
35
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
36
|
+
msgid "Disable creation of new blocks after this block"
|
|
37
|
+
msgstr ""
|
|
38
|
+
|
|
39
|
+
#. Default: "Disable drag & drop on this block"
|
|
40
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
41
|
+
msgid "Disable drag & drop on this block"
|
|
42
|
+
msgstr ""
|
|
43
|
+
|
|
44
|
+
#. Default: "Disable editing on hero block settings"
|
|
45
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
46
|
+
msgid "Disable editing on hero block settings"
|
|
47
|
+
msgstr ""
|
|
48
|
+
|
|
49
|
+
#. Default: "Disable editing on hero titles"
|
|
50
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
51
|
+
msgid "Disable editing on hero titles"
|
|
52
|
+
msgstr ""
|
|
53
|
+
|
|
54
|
+
#. Default: "Disable editing on this block"
|
|
55
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
56
|
+
msgid "Disable editing on this block"
|
|
57
|
+
msgstr ""
|
|
58
|
+
|
|
59
|
+
#. Default: "Disable inner buttons"
|
|
60
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
61
|
+
msgid "Disable inner buttons"
|
|
62
|
+
msgstr ""
|
|
63
|
+
|
|
64
|
+
#. Default: "Disable new blocks"
|
|
65
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
66
|
+
msgid "Disable new blocks"
|
|
67
|
+
msgstr ""
|
|
68
|
+
|
|
69
|
+
#. Default: "Don't allow deletion of this block"
|
|
70
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
71
|
+
msgid "Don't allow deletion of this block"
|
|
72
|
+
msgstr ""
|
|
14
73
|
|
|
74
|
+
#. Default: "Fixed layout"
|
|
75
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
76
|
+
msgid "Fixed layout"
|
|
77
|
+
msgstr ""
|
|
78
|
+
|
|
79
|
+
#. Default: "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
|
|
80
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
81
|
+
msgid "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
|
|
82
|
+
msgstr ""
|
|
83
|
+
|
|
84
|
+
#. Default: "Fixed position"
|
|
85
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
86
|
+
msgid "Fixed position"
|
|
87
|
+
msgstr ""
|
|
88
|
+
|
|
89
|
+
#. Default: "Helper text"
|
|
90
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
91
|
+
msgid "Helper text"
|
|
92
|
+
msgstr ""
|
|
93
|
+
|
|
94
|
+
#. Default: "Hero"
|
|
95
|
+
#: components/Blocks/Hero/index
|
|
96
|
+
msgid "Hero"
|
|
97
|
+
msgstr ""
|
|
98
|
+
|
|
99
|
+
#. Default: "Hero block settings"
|
|
100
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
101
|
+
msgid "Hero block settings"
|
|
102
|
+
msgstr ""
|
|
103
|
+
|
|
104
|
+
#. Default: "Hide all block related buttons within this block"
|
|
105
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
106
|
+
msgid "Hide all block related buttons within this block"
|
|
107
|
+
msgstr ""
|
|
108
|
+
|
|
109
|
+
#. Default: "Instructions"
|
|
110
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
111
|
+
msgid "Instructions"
|
|
112
|
+
msgstr ""
|
|
113
|
+
|
|
114
|
+
#. Default: "Read-only"
|
|
115
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
116
|
+
msgid "Read-only"
|
|
117
|
+
msgstr ""
|
|
118
|
+
|
|
119
|
+
#. Default: "Read-only settings"
|
|
120
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
121
|
+
msgid "Read-only settings"
|
|
122
|
+
msgstr ""
|
|
123
|
+
|
|
124
|
+
#. Default: "Read-only titles"
|
|
125
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
126
|
+
msgid "Read-only titles"
|
|
127
|
+
msgstr ""
|
|
128
|
+
|
|
129
|
+
#. Default: "Required"
|
|
130
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
131
|
+
msgid "Required"
|
|
132
|
+
msgstr ""
|
|
@@ -11,4 +11,122 @@ msgstr ""
|
|
|
11
11
|
"Content-Transfer-Encoding: \n"
|
|
12
12
|
"Plural-Forms: \n"
|
|
13
13
|
|
|
14
|
+
#. Default: "A short hint that describes the expected value within this block"
|
|
15
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
16
|
+
msgid "A short hint that describes the expected value within this block"
|
|
17
|
+
msgstr ""
|
|
18
|
+
|
|
19
|
+
#. Default: "Allow only the following blocks types"
|
|
20
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
21
|
+
msgid "Allow only the following blocks types"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#. Default: "Default"
|
|
25
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
26
|
+
msgid "Default"
|
|
27
|
+
msgstr ""
|
|
28
|
+
|
|
29
|
+
#. Default: "Detailed expected value within this block"
|
|
30
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
31
|
+
msgid "Detailed expected value within this block"
|
|
32
|
+
msgstr ""
|
|
33
|
+
|
|
34
|
+
#. Default: "Disable creation of new blocks after this block"
|
|
35
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
36
|
+
msgid "Disable creation of new blocks after this block"
|
|
37
|
+
msgstr ""
|
|
38
|
+
|
|
39
|
+
#. Default: "Disable drag & drop on this block"
|
|
40
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
41
|
+
msgid "Disable drag & drop on this block"
|
|
42
|
+
msgstr ""
|
|
43
|
+
|
|
44
|
+
#. Default: "Disable editing on hero block settings"
|
|
45
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
46
|
+
msgid "Disable editing on hero block settings"
|
|
47
|
+
msgstr ""
|
|
48
|
+
|
|
49
|
+
#. Default: "Disable editing on hero titles"
|
|
50
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
51
|
+
msgid "Disable editing on hero titles"
|
|
52
|
+
msgstr ""
|
|
53
|
+
|
|
54
|
+
#. Default: "Disable editing on this block"
|
|
55
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
56
|
+
msgid "Disable editing on this block"
|
|
57
|
+
msgstr ""
|
|
58
|
+
|
|
59
|
+
#. Default: "Disable inner buttons"
|
|
60
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
61
|
+
msgid "Disable inner buttons"
|
|
62
|
+
msgstr ""
|
|
63
|
+
|
|
64
|
+
#. Default: "Disable new blocks"
|
|
65
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
66
|
+
msgid "Disable new blocks"
|
|
67
|
+
msgstr ""
|
|
68
|
+
|
|
69
|
+
#. Default: "Don't allow deletion of this block"
|
|
70
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
71
|
+
msgid "Don't allow deletion of this block"
|
|
72
|
+
msgstr ""
|
|
14
73
|
|
|
74
|
+
#. Default: "Fixed layout"
|
|
75
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
76
|
+
msgid "Fixed layout"
|
|
77
|
+
msgstr ""
|
|
78
|
+
|
|
79
|
+
#. Default: "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
|
|
80
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
81
|
+
msgid "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
|
|
82
|
+
msgstr ""
|
|
83
|
+
|
|
84
|
+
#. Default: "Fixed position"
|
|
85
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
86
|
+
msgid "Fixed position"
|
|
87
|
+
msgstr ""
|
|
88
|
+
|
|
89
|
+
#. Default: "Helper text"
|
|
90
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
91
|
+
msgid "Helper text"
|
|
92
|
+
msgstr ""
|
|
93
|
+
|
|
94
|
+
#. Default: "Hero"
|
|
95
|
+
#: components/Blocks/Hero/index
|
|
96
|
+
msgid "Hero"
|
|
97
|
+
msgstr ""
|
|
98
|
+
|
|
99
|
+
#. Default: "Hero block settings"
|
|
100
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
101
|
+
msgid "Hero block settings"
|
|
102
|
+
msgstr ""
|
|
103
|
+
|
|
104
|
+
#. Default: "Hide all block related buttons within this block"
|
|
105
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
106
|
+
msgid "Hide all block related buttons within this block"
|
|
107
|
+
msgstr ""
|
|
108
|
+
|
|
109
|
+
#. Default: "Instructions"
|
|
110
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
111
|
+
msgid "Instructions"
|
|
112
|
+
msgstr ""
|
|
113
|
+
|
|
114
|
+
#. Default: "Read-only"
|
|
115
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
116
|
+
msgid "Read-only"
|
|
117
|
+
msgstr ""
|
|
118
|
+
|
|
119
|
+
#. Default: "Read-only settings"
|
|
120
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
121
|
+
msgid "Read-only settings"
|
|
122
|
+
msgstr ""
|
|
123
|
+
|
|
124
|
+
#. Default: "Read-only titles"
|
|
125
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
126
|
+
msgid "Read-only titles"
|
|
127
|
+
msgstr ""
|
|
128
|
+
|
|
129
|
+
#. Default: "Required"
|
|
130
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
131
|
+
msgid "Required"
|
|
132
|
+
msgstr ""
|
package/locales/volto.pot
CHANGED
|
@@ -1,16 +1,134 @@
|
|
|
1
1
|
msgid ""
|
|
2
2
|
msgstr ""
|
|
3
3
|
"Project-Id-Version: Plone\n"
|
|
4
|
-
"POT-Creation-Date:
|
|
4
|
+
"POT-Creation-Date: 2026-03-10T22:13:14.190Z\n"
|
|
5
5
|
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
|
6
6
|
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
|
7
|
-
"MIME-Version: 1.0\n"
|
|
8
7
|
"Content-Type: text/plain; charset=utf-8\n"
|
|
9
8
|
"Content-Transfer-Encoding: 8bit\n"
|
|
10
9
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
10
|
+
"MIME-Version: 1.0\n"
|
|
11
11
|
"Language-Code: en\n"
|
|
12
12
|
"Language-Name: English\n"
|
|
13
13
|
"Preferred-Encodings: utf-8\n"
|
|
14
14
|
"Domain: volto\n"
|
|
15
15
|
|
|
16
|
+
#. Default: "A short hint that describes the expected value within this block"
|
|
17
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
18
|
+
msgid "A short hint that describes the expected value within this block"
|
|
19
|
+
msgstr ""
|
|
20
|
+
|
|
21
|
+
#. Default: "Allow only the following blocks types"
|
|
22
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
23
|
+
msgid "Allow only the following blocks types"
|
|
24
|
+
msgstr ""
|
|
25
|
+
|
|
26
|
+
#. Default: "Default"
|
|
27
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
28
|
+
msgid "Default"
|
|
29
|
+
msgstr ""
|
|
30
|
+
|
|
31
|
+
#. Default: "Detailed expected value within this block"
|
|
32
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
33
|
+
msgid "Detailed expected value within this block"
|
|
34
|
+
msgstr ""
|
|
35
|
+
|
|
36
|
+
#. Default: "Disable creation of new blocks after this block"
|
|
37
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
38
|
+
msgid "Disable creation of new blocks after this block"
|
|
39
|
+
msgstr ""
|
|
40
|
+
|
|
41
|
+
#. Default: "Disable drag & drop on this block"
|
|
42
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
43
|
+
msgid "Disable drag & drop on this block"
|
|
44
|
+
msgstr ""
|
|
45
|
+
|
|
46
|
+
#. Default: "Disable editing on hero block settings"
|
|
47
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
48
|
+
msgid "Disable editing on hero block settings"
|
|
49
|
+
msgstr ""
|
|
50
|
+
|
|
51
|
+
#. Default: "Disable editing on hero titles"
|
|
52
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
53
|
+
msgid "Disable editing on hero titles"
|
|
54
|
+
msgstr ""
|
|
55
|
+
|
|
56
|
+
#. Default: "Disable editing on this block"
|
|
57
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
58
|
+
msgid "Disable editing on this block"
|
|
59
|
+
msgstr ""
|
|
60
|
+
|
|
61
|
+
#. Default: "Disable inner buttons"
|
|
62
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
63
|
+
msgid "Disable inner buttons"
|
|
64
|
+
msgstr ""
|
|
65
|
+
|
|
66
|
+
#. Default: "Disable new blocks"
|
|
67
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
68
|
+
msgid "Disable new blocks"
|
|
69
|
+
msgstr ""
|
|
70
|
+
|
|
71
|
+
#. Default: "Don't allow deletion of this block"
|
|
72
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
73
|
+
msgid "Don't allow deletion of this block"
|
|
74
|
+
msgstr ""
|
|
75
|
+
|
|
76
|
+
#. Default: "Fixed layout"
|
|
77
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
78
|
+
msgid "Fixed layout"
|
|
79
|
+
msgstr ""
|
|
80
|
+
|
|
81
|
+
#. Default: "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
|
|
82
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
83
|
+
msgid "Fixed layout, New panes (tabs) created by Editor within this block will be ignored"
|
|
84
|
+
msgstr ""
|
|
85
|
+
|
|
86
|
+
#. Default: "Fixed position"
|
|
87
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
88
|
+
msgid "Fixed position"
|
|
89
|
+
msgstr ""
|
|
90
|
+
|
|
91
|
+
#. Default: "Helper text"
|
|
92
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
93
|
+
msgid "Helper text"
|
|
94
|
+
msgstr ""
|
|
95
|
+
|
|
96
|
+
#. Default: "Hero"
|
|
97
|
+
#: components/Blocks/Hero/index
|
|
98
|
+
msgid "Hero"
|
|
99
|
+
msgstr ""
|
|
100
|
+
|
|
101
|
+
#. Default: "Hero block settings"
|
|
102
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
103
|
+
msgid "Hero block settings"
|
|
104
|
+
msgstr ""
|
|
105
|
+
|
|
106
|
+
#. Default: "Hide all block related buttons within this block"
|
|
107
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
108
|
+
msgid "Hide all block related buttons within this block"
|
|
109
|
+
msgstr ""
|
|
110
|
+
|
|
111
|
+
#. Default: "Instructions"
|
|
112
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
113
|
+
msgid "Instructions"
|
|
114
|
+
msgstr ""
|
|
115
|
+
|
|
116
|
+
#. Default: "Read-only"
|
|
117
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
118
|
+
msgid "Read-only"
|
|
119
|
+
msgstr ""
|
|
120
|
+
|
|
121
|
+
#. Default: "Read-only settings"
|
|
122
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
123
|
+
msgid "Read-only settings"
|
|
124
|
+
msgstr ""
|
|
16
125
|
|
|
126
|
+
#. Default: "Read-only titles"
|
|
127
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
128
|
+
msgid "Read-only titles"
|
|
129
|
+
msgstr ""
|
|
130
|
+
|
|
131
|
+
#. Default: "Required"
|
|
132
|
+
#: components/Blocks/Hero/LayoutSchema
|
|
133
|
+
msgid "Required"
|
|
134
|
+
msgstr ""
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { Icon } from 'semantic-ui-react';
|
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import configureStore from 'redux-mock-store';
|
|
6
6
|
import config from '@plone/volto/registry';
|
|
7
|
-
import '@testing-library/jest-dom
|
|
7
|
+
import '@testing-library/jest-dom';
|
|
8
8
|
|
|
9
9
|
import Copyright from './Copyright';
|
|
10
10
|
|
|
@@ -4,7 +4,6 @@ import isFunction from 'lodash/isFunction';
|
|
|
4
4
|
import { Icon } from 'semantic-ui-react';
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
6
|
import { BlocksForm } from '@plone/volto/components';
|
|
7
|
-
import EditBlockWrapper from '@plone/volto/components/manage/Blocks/Block/EditBlockWrapper';
|
|
8
7
|
import { v4 as uuid } from 'uuid';
|
|
9
8
|
import '@eeacms/volto-hero-block/components/Blocks/Hero/edit.css';
|
|
10
9
|
|
|
@@ -15,8 +14,7 @@ import {
|
|
|
15
14
|
UniversalLink,
|
|
16
15
|
} from '@plone/volto/components';
|
|
17
16
|
import { BodyClass } from '@plone/volto/helpers';
|
|
18
|
-
|
|
19
|
-
import { getFieldURL } from '@eeacms/volto-hero-block/helpers';
|
|
17
|
+
import { getFieldURL } from '@plone/volto/helpers/Url/Url';
|
|
20
18
|
import { HeroBlockSchema } from './schema';
|
|
21
19
|
import Copyright from './Copyright';
|
|
22
20
|
import Hero from './Hero';
|
|
@@ -117,7 +115,7 @@ export default function Edit(props) {
|
|
|
117
115
|
allowedBlocks={'slate'}
|
|
118
116
|
selectedBlock={selectedBlock}
|
|
119
117
|
title={data.placeholder}
|
|
120
|
-
onSelectBlock={(s
|
|
118
|
+
onSelectBlock={(s) => {
|
|
121
119
|
setSelectedBlock(s);
|
|
122
120
|
}}
|
|
123
121
|
onChangeFormData={(newFormData) => {
|
|
@@ -141,17 +139,7 @@ export default function Edit(props) {
|
|
|
141
139
|
}
|
|
142
140
|
}}
|
|
143
141
|
pathname={pathname}
|
|
144
|
-
|
|
145
|
-
{({ draginfo }, editBlock, blockProps) => (
|
|
146
|
-
<EditBlockWrapper
|
|
147
|
-
draginfo={draginfo}
|
|
148
|
-
blockProps={blockProps}
|
|
149
|
-
disabled={data.disableInnerButtons}
|
|
150
|
-
>
|
|
151
|
-
{editBlock}
|
|
152
|
-
</EditBlockWrapper>
|
|
153
|
-
)}
|
|
154
|
-
</BlocksForm>
|
|
142
|
+
/>
|
|
155
143
|
</Hero.Text>
|
|
156
144
|
<Hero.Meta {...data}>
|
|
157
145
|
<Metadata {...data} />
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-redux';
|
|
4
|
+
import { IntlProvider } from 'react-intl';
|
|
4
5
|
import configureStore from 'redux-mock-store';
|
|
5
6
|
import Edit from './Edit';
|
|
6
7
|
import config from '@plone/volto/registry';
|
|
7
|
-
import '@testing-library/jest-dom
|
|
8
|
+
import '@testing-library/jest-dom';
|
|
9
|
+
|
|
10
|
+
// Mock uuid to avoid node:crypto import issues
|
|
11
|
+
jest.mock('uuid', () => ({
|
|
12
|
+
v4: () => 'mock-uuid-' + Math.random().toString(36).substr(2, 9),
|
|
13
|
+
}));
|
|
8
14
|
|
|
9
15
|
const mockStore = configureStore([]);
|
|
10
16
|
const observe = jest.fn();
|
|
11
17
|
const unobserve = jest.fn();
|
|
18
|
+
const disconnect = jest.fn();
|
|
12
19
|
jest.mock('@plone/volto/components', () => {
|
|
13
20
|
return {
|
|
14
21
|
__esModule: true,
|
|
15
|
-
BlocksForm: ({ placeholder
|
|
22
|
+
BlocksForm: ({ placeholder }) => (
|
|
16
23
|
<div id="test">
|
|
17
24
|
<div>{placeholder}</div>
|
|
18
|
-
{children}
|
|
19
25
|
</div>
|
|
20
26
|
),
|
|
21
27
|
SidebarPortal: ({ children }) => <div>{children}</div>,
|
|
@@ -34,9 +40,10 @@ jest.mock('react-router-dom', () => ({
|
|
|
34
40
|
}),
|
|
35
41
|
}));
|
|
36
42
|
|
|
37
|
-
window.IntersectionObserver = jest.fn((
|
|
43
|
+
window.IntersectionObserver = jest.fn(() => ({
|
|
38
44
|
observe,
|
|
39
45
|
unobserve,
|
|
46
|
+
disconnect,
|
|
40
47
|
}));
|
|
41
48
|
|
|
42
49
|
config.blocks = {
|
|
@@ -45,6 +52,7 @@ config.blocks = {
|
|
|
45
52
|
copyrightPrefix: 'Test Prefix',
|
|
46
53
|
schema: {
|
|
47
54
|
title: 'Hero',
|
|
55
|
+
required: [],
|
|
48
56
|
},
|
|
49
57
|
},
|
|
50
58
|
},
|
|
@@ -53,6 +61,7 @@ config.settings = {
|
|
|
53
61
|
slate: {
|
|
54
62
|
textblockExtensions: [],
|
|
55
63
|
},
|
|
64
|
+
themeColors: [],
|
|
56
65
|
};
|
|
57
66
|
|
|
58
67
|
describe('Edit component', () => {
|
|
@@ -67,9 +76,11 @@ describe('Edit component', () => {
|
|
|
67
76
|
|
|
68
77
|
it('renders without crashing', () => {
|
|
69
78
|
const { container } = render(
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
79
|
+
<IntlProvider locale="en" messages={{}}>
|
|
80
|
+
<Provider store={store}>
|
|
81
|
+
<Edit onChangeBlock={() => {}} onSelectBlock={() => {}} />
|
|
82
|
+
</Provider>
|
|
83
|
+
</IntlProvider>,
|
|
73
84
|
);
|
|
74
85
|
expect(container).toBeTruthy();
|
|
75
86
|
});
|
|
@@ -89,9 +100,11 @@ describe('Edit component', () => {
|
|
|
89
100
|
};
|
|
90
101
|
|
|
91
102
|
const { container } = render(
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
|
|
103
|
+
<IntlProvider locale="en" messages={{}}>
|
|
104
|
+
<Provider store={store}>
|
|
105
|
+
<Edit data={data} onChangeBlock={() => {}} />
|
|
106
|
+
</Provider>
|
|
107
|
+
</IntlProvider>,
|
|
95
108
|
);
|
|
96
109
|
|
|
97
110
|
expect(container.querySelector('#test')).toBeInTheDocument();
|
|
@@ -103,15 +116,18 @@ describe('Edit component', () => {
|
|
|
103
116
|
hero: {
|
|
104
117
|
schema: () => ({
|
|
105
118
|
title: 'Hero',
|
|
119
|
+
required: [],
|
|
106
120
|
}),
|
|
107
121
|
},
|
|
108
122
|
},
|
|
109
123
|
};
|
|
110
124
|
const onSelectBlock = jest.fn();
|
|
111
125
|
render(
|
|
112
|
-
<
|
|
113
|
-
<
|
|
114
|
-
|
|
126
|
+
<IntlProvider locale="en" messages={{}}>
|
|
127
|
+
<Provider store={store}>
|
|
128
|
+
<Edit onSelectBlock={onSelectBlock} onChangeBlock={() => {}} />
|
|
129
|
+
</Provider>
|
|
130
|
+
</IntlProvider>,
|
|
115
131
|
);
|
|
116
132
|
});
|
|
117
133
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo, useRef } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
5
|
-
import { isImageGif, getFieldURL } from '@eeacms/volto-hero-block/helpers';
|
|
4
|
+
import { getImageScaleParams } from '@eeacms/volto-object-widget/helpers';
|
|
6
5
|
import { useFirstVisited } from '@eeacms/volto-hero-block/hooks';
|
|
7
6
|
|
|
8
7
|
Hero.propTypes = {
|
|
9
|
-
image: PropTypes.string,
|
|
8
|
+
image: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
10
9
|
fullWidth: PropTypes.bool,
|
|
11
10
|
fullHeight: PropTypes.bool,
|
|
12
11
|
alignContent: PropTypes.string,
|
|
@@ -18,46 +17,48 @@ Hero.propTypes = {
|
|
|
18
17
|
textVariant: PropTypes.string,
|
|
19
18
|
};
|
|
20
19
|
|
|
21
|
-
function Hero({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
function Hero(props) {
|
|
21
|
+
const {
|
|
22
|
+
image,
|
|
23
|
+
fullWidth = false,
|
|
24
|
+
fullHeight = false,
|
|
25
|
+
height,
|
|
26
|
+
styles,
|
|
27
|
+
overlay = true,
|
|
28
|
+
children,
|
|
29
|
+
spaced = false,
|
|
30
|
+
inverted = false,
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const scaledImage = useMemo(
|
|
34
|
+
() => (image ? getImageScaleParams(image, 'huge') : null),
|
|
35
|
+
[image],
|
|
36
|
+
);
|
|
34
37
|
const { alignContent = 'center', backgroundVariant = 'primary' } =
|
|
35
38
|
styles || {};
|
|
36
|
-
const bgImgRef =
|
|
39
|
+
const bgImgRef = useRef();
|
|
37
40
|
const onScreen = useFirstVisited(bgImgRef);
|
|
38
|
-
const containerCssStyles =
|
|
41
|
+
const containerCssStyles = useMemo(
|
|
39
42
|
() => ({
|
|
40
43
|
...(height && !fullHeight ? { height } : {}),
|
|
41
44
|
}),
|
|
42
45
|
[height, fullHeight],
|
|
43
46
|
);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
: {};
|
|
47
|
+
const backgroundImageStyle = useMemo(
|
|
48
|
+
() =>
|
|
49
|
+
onScreen && scaledImage
|
|
50
|
+
? {
|
|
51
|
+
backgroundImage: `url(${scaledImage.download})`,
|
|
52
|
+
}
|
|
53
|
+
: {},
|
|
54
|
+
[onScreen, scaledImage],
|
|
55
|
+
);
|
|
55
56
|
|
|
56
57
|
return (
|
|
57
58
|
<div
|
|
58
59
|
className={cx(
|
|
59
60
|
'eea hero-block',
|
|
60
|
-
!
|
|
61
|
+
!scaledImage &&
|
|
61
62
|
backgroundVariant &&
|
|
62
63
|
!fullWidth &&
|
|
63
64
|
`color-bg-${backgroundVariant}`,
|
|
@@ -71,7 +72,7 @@ function Hero({
|
|
|
71
72
|
<div
|
|
72
73
|
className={cx(
|
|
73
74
|
'hero-block-image-wrapper',
|
|
74
|
-
!
|
|
75
|
+
!scaledImage &&
|
|
75
76
|
backgroundVariant &&
|
|
76
77
|
fullWidth &&
|
|
77
78
|
`color-bg-${backgroundVariant}`,
|
|
@@ -86,7 +87,7 @@ function Hero({
|
|
|
86
87
|
ref={bgImgRef}
|
|
87
88
|
style={backgroundImageStyle}
|
|
88
89
|
/>
|
|
89
|
-
{
|
|
90
|
+
{scaledImage && overlay && (
|
|
90
91
|
<div className="hero-block-image-overlay dark-overlay-4"></div>
|
|
91
92
|
)}
|
|
92
93
|
</div>
|