@eeacms/volto-tabs-block 10.0.3 → 10.0.5
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/.github/workflows/betterleaks.yml +133 -0
- package/.gitleaks.toml +89 -0
- package/CHANGELOG.md +10 -69
- package/README.md +59 -0
- package/RELEASE.md +1 -1
- package/jest-addon.config.js +1 -0
- package/jest.uuid.js +3 -0
- package/package.json +1 -1
- package/src/components/Edit.jsx +9 -5
- package/src/components/Edit.test.jsx +72 -3
- package/src/components/variations/default/Edit.jsx +2 -10
- package/src/components/variations/horizontal-responsive/Edit.jsx +2 -10
- package/src/helpers.js +8 -0
- package/src/helpers.test.js +21 -0
- package/src/less/tabs.less +1 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
name: Betterleaks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
scan:
|
|
12
|
+
name: Scan for secrets
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
env:
|
|
15
|
+
SMTP_URL: ${{ secrets.SMTP_URL }}
|
|
16
|
+
SMTP_PORT: ${{ secrets.SMTP_PORT || '25' }}
|
|
17
|
+
SMTP_EMAIL: ${{ secrets.SMTP_EMAIL }}
|
|
18
|
+
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout repository
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
with:
|
|
23
|
+
fetch-depth: 1
|
|
24
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
25
|
+
|
|
26
|
+
- name: Run Betterleaks
|
|
27
|
+
id: betterleaks
|
|
28
|
+
continue-on-error: true
|
|
29
|
+
uses: dortort/betterleaks-action@v0.1.0
|
|
30
|
+
with:
|
|
31
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
32
|
+
scan-mode: dir
|
|
33
|
+
scan-path: .
|
|
34
|
+
config: .gitleaks.toml
|
|
35
|
+
report-format: json
|
|
36
|
+
report-path: betterleaks-report.json
|
|
37
|
+
redact: "true"
|
|
38
|
+
no-color: "true"
|
|
39
|
+
no-banner: "true"
|
|
40
|
+
fail-on-leak: "true"
|
|
41
|
+
|
|
42
|
+
- name: Upload Betterleaks report
|
|
43
|
+
if: always()
|
|
44
|
+
uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: betterleaks-report
|
|
47
|
+
path: betterleaks-report.json
|
|
48
|
+
if-no-files-found: ignore
|
|
49
|
+
|
|
50
|
+
- name: Build Betterleaks email summary
|
|
51
|
+
id: leak_summary
|
|
52
|
+
if: steps.betterleaks.outcome == 'failure'
|
|
53
|
+
shell: bash
|
|
54
|
+
run: |
|
|
55
|
+
if [[ -s betterleaks-report.json ]]; then
|
|
56
|
+
jq -r '
|
|
57
|
+
def one_line:
|
|
58
|
+
tostring
|
|
59
|
+
| gsub("[\r\n]+"; " ")
|
|
60
|
+
| if length > 240 then .[0:240] + "..." else . end;
|
|
61
|
+
|
|
62
|
+
.[:20][]
|
|
63
|
+
| "- " + (.RuleID // "unknown-rule")
|
|
64
|
+
+ " at " + (.File // "unknown-file")
|
|
65
|
+
+ ":" + ((.StartLine // 0) | tostring)
|
|
66
|
+
+ "\n match: " + ((.Match // .Secret // "REDACTED") | one_line)
|
|
67
|
+
' betterleaks-report.json > betterleaks-email-summary.txt
|
|
68
|
+
|
|
69
|
+
count="$(jq 'length' betterleaks-report.json)"
|
|
70
|
+
if (( count > 20 )); then
|
|
71
|
+
{
|
|
72
|
+
echo ""
|
|
73
|
+
echo "... and $((count - 20)) more finding(s). Download the artifact for full details."
|
|
74
|
+
} >> betterleaks-email-summary.txt
|
|
75
|
+
fi
|
|
76
|
+
else
|
|
77
|
+
echo "No JSON report was generated. Download the workflow logs for details." > betterleaks-email-summary.txt
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
echo "text<<BETTERLEAKS_SUMMARY"
|
|
82
|
+
cat betterleaks-email-summary.txt
|
|
83
|
+
echo "BETTERLEAKS_SUMMARY"
|
|
84
|
+
} >> "$GITHUB_OUTPUT"
|
|
85
|
+
|
|
86
|
+
- name: Resolve committer email
|
|
87
|
+
id: committer
|
|
88
|
+
if: steps.betterleaks.outcome == 'failure'
|
|
89
|
+
shell: bash
|
|
90
|
+
run: |
|
|
91
|
+
committer_email="$(git log -1 --format='%ce')"
|
|
92
|
+
author_email="$(git log -1 --format='%ae')"
|
|
93
|
+
email="$committer_email"
|
|
94
|
+
if [[ -z "$email" || "$email" == *"noreply.github.com"* ]]; then
|
|
95
|
+
email="$author_email"
|
|
96
|
+
fi
|
|
97
|
+
if [[ "$email" =~ ^[^[:space:]@]+@[^[:space:]@]+\.[^[:space:]@]+$ && "$email" != *"noreply.github.com"* ]]; then
|
|
98
|
+
echo "email=$email" >> "$GITHUB_OUTPUT"
|
|
99
|
+
else
|
|
100
|
+
echo "No deliverable committer email found; skipping Betterleaks email notification."
|
|
101
|
+
echo "email=" >> "$GITHUB_OUTPUT"
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
- name: Email committer on Betterleaks failure
|
|
105
|
+
if: steps.betterleaks.outcome == 'failure' && steps.committer.outputs.email != '' && env.SMTP_URL != '' && env.SMTP_EMAIL != ''
|
|
106
|
+
uses: dawidd6/action-send-mail@v18
|
|
107
|
+
with:
|
|
108
|
+
server_address: ${{ env.SMTP_URL }}
|
|
109
|
+
server_port: ${{ env.SMTP_PORT }}
|
|
110
|
+
secure: ${{ env.SMTP_PORT == '465' }}
|
|
111
|
+
username: ${{ env.SMTP_EMAIL }}
|
|
112
|
+
password: ${{ env.SMTP_PASSWORD }}
|
|
113
|
+
from: ${{ env.SMTP_EMAIL }}
|
|
114
|
+
to: ${{ steps.committer.outputs.email }}
|
|
115
|
+
subject: "[Betterleaks] Secret scan failed in ${{ github.repository }}"
|
|
116
|
+
body: |
|
|
117
|
+
Betterleaks detected one or more potential secrets.
|
|
118
|
+
|
|
119
|
+
Repository: ${{ github.repository }}
|
|
120
|
+
Branch: ${{ github.ref_name }}
|
|
121
|
+
Commit: ${{ github.sha }}
|
|
122
|
+
Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
123
|
+
|
|
124
|
+
Findings:
|
|
125
|
+
${{ steps.leak_summary.outputs.text }}
|
|
126
|
+
|
|
127
|
+
Download the betterleaks-report artifact from the workflow run for details.
|
|
128
|
+
|
|
129
|
+
- name: Fail if Betterleaks found leaks
|
|
130
|
+
if: steps.betterleaks.outcome == 'failure'
|
|
131
|
+
run: |
|
|
132
|
+
echo "Betterleaks detected one or more secrets. Download the betterleaks-report artifact from this workflow run for details."
|
|
133
|
+
exit 1
|
package/.gitleaks.toml
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
title = "Betterleaks config"
|
|
2
|
+
|
|
3
|
+
[extend]
|
|
4
|
+
useDefault = true
|
|
5
|
+
|
|
6
|
+
[[rules]]
|
|
7
|
+
id = "secret-literal-assignment"
|
|
8
|
+
description = "Secret-like literal assignment in source, YAML, env and config files"
|
|
9
|
+
regex = '''(?i)([A-Za-z0-9_.-]*(?:password|passwd|pwd|api[_-]?key|apikey|access[_-]?key|secret[_-]?access[_-]?key|private[_-]?key|client[_-]?secret|consumer[_-]?key|consumer[_-]?secret|(?:auth|access|refresh|session|api|bearer|id|jwt|csrf|xsrf|oauth)[_-]?token|translate[_-]?auth|translation[_-]?auth|auth[_-]?password|auth[_-]?key|auth[_-]?credentials|database[_-]?url|connection[_-]?string)[A-Za-z0-9_.-]*)[ \t]*[:=][ \t]*["'']?([^"''[:space:]#{}$.][^"''\n#{}]{2,})["'']?'''
|
|
10
|
+
secretGroup = 2
|
|
11
|
+
keywords = [
|
|
12
|
+
"password",
|
|
13
|
+
"passwd",
|
|
14
|
+
"pwd",
|
|
15
|
+
"api_key",
|
|
16
|
+
"apikey",
|
|
17
|
+
"access_key",
|
|
18
|
+
"private_key",
|
|
19
|
+
"client_secret",
|
|
20
|
+
"consumer_key",
|
|
21
|
+
"consumer_secret",
|
|
22
|
+
"auth_token",
|
|
23
|
+
"access_token",
|
|
24
|
+
"refresh_token",
|
|
25
|
+
"session_token",
|
|
26
|
+
"api_token",
|
|
27
|
+
"bearer_token",
|
|
28
|
+
"id_token",
|
|
29
|
+
"jwt_token",
|
|
30
|
+
"csrf_token",
|
|
31
|
+
"xsrf_token",
|
|
32
|
+
"oauth_token",
|
|
33
|
+
"translate_auth",
|
|
34
|
+
"translation_auth",
|
|
35
|
+
"auth_password",
|
|
36
|
+
"auth_key",
|
|
37
|
+
"auth_credentials",
|
|
38
|
+
"database_url",
|
|
39
|
+
"connection_string"
|
|
40
|
+
]
|
|
41
|
+
tags = ["literal-secret"]
|
|
42
|
+
|
|
43
|
+
[[rules]]
|
|
44
|
+
id = "env-short-secret-assignment"
|
|
45
|
+
description = "Uppercase env-style PASS/TOKEN/SECRET assignment"
|
|
46
|
+
regex = '''\b((?:PASS|TOKEN|SECRET|[A-Z0-9_]*(?:_PASS|_TOKEN|_SECRET|PASS_|TOKEN_|SECRET_)[A-Z0-9_]*))[ \t]*[:=][ \t]*["'']?([^"''[:space:]#{}$.][^"''\n#{}]{2,})["'']?'''
|
|
47
|
+
secretGroup = 2
|
|
48
|
+
keywords = [
|
|
49
|
+
"PASS",
|
|
50
|
+
"TOKEN",
|
|
51
|
+
"SECRET"
|
|
52
|
+
]
|
|
53
|
+
tags = ["env", "literal-secret"]
|
|
54
|
+
|
|
55
|
+
[[rules]]
|
|
56
|
+
id = "standalone-sk-token"
|
|
57
|
+
description = "Standalone sk-* token not attached to a secret-like variable name"
|
|
58
|
+
regex = '''(?i)\b(sk-[A-Za-z0-9][A-Za-z0-9_-]{20,})\b'''
|
|
59
|
+
secretGroup = 1
|
|
60
|
+
entropy = 2.5
|
|
61
|
+
keywords = ["sk-"]
|
|
62
|
+
tags = ["standalone-token", "generic"]
|
|
63
|
+
|
|
64
|
+
[[rules]]
|
|
65
|
+
id = "dotenv-only-jest-setup"
|
|
66
|
+
description = ".env may only contain the committed Jest setup lines"
|
|
67
|
+
path = '''(?i)(^|/)\.env$'''
|
|
68
|
+
regex = '''(?m)^(.+)$'''
|
|
69
|
+
secretGroup = 1
|
|
70
|
+
tags = ["file", "dotenv"]
|
|
71
|
+
[[rules.allowlists]]
|
|
72
|
+
regexTarget = "match"
|
|
73
|
+
regexes = [
|
|
74
|
+
'''^JEST_USE_SETUP=OFF # Jest configuration variables: ON, OFF\r?$''',
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
[[rules]]
|
|
78
|
+
id = "forbidden-secret-file"
|
|
79
|
+
description = "Forbidden secret-bearing file committed to repository"
|
|
80
|
+
path = '''(?i)(^|/)(\.env\..*|\.npmrc|\.pypirc|id_rsa|id_ed25519|.*\.(pem|key|p12|pfx|jks|kubeconfig))$'''
|
|
81
|
+
regex = '''(?s).{1,}'''
|
|
82
|
+
tags = ["file", "secret-file"]
|
|
83
|
+
|
|
84
|
+
[[allowlists]]
|
|
85
|
+
description = "Allow Jenkins SonarQube token environment variable reference"
|
|
86
|
+
regexTarget = "match"
|
|
87
|
+
regexes = [
|
|
88
|
+
'''SONAR_AUTH_TOKEN''',
|
|
89
|
+
]
|
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,19 @@ 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
|
-
### [10.0.
|
|
7
|
+
### [10.0.5](https://github.com/eea/volto-tabs-block/compare/10.0.4...10.0.5) - 29 October 2026
|
|
8
8
|
|
|
9
9
|
#### :bug: Bug Fixes
|
|
10
10
|
|
|
11
|
-
- fix:
|
|
11
|
+
- fix: add a new block to a tab emptied with delete - refs #308479 [dobri1408 - [`985acee`](https://github.com/eea/volto-tabs-block/commit/985aceecb0c9c44fd86ad81ed9557484b55d9e5e)]
|
|
12
|
+
- fix: Add betterleaks github action - refs #304517 [dobri1408 - [`8e3b4c3`](https://github.com/eea/volto-tabs-block/commit/8e3b4c313ac05316602252f68ff6531498a35862)]
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- test: pin Chromium version 149 to work with Cypress [valentinab25 - [`a867bbe`](https://github.com/eea/volto-tabs-block/commit/a867bbed901538b2e0613d413943035f663beb47)]
|
|
17
|
+
### [10.0.4](https://github.com/eea/volto-tabs-block/compare/10.0.3...10.0.4) - 6 June 2026
|
|
18
|
+
|
|
19
|
+
### [10.0.3](https://github.com/eea/volto-tabs-block/compare/10.0.2...10.0.3) - 4 June 2026
|
|
12
20
|
|
|
13
21
|
### [10.0.2](https://github.com/eea/volto-tabs-block/compare/10.0.1...10.0.2) - 21 April 2026
|
|
14
22
|
|
|
@@ -23,11 +31,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
23
31
|
|
|
24
32
|
- feat: Volto 18 support - refs #287700 [Alin Voinea - [`f370bb2`](https://github.com/eea/volto-tabs-block/commit/f370bb24f0a741129c21896338baf19ed4bab030)]
|
|
25
33
|
|
|
26
|
-
#### :house: Internal changes
|
|
27
|
-
|
|
28
|
-
- chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`1e18835`](https://github.com/eea/volto-tabs-block/commit/1e18835ff2d59579de5dc9bb8ec6056a90dd7f77)]
|
|
29
|
-
- chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`1b14a57`](https://github.com/eea/volto-tabs-block/commit/1b14a57d39aa4685294068fff78275a1f6248964)]
|
|
30
|
-
|
|
31
34
|
#### :hammer_and_wrench: Others
|
|
32
35
|
|
|
33
36
|
- Release 10.0.0: Volto 18 support [Alin Voinea - [`3f509ae`](https://github.com/eea/volto-tabs-block/commit/3f509aed7cff2e43d4d50f64bf24b6244602fd95)]
|
|
@@ -38,20 +41,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
38
41
|
#### :hammer_and_wrench: Others
|
|
39
42
|
|
|
40
43
|
- Release 9.1.0 [Alin Voinea - [`4396e37`](https://github.com/eea/volto-tabs-block/commit/4396e3740694d99cbb66414783c3fbbef7ed2022)]
|
|
41
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`20aaf70`](https://github.com/eea/volto-tabs-block/commit/20aaf70fec13c977a805caeec043457867e62c36)]
|
|
42
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`d516041`](https://github.com/eea/volto-tabs-block/commit/d516041244ee793504833b38033e75df20a8fa13)]
|
|
43
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ae5b123`](https://github.com/eea/volto-tabs-block/commit/ae5b123036ab3ec9d225228206016d78ab6dcaa4)]
|
|
44
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`74fb410`](https://github.com/eea/volto-tabs-block/commit/74fb410ec9e3657e55fc5ea35c6717a737ddc375)]
|
|
45
44
|
### [9.0.3](https://github.com/eea/volto-tabs-block/compare/9.0.2...9.0.3) - 7 May 2025
|
|
46
45
|
|
|
47
46
|
#### :bug: Bug Fixes
|
|
48
47
|
|
|
49
48
|
- fix: Active tab when navigation from within - refs #287006 [Nilesh - [`5133d07`](https://github.com/eea/volto-tabs-block/commit/5133d07b1fcf9fef8b336ea27a679d4aea594513)]
|
|
50
49
|
|
|
51
|
-
#### :hammer_and_wrench: Others
|
|
52
|
-
|
|
53
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`01b5632`](https://github.com/eea/volto-tabs-block/commit/01b563271bd04f4329d9f876278324b970443413)]
|
|
54
|
-
- Add Sonarqube tag using ied-frontend addons list [EEA Jenkins - [`d457e25`](https://github.com/eea/volto-tabs-block/commit/d457e25d8a97b080eb8eb32ae4b85db530049e96)]
|
|
55
50
|
### [9.0.2](https://github.com/eea/volto-tabs-block/compare/9.0.1...9.0.2) - 27 January 2025
|
|
56
51
|
|
|
57
52
|
#### :house: Internal changes
|
|
@@ -100,10 +95,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
100
95
|
- feat: Release 8.0.0 - Volto 17 support [alin - [`57dd000`](https://github.com/eea/volto-tabs-block/commit/57dd0008921899688a6175c9fb00588593a7b307)]
|
|
101
96
|
- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`80b384c`](https://github.com/eea/volto-tabs-block/commit/80b384ca871dd2578b1cd0c0bf3e238d0289b977)]
|
|
102
97
|
|
|
103
|
-
#### :hammer_and_wrench: Others
|
|
104
|
-
|
|
105
|
-
- Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`cb58ea7`](https://github.com/eea/volto-tabs-block/commit/cb58ea7417e8dd237b66908fd53f1f3ca8726566)]
|
|
106
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`4377ffc`](https://github.com/eea/volto-tabs-block/commit/4377ffc350a92f62cbe77b17b67dd331c71cbcd7)]
|
|
107
98
|
### [7.5.1](https://github.com/eea/volto-tabs-block/compare/7.5.0...7.5.1) - 28 March 2024
|
|
108
99
|
|
|
109
100
|
#### :nail_care: Enhancements
|
|
@@ -146,7 +137,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
146
137
|
- Update react-slick version to 0.30.1 [David Ichim - [`3369176`](https://github.com/eea/volto-tabs-block/commit/33691768899e7f91d2cd15319dbe3ebe66cf1513)]
|
|
147
138
|
- update [Razvan - [`61b19e8`](https://github.com/eea/volto-tabs-block/commit/61b19e8584ff6023320b3671414392ea11449ff0)]
|
|
148
139
|
- use DefaultEdit variation for responsive accordion, refs #266327 [Razvan - [`11acf6c`](https://github.com/eea/volto-tabs-block/commit/11acf6ce5afe022ddd30bff42c9a3321d1284da6)]
|
|
149
|
-
- Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`5045757`](https://github.com/eea/volto-tabs-block/commit/5045757a275477ba382551b301998d835741b716)]
|
|
150
140
|
### [7.0.5](https://github.com/eea/volto-tabs-block/compare/7.0.4...7.0.5) - 10 December 2023
|
|
151
141
|
|
|
152
142
|
#### :rocket: New Features
|
|
@@ -154,10 +144,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
154
144
|
- feat: add more tests for view/edit component [hazigabriel - [`72d0467`](https://github.com/eea/volto-tabs-block/commit/72d0467e74042b103630aacb8cffafb7c7a4a83f)]
|
|
155
145
|
- feat: refactor custom useQuery hook to avoid uncessary rerender [hazigabriel - [`6f28052`](https://github.com/eea/volto-tabs-block/commit/6f28052336db391ef9c918b2b329da4ae1639850)]
|
|
156
146
|
|
|
157
|
-
#### :bug: Bug Fixes
|
|
158
|
-
|
|
159
|
-
- fix: add jest config to fix jenkins error [hazigabriel - [`63fa962`](https://github.com/eea/volto-tabs-block/commit/63fa962f7f49ac8986ff250db57f544292aa951c)]
|
|
160
|
-
|
|
161
147
|
### [7.0.4](https://github.com/eea/volto-tabs-block/compare/7.0.3...7.0.4) - 4 December 2023
|
|
162
148
|
|
|
163
149
|
#### :bug: Bug Fixes
|
|
@@ -176,10 +162,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
176
162
|
|
|
177
163
|
- fix(menu): Update secondary pointing inverted active border color variable in menu [David Ichim - [`d8a7837`](https://github.com/eea/volto-tabs-block/commit/d8a78377058732c42295196810416b41ad41417c)]
|
|
178
164
|
|
|
179
|
-
#### :hammer_and_wrench: Others
|
|
180
|
-
|
|
181
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`3b87d12`](https://github.com/eea/volto-tabs-block/commit/3b87d12df4d01031231b15eb4196f6ff6937706b)]
|
|
182
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`f5f3430`](https://github.com/eea/volto-tabs-block/commit/f5f343024b45bb0206e0169cce6dd0e8472b6795)]
|
|
183
165
|
### [7.0.1](https://github.com/eea/volto-tabs-block/compare/7.0.0...7.0.1) - 9 November 2023
|
|
184
166
|
|
|
185
167
|
#### :bug: Bug Fixes
|
|
@@ -187,17 +169,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
187
169
|
- fix(tabs): default view style due to missing class found on edit #75 from eea/develop [ichim-david - [`f620621`](https://github.com/eea/volto-tabs-block/commit/f6206213915d072838173ca2a5bff4d4ddc461c1)]
|
|
188
170
|
- fix(tabs): added missing tabs-secondary-variant class to default tab view template [David Ichim - [`a122359`](https://github.com/eea/volto-tabs-block/commit/a122359601d548d7577e7f978b5025a92469d1dd)]
|
|
189
171
|
|
|
190
|
-
#### :hammer_and_wrench: Others
|
|
191
|
-
|
|
192
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`bd6ffd4`](https://github.com/eea/volto-tabs-block/commit/bd6ffd42a00a2d77ff59545d9adaab7a45361446)]
|
|
193
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`d481e25`](https://github.com/eea/volto-tabs-block/commit/d481e25c4d61d7ff6ea11ff75c99fbdd730ecd82)]
|
|
194
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`6c39efc`](https://github.com/eea/volto-tabs-block/commit/6c39efcc30bddfebb6c61f8a8cd714f61828ec69)]
|
|
195
172
|
## [7.0.0](https://github.com/eea/volto-tabs-block/compare/6.0.3...7.0.0) - 31 October 2023
|
|
196
173
|
|
|
197
|
-
#### :house: Internal changes
|
|
198
|
-
|
|
199
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`f2e3d39`](https://github.com/eea/volto-tabs-block/commit/f2e3d3973c026f0331b82e0f691ec9bdc5899672)]
|
|
200
|
-
|
|
201
174
|
#### :hammer_and_wrench: Others
|
|
202
175
|
|
|
203
176
|
- Release 7.0.0 with variation support, icons for titles and i18n improvements #74 from eea/develop [ichim-david - [`a48175f`](https://github.com/eea/volto-tabs-block/commit/a48175fa3bc76650a76f993f0a3f4a3b43d14a9a)]
|
|
@@ -250,7 +223,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
250
223
|
- Removed static alt title for image and set tab title to image when hideTitle is enabled [David Ichim - [`724f7ff`](https://github.com/eea/volto-tabs-block/commit/724f7fffb07b2679dd7135644e79c04aabdbf5f1)]
|
|
251
224
|
- fix test by having proper variation name that was accordion and not accordionResponsive [David Ichim - [`7c47ee0`](https://github.com/eea/volto-tabs-block/commit/7c47ee0e8666360b6df4597d00397fe1b00aa861)]
|
|
252
225
|
- Added format messages to the default tab schema [David Ichim - [`d1503e3`](https://github.com/eea/volto-tabs-block/commit/d1503e31f394208d6fc8afb07b1232dc65e68c04)]
|
|
253
|
-
- Use Volto 16 for Jenkins tests until we are compatible with 17 [David Ichim - [`2b67e55`](https://github.com/eea/volto-tabs-block/commit/2b67e55745f815544ea462220a27193f13173e5c)]
|
|
254
226
|
- updated test to also handle double click on edit and clicking around tabs [David Ichim - [`843f44b`](https://github.com/eea/volto-tabs-block/commit/843f44ba797355987a5a439d741dc947de21afce)]
|
|
255
227
|
- enable pointing and secondary option and added some basic styling for tabs transformed into accordions [David Ichim - [`31baef7`](https://github.com/eea/volto-tabs-block/commit/31baef71e8765ad44f4c605954edd0995a996ab9)]
|
|
256
228
|
- avoid double title if icon is enabled and removed rrt styles [David Ichim - [`b29941f`](https://github.com/eea/volto-tabs-block/commit/b29941f37b9b2131fd1b0e021351dd64bdff5237)]
|
|
@@ -371,7 +343,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
371
343
|
- prettier fix [David Ichim - [`ac3e199`](https://github.com/eea/volto-tabs-block/commit/ac3e199a33651d21c003bf87b544c27f32a4638a)]
|
|
372
344
|
- bump package version [David Ichim - [`011a9f0`](https://github.com/eea/volto-tabs-block/commit/011a9f0ef826e3a1367f0ea81a64072f49e239f8)]
|
|
373
345
|
- lint fix after i18n enhancements from community [David Ichim - [`c46f8e1`](https://github.com/eea/volto-tabs-block/commit/c46f8e1096ab7e99b9a98e1c191b27f508e977eb)]
|
|
374
|
-
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`21697b3`](https://github.com/eea/volto-tabs-block/commit/21697b3ebe7f52f7753e491ab76733df4004955f)]
|
|
375
346
|
- Add i18n support and pt_BR translation [André Clímaco - [`dfb1e66`](https://github.com/eea/volto-tabs-block/commit/dfb1e667a91e8250ea437a950217c6474771f3e5)]
|
|
376
347
|
### [5.0.8](https://github.com/eea/volto-tabs-block/compare/5.0.7...5.0.8) - 18 August 2023
|
|
377
348
|
|
|
@@ -407,10 +378,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
407
378
|
- test: add unit tests for helpers - refs #253277 [ana-oprea - [`aa270d7`](https://github.com/eea/volto-tabs-block/commit/aa270d7db0da5086d48378a6ccf503e563805d72)]
|
|
408
379
|
### [5.0.3](https://github.com/eea/volto-tabs-block/compare/5.0.2...5.0.3) - 12 June 2023
|
|
409
380
|
|
|
410
|
-
#### :house: Internal changes
|
|
411
|
-
|
|
412
|
-
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`820aaa9`](https://github.com/eea/volto-tabs-block/commit/820aaa963e978a893a23b77f694bb011f3d768c1)]
|
|
413
|
-
|
|
414
381
|
#### :hammer_and_wrench: Others
|
|
415
382
|
|
|
416
383
|
- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`e3b0519`](https://github.com/eea/volto-tabs-block/commit/e3b051969a3dac74b5f33340447fe98ffbc0fb14)]
|
|
@@ -498,9 +465,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
498
465
|
|
|
499
466
|
- fix(Edit.jsx): add key prop to MenuItem component to avoid warning in console [Miu Razvan - [`55cc784`](https://github.com/eea/volto-tabs-block/commit/55cc784f452637cf686f80a40aef3809784032f6)]
|
|
500
467
|
|
|
501
|
-
#### :hammer_and_wrench: Others
|
|
502
|
-
|
|
503
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`52bc1b0`](https://github.com/eea/volto-tabs-block/commit/52bc1b0fbd4611173b8ca9dc2cf4033b31474420)]
|
|
504
468
|
## [4.0.0](https://github.com/eea/volto-tabs-block/compare/3.0.1...4.0.0) - 10 March 2023
|
|
505
469
|
|
|
506
470
|
#### :house: Internal changes
|
|
@@ -511,13 +475,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
511
475
|
#### :hammer_and_wrench: Others
|
|
512
476
|
|
|
513
477
|
- Release 4.0.0 [Alin Voinea - [`8fc4cc9`](https://github.com/eea/volto-tabs-block/commit/8fc4cc9d8dc71e623e6586b95871cb3b98dc385f)]
|
|
514
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`22d5bdc`](https://github.com/eea/volto-tabs-block/commit/22d5bdc1b3579cc46c73ce855041ca09154eb502)]
|
|
515
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`fde4324`](https://github.com/eea/volto-tabs-block/commit/fde4324f962cde8e8de0d76a44bee4b67d216bf8)]
|
|
516
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9175e47`](https://github.com/eea/volto-tabs-block/commit/9175e470d793edc63b62a99940aed25dd45f3713)]
|
|
517
|
-
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`3348950`](https://github.com/eea/volto-tabs-block/commit/334895036f8e367281abb35a20879c32dfbfc292)]
|
|
518
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`39bfb39`](https://github.com/eea/volto-tabs-block/commit/39bfb39fa6e8483e639491ff998293e758ac6384)]
|
|
519
|
-
- yarn 3 [Alin Voinea - [`7e98df5`](https://github.com/eea/volto-tabs-block/commit/7e98df59669d71945be461e86e282b913538b805)]
|
|
520
|
-
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`079d7a4`](https://github.com/eea/volto-tabs-block/commit/079d7a43480e92fe280a9372399ff2d4d28537ae)]
|
|
521
478
|
### [3.0.1](https://github.com/eea/volto-tabs-block/compare/3.0.0...3.0.1) - 16 November 2022
|
|
522
479
|
|
|
523
480
|
#### :hammer_and_wrench: Others
|
|
@@ -541,9 +498,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
541
498
|
|
|
542
499
|
#### :hammer_and_wrench: Others
|
|
543
500
|
|
|
544
|
-
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`a00e419`](https://github.com/eea/volto-tabs-block/commit/a00e419aef4c82a25f277f5e25e3d512c7838264)]
|
|
545
501
|
- lint fix [David Ichim - [`c0a898c`](https://github.com/eea/volto-tabs-block/commit/c0a898c54461478baed2ac2f149ae580d4c89aeb)]
|
|
546
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`3b284e6`](https://github.com/eea/volto-tabs-block/commit/3b284e65e0eafa9b5ad8c92b4cb77628ffcc8103)]
|
|
547
502
|
### [2.2.0](https://github.com/eea/volto-tabs-block/compare/2.1.0...2.2.0) - 25 August 2022
|
|
548
503
|
|
|
549
504
|
#### :hammer_and_wrench: Others
|
|
@@ -559,7 +514,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
559
514
|
|
|
560
515
|
- Release 2.1.0 [Alin Voinea - [`3cdfa30`](https://github.com/eea/volto-tabs-block/commit/3cdfa30d4d03d864be8ad63f0648b4717298734a)]
|
|
561
516
|
- Squashed commit of the following: [Alin Voinea - [`ca241f5`](https://github.com/eea/volto-tabs-block/commit/ca241f56a96817679a1948154e2a8cc0e17b96fe)]
|
|
562
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`68ea5a6`](https://github.com/eea/volto-tabs-block/commit/68ea5a6b971fc36840cf5716a04f68316b229b2b)]
|
|
563
517
|
### [2.0.2](https://github.com/eea/volto-tabs-block/compare/2.0.1...2.0.2) - 16 June 2022
|
|
564
518
|
|
|
565
519
|
### [2.0.1](https://github.com/eea/volto-tabs-block/compare/2.0.0...2.0.1) - 10 June 2022
|
|
@@ -603,8 +557,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
603
557
|
- Let theme addon to set default values for default template schema [Miu Razvan - [`55f148d`](https://github.com/eea/volto-tabs-block/commit/55f148d1a95417f8a0b55681ce250acde8463c1c)]
|
|
604
558
|
- Render pane as container if tabs-block has full-width class [Miu Razvan - [`bbffb96`](https://github.com/eea/volto-tabs-block/commit/bbffb96b908476ddee447af3ce79bafb1a12f9a8)]
|
|
605
559
|
- Refactor default template [Miu Razvan - [`58eff52`](https://github.com/eea/volto-tabs-block/commit/58eff5281adb08a5f8fe6d21fd43330252012277)]
|
|
606
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`72a6735`](https://github.com/eea/volto-tabs-block/commit/72a6735cbbc0e7d57b4bb7ea83fea9becc317018)]
|
|
607
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`e928da1`](https://github.com/eea/volto-tabs-block/commit/e928da1df7e4680bd4be9b5d46406800d721b8c5)]
|
|
608
560
|
### [1.2.12](https://github.com/eea/volto-tabs-block/compare/1.2.11...1.2.12) - 21 January 2022
|
|
609
561
|
|
|
610
562
|
### [1.2.11](https://github.com/eea/volto-tabs-block/compare/1.2.10...1.2.11) - 4 January 2022
|
|
@@ -617,19 +569,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
617
569
|
- more cy tests [Daniela Mormocea - [`3aff15c`](https://github.com/eea/volto-tabs-block/commit/3aff15c3cb8247beee2bf80598e2f03400b3a479)]
|
|
618
570
|
### [1.2.9](https://github.com/eea/volto-tabs-block/compare/1.2.8...1.2.9) - 18 December 2021
|
|
619
571
|
|
|
620
|
-
#### :hammer_and_wrench: Others
|
|
621
|
-
|
|
622
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`cd2e2ac`](https://github.com/eea/volto-tabs-block/commit/cd2e2ac1d127bfc688ecf16e17734603ab727a34)]
|
|
623
572
|
### [1.2.8](https://github.com/eea/volto-tabs-block/compare/1.2.7...1.2.8) - 10 December 2021
|
|
624
573
|
|
|
625
574
|
#### :hammer_and_wrench: Others
|
|
626
575
|
|
|
627
576
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d10c0b3`](https://github.com/eea/volto-tabs-block/commit/d10c0b3d35d25c530d19eebde38dfe5da8fda01b)]
|
|
628
|
-
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`1a7187f`](https://github.com/eea/volto-tabs-block/commit/1a7187f10b2bd9e1307dabf51823f63ccd766864)]
|
|
629
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`72a7550`](https://github.com/eea/volto-tabs-block/commit/72a755025b38e1d8dd7fe206273a70585e4b9ac8)]
|
|
630
|
-
- Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`022b277`](https://github.com/eea/volto-tabs-block/commit/022b2779a5d7fd7217c2d8a559eafab0bd86ce23)]
|
|
631
|
-
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`84c9bea`](https://github.com/eea/volto-tabs-block/commit/84c9bea7a0aba2fe9ef9713e7131de6da6e0bcce)]
|
|
632
|
-
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`020aa97`](https://github.com/eea/volto-tabs-block/commit/020aa97bc70a643ea3857566c5a1dc3a5200c2be)]
|
|
633
577
|
### [1.2.7](https://github.com/eea/volto-tabs-block/compare/1.2.6...1.2.7) - 27 August 2021
|
|
634
578
|
|
|
635
579
|
#### :hammer_and_wrench: Others
|
|
@@ -646,12 +590,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
646
590
|
|
|
647
591
|
- Move less import in View instead of Edit [Tiberiu Ichim - [`84aeff0`](https://github.com/eea/volto-tabs-block/commit/84aeff04a980076f54687c546691d37b6e790478)]
|
|
648
592
|
- gitignore tweaks [Tiberiu Ichim - [`f4c993d`](https://github.com/eea/volto-tabs-block/commit/f4c993d004b126f08f16651ab9460546fa9e9cad)]
|
|
649
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`865906a`](https://github.com/eea/volto-tabs-block/commit/865906a0deb261d44cc23e26bfd2d1dd0e319640)]
|
|
650
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`5383861`](https://github.com/eea/volto-tabs-block/commit/538386100adbc868e693c1c2a5ba13461307ffee)]
|
|
651
593
|
- Style update [razvanMiu - [`323aaaf`](https://github.com/eea/volto-tabs-block/commit/323aaafcad01d8fdf0e713a1fc254ae9fe319f43)]
|
|
652
594
|
- Fix 'scroll to' feature on carousel [razvanMiu - [`16c6a08`](https://github.com/eea/volto-tabs-block/commit/16c6a08f6db687542ea38e07a92b265e592f6173)]
|
|
653
595
|
- Better accesibility [razvanMiu - [`3511611`](https://github.com/eea/volto-tabs-block/commit/351161197270a4807f01d85a7055cbaadae72f8e)]
|
|
654
|
-
- Updated Jenkins dependencies [razvanMiu - [`24471fd`](https://github.com/eea/volto-tabs-block/commit/24471fd7c678d04f244b132f13b4c655838f4e94)]
|
|
655
596
|
- Add jest configuration [valentinab25 - [`c01b021`](https://github.com/eea/volto-tabs-block/commit/c01b0213bcb4b51408b6e3c196b2dcfa086377a9)]
|
|
656
597
|
### [1.2.4](https://github.com/eea/volto-tabs-block/compare/1.2.3...1.2.4) - 27 May 2021
|
|
657
598
|
|
package/README.md
CHANGED
|
@@ -133,6 +133,65 @@ See [RELEASE.md](https://github.com/eea/volto-tabs-block/blob/master/RELEASE.md)
|
|
|
133
133
|
|
|
134
134
|
See [DEVELOP.md](https://github.com/eea/volto-tabs-block/blob/master/DEVELOP.md).
|
|
135
135
|
|
|
136
|
+
## Secret Scanning
|
|
137
|
+
|
|
138
|
+
This repository uses the Betterleaks GitHub Action to scan the current
|
|
139
|
+
repository content on every push and pull request. The scan uses the rules in
|
|
140
|
+
`.gitleaks.toml` and uploads a `betterleaks-report` artifact when a finding is
|
|
141
|
+
detected.
|
|
142
|
+
|
|
143
|
+
If the optional SMTP secrets are configured, failed scans also send an email to
|
|
144
|
+
the last commit committer. The workflow expects these repository or
|
|
145
|
+
organization secrets:
|
|
146
|
+
|
|
147
|
+
- `SMTP_URL`
|
|
148
|
+
- `SMTP_PORT` (optional, defaults to `25`)
|
|
149
|
+
- `SMTP_EMAIL`
|
|
150
|
+
- `SMTP_PASSWORD` (optional if the SMTP server does not require authentication)
|
|
151
|
+
|
|
152
|
+
Port `465` is sent with direct TLS; other ports use the default SMTP handshake.
|
|
153
|
+
The email includes a short finding summary from the redacted Betterleaks report,
|
|
154
|
+
including the redacted matched line from each finding.
|
|
155
|
+
|
|
156
|
+
There are three common outcomes:
|
|
157
|
+
|
|
158
|
+
1. **Everything is OK.** The `Betterleaks / Scan for secrets` check is green and
|
|
159
|
+
no action is needed. Regular references to runtime values are OK, for example:
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
const tokenFromCookie = req.universalCookies.get('auth_token');
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
2. **A real secret was found.** The check is red and the workflow log asks you to
|
|
166
|
+
download the `betterleaks-report` artifact. Open the artifact from the GitHub
|
|
167
|
+
Actions run and check the reported file, line and rule. Remove the committed
|
|
168
|
+
value, move it to the proper secret store, and rotate it if it was exposed.
|
|
169
|
+
A report entry looks like this:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"RuleID": "secret-literal-assignment",
|
|
174
|
+
"File": "src/config.js",
|
|
175
|
+
"StartLine": 12,
|
|
176
|
+
"Secret": "[REDACTED]"
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
3. **The finding is a false positive.** Keep the value only if it is clearly not
|
|
181
|
+
sensitive, such as a test fixture, placeholder, or public example. Add
|
|
182
|
+
`betterleaks:allow` on the same line and include a short explanation in the
|
|
183
|
+
pull request.
|
|
184
|
+
|
|
185
|
+
```js
|
|
186
|
+
const testPassword = 'admin'; //betterleaks:allow
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
password: "admin" #betterleaks:allow
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Do not add `betterleaks:allow` to real credentials.
|
|
194
|
+
|
|
136
195
|
## Copyright and license
|
|
137
196
|
|
|
138
197
|
The Initial Owner of the Original Code is European Environment Agency (EEA).
|
package/RELEASE.md
CHANGED
|
@@ -33,7 +33,7 @@ Release-it is a tool that automates 4 important steps in the release process:
|
|
|
33
33
|
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
34
34
|
|
|
35
35
|
```
|
|
36
|
-
export GITHUB_TOKEN=
|
|
36
|
+
export GITHUB_TOKEN="${GITHUB_TOKEN}"
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
|
package/jest-addon.config.js
CHANGED
|
@@ -15,6 +15,7 @@ module.exports = {
|
|
|
15
15
|
'!src/**/*.d.ts',
|
|
16
16
|
],
|
|
17
17
|
moduleNameMapper: {
|
|
18
|
+
'^uuid$': '<rootDir>/src/addons/volto-tabs-block/jest.uuid.js',
|
|
18
19
|
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
19
20
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
20
21
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
package/jest.uuid.js
ADDED
package/package.json
CHANGED
package/src/components/Edit.jsx
CHANGED
|
@@ -3,7 +3,11 @@ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
|
3
3
|
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
|
|
4
4
|
import { getBlocksLayoutFieldname } from '@plone/volto/helpers/Blocks/Blocks';
|
|
5
5
|
import { TABS_BLOCK } from '@eeacms/volto-tabs-block/constants';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
empty,
|
|
8
|
+
emptyTab,
|
|
9
|
+
fillEmptyTab,
|
|
10
|
+
} from '@eeacms/volto-tabs-block/helpers';
|
|
7
11
|
import { StyleWrapperView } from '@eeacms/volto-block-style/StyleWrapper';
|
|
8
12
|
import { BlockStyleWrapperEdit } from '@eeacms/volto-block-style/BlockStyleWrapper';
|
|
9
13
|
import { getVariation } from '@eeacms/volto-tabs-block/helpers';
|
|
@@ -102,10 +106,10 @@ const Edit = (props) => {
|
|
|
102
106
|
...tabsData,
|
|
103
107
|
blocks: {
|
|
104
108
|
...tabsData.blocks,
|
|
105
|
-
[activeTab]: {
|
|
109
|
+
[activeTab]: fillEmptyTab({
|
|
106
110
|
...tabData,
|
|
107
111
|
...blocksState.current,
|
|
108
|
-
},
|
|
112
|
+
}),
|
|
109
113
|
},
|
|
110
114
|
},
|
|
111
115
|
});
|
|
@@ -219,10 +223,10 @@ const Edit = (props) => {
|
|
|
219
223
|
...tabsData,
|
|
220
224
|
blocks: {
|
|
221
225
|
...tabsData.blocks,
|
|
222
|
-
[activeTab]: {
|
|
226
|
+
[activeTab]: fillEmptyTab({
|
|
223
227
|
...tabData,
|
|
224
228
|
...newBlockData,
|
|
225
|
-
},
|
|
229
|
+
}),
|
|
226
230
|
},
|
|
227
231
|
},
|
|
228
232
|
});
|
|
@@ -25,6 +25,15 @@ jest.mock(
|
|
|
25
25
|
() => ({
|
|
26
26
|
empty: jest.fn(),
|
|
27
27
|
emptyTab: jest.fn(() => ({})),
|
|
28
|
+
fillEmptyTab: jest.fn((tab) =>
|
|
29
|
+
tab?.blocks_layout?.items?.length > 0
|
|
30
|
+
? tab
|
|
31
|
+
: {
|
|
32
|
+
...tab,
|
|
33
|
+
blocks: { filled: { '@type': 'text' } },
|
|
34
|
+
blocks_layout: { items: ['filled'] },
|
|
35
|
+
},
|
|
36
|
+
),
|
|
28
37
|
getVariation: jest.fn(() => 'default'),
|
|
29
38
|
}),
|
|
30
39
|
{ virtual: true },
|
|
@@ -78,10 +87,13 @@ jest.mock('@plone/volto/components/manage/Sidebar/SidebarPortal', () => ({
|
|
|
78
87
|
default: ({ children }) => <div>{children}</div>,
|
|
79
88
|
}));
|
|
80
89
|
|
|
90
|
+
const mockBlocksFormProps = jest.fn();
|
|
91
|
+
|
|
81
92
|
jest.mock('@plone/volto/components/manage/Blocks/Block/BlocksForm', () => ({
|
|
82
93
|
__esModule: true,
|
|
83
94
|
default: jest.fn(
|
|
84
|
-
({ multiSelected, onSelectBlock, properties, selectedBlock }) => {
|
|
95
|
+
({ multiSelected, onSelectBlock, properties, selectedBlock, ...rest }) => {
|
|
96
|
+
mockBlocksFormProps({ properties, ...rest });
|
|
85
97
|
const blockList = properties.blocks
|
|
86
98
|
? Object.entries(properties.blocks)
|
|
87
99
|
: [];
|
|
@@ -110,12 +122,21 @@ jest.mock('@plone/volto/components/manage/Blocks/Block/BlocksForm', () => ({
|
|
|
110
122
|
|
|
111
123
|
jest.mock('@plone/volto/components/manage/Form/BlocksToolbar', () => ({
|
|
112
124
|
__esModule: true,
|
|
113
|
-
default: ({ selectedBlock, selectedBlocks }) => (
|
|
125
|
+
default: ({ onChangeBlocks, selectedBlock, selectedBlocks }) => (
|
|
114
126
|
<div
|
|
115
127
|
data-testid="blocks-toolbar"
|
|
116
128
|
data-selected-block={selectedBlock || ''}
|
|
117
129
|
data-selected-blocks={(selectedBlocks || []).join(',')}
|
|
118
|
-
|
|
130
|
+
>
|
|
131
|
+
<button
|
|
132
|
+
type="button"
|
|
133
|
+
onClick={() =>
|
|
134
|
+
onChangeBlocks({ blocks: {}, blocks_layout: { items: [] } })
|
|
135
|
+
}
|
|
136
|
+
>
|
|
137
|
+
Delete all
|
|
138
|
+
</button>
|
|
139
|
+
</div>
|
|
119
140
|
),
|
|
120
141
|
}));
|
|
121
142
|
|
|
@@ -236,4 +257,52 @@ describe('Tabs Edit', () => {
|
|
|
236
257
|
'block1,block2',
|
|
237
258
|
);
|
|
238
259
|
});
|
|
260
|
+
|
|
261
|
+
const renderEdit = (onChangeBlock) =>
|
|
262
|
+
render(
|
|
263
|
+
<Provider store={store}>
|
|
264
|
+
<MemoryRouter>
|
|
265
|
+
<Edit
|
|
266
|
+
block="tabs-block"
|
|
267
|
+
data={mockData}
|
|
268
|
+
onChangeBlock={onChangeBlock}
|
|
269
|
+
onChangeField={jest.fn()}
|
|
270
|
+
selected={true}
|
|
271
|
+
setSidebarTab={jest.fn()}
|
|
272
|
+
blockNode={{ current: document.createElement('div') }}
|
|
273
|
+
/>
|
|
274
|
+
</MemoryRouter>
|
|
275
|
+
</Provider>,
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
it('adds a new block to a tab emptied from the toolbar', () => {
|
|
279
|
+
const onChangeBlock = jest.fn();
|
|
280
|
+
renderEdit(onChangeBlock);
|
|
281
|
+
onChangeBlock.mockClear();
|
|
282
|
+
|
|
283
|
+
fireEvent.click(screen.getByRole('button', { name: 'Delete all' }));
|
|
284
|
+
|
|
285
|
+
const tab = onChangeBlock.mock.calls[0][1].data.blocks.tab1;
|
|
286
|
+
expect(onChangeBlock).toHaveBeenCalledTimes(1);
|
|
287
|
+
expect(tab.title).toBe('Tab 1');
|
|
288
|
+
expect(tab.blocks_layout.items).toEqual(['filled']);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('keeps the tab title when the nested form empties it', () => {
|
|
292
|
+
const onChangeBlock = jest.fn();
|
|
293
|
+
renderEdit(onChangeBlock);
|
|
294
|
+
onChangeBlock.mockClear();
|
|
295
|
+
|
|
296
|
+
const { properties, onChangeFormData } =
|
|
297
|
+
mockBlocksFormProps.mock.calls.at(-1)[0];
|
|
298
|
+
onChangeFormData({
|
|
299
|
+
...properties,
|
|
300
|
+
blocks: {},
|
|
301
|
+
blocks_layout: { items: [] },
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
const tab = onChangeBlock.mock.calls[0][1].data.blocks.tab1;
|
|
305
|
+
expect(tab.title).toBe('Tab 1');
|
|
306
|
+
expect(tab.blocks_layout.items).toEqual(['filled']);
|
|
307
|
+
});
|
|
239
308
|
});
|
|
@@ -6,6 +6,7 @@ import cx from 'classnames';
|
|
|
6
6
|
import { Menu, Tab, Input, Container } from 'semantic-ui-react';
|
|
7
7
|
import BlocksForm from '@plone/volto/components/manage/Blocks/Block/BlocksForm';
|
|
8
8
|
import { emptyBlocksForm } from '@plone/volto/helpers/Blocks/Blocks';
|
|
9
|
+
import { fillEmptyTab } from '@eeacms/volto-tabs-block/helpers';
|
|
9
10
|
import { defaultSchemaEnhancer } from '@eeacms/volto-tabs-block/components/variations/default/schema';
|
|
10
11
|
import { AssetTab } from '@eeacms/volto-tabs-block/components';
|
|
11
12
|
import {
|
|
@@ -180,7 +181,6 @@ export const MenuItem = (props) => {
|
|
|
180
181
|
};
|
|
181
182
|
|
|
182
183
|
const Edit = (props) => {
|
|
183
|
-
const intl = useIntl();
|
|
184
184
|
const {
|
|
185
185
|
activeBlock = null,
|
|
186
186
|
activeTab = null,
|
|
@@ -195,7 +195,6 @@ const Edit = (props) => {
|
|
|
195
195
|
tabs = {},
|
|
196
196
|
tabsData = {},
|
|
197
197
|
tabsList = [],
|
|
198
|
-
emptyTab = () => {},
|
|
199
198
|
onChangeBlock = noop,
|
|
200
199
|
onChangeTabData = noop,
|
|
201
200
|
onSelectBlock = noop,
|
|
@@ -267,14 +266,7 @@ const Edit = (props) => {
|
|
|
267
266
|
...tabsData,
|
|
268
267
|
blocks: {
|
|
269
268
|
...tabsData.blocks,
|
|
270
|
-
[activeTab]:
|
|
271
|
-
...(newFormData.blocks_layout?.items.length > 0
|
|
272
|
-
? newFormData
|
|
273
|
-
: emptyTab({
|
|
274
|
-
schema: schema?.properties?.data?.schema || {},
|
|
275
|
-
intl,
|
|
276
|
-
})),
|
|
277
|
-
},
|
|
269
|
+
[activeTab]: fillEmptyTab(newFormData),
|
|
278
270
|
},
|
|
279
271
|
},
|
|
280
272
|
});
|
|
@@ -8,6 +8,7 @@ import isEmpty from 'lodash/isEmpty';
|
|
|
8
8
|
import cx from 'classnames';
|
|
9
9
|
import { Menu, Tab, Container, Dropdown, Input } from 'semantic-ui-react';
|
|
10
10
|
import { emptyBlocksForm } from '@plone/volto/helpers/Blocks/Blocks';
|
|
11
|
+
import { fillEmptyTab } from '@eeacms/volto-tabs-block/helpers';
|
|
11
12
|
import BlocksForm from '@plone/volto/components/manage/Blocks/Block/BlocksForm';
|
|
12
13
|
import { defaultSchemaEnhancer } from '@eeacms/volto-tabs-block/components/variations/default/schema';
|
|
13
14
|
import {
|
|
@@ -282,7 +283,6 @@ const MenuWrapper = (props) => {
|
|
|
282
283
|
};
|
|
283
284
|
|
|
284
285
|
const Edit = (props) => {
|
|
285
|
-
const intl = useIntl();
|
|
286
286
|
const {
|
|
287
287
|
metadata = {},
|
|
288
288
|
data = {},
|
|
@@ -296,7 +296,6 @@ const Edit = (props) => {
|
|
|
296
296
|
activeBlock = null,
|
|
297
297
|
screen,
|
|
298
298
|
tabsData = {},
|
|
299
|
-
emptyTab = () => {},
|
|
300
299
|
onChangeBlock = noop,
|
|
301
300
|
onChangeTabData = noop,
|
|
302
301
|
onSelectBlock = noop,
|
|
@@ -370,14 +369,7 @@ const Edit = (props) => {
|
|
|
370
369
|
...tabsData,
|
|
371
370
|
blocks: {
|
|
372
371
|
...tabsData.blocks,
|
|
373
|
-
[activeTab]:
|
|
374
|
-
...(newFormData.blocks_layout.items.length > 0
|
|
375
|
-
? newFormData
|
|
376
|
-
: emptyTab({
|
|
377
|
-
schema: schema.properties.data.schema,
|
|
378
|
-
intl,
|
|
379
|
-
})),
|
|
380
|
-
},
|
|
372
|
+
[activeTab]: fillEmptyTab(newFormData),
|
|
381
373
|
},
|
|
382
374
|
},
|
|
383
375
|
});
|
package/src/helpers.js
CHANGED
|
@@ -40,6 +40,14 @@ export const empty = ({ schema, intl }) => {
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
// Fill an emptied tab right away, keeping its own fields (title, settings).
|
|
44
|
+
// Otherwise the tab is left with no block to type in, and filling it later
|
|
45
|
+
// would add an undo history entry that every undo lands on and refills.
|
|
46
|
+
export const fillEmptyTab = (tab) =>
|
|
47
|
+
tab?.blocks_layout?.items?.length > 0
|
|
48
|
+
? tab
|
|
49
|
+
: { ...tab, ...emptyBlocksForm() };
|
|
50
|
+
|
|
43
51
|
export const emptyTab = ({ schema, intl }) => {
|
|
44
52
|
const data = {
|
|
45
53
|
'@type': 'tab',
|
package/src/helpers.test.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
empty,
|
|
3
3
|
emptyTab,
|
|
4
|
+
fillEmptyTab,
|
|
4
5
|
scrollToTarget,
|
|
5
6
|
getParentTabFromHash,
|
|
6
7
|
isTabEmpty,
|
|
@@ -136,3 +137,23 @@ describe('getParentTabFromHash function', () => {
|
|
|
136
137
|
expect(result).toEqual(null);
|
|
137
138
|
});
|
|
138
139
|
});
|
|
140
|
+
|
|
141
|
+
describe('fillEmptyTab function', () => {
|
|
142
|
+
it('fills an emptied tab and keeps its title', () => {
|
|
143
|
+
const result = fillEmptyTab({
|
|
144
|
+
'@type': 'tab',
|
|
145
|
+
title: 'Tab 1',
|
|
146
|
+
blocks: {},
|
|
147
|
+
blocks_layout: { items: [] },
|
|
148
|
+
});
|
|
149
|
+
expect(result.title).toBe('Tab 1');
|
|
150
|
+
expect(result['@type']).toBe('tab');
|
|
151
|
+
expect(result.blocks_layout.items).toHaveLength(1);
|
|
152
|
+
expect(Object.keys(result.blocks)).toEqual(result.blocks_layout.items);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('returns a tab with blocks unchanged', () => {
|
|
156
|
+
const tab = { blocks: { a: {} }, blocks_layout: { items: ['a'] } };
|
|
157
|
+
expect(fillEmptyTab(tab)).toBe(tab);
|
|
158
|
+
});
|
|
159
|
+
});
|