@eeacms/volto-tabs-block 10.0.0 → 10.0.2

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/.eslintrc.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const { AddonRegistry } = require('@plone/registry/addon-registry');
3
4
  const projectRootPath = fs.realpathSync(__dirname + '/../../../');
4
5
 
5
6
  let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
@@ -16,41 +17,16 @@ if (configFile) {
16
17
  voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
17
18
  }
18
19
 
19
- const registryDistPath = path.join(
20
- projectRootPath,
21
- 'node_modules/@plone/registry/dist/addon-registry/addon-registry.cjs',
22
- );
23
- const registrySrcPath = path.join(
24
- projectRootPath,
25
- 'node_modules/@plone/registry/src/addon-registry',
26
- );
27
-
28
- let AddonConfigurationRegistry;
29
- if (fs.existsSync(registryDistPath)) {
30
- AddonConfigurationRegistry = require(registryDistPath).AddonRegistry;
31
- } else if (
32
- fs.existsSync(registrySrcPath) ||
33
- fs.existsSync(`${registrySrcPath}.js`)
34
- ) {
35
- AddonConfigurationRegistry = require(registrySrcPath);
36
- } else {
37
- AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
38
- }
39
-
40
- const reg = new AddonConfigurationRegistry(projectRootPath);
20
+ const { registry } = AddonRegistry.init(projectRootPath);
41
21
 
42
22
  // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
43
- const addonAliases = Object.keys(reg.packages).map((o) => [
23
+ const addonAliases = Object.keys(registry.packages).map((o) => [
44
24
  o,
45
- reg.packages[o].modulePath,
25
+ registry.packages[o].modulePath,
46
26
  ]);
47
27
 
48
- const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
49
- const voltoSlatePath = fs.existsSync(
50
- path.join(projectRootPath, 'node_modules/@plone/volto-slate/src'),
51
- )
52
- ? '@plone/volto-slate/src'
53
- : '@plone/volto/packages/volto-slate/src';
28
+ const addonExtenders = registry.getEslintExtenders().map((m) => require(m));
29
+ const voltoSlatePath = '@plone/volto-slate/src';
54
30
 
55
31
  const defaultConfig = {
56
32
  extends: `${voltoPath}/.eslintrc`,
package/CHANGELOG.md CHANGED
@@ -4,7 +4,18 @@ 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.0](https://github.com/eea/volto-tabs-block/compare/9.1.0...10.0.0) - 27 March 2026
7
+ ### [10.0.2](https://github.com/eea/volto-tabs-block/compare/10.0.1...10.0.2) - 21 April 2026
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix(tabs): deep‑clone blocks on copy/paste, ref #302532 [Miu Razvan - [`275bcb2`](https://github.com/eea/volto-tabs-block/commit/275bcb229faf7eeb02271d3e34e003607a48d496)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - add tests for cloneData [Miu Razvan - [`8db3bac`](https://github.com/eea/volto-tabs-block/commit/8db3bac901d0a98e72bcd401e811f5b67c6c5bff)]
16
+ ### [10.0.1](https://github.com/eea/volto-tabs-block/compare/10.0.0...10.0.1) - 9 April 2026
17
+
18
+ ## [10.0.0](https://github.com/eea/volto-tabs-block/compare/9.1.0...10.0.0) - 27 March 2026
8
19
 
9
20
  #### :rocket: New Features
10
21
 
@@ -12,9 +23,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
12
23
 
13
24
  #### :house: Internal changes
14
25
 
26
+ - chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`1e18835`](https://github.com/eea/volto-tabs-block/commit/1e18835ff2d59579de5dc9bb8ec6056a90dd7f77)]
27
+ - chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`1b14a57`](https://github.com/eea/volto-tabs-block/commit/1b14a57d39aa4685294068fff78275a1f6248964)]
15
28
 
16
29
  #### :hammer_and_wrench: Others
17
30
 
31
+ - Release 10.0.0: Volto 18 support [Alin Voinea - [`3f509ae`](https://github.com/eea/volto-tabs-block/commit/3f509aed7cff2e43d4d50f64bf24b6244602fd95)]
18
32
  - test: Fix make test [Alin V. (Claudiu) - [`c29c5bc`](https://github.com/eea/volto-tabs-block/commit/c29c5bcc5f0e24ce636dc12c87a8579eb93bd56d)]
19
33
  - tests: Fix Sonar Qube tags - refs #297339 [Alin Voinea - [`89ca2ae`](https://github.com/eea/volto-tabs-block/commit/89ca2ae4bc3821bed8012188e94930ae4457accf)]
20
34
  ### [9.1.0](https://github.com/eea/volto-tabs-block/compare/9.0.3...9.1.0) - 24 July 2025
@@ -22,6 +36,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
22
36
  #### :hammer_and_wrench: Others
23
37
 
24
38
  - Release 9.1.0 [Alin Voinea - [`4396e37`](https://github.com/eea/volto-tabs-block/commit/4396e3740694d99cbb66414783c3fbbef7ed2022)]
39
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`20aaf70`](https://github.com/eea/volto-tabs-block/commit/20aaf70fec13c977a805caeec043457867e62c36)]
40
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`d516041`](https://github.com/eea/volto-tabs-block/commit/d516041244ee793504833b38033e75df20a8fa13)]
41
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ae5b123`](https://github.com/eea/volto-tabs-block/commit/ae5b123036ab3ec9d225228206016d78ab6dcaa4)]
42
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`74fb410`](https://github.com/eea/volto-tabs-block/commit/74fb410ec9e3657e55fc5ea35c6717a737ddc375)]
25
43
  ### [9.0.3](https://github.com/eea/volto-tabs-block/compare/9.0.2...9.0.3) - 7 May 2025
26
44
 
27
45
  #### :bug: Bug Fixes
@@ -30,6 +48,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
30
48
 
31
49
  #### :hammer_and_wrench: Others
32
50
 
51
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`01b5632`](https://github.com/eea/volto-tabs-block/commit/01b563271bd04f4329d9f876278324b970443413)]
52
+ - Add Sonarqube tag using ied-frontend addons list [EEA Jenkins - [`d457e25`](https://github.com/eea/volto-tabs-block/commit/d457e25d8a97b080eb8eb32ae4b85db530049e96)]
33
53
  ### [9.0.2](https://github.com/eea/volto-tabs-block/compare/9.0.1...9.0.2) - 27 January 2025
34
54
 
35
55
  #### :house: Internal changes
@@ -80,6 +100,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
80
100
 
81
101
  #### :hammer_and_wrench: Others
82
102
 
103
+ - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`cb58ea7`](https://github.com/eea/volto-tabs-block/commit/cb58ea7417e8dd237b66908fd53f1f3ca8726566)]
104
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`4377ffc`](https://github.com/eea/volto-tabs-block/commit/4377ffc350a92f62cbe77b17b67dd331c71cbcd7)]
83
105
  ### [7.5.1](https://github.com/eea/volto-tabs-block/compare/7.5.0...7.5.1) - 28 March 2024
84
106
 
85
107
  #### :nail_care: Enhancements
@@ -122,6 +144,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
122
144
  - Update react-slick version to 0.30.1 [David Ichim - [`3369176`](https://github.com/eea/volto-tabs-block/commit/33691768899e7f91d2cd15319dbe3ebe66cf1513)]
123
145
  - update [Razvan - [`61b19e8`](https://github.com/eea/volto-tabs-block/commit/61b19e8584ff6023320b3671414392ea11449ff0)]
124
146
  - use DefaultEdit variation for responsive accordion, refs #266327 [Razvan - [`11acf6c`](https://github.com/eea/volto-tabs-block/commit/11acf6ce5afe022ddd30bff42c9a3321d1284da6)]
147
+ - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`5045757`](https://github.com/eea/volto-tabs-block/commit/5045757a275477ba382551b301998d835741b716)]
125
148
  ### [7.0.5](https://github.com/eea/volto-tabs-block/compare/7.0.4...7.0.5) - 10 December 2023
126
149
 
127
150
  #### :rocket: New Features
@@ -153,6 +176,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
153
176
 
154
177
  #### :hammer_and_wrench: Others
155
178
 
179
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`3b87d12`](https://github.com/eea/volto-tabs-block/commit/3b87d12df4d01031231b15eb4196f6ff6937706b)]
180
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`f5f3430`](https://github.com/eea/volto-tabs-block/commit/f5f343024b45bb0206e0169cce6dd0e8472b6795)]
156
181
  ### [7.0.1](https://github.com/eea/volto-tabs-block/compare/7.0.0...7.0.1) - 9 November 2023
157
182
 
158
183
  #### :bug: Bug Fixes
@@ -162,10 +187,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
162
187
 
163
188
  #### :hammer_and_wrench: Others
164
189
 
190
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`bd6ffd4`](https://github.com/eea/volto-tabs-block/commit/bd6ffd42a00a2d77ff59545d9adaab7a45361446)]
191
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`d481e25`](https://github.com/eea/volto-tabs-block/commit/d481e25c4d61d7ff6ea11ff75c99fbdd730ecd82)]
192
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`6c39efc`](https://github.com/eea/volto-tabs-block/commit/6c39efcc30bddfebb6c61f8a8cd714f61828ec69)]
165
193
  ## [7.0.0](https://github.com/eea/volto-tabs-block/compare/6.0.3...7.0.0) - 31 October 2023
166
194
 
167
195
  #### :house: Internal changes
168
196
 
197
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`f2e3d39`](https://github.com/eea/volto-tabs-block/commit/f2e3d3973c026f0331b82e0f691ec9bdc5899672)]
169
198
 
170
199
  #### :hammer_and_wrench: Others
171
200
 
@@ -378,6 +407,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
378
407
 
379
408
  #### :house: Internal changes
380
409
 
410
+ - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`820aaa9`](https://github.com/eea/volto-tabs-block/commit/820aaa963e978a893a23b77f694bb011f3d768c1)]
381
411
 
382
412
  #### :hammer_and_wrench: Others
383
413
 
@@ -468,6 +498,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
468
498
 
469
499
  #### :hammer_and_wrench: Others
470
500
 
501
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`52bc1b0`](https://github.com/eea/volto-tabs-block/commit/52bc1b0fbd4611173b8ca9dc2cf4033b31474420)]
471
502
  ## [4.0.0](https://github.com/eea/volto-tabs-block/compare/3.0.1...4.0.0) - 10 March 2023
472
503
 
473
504
  #### :house: Internal changes
@@ -478,7 +509,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
478
509
  #### :hammer_and_wrench: Others
479
510
 
480
511
  - Release 4.0.0 [Alin Voinea - [`8fc4cc9`](https://github.com/eea/volto-tabs-block/commit/8fc4cc9d8dc71e623e6586b95871cb3b98dc385f)]
512
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`22d5bdc`](https://github.com/eea/volto-tabs-block/commit/22d5bdc1b3579cc46c73ce855041ca09154eb502)]
513
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`fde4324`](https://github.com/eea/volto-tabs-block/commit/fde4324f962cde8e8de0d76a44bee4b67d216bf8)]
514
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9175e47`](https://github.com/eea/volto-tabs-block/commit/9175e470d793edc63b62a99940aed25dd45f3713)]
481
515
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`3348950`](https://github.com/eea/volto-tabs-block/commit/334895036f8e367281abb35a20879c32dfbfc292)]
516
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`39bfb39`](https://github.com/eea/volto-tabs-block/commit/39bfb39fa6e8483e639491ff998293e758ac6384)]
517
+ - yarn 3 [Alin Voinea - [`7e98df5`](https://github.com/eea/volto-tabs-block/commit/7e98df59669d71945be461e86e282b913538b805)]
518
+ - Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`079d7a4`](https://github.com/eea/volto-tabs-block/commit/079d7a43480e92fe280a9372399ff2d4d28537ae)]
482
519
  ### [3.0.1](https://github.com/eea/volto-tabs-block/compare/3.0.0...3.0.1) - 16 November 2022
483
520
 
484
521
  #### :hammer_and_wrench: Others
@@ -502,7 +539,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
502
539
 
503
540
  #### :hammer_and_wrench: Others
504
541
 
542
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`a00e419`](https://github.com/eea/volto-tabs-block/commit/a00e419aef4c82a25f277f5e25e3d512c7838264)]
505
543
  - lint fix [David Ichim - [`c0a898c`](https://github.com/eea/volto-tabs-block/commit/c0a898c54461478baed2ac2f149ae580d4c89aeb)]
544
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`3b284e6`](https://github.com/eea/volto-tabs-block/commit/3b284e65e0eafa9b5ad8c92b4cb77628ffcc8103)]
506
545
  ### [2.2.0](https://github.com/eea/volto-tabs-block/compare/2.1.0...2.2.0) - 25 August 2022
507
546
 
508
547
  #### :hammer_and_wrench: Others
@@ -518,6 +557,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
518
557
 
519
558
  - Release 2.1.0 [Alin Voinea - [`3cdfa30`](https://github.com/eea/volto-tabs-block/commit/3cdfa30d4d03d864be8ad63f0648b4717298734a)]
520
559
  - Squashed commit of the following: [Alin Voinea - [`ca241f5`](https://github.com/eea/volto-tabs-block/commit/ca241f56a96817679a1948154e2a8cc0e17b96fe)]
560
+ - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`68ea5a6`](https://github.com/eea/volto-tabs-block/commit/68ea5a6b971fc36840cf5716a04f68316b229b2b)]
521
561
  ### [2.0.2](https://github.com/eea/volto-tabs-block/compare/2.0.1...2.0.2) - 16 June 2022
522
562
 
523
563
  ### [2.0.1](https://github.com/eea/volto-tabs-block/compare/2.0.0...2.0.1) - 10 June 2022
@@ -561,6 +601,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
561
601
  - Let theme addon to set default values for default template schema [Miu Razvan - [`55f148d`](https://github.com/eea/volto-tabs-block/commit/55f148d1a95417f8a0b55681ce250acde8463c1c)]
562
602
  - Render pane as container if tabs-block has full-width class [Miu Razvan - [`bbffb96`](https://github.com/eea/volto-tabs-block/commit/bbffb96b908476ddee447af3ce79bafb1a12f9a8)]
563
603
  - Refactor default template [Miu Razvan - [`58eff52`](https://github.com/eea/volto-tabs-block/commit/58eff5281adb08a5f8fe6d21fd43330252012277)]
604
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`72a6735`](https://github.com/eea/volto-tabs-block/commit/72a6735cbbc0e7d57b4bb7ea83fea9becc317018)]
605
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`e928da1`](https://github.com/eea/volto-tabs-block/commit/e928da1df7e4680bd4be9b5d46406800d721b8c5)]
564
606
  ### [1.2.12](https://github.com/eea/volto-tabs-block/compare/1.2.11...1.2.12) - 21 January 2022
565
607
 
566
608
  ### [1.2.11](https://github.com/eea/volto-tabs-block/compare/1.2.10...1.2.11) - 4 January 2022
@@ -575,11 +617,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
575
617
 
576
618
  #### :hammer_and_wrench: Others
577
619
 
620
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`cd2e2ac`](https://github.com/eea/volto-tabs-block/commit/cd2e2ac1d127bfc688ecf16e17734603ab727a34)]
578
621
  ### [1.2.8](https://github.com/eea/volto-tabs-block/compare/1.2.7...1.2.8) - 10 December 2021
579
622
 
580
623
  #### :hammer_and_wrench: Others
581
624
 
582
625
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d10c0b3`](https://github.com/eea/volto-tabs-block/commit/d10c0b3d35d25c530d19eebde38dfe5da8fda01b)]
626
+ - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`1a7187f`](https://github.com/eea/volto-tabs-block/commit/1a7187f10b2bd9e1307dabf51823f63ccd766864)]
627
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`72a7550`](https://github.com/eea/volto-tabs-block/commit/72a755025b38e1d8dd7fe206273a70585e4b9ac8)]
628
+ - Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`022b277`](https://github.com/eea/volto-tabs-block/commit/022b2779a5d7fd7217c2d8a559eafab0bd86ce23)]
629
+ - Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`84c9bea`](https://github.com/eea/volto-tabs-block/commit/84c9bea7a0aba2fe9ef9713e7131de6da6e0bcce)]
630
+ - Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`020aa97`](https://github.com/eea/volto-tabs-block/commit/020aa97bc70a643ea3857566c5a1dc3a5200c2be)]
583
631
  ### [1.2.7](https://github.com/eea/volto-tabs-block/compare/1.2.6...1.2.7) - 27 August 2021
584
632
 
585
633
  #### :hammer_and_wrench: Others
@@ -596,6 +644,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
596
644
 
597
645
  - Move less import in View instead of Edit [Tiberiu Ichim - [`84aeff0`](https://github.com/eea/volto-tabs-block/commit/84aeff04a980076f54687c546691d37b6e790478)]
598
646
  - gitignore tweaks [Tiberiu Ichim - [`f4c993d`](https://github.com/eea/volto-tabs-block/commit/f4c993d004b126f08f16651ab9460546fa9e9cad)]
647
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`865906a`](https://github.com/eea/volto-tabs-block/commit/865906a0deb261d44cc23e26bfd2d1dd0e319640)]
648
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`5383861`](https://github.com/eea/volto-tabs-block/commit/538386100adbc868e693c1c2a5ba13461307ffee)]
599
649
  - Style update [razvanMiu - [`323aaaf`](https://github.com/eea/volto-tabs-block/commit/323aaafcad01d8fdf0e713a1fc254ae9fe319f43)]
600
650
  - Fix 'scroll to' feature on carousel [razvanMiu - [`16c6a08`](https://github.com/eea/volto-tabs-block/commit/16c6a08f6db687542ea38e07a92b265e592f6173)]
601
651
  - Better accesibility [razvanMiu - [`3511611`](https://github.com/eea/volto-tabs-block/commit/351161197270a4807f01d85a7055cbaadae72f8e)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tabs-block",
3
- "version": "10.0.0",
3
+ "version": "10.0.2",
4
4
  "description": "volto-tabs-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,19 +1,17 @@
1
- import React from 'react';
2
- import { without } from 'lodash';
3
- import cx from 'classnames';
4
- import config from '@plone/volto/registry';
5
- import {
6
- SidebarPortal,
7
- BlocksToolbar,
8
- BlockDataForm,
9
- } from '@plone/volto/components';
10
- import { getBlocksLayoutFieldname } from '@plone/volto/helpers';
1
+ import BlocksToolbar from '@plone/volto/components/manage/Form/BlocksToolbar';
2
+ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
3
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
+ import { getBlocksLayoutFieldname } from '@plone/volto/helpers/Blocks/Blocks';
11
5
  import { TABS_BLOCK } from '@eeacms/volto-tabs-block/constants';
12
6
  import { empty, emptyTab } from '@eeacms/volto-tabs-block/helpers';
13
7
  import { StyleWrapperView } from '@eeacms/volto-block-style/StyleWrapper';
14
8
  import { BlockStyleWrapperEdit } from '@eeacms/volto-block-style/BlockStyleWrapper';
15
9
  import { getVariation } from '@eeacms/volto-tabs-block/helpers';
16
10
  import { DefaultEdit } from './variations/default';
11
+ import config from '@plone/volto/registry';
12
+ import cx from 'classnames';
13
+ import without from 'lodash/without';
14
+ import React from 'react';
17
15
  import { useIntl } from 'react-intl';
18
16
 
19
17
  import '@eeacms/volto-tabs-block/less/edit.less';
@@ -6,7 +6,7 @@ import { Provider } from 'react-intl-redux';
6
6
  import { MemoryRouter } from 'react-router-dom';
7
7
  import config from '@plone/volto/registry';
8
8
  import Edit from './Edit';
9
- import { TABS_BLOCK } from '../constants';
9
+ import { TABS_BLOCK } from '@eeacms/volto-tabs-block/constants';
10
10
 
11
11
  jest.mock('uuid', () => ({
12
12
  v4: () => 'test-uuid-1234',
@@ -73,8 +73,14 @@ jest.mock('./variations/default', () => ({
73
73
  DefaultEdit: jest.requireActual('./variations/default/Edit').default,
74
74
  }));
75
75
 
76
- jest.mock('@plone/volto/components', () => ({
77
- BlocksForm: jest.fn(
76
+ jest.mock('@plone/volto/components/manage/Sidebar/SidebarPortal', () => ({
77
+ __esModule: true,
78
+ default: ({ children }) => <div>{children}</div>,
79
+ }));
80
+
81
+ jest.mock('@plone/volto/components/manage/Blocks/Block/BlocksForm', () => ({
82
+ __esModule: true,
83
+ default: jest.fn(
78
84
  ({ multiSelected, onSelectBlock, properties, selectedBlock }) => {
79
85
  const blockList = properties.blocks
80
86
  ? Object.entries(properties.blocks)
@@ -100,15 +106,22 @@ jest.mock('@plone/volto/components', () => ({
100
106
  );
101
107
  },
102
108
  ),
103
- SidebarPortal: ({ children }) => <div>{children}</div>,
104
- BlocksToolbar: ({ selectedBlock, selectedBlocks }) => (
109
+ }));
110
+
111
+ jest.mock('@plone/volto/components/manage/Form/BlocksToolbar', () => ({
112
+ __esModule: true,
113
+ default: ({ selectedBlock, selectedBlocks }) => (
105
114
  <div
106
115
  data-testid="blocks-toolbar"
107
116
  data-selected-block={selectedBlock || ''}
108
117
  data-selected-blocks={(selectedBlocks || []).join(',')}
109
118
  />
110
119
  ),
111
- BlockDataForm: () => <div>BlockDataForm</div>,
120
+ }));
121
+
122
+ jest.mock('@plone/volto/components/manage/Form/BlockDataForm', () => ({
123
+ __esModule: true,
124
+ default: () => <div>BlockDataForm</div>,
112
125
  }));
113
126
 
114
127
  jest.mock(
@@ -1,4 +1,4 @@
1
- import { TABS_BLOCK } from '../constants';
1
+ import { TABS_BLOCK } from '@eeacms/volto-tabs-block/constants';
2
2
 
3
3
  const blocksArray = (config) => {
4
4
  const choices = Object.keys(config.blocks.blocksConfig)
@@ -6,8 +6,8 @@ import cx from 'classnames';
6
6
  import noop from 'lodash/noop';
7
7
 
8
8
  import { Icon } from 'semantic-ui-react';
9
- import { Icon as VoltoIcon } from '@plone/volto/components';
10
- import { RenderBlocks } from '@plone/volto/components';
9
+ import VoltoIcon from '@plone/volto/components/theme/Icon/Icon';
10
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
11
11
  import config from '@plone/volto/registry';
12
12
 
13
13
  import Tabs from 'react-responsive-tabs';
@@ -17,7 +17,7 @@ import { getParentTabFromHash } from '@eeacms/volto-tabs-block/helpers';
17
17
  import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
18
18
 
19
19
  import '@eeacms/volto-tabs-block/less/menu.less';
20
- import { getVariation } from '../../../helpers';
20
+ import { getVariation } from '@eeacms/volto-tabs-block/helpers';
21
21
 
22
22
  class Tab extends React.Component {
23
23
  render() {
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import { withRouter } from 'react-router';
3
3
  import loadable from '@loadable/component';
4
4
  import cx from 'classnames';
5
- import { Icon, RenderBlocks } from '@plone/volto/components';
5
+ import Icon from '@plone/volto/components/theme/Icon/Icon';
6
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
6
7
 
7
8
  import rightArrowSVG from '@eeacms/volto-tabs-block/icons/right-key.svg';
8
9
  import leftArrowSVG from '@eeacms/volto-tabs-block/icons/left-key.svg';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { withRouter } from 'react-router';
3
3
  import loadable from '@loadable/component';
4
4
  import cx from 'classnames';
5
- import { RenderBlocks } from '@plone/volto/components';
5
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
6
6
  import 'slick-carousel/slick/slick.css';
7
7
  import 'slick-carousel/slick/slick-theme.css';
8
8
  import '@eeacms/volto-tabs-block/less/carousel.less';
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl';
3
- import { isEmpty } from 'lodash';
3
+ import isEmpty from 'lodash/isEmpty';
4
4
  import { v4 as uuid } from 'uuid';
5
5
  import cx from 'classnames';
6
6
  import { Menu, Tab, Input, Container } from 'semantic-ui-react';
7
- import { BlocksForm } from '@plone/volto/components';
8
- import { emptyBlocksForm } from '@plone/volto/helpers';
7
+ import BlocksForm from '@plone/volto/components/manage/Blocks/Block/BlocksForm';
8
+ import { emptyBlocksForm } from '@plone/volto/helpers/Blocks/Blocks';
9
9
  import { defaultSchemaEnhancer } from '@eeacms/volto-tabs-block/components/variations/default/schema';
10
10
  import { AssetTab } from '@eeacms/volto-tabs-block/components';
11
11
  import {
@@ -3,14 +3,14 @@ import { compose } from 'redux';
3
3
  import { withRouter } from 'react-router';
4
4
  import cx from 'classnames';
5
5
  import { Menu, Tab, Container, Icon, Image } from 'semantic-ui-react';
6
- import { RenderBlocks } from '@plone/volto/components';
6
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
7
7
  import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
8
8
  import {
9
9
  SimpleMarkdown,
10
10
  getMenuPosition,
11
11
  } from '@eeacms/volto-tabs-block/utils';
12
12
 
13
- import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
13
+ import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers/Url/Url';
14
14
 
15
15
  import '@eeacms/volto-tabs-block/less/menu.less';
16
16
 
@@ -4,11 +4,11 @@ import { compose } from 'redux';
4
4
  import { useIntl } from 'react-intl';
5
5
  import { withRouter } from 'react-router';
6
6
  import { v4 as uuid } from 'uuid';
7
- import { isEmpty } from 'lodash';
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
- import { emptyBlocksForm } from '@plone/volto/helpers';
11
- import { BlocksForm } from '@plone/volto/components';
10
+ import { emptyBlocksForm } from '@plone/volto/helpers/Blocks/Blocks';
11
+ import BlocksForm from '@plone/volto/components/manage/Blocks/Block/BlocksForm';
12
12
  import { defaultSchemaEnhancer } from '@eeacms/volto-tabs-block/components/variations/default/schema';
13
13
  import {
14
14
  SimpleMarkdown,
@@ -4,7 +4,7 @@ import { compose } from 'redux';
4
4
  import { withRouter } from 'react-router';
5
5
  import cx from 'classnames';
6
6
  import { Menu, Tab, Container, Dropdown, Button } from 'semantic-ui-react';
7
- import { RenderBlocks } from '@plone/volto/components';
7
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
8
8
  import {
9
9
  SimpleMarkdown,
10
10
  getMenuPosition,
package/src/helpers.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  getBlocksFieldname,
6
6
  getBlocksLayoutFieldname,
7
7
  blockHasValue,
8
- } from '@plone/volto/helpers';
8
+ } from '@plone/volto/helpers/Blocks/Blocks';
9
9
  import { visitBlocks, toSlug } from '@eeacms/volto-anchors/helpers';
10
10
 
11
11
  const variationsMapping = {
package/src/index.js CHANGED
@@ -21,6 +21,7 @@ import { TabsWidget } from './widgets';
21
21
  import tabsSVG from '@eeacms/volto-tabs-block//icons/tabs.svg';
22
22
  import rightSVG from '@plone/volto/icons/right-key.svg';
23
23
  import downSVG from '@plone/volto/icons/down-key.svg';
24
+ import { cloneData } from './utils';
24
25
 
25
26
  defineMessages({
26
27
  default: {
@@ -55,6 +56,7 @@ const applyConfig = (config) => {
55
56
  view: TabsView,
56
57
  restricted: false,
57
58
  mostUsed: false,
59
+ cloneData,
58
60
  sidebarTab: 1,
59
61
  security: {
60
62
  addPermission: [],
@@ -0,0 +1,51 @@
1
+ import { v4 as uuid } from 'uuid';
2
+ import {
3
+ getBlocksFieldname,
4
+ getBlocksLayoutFieldname,
5
+ getBlocks,
6
+ hasBlocksData,
7
+ } from '@plone/volto/helpers/Blocks/Blocks';
8
+ import config from '@plone/volto/registry';
9
+
10
+ /* Inline deep‑clone helpers – used only by the Tabs block */
11
+ function deepCloneFormData(formData) {
12
+ const blocksField = getBlocksFieldname(formData);
13
+ const layoutField = getBlocksLayoutFieldname(formData);
14
+ const childBlocks = getBlocks(formData);
15
+
16
+ const cloned = childBlocks
17
+ .map(([_, child]) => {
18
+ const childCfg = config.blocks.blocksConfig[child['@type']] || {};
19
+ if (childCfg.cloneData) {
20
+ return childCfg.cloneData(child);
21
+ }
22
+ return hasBlocksData(child) ? deepCloneFormData(child) : [uuid(), child];
23
+ })
24
+ .filter(Boolean);
25
+
26
+ const newData = {
27
+ ...formData,
28
+ [blocksField]: {
29
+ ...Object.fromEntries(cloned.map(([newId, data]) => [newId, data])),
30
+ },
31
+ [layoutField]: {
32
+ items: cloned.map(([newId]) => newId),
33
+ },
34
+ };
35
+
36
+ // Return a fresh UUID for the *parent* block and its cloned content
37
+ return [uuid(), newData];
38
+ }
39
+
40
+ export function cloneData(blockData) {
41
+ const tabsData = blockData.data;
42
+ const cloneWithIds = deepCloneFormData(tabsData);
43
+ const [id, newBlockData] = cloneWithIds;
44
+ return [
45
+ id,
46
+ {
47
+ ...blockData,
48
+ data: newBlockData,
49
+ },
50
+ ];
51
+ }
@@ -0,0 +1,113 @@
1
+ import { v4 as uuid } from 'uuid';
2
+ import { getBlocks } from '@plone/volto/helpers/Blocks/Blocks';
3
+ import config from '@plone/volto/registry';
4
+ import { cloneData } from './cloneData';
5
+
6
+ jest.mock('@plone/volto/helpers/Blocks/Blocks', () => ({
7
+ getBlocks: jest.fn(),
8
+ getBlocksFieldname: jest.fn(() => 'blocks'),
9
+ getBlocksLayoutFieldname: jest.fn(() => 'blocks_layout'),
10
+ hasBlocksData: jest.fn((block) => !!block.blocks),
11
+ }));
12
+
13
+ describe('cloneData', () => {
14
+ it('should clone the blockData with calling cloneData directly', () => {
15
+ const blockId = uuid();
16
+ const mockBlockData = {
17
+ data: {
18
+ '@type': 'tabs',
19
+ blocks: {
20
+ [blockId]: {
21
+ '@type': 'test',
22
+ },
23
+ },
24
+ blocks_layout: {
25
+ items: [blockId],
26
+ },
27
+ },
28
+ };
29
+
30
+ getBlocks.mockReturnValue([[blockId, mockBlockData.data.blocks[blockId]]]);
31
+
32
+ const [id, clonedBlockData] = cloneData(mockBlockData);
33
+ const clonedBlockId = clonedBlockData.data.blocks_layout.items[0];
34
+ const clonedBlock = clonedBlockData.data.blocks[clonedBlockId];
35
+ expect(clonedBlock).toBeDefined();
36
+ expect(clonedBlockId).not.toEqual(blockId);
37
+ expect(clonedBlock).toEqual(mockBlockData.data.blocks[blockId]);
38
+ expect(id).not.toBeNull();
39
+ });
40
+
41
+ it('should clone the blockData with calling cloneData from block config', () => {
42
+ const blockId = uuid();
43
+ const mockBlockData = {
44
+ data: {
45
+ '@type': 'tabs',
46
+ blocks: {
47
+ [blockId]: {
48
+ '@type': 'test',
49
+ blocks: {},
50
+ },
51
+ },
52
+ blocks_layout: {
53
+ items: [blockId],
54
+ },
55
+ },
56
+ };
57
+
58
+ getBlocks.mockReturnValue([[blockId, mockBlockData.data.blocks[blockId]]]);
59
+
60
+ config.blocks.blocksConfig = {
61
+ test: {
62
+ cloneData: jest.fn(() => [
63
+ 'test_uuid',
64
+ mockBlockData.data.blocks[blockId],
65
+ ]),
66
+ },
67
+ };
68
+ const [id, clonedBlockData] = cloneData(mockBlockData);
69
+ expect(id).not.toEqual('test_uuid');
70
+ expect(clonedBlockData.data.blocks['test_uuid']).toEqual(
71
+ mockBlockData.data.blocks[blockId],
72
+ );
73
+ });
74
+
75
+ it('should recursively clone nested blocks', () => {
76
+ const outerBlockId = uuid();
77
+ const innerBlockId = uuid();
78
+ const innerBlock = {
79
+ '@type': 'inner',
80
+ blocks: {
81
+ [innerBlockId]: { '@type': 'leaf' },
82
+ },
83
+ blocks_layout: { items: [innerBlockId] },
84
+ };
85
+ const mockBlockData = {
86
+ data: {
87
+ '@type': 'tabs',
88
+ blocks: {
89
+ [outerBlockId]: innerBlock,
90
+ },
91
+ blocks_layout: {
92
+ items: [outerBlockId],
93
+ },
94
+ },
95
+ };
96
+
97
+ getBlocks
98
+ .mockReturnValueOnce([[outerBlockId, innerBlock]])
99
+ .mockReturnValueOnce([[innerBlockId, innerBlock.blocks[innerBlockId]]]);
100
+
101
+ const [id, clonedBlockData] = cloneData(mockBlockData);
102
+ const newOuterId = clonedBlockData.data.blocks_layout.items[0];
103
+ expect(newOuterId).not.toEqual(outerBlockId);
104
+ expect(id).not.toBeNull();
105
+ const newOuterBlock = clonedBlockData.data.blocks[newOuterId];
106
+ expect(newOuterBlock).toBeDefined();
107
+ const newInnerId = newOuterBlock.blocks_layout.items[0];
108
+ expect(newInnerId).not.toEqual(innerBlockId);
109
+ expect(newOuterBlock.blocks[newInnerId]).toEqual(
110
+ innerBlock.blocks[innerBlockId],
111
+ );
112
+ });
113
+ });
@@ -44,3 +44,4 @@ const toggleItem = (container, item, hidden) => {
44
44
 
45
45
  export { SimpleMarkdown, getMenuPosition, toggleItem };
46
46
  export * from './dimensions';
47
+ export { cloneData } from './cloneData';
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
2
  import { v4 as uuid } from 'uuid';
3
- import { omit, without } from 'lodash';
3
+ import omit from 'lodash/omit';
4
+ import without from 'lodash/without';
4
5
  import move from 'lodash-move';
5
- import { Icon, FormFieldWrapper, DragDropList } from '@plone/volto/components';
6
+ import Icon from '@plone/volto/components/theme/Icon/Icon';
7
+ import DragDropList from '@plone/volto/components/manage/DragDropList/DragDropList';
8
+ import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
6
9
  import { emptyTab } from '@eeacms/volto-tabs-block/helpers';
7
10
  import { StyleWrapperEdit } from '@eeacms/volto-block-style/StyleWrapper';
8
11
  import ObjectWidget from '@plone/volto/components/manage/Widgets/ObjectWidget';