@eeacms/volto-slate-footnote 8.0.0 → 8.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
@@ -16,16 +16,16 @@ if (configFile) {
16
16
  voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
17
17
  }
18
18
 
19
- const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
20
- const reg = new AddonConfigurationRegistry(projectRootPath);
19
+ const { AddonRegistry } = require('@plone/registry/addon-registry');
20
+ const { registry } = AddonRegistry.init(projectRootPath);
21
21
 
22
22
  // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
23
- const addonAliases = Object.keys(reg.packages).map((o) => [
23
+ const addonAliases = Object.keys(registry.packages).map((o) => [
24
24
  o,
25
- reg.packages[o].modulePath,
25
+ registry.packages[o].modulePath,
26
26
  ]);
27
27
 
28
- const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
28
+ const addonExtenders = registry.getEslintExtenders().map((m) => require(m));
29
29
 
30
30
  const defaultConfig = {
31
31
  extends: `${voltoPath}/.eslintrc`,
@@ -34,7 +34,7 @@ const defaultConfig = {
34
34
  alias: {
35
35
  map: [
36
36
  ['@plone/volto', '@plone/volto/src'],
37
- ['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
37
+ ['@plone/volto-slate', '@plone/volto-slate/src'],
38
38
  ...addonAliases,
39
39
  ['@package', `${__dirname}/src`],
40
40
  ['@root', `${__dirname}/src`],
@@ -48,6 +48,7 @@ const defaultConfig = {
48
48
  },
49
49
  },
50
50
  rules: {
51
+ 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
51
52
  'react/jsx-no-target-blank': [
52
53
  'error',
53
54
  {
package/CHANGELOG.md CHANGED
@@ -4,7 +4,15 @@ 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
- ### [8.0.0](https://github.com/eea/volto-slate-footnote/compare/7.2.6...8.0.0) - 30 March 2026
7
+ ### [8.0.2](https://github.com/eea/volto-slate-footnote/compare/8.0.1...8.0.2) - 23 April 2026
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: Hydration warnings - refs #302095 [Alin Voinea - [`6dc22d5`](https://github.com/eea/volto-slate-footnote/commit/6dc22d5e7f459d2177dbafb1fbb02e5e71a6734c)]
12
+
13
+ ### [8.0.1](https://github.com/eea/volto-slate-footnote/compare/8.0.0...8.0.1) - 9 April 2026
14
+
15
+ ## [8.0.0](https://github.com/eea/volto-slate-footnote/compare/7.2.6...8.0.0) - 30 March 2026
8
16
 
9
17
  #### :rocket: New Features
10
18
 
@@ -12,9 +20,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
12
20
 
13
21
  #### :house: Internal changes
14
22
 
23
+ - chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`ba537fc`](https://github.com/eea/volto-slate-footnote/commit/ba537fc2abdda5ebb7e1ddb2db982959cb11c555)]
24
+ - chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`79ce621`](https://github.com/eea/volto-slate-footnote/commit/79ce621a2b2ccd86de1fed49aa6cf6d6a47d796e)]
15
25
 
16
26
  #### :hammer_and_wrench: Others
17
27
 
28
+ - Release 8.0.0: Volto 18 support [Alin Voinea - [`fd4f620`](https://github.com/eea/volto-slate-footnote/commit/fd4f620ad4009e5c0e6577424b069fa2028ddd77)]
18
29
  - test: Fix make test [Alin V. (Claudiu) - [`8a54d4a`](https://github.com/eea/volto-slate-footnote/commit/8a54d4a16496c92a9c25d42102e0176cb3dc56ab)]
19
30
  - tests: Fix Sonar Qube tags - refs #297339 [Alin Voinea - [`d2287d1`](https://github.com/eea/volto-slate-footnote/commit/d2287d1eacf022e59896cabe529ff6d80134dded)]
20
31
  ### [7.2.6](https://github.com/eea/volto-slate-footnote/compare/7.2.5...7.2.6) - 22 September 2025
@@ -41,6 +52,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
41
52
 
42
53
  #### :hammer_and_wrench: Others
43
54
 
55
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0f74fe1`](https://github.com/eea/volto-slate-footnote/commit/0f74fe1d9d2d0707e1ef88b969e1248b09e95ad0)]
56
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`23f6e17`](https://github.com/eea/volto-slate-footnote/commit/23f6e173ec8b17cfa354c635ed17c733d42568eb)]
57
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`967eaa9`](https://github.com/eea/volto-slate-footnote/commit/967eaa96d27f410c6c3dfc7471e887f4a2c04af5)]
58
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c20a5a6`](https://github.com/eea/volto-slate-footnote/commit/c20a5a68fe75d6f6dc8d9b7b0ee4628470d2459e)]
59
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`2408868`](https://github.com/eea/volto-slate-footnote/commit/2408868886b25627e9b398ba55e2fdb3ef79d252)]
60
+ - Add Sonarqube tag using ied-frontend addons list [EEA Jenkins - [`23eb21d`](https://github.com/eea/volto-slate-footnote/commit/23eb21d1dfb69a56a37aa9d2da58922b87cbe873)]
44
61
  ### [7.2.3](https://github.com/eea/volto-slate-footnote/compare/7.2.2...7.2.3) - 31 January 2025
45
62
 
46
63
  #### :bug: Bug Fixes
@@ -89,6 +106,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
89
106
 
90
107
  #### :hammer_and_wrench: Others
91
108
 
109
+ - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`1258c37`](https://github.com/eea/volto-slate-footnote/commit/1258c370d2ce42ddff78d6b749ab8c45897991d3)]
110
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`e1031b1`](https://github.com/eea/volto-slate-footnote/commit/e1031b1db0a34679e0bb312e8f0db9433bf08498)]
92
111
  ### [6.3.0](https://github.com/eea/volto-slate-footnote/compare/6.2.3...6.3.0) - 28 March 2024
93
112
 
94
113
  #### :hammer_and_wrench: Others
@@ -108,6 +127,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
108
127
 
109
128
  #### :hammer_and_wrench: Others
110
129
 
130
+ - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`aa335f9`](https://github.com/eea/volto-slate-footnote/commit/aa335f9eedd9d994b6fbceb57102d848dbdbae15)]
111
131
  ### [6.2.2](https://github.com/eea/volto-slate-footnote/compare/6.2.1...6.2.2) - 20 January 2024
112
132
 
113
133
  #### :hammer_and_wrench: Others
@@ -132,9 +152,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
132
152
 
133
153
  #### :house: Internal changes
134
154
 
155
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`5a5e1ad`](https://github.com/eea/volto-slate-footnote/commit/5a5e1adf997af84e93a4015dc66b7299abba0874)]
135
156
 
136
157
  #### :hammer_and_wrench: Others
137
158
 
159
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`af6d78f`](https://github.com/eea/volto-slate-footnote/commit/af6d78f60dd040fe61ebb225f4a689ac21ffb55c)]
160
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`7f4c07f`](https://github.com/eea/volto-slate-footnote/commit/7f4c07f1fc2e9893d1f925152a473855a7e0f064)]
161
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`0670217`](https://github.com/eea/volto-slate-footnote/commit/0670217cca01571e8a3bd64ee3d85bb53ce447be)]
162
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`ec08749`](https://github.com/eea/volto-slate-footnote/commit/ec08749f9547d2c133b2174ab8d60cf2bdb1b23a)]
163
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`237e6a3`](https://github.com/eea/volto-slate-footnote/commit/237e6a331e3608aa35d1c93a03c435daf330c2bd)]
138
164
  ### [6.1.8](https://github.com/eea/volto-slate-footnote/compare/6.1.7...6.1.8) - 22 October 2023
139
165
 
140
166
  #### :house: Internal changes
@@ -204,17 +230,25 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
204
230
 
205
231
  #### :house: Internal changes
206
232
 
233
+ - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`ded882a`](https://github.com/eea/volto-slate-footnote/commit/ded882a1ca1183c2ba74ff4246111123ee36e6cb)]
207
234
 
208
235
  #### :hammer_and_wrench: Others
209
236
 
210
237
  - test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`3e0749c`](https://github.com/eea/volto-slate-footnote/commit/3e0749cc5bd7f5810ac6fd7a3feee4df0435ee0a)]
211
238
  - test: Add unit tests for utils - refs #253277 [ana-oprea - [`a709895`](https://github.com/eea/volto-slate-footnote/commit/a709895d9953742ef6d39f8d9673c06b2efe6a64)]
212
239
  - test: Fix test config, coverage Refs #253277 [valentinab25 - [`dc4d6dc`](https://github.com/eea/volto-slate-footnote/commit/dc4d6dc9b39bfe2c892156f32c764153d1366486)]
240
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`4f0ecee`](https://github.com/eea/volto-slate-footnote/commit/4f0ecee224d5d6604dfbb562556e45437edbb8ec)]
213
241
  ### [6.1.0](https://github.com/eea/volto-slate-footnote/compare/6.0.2...6.1.0) - 27 March 2023
214
242
 
215
243
  #### :hammer_and_wrench: Others
216
244
 
245
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`23959ee`](https://github.com/eea/volto-slate-footnote/commit/23959ee43d45ec5eaa483590415a75fc58faae03)]
246
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`7aa6f34`](https://github.com/eea/volto-slate-footnote/commit/7aa6f3439953cc3d8f28875eff9fbcc24084cbc7)]
247
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`b117d15`](https://github.com/eea/volto-slate-footnote/commit/b117d15e51b3cf10717b9dd9dfef8304d46ad556)]
217
248
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`97ed8fb`](https://github.com/eea/volto-slate-footnote/commit/97ed8fbd92f76c2b3128b62cdc1a77611e79410a)]
249
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`cb22f5e`](https://github.com/eea/volto-slate-footnote/commit/cb22f5e8e9d3aed0a3b4374b6d4d80c8c2bb66e1)]
250
+ - yarn 3 [Alin Voinea - [`f5bb904`](https://github.com/eea/volto-slate-footnote/commit/f5bb904eecf740ffd57dbccf9a597c99ea2dfc0c)]
251
+ - Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`59cf6d3`](https://github.com/eea/volto-slate-footnote/commit/59cf6d334a460e373dda3e2e28754fcdd9fb0281)]
218
252
  ### [6.0.2](https://github.com/eea/volto-slate-footnote/compare/6.0.1...6.0.2) - 16 November 2022
219
253
 
220
254
  #### :hammer_and_wrench: Others
@@ -230,27 +264,37 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
230
264
 
231
265
  #### :hammer_and_wrench: Others
232
266
 
267
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`dc3c7de`](https://github.com/eea/volto-slate-footnote/commit/dc3c7deaa8c692689ea0cec66cf019f05f9c4e22)]
268
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`133969a`](https://github.com/eea/volto-slate-footnote/commit/133969a37a6153a19af121d2f6031a70bc67cc9d)]
233
269
  ### [5.0.1](https://github.com/eea/volto-slate-footnote/compare/5.0.0...5.0.1) - 30 June 2022
234
270
 
235
271
  #### :hammer_and_wrench: Others
236
272
 
273
+ - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`4d5af13`](https://github.com/eea/volto-slate-footnote/commit/4d5af1345aad9071c031f7f00efd6bc5da04541f)]
237
274
  ## [5.0.0](https://github.com/eea/volto-slate-footnote/compare/4.0.5...5.0.0) - 19 May 2022
238
275
 
239
276
  ### [4.0.5](https://github.com/eea/volto-slate-footnote/compare/4.0.4...4.0.5) - 17 May 2022
240
277
 
241
278
  #### :hammer_and_wrench: Others
242
279
 
280
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`85a16ee`](https://github.com/eea/volto-slate-footnote/commit/85a16ee73d21d696282dc24933169d3c31383027)]
281
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`418349c`](https://github.com/eea/volto-slate-footnote/commit/418349ce22d98bf5dee58130d6f1cb9f45bbaa46)]
243
282
  ### [4.0.4](https://github.com/eea/volto-slate-footnote/compare/4.0.3...4.0.4) - 3 January 2022
244
283
 
245
284
  ### [4.0.3](https://github.com/eea/volto-slate-footnote/compare/4.0.2...4.0.3) - 18 December 2021
246
285
 
247
286
  #### :hammer_and_wrench: Others
248
287
 
288
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`ad06940`](https://github.com/eea/volto-slate-footnote/commit/ad0694074a06eb56ec1891256b262e9854c0303d)]
249
289
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`1081079`](https://github.com/eea/volto-slate-footnote/commit/1081079444f5ac806e9d56765c4ccf0b9e415a73)]
290
+ - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`307687b`](https://github.com/eea/volto-slate-footnote/commit/307687b93d966e0df5c4a3f813dbb19442d2e169)]
291
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0460e2a`](https://github.com/eea/volto-slate-footnote/commit/0460e2a73a4c8ede00b0c1fc3f05624eaa345a33)]
292
+ - Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`8aecee9`](https://github.com/eea/volto-slate-footnote/commit/8aecee99f11387e4ce31825209798772d7fee060)]
250
293
  ### [4.0.2](https://github.com/eea/volto-slate-footnote/compare/4.0.1...4.0.2) - 30 September 2021
251
294
 
252
295
  #### :hammer_and_wrench: Others
253
296
 
297
+ - Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`cf33efe`](https://github.com/eea/volto-slate-footnote/commit/cf33efec91b4b8d13562b8c8f660e7a78191d9e0)]
254
298
  - Remove :asDefault dependency from volto-slate [Alin Voinea - [`13dad5e`](https://github.com/eea/volto-slate-footnote/commit/13dad5ed23043fa7a24682e1ac6addc86632bfe0)]
255
299
  ### [4.0.1](https://github.com/eea/volto-slate-footnote/compare/4.0.0...4.0.1) - 29 September 2021
256
300
 
@@ -258,6 +302,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
258
302
 
259
303
  #### :hammer_and_wrench: Others
260
304
 
305
+ - Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`80a159b`](https://github.com/eea/volto-slate-footnote/commit/80a159bb67698cddedadc494e7ae2da32a96faea)]
261
306
  ### [3.2.0](https://github.com/eea/volto-slate-footnote/compare/3.1.1...3.2.0) - 13 September 2021
262
307
 
263
308
  #### :hammer_and_wrench: Others
@@ -270,6 +315,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
270
315
  - Remove console.log [Alin Voinea - [`b5d83e7`](https://github.com/eea/volto-slate-footnote/commit/b5d83e7c13240151f602d122ecf09ba9b8e335f3)]
271
316
  - Fix slate json field default value in DX layout [Alin Voinea - [`f2805bb`](https://github.com/eea/volto-slate-footnote/commit/f2805bbc15c51ebd914ee5f4eb9dd34ef32e095b)]
272
317
  - Fix cypress api_url [Alin Voinea - [`6a4966a`](https://github.com/eea/volto-slate-footnote/commit/6a4966a2f92e932e1d0df35351989cda535f15c8)]
318
+ - Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`aed3984`](https://github.com/eea/volto-slate-footnote/commit/aed39840ecd467689eaf0adb352bd00ce95bdbbe)]
273
319
  ### [3.1.0](https://github.com/eea/volto-slate-footnote/compare/3.0.0...3.1.0) - 9 September 2021
274
320
 
275
321
  #### :hammer_and_wrench: Others
@@ -290,6 +336,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
290
336
  - Bump version to 2.4.0 [Alin Voinea - [`bef0d34`](https://github.com/eea/volto-slate-footnote/commit/bef0d34c2b9c20915578ffaefb4fd30cbf42f0a1)]
291
337
  - Fix Slate point from DOM crash [Alin Voinea - [`c852f79`](https://github.com/eea/volto-slate-footnote/commit/c852f7987ffe8db433235b70792002d40ade690f)]
292
338
  - Fix crash on copy&paste beforeInsert condition [Alin Voinea - [`85172cf`](https://github.com/eea/volto-slate-footnote/commit/85172cff3e2ea95a86d4b4fb452f3c0287b80e8f)]
339
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`b471c41`](https://github.com/eea/volto-slate-footnote/commit/b471c418d198b1bde95acfe0b256f642bacc6865)]
293
340
  ### [2.3.1](https://github.com/eea/volto-slate-footnote/compare/2.3.0...2.3.1) - 25 June 2021
294
341
 
295
342
  ### [2.3.0](https://github.com/eea/volto-slate-footnote/compare/2.2.2...2.3.0) - 12 June 2021
package/Jenkinsfile CHANGED
@@ -10,8 +10,8 @@ pipeline {
10
10
  DEPENDENCIES = ""
11
11
  BACKEND_PROFILES = "eea.kitkat:testing"
12
12
  BACKEND_ADDONS = ""
13
- VOLTO = "17"
14
- VOLTO18_BREAKING_CHANGES = "no"
13
+ CURRENT_VOLTO = "18-yarn"
14
+ PREVIOUS_VOLTO = "17"
15
15
  IMAGE_NAME = BUILD_TAG.toLowerCase()
16
16
  }
17
17
 
@@ -72,12 +72,13 @@ pipeline {
72
72
  }
73
73
  parallel {
74
74
 
75
- stage('Volto 17') {
75
+ // Declarative stage names must stay string literals.
76
+ stage('Volto 18-yarn') {
76
77
  agent { node { label 'docker-1.13'} }
77
78
  stages {
78
79
  stage('Build test image') {
79
80
  steps {
80
- sh '''docker build --pull --build-arg="VOLTO_VERSION=$VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend'''
81
+ sh '''docker build --pull --build-arg="VOLTO_VERSION=$CURRENT_VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend-current'''
81
82
  }
82
83
  }
83
84
 
@@ -88,9 +89,9 @@ pipeline {
88
89
  }
89
90
  steps {
90
91
  script {
91
- fix_result = sh(script: '''docker run --name="$IMAGE_NAME-fix" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend ci-fix''', returnStatus: true)
92
- sh '''docker cp $IMAGE_NAME-fix:/app/src/addons/$GIT_NAME/src .'''
93
- sh '''docker rm -v $IMAGE_NAME-fix'''
92
+ fix_result = sh(script: '''docker run --name="$IMAGE_NAME-fix-current" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend-current ci-fix''', returnStatus: true)
93
+ sh '''docker cp $IMAGE_NAME-fix-current:/app/src/addons/$GIT_NAME/src .'''
94
+ sh '''docker rm -v $IMAGE_NAME-fix-current'''
94
95
  FOUND_FIX = sh(script: '''git diff | wc -l''', returnStdout: true).trim()
95
96
 
96
97
  if (FOUND_FIX != '0') {
@@ -111,21 +112,21 @@ pipeline {
111
112
  stage('ES lint') {
112
113
  when { environment name: 'SKIP_TESTS', value: '' }
113
114
  steps {
114
- sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint'''
115
+ sh '''docker run --rm --name="$IMAGE_NAME-eslint-current" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend-current lint'''
115
116
  }
116
117
  }
117
118
 
118
119
  stage('Style lint') {
119
120
  when { environment name: 'SKIP_TESTS', value: '' }
120
121
  steps {
121
- sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint'''
122
+ sh '''docker run --rm --name="$IMAGE_NAME-stylelint-current" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend-current stylelint'''
122
123
  }
123
124
  }
124
125
 
125
126
  stage('Prettier') {
126
127
  when { environment name: 'SKIP_TESTS', value: '' }
127
128
  steps {
128
- sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier'''
129
+ sh '''docker run --rm --name="$IMAGE_NAME-prettier-current" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend-current prettier'''
129
130
  }
130
131
  }
131
132
  stage('Unit tests') {
@@ -133,25 +134,25 @@ pipeline {
133
134
  steps {
134
135
  script {
135
136
  try {
136
- sh '''docker run --name="$IMAGE_NAME-volto" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend test-ci'''
137
- sh '''rm -rf xunit-reports'''
138
- sh '''mkdir -p xunit-reports'''
139
- sh '''docker cp $IMAGE_NAME-volto:/app/coverage xunit-reports/'''
140
- sh '''docker cp $IMAGE_NAME-volto:/app/junit.xml xunit-reports/'''
137
+ sh '''docker run --name="$IMAGE_NAME-volto-current" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend-current test-ci'''
138
+ sh '''rm -rf xunit-reports-current'''
139
+ sh '''mkdir -p xunit-reports-current'''
140
+ sh '''docker cp $IMAGE_NAME-volto-current:/app/coverage xunit-reports-current/'''
141
+ sh '''docker cp $IMAGE_NAME-volto-current:/app/junit.xml xunit-reports-current/'''
141
142
  publishHTML(target : [
142
143
  allowMissing: false,
143
144
  alwaysLinkToLastBuild: true,
144
145
  keepAll: true,
145
- reportDir: 'xunit-reports/coverage/lcov-report',
146
+ reportDir: 'xunit-reports-current/coverage/lcov-report',
146
147
  reportFiles: 'index.html',
147
148
  reportName: 'UTCoverage',
148
149
  reportTitles: 'Unit Tests Code Coverage'
149
150
  ])
150
151
  } finally {
151
152
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
152
- junit testResults: 'xunit-reports/junit.xml', allowEmptyResults: true
153
+ junit testResults: 'xunit-reports-current/junit.xml', allowEmptyResults: true
153
154
  }
154
- sh script: '''docker rm -v $IMAGE_NAME-volto''', returnStatus: true
155
+ sh script: '''docker rm -v $IMAGE_NAME-volto-current''', returnStatus: true
155
156
  }
156
157
  }
157
158
  }
@@ -162,52 +163,52 @@ pipeline {
162
163
  steps {
163
164
  script {
164
165
  try {
165
- sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
166
- sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
167
- frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make check-ci''', returnStatus: true
166
+ sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone-current" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
167
+ sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone-current:plone --name="$IMAGE_NAME-cypress-current" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend-current start-ci'''
168
+ frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress-current make check-ci''', returnStatus: true
168
169
  if ( frontend != 0 ) {
169
- sh '''docker logs $IMAGE_NAME-cypress; exit 1'''
170
+ sh '''docker logs $IMAGE_NAME-cypress-current; exit 1'''
170
171
  }
171
172
 
172
- sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
173
+ sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress-current make cypress-ci'''
173
174
  } finally {
174
175
  try {
175
176
  if ( frontend == 0 ) {
176
- sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
177
- sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
178
- videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
179
- sh '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
180
- screenshots = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots''', returnStatus: true
177
+ sh '''rm -rf cypress-videos-current cypress-results-current cypress-coverage-current cypress-screenshots-current'''
178
+ sh '''mkdir -p cypress-videos-current cypress-results-current cypress-coverage-current cypress-screenshots-current'''
179
+ videos = sh script: '''docker cp $IMAGE_NAME-cypress-current:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos-current/''', returnStatus: true
180
+ sh '''docker cp $IMAGE_NAME-cypress-current:/app/src/addons/$GIT_NAME/cypress/reports cypress-results-current/'''
181
+ screenshots = sh script: '''docker cp $IMAGE_NAME-cypress-current:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots-current''', returnStatus: true
181
182
 
182
- archiveArtifacts artifacts: 'cypress-screenshots/**', fingerprint: true, allowEmptyArchive: true
183
+ archiveArtifacts artifacts: 'cypress-screenshots-current/**', fingerprint: true, allowEmptyArchive: true
183
184
 
184
- coverage = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/coverage cypress-coverage''', returnStatus: true
185
+ coverage = sh script: '''docker cp $IMAGE_NAME-cypress-current:/app/src/addons/$GIT_NAME/coverage cypress-coverage-current''', returnStatus: true
185
186
 
186
187
  if ( coverage == 0 ) {
187
188
  publishHTML(target : [allowMissing: false,
188
189
  alwaysLinkToLastBuild: true,
189
190
  keepAll: true,
190
- reportDir: 'cypress-coverage/coverage/lcov-report',
191
+ reportDir: 'cypress-coverage-current/coverage/lcov-report',
191
192
  reportFiles: 'index.html',
192
193
  reportName: 'CypressCoverage',
193
194
  reportTitles: 'Integration Tests Code Coverage'])
194
195
  }
195
196
  if ( videos == 0 ) {
196
- sh '''for file in $(find cypress-results -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos/videos/$testname.mp4; fi; done'''
197
- archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
197
+ sh '''for file in $(find cypress-results-current -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos-current/videos/$testname.mp4; fi; done'''
198
+ archiveArtifacts artifacts: 'cypress-videos-current/**/*.mp4', fingerprint: true, allowEmptyArchive: true
198
199
  }
199
200
  }
200
201
  } finally {
201
202
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
202
- junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
203
+ junit testResults: 'cypress-results-current/**/*.xml', allowEmptyResults: true
203
204
  }
204
205
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
205
- sh '''docker logs $IMAGE_NAME-cypress'''
206
+ sh '''docker logs $IMAGE_NAME-cypress-current'''
206
207
  }
207
- sh script: "docker stop $IMAGE_NAME-cypress", returnStatus: true
208
- sh script: "docker stop $IMAGE_NAME-plone", returnStatus: true
209
- sh script: "docker rm -v $IMAGE_NAME-plone", returnStatus: true
210
- sh script: "docker rm -v $IMAGE_NAME-cypress", returnStatus: true
208
+ sh script: "docker stop $IMAGE_NAME-cypress-current", returnStatus: true
209
+ sh script: "docker stop $IMAGE_NAME-plone-current", returnStatus: true
210
+ sh script: "docker rm -v $IMAGE_NAME-plone-current", returnStatus: true
211
+ sh script: "docker rm -v $IMAGE_NAME-cypress-current", returnStatus: true
211
212
  }
212
213
  }
213
214
  }
@@ -246,9 +247,9 @@ pipeline {
246
247
  env.sonarParams = " -Dsonar.branch.name=${env.BRANCH_NAME}"
247
248
  }
248
249
  withSonarQubeEnv('Sonarqube') {
249
- sh '''sed -i "s#/app/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
250
- sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
251
- sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME -Dsonar.projectName=$GIT_NAME -Dsonar.projectVersion=\$(jq -r '.version' package.json) ${env.sonarParams}"
250
+ sh '''sed -i "s#/app/src/addons/${GIT_NAME}/##g" xunit-reports-current/coverage/lcov.info'''
251
+ sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports-current/coverage/lcov.info'''
252
+ sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports-current/coverage/lcov.info,./cypress-coverage-current/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME -Dsonar.projectName=$GIT_NAME -Dsonar.projectVersion=\$(jq -r '.version' package.json) ${env.sonarParams}"
252
253
  sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}&tags=${SONARQUBE_TAGS}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done'''
253
254
  }
254
255
  }
@@ -259,75 +260,77 @@ pipeline {
259
260
  }
260
261
  }
261
262
 
262
- stage('Volto 18') {
263
+ stage('Volto 17') {
263
264
  agent { node { label 'integration'} }
264
- when {
265
- environment name: 'SKIP_TESTS', value: ''
266
- not { environment name: 'VOLTO18_BREAKING_CHANGES', value: 'yes' }
265
+ when {
266
+ allOf {
267
+ environment name: 'SKIP_TESTS', value: ''
268
+ expression { return !!env.PREVIOUS_VOLTO?.trim() }
269
+ }
267
270
  }
268
271
  stages {
269
272
  stage('Build test image') {
270
273
  steps {
271
- sh '''docker build --pull --build-arg="VOLTO_VERSION=18-yarn" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend18'''
274
+ sh '''docker build --pull --build-arg="VOLTO_VERSION=$PREVIOUS_VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend-previous'''
272
275
  }
273
276
  }
274
277
 
275
- stage('Unit tests Volto 18') {
278
+ stage('Unit tests') {
276
279
  steps {
277
280
  script {
278
281
  try {
279
- sh '''docker run --name="$IMAGE_NAME-volto18" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend18 test-ci'''
280
- sh '''rm -rf xunit-reports18'''
281
- sh '''mkdir -p xunit-reports18'''
282
- sh '''docker cp $IMAGE_NAME-volto18:/app/junit.xml xunit-reports18/'''
282
+ sh '''docker run --name="$IMAGE_NAME-volto-previous" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend-previous test-ci'''
283
+ sh '''rm -rf xunit-reports-previous'''
284
+ sh '''mkdir -p xunit-reports-previous'''
285
+ sh '''docker cp $IMAGE_NAME-volto-previous:/app/junit.xml xunit-reports-previous/'''
283
286
  } finally {
284
287
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
285
- junit testResults: 'xunit-reports18/junit.xml', allowEmptyResults: true
288
+ junit testResults: 'xunit-reports-previous/junit.xml', allowEmptyResults: true
286
289
  }
287
- sh script: '''docker rm -v $IMAGE_NAME-volto18''', returnStatus: true
290
+ sh script: '''docker rm -v $IMAGE_NAME-volto-previous''', returnStatus: true
288
291
  }
289
292
  }
290
293
  }
291
294
  }
292
295
 
293
- stage('Integration tests Volto 18') {
296
+ stage('Integration tests') {
294
297
  steps {
295
298
  script {
296
299
  try {
297
- sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone18" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
298
- sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone18:plone --name="$IMAGE_NAME-cypress18" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend18 start-ci'''
299
- frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress18 make check-ci''', returnStatus: true
300
+ sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone-previous" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
301
+ sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone-previous:plone --name="$IMAGE_NAME-cypress-previous" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend-previous start-ci'''
302
+ frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress-previous make check-ci''', returnStatus: true
300
303
  if ( frontend != 0 ) {
301
- sh '''docker logs $IMAGE_NAME-cypress18; exit 1'''
304
+ sh '''docker logs $IMAGE_NAME-cypress-previous; exit 1'''
302
305
  }
303
- sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress18 make cypress-ci'''
306
+ sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress-previous make cypress-ci'''
304
307
  } finally {
305
308
  try {
306
309
  if ( frontend == 0 ) {
307
- sh '''rm -rf cypress-videos18 cypress-results18 cypress-coverage18 cypress-screenshots18'''
308
- sh '''mkdir -p cypress-videos18 cypress-results18 cypress-coverage18 cypress-screenshots18'''
309
- videos = sh script: '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos18/''', returnStatus: true
310
- sh '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/reports cypress-results18/'''
311
- screenshots = sh script: '''docker cp $IMAGE_NAME-cypress18:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots18''', returnStatus: true
310
+ sh '''rm -rf cypress-videos-previous cypress-results-previous cypress-coverage-previous cypress-screenshots-previous'''
311
+ sh '''mkdir -p cypress-videos-previous cypress-results-previous cypress-coverage-previous cypress-screenshots-previous'''
312
+ videos = sh script: '''docker cp $IMAGE_NAME-cypress-previous:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos-previous/''', returnStatus: true
313
+ sh '''docker cp $IMAGE_NAME-cypress-previous:/app/src/addons/$GIT_NAME/cypress/reports cypress-results-previous/'''
314
+ screenshots = sh script: '''docker cp $IMAGE_NAME-cypress-previous:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots-previous''', returnStatus: true
312
315
 
313
- archiveArtifacts artifacts: 'cypress-screenshots18/**', fingerprint: true, allowEmptyArchive: true
316
+ archiveArtifacts artifacts: 'cypress-screenshots-previous/**', fingerprint: true, allowEmptyArchive: true
314
317
 
315
318
  if ( videos == 0 ) {
316
- sh '''for file in $(find cypress-results18 -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos18/videos/$testname.mp4; fi; done'''
317
- archiveArtifacts artifacts: 'cypress-videos18/**/*.mp4', fingerprint: true, allowEmptyArchive: true
319
+ sh '''for file in $(find cypress-results-previous -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos-previous/videos/$testname.mp4; fi; done'''
320
+ archiveArtifacts artifacts: 'cypress-videos-previous/**/*.mp4', fingerprint: true, allowEmptyArchive: true
318
321
  }
319
322
  }
320
323
  } finally {
321
324
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
322
- junit testResults: 'cypress-results18/**/*.xml', allowEmptyResults: true
325
+ junit testResults: 'cypress-results-previous/**/*.xml', allowEmptyResults: true
323
326
  }
324
327
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
325
- sh '''docker logs $IMAGE_NAME-cypress18'''
328
+ sh '''docker logs $IMAGE_NAME-cypress-previous'''
326
329
  }
327
- sh script: "docker stop $IMAGE_NAME-cypress18", returnStatus: true
328
- sh script: "docker stop $IMAGE_NAME-plone18", returnStatus: true
329
- sh script: "docker rm -v $IMAGE_NAME-plone18", returnStatus: true
330
- sh script: "docker rm -v $IMAGE_NAME-cypress18", returnStatus: true
330
+ sh script: "docker stop $IMAGE_NAME-cypress-previous", returnStatus: true
331
+ sh script: "docker stop $IMAGE_NAME-plone-previous", returnStatus: true
332
+ sh script: "docker rm -v $IMAGE_NAME-plone-previous", returnStatus: true
333
+ sh script: "docker rm -v $IMAGE_NAME-cypress-previous", returnStatus: true
331
334
  }
332
335
  }
333
336
  }
@@ -339,8 +342,8 @@ pipeline {
339
342
  }
340
343
  post {
341
344
  always {
342
- sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
343
- sh script: "docker rmi $IMAGE_NAME-frontend18", returnStatus: true
345
+ sh script: "docker rmi $IMAGE_NAME-frontend-current", returnStatus: true
346
+ sh script: "docker rmi $IMAGE_NAME-frontend-previous", returnStatus: true
344
347
  }
345
348
  }
346
349
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-slate-footnote",
3
- "version": "8.0.0",
3
+ "version": "8.0.2",
4
4
  "description": "volto-slate-footnote: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import FootnotesBlockView from './FootnotesBlockView';
3
- import { InlineForm, SidebarPortal } from '@plone/volto/components';
1
+ import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
2
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
3
  import { FootnoteBlockSchema as schema } from './schema';
4
+ import FootnotesBlockView from './FootnotesBlockView';
5
5
  import { Segment } from 'semantic-ui-react';
6
6
 
7
7
  /**
@@ -7,8 +7,8 @@ import {
7
7
  } from '@eeacms/volto-slate-footnote/editor/utils';
8
8
  import './less/public.less';
9
9
 
10
- import { UniversalLink } from '@plone/volto/components';
11
- import { renderTextWithLinks } from '../../editor/utils';
10
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
11
+ import { renderTextWithLinks } from '@eeacms/volto-slate-footnote/editor/utils';
12
12
 
13
13
  const alphabet = 'abcdefghijklmnopqrstuvwxyz';
14
14
 
@@ -30,10 +30,10 @@ const FootnotesBlockView = (props) => {
30
30
  const localMetadata = global
31
31
  ? metadata
32
32
  : content
33
- ? content
34
- : tabData
35
- ? tabData
36
- : properties;
33
+ ? content
34
+ : tabData
35
+ ? tabData
36
+ : properties;
37
37
 
38
38
  const blocks = getAllBlocksAndSlateFields(localMetadata);
39
39
  const notesObj = makeFootnoteListOfUniqueItems(blocks);
@@ -3,8 +3,9 @@ import { render } from '@testing-library/react';
3
3
  import '@testing-library/jest-dom';
4
4
  import FootnotesBlockView from './FootnotesBlockView';
5
5
 
6
- jest.mock('@plone/volto/components', () => ({
7
- UniversalLink: ({ children, href }) => <a href={href}>{children}</a>,
6
+ jest.mock('@plone/volto/components/manage/UniversalLink/UniversalLink', () => ({
7
+ __esModule: true,
8
+ default: ({ children, href }) => <a href={href}>{children}</a>,
8
9
  }));
9
10
 
10
11
  jest.mock('@eeacms/volto-slate-footnote/editor/utils', () => ({
@@ -1,8 +1,8 @@
1
1
  import codeSVG from '@plone/volto/icons/code.svg';
2
+ import { FOOTNOTE } from '@eeacms/volto-slate-footnote/constants';
2
3
 
3
4
  import FootnotesBlockView from './FootnotesBlockView';
4
5
  import FootnotesBlockEdit from './FootnotesBlockEdit';
5
- import { FOOTNOTE } from '@plone/volto-slate/constants';
6
6
 
7
7
  /**
8
8
  * @summary Called from Volto to configure new or existing Volto block types.
@@ -1,9 +1,11 @@
1
- import { isEqual, isEmpty } from 'lodash';
1
+ import isEqual from 'lodash/isEqual';
2
+ import isEmpty from 'lodash/isEmpty';
2
3
  import React, { useEffect } from 'react';
3
4
  import { useDispatch, useSelector } from 'react-redux';
4
5
  import { ReactEditor } from 'slate-react';
5
6
  import { setPluginOptions } from '@plone/volto-slate/actions';
6
- import { Icon as VoltoIcon, InlineForm } from '@plone/volto/components';
7
+ import VoltoIcon from '@plone/volto/components/theme/Icon/Icon';
8
+ import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
7
9
  import briefcaseSVG from '@plone/volto/icons/briefcase.svg';
8
10
  import checkSVG from '@plone/volto/icons/check.svg';
9
11
  import clearSVG from '@plone/volto/icons/clear.svg';
@@ -11,6 +13,8 @@ import { Node } from 'slate';
11
13
  import { getAllBlocksAndSlateFields } from '@eeacms/volto-slate-footnote/editor/utils';
12
14
  import config from '@plone/volto/registry';
13
15
 
16
+ const EMPTY_OBJECT = Object.freeze({});
17
+
14
18
  const FootnoteEditor = (props) => {
15
19
  const {
16
20
  editor,
@@ -27,7 +31,9 @@ const FootnoteEditor = (props) => {
27
31
  const pid = `${editor.uid}-${pluginId}`;
28
32
  const [formData, setFormData] = React.useState({});
29
33
  const active = getActiveElement(editor);
30
- const initialFormData = useSelector((state) => state?.content?.data || {});
34
+ const initialFormData = useSelector(
35
+ (state) => state?.content?.data ?? EMPTY_OBJECT,
36
+ );
31
37
 
32
38
  if (!active) {
33
39
  /* eslint no-console: 0 */
@@ -36,8 +42,10 @@ const FootnoteEditor = (props) => {
36
42
  const [elementNode] = active;
37
43
  const isElement = isActiveElement(editor);
38
44
 
39
- const blockProps = editor?.getBlockProps ? editor.getBlockProps() : {};
40
- const metadata = blockProps.metadata || blockProps.properties || {};
45
+ const blockProps = editor?.getBlockProps
46
+ ? editor.getBlockProps()
47
+ : EMPTY_OBJECT;
48
+ const metadata = blockProps.metadata || blockProps.properties || EMPTY_OBJECT;
41
49
  const metadataBlocks = getAllBlocksAndSlateFields(metadata);
42
50
  const storeBlocks = getAllBlocksAndSlateFields(initialFormData);
43
51
  const uniqueFootnoteBlocks = [];
@@ -11,10 +11,11 @@ import {
11
11
  selectTheme,
12
12
  customSelectStyles,
13
13
  } from '@plone/volto/components/manage/Widgets/SelectStyling';
14
- import { escapeRegExp, filter } from 'lodash';
14
+ import escapeRegExp from 'lodash/escapeRegExp';
15
+ import filter from 'lodash/filter';
15
16
  import { nanoid } from '@plone/volto-slate/utils';
16
17
 
17
- import { FormFieldWrapper } from '@plone/volto/components';
18
+ import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
18
19
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
19
20
 
20
21
  const messages = defineMessages({
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Search, Card, Segment } from 'semantic-ui-react';
3
- import { escapeRegExp, filter } from 'lodash';
3
+ import escapeRegExp from 'lodash/escapeRegExp';
4
+ import filter from 'lodash/filter';
4
5
 
5
6
  const SearchWidget = (props) => {
6
7
  const [results, setResults] = useState([]);
@@ -1,4 +1,4 @@
1
- import { FOOTNOTE } from '../constants';
1
+ import { FOOTNOTE } from '@eeacms/volto-slate-footnote/constants';
2
2
  import { nanoid } from '@plone/volto-slate/utils';
3
3
  import { Transforms } from 'slate';
4
4
 
@@ -4,12 +4,12 @@ import { v4 as uuid } from 'uuid';
4
4
  import {
5
5
  getBlocksFieldname,
6
6
  getBlocksLayoutFieldname,
7
- } from '@plone/volto/helpers';
7
+ } from '@plone/volto/helpers/Blocks/Blocks';
8
8
  import { makeInlineElementPlugin } from '@plone/volto-slate/elementEditor';
9
9
  import { _insertElement } from '@plone/volto-slate/elementEditor/utils';
10
10
  import { FootnoteEditorSchema } from './schema';
11
11
  import { withFootnote, withBeforeInsertFragment } from './extensions';
12
- import { FOOTNOTE } from '../constants';
12
+ import { FOOTNOTE } from '@eeacms/volto-slate-footnote/constants';
13
13
  import { FootnoteElement } from './render';
14
14
  import FootnoteEditor from './FootnoteEditor';
15
15
 
@@ -7,12 +7,20 @@ import {
7
7
  makeFootnoteListOfUniqueItems,
8
8
  openAccordionOrTabIfContainsFootnoteReference,
9
9
  } from './utils';
10
- import { isEmpty } from 'lodash';
10
+ import isEmpty from 'lodash/isEmpty';
11
11
  import { useSelector } from 'react-redux';
12
12
 
13
13
  import { renderTextWithLinks } from './utils';
14
14
  import { useHistory } from 'react-router-dom';
15
15
 
16
+ /**
17
+ * Removes '<?xml version="1.0"?>' from footnote
18
+ * @param {string} footnote
19
+ * @returns {string} formatted footnote
20
+ */
21
+
22
+ const EMPTY_OBJECT = Object.freeze({});
23
+
16
24
  /**
17
25
  * Removes '<?xml version="1.0"?>' from footnote
18
26
  * @param {string} footnote
@@ -45,11 +53,13 @@ export const FootnoteElement = (props) => {
45
53
  };
46
54
  const history = useHistory();
47
55
 
48
- const initialFormData = useSelector((state) => state?.content?.data || {});
56
+ const initialFormData = useSelector(
57
+ (state) => state?.content?.data ?? EMPTY_OBJECT,
58
+ );
49
59
  const blockProps = editor?.getBlockProps ? editor.getBlockProps() : null;
50
60
  const metadata = blockProps
51
- ? blockProps.metadata || blockProps.properties
52
- : extras?.metadata || {};
61
+ ? blockProps.metadata || blockProps.properties || EMPTY_OBJECT
62
+ : extras?.metadata || EMPTY_OBJECT;
53
63
  const blocks = getAllBlocksAndSlateFields(metadata);
54
64
  const storeBlocks = getAllBlocksAndSlateFields(initialFormData);
55
65
 
@@ -1,8 +1,8 @@
1
1
  import config from '@plone/volto/registry';
2
2
  import { Node } from 'slate';
3
3
  import { getAllBlocks } from '@plone/volto-slate/utils';
4
- import { escapeRegExp } from 'lodash';
5
- import { UniversalLink } from '@plone/volto/components';
4
+ import escapeRegExp from 'lodash/escapeRegExp';
5
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
6
6
 
7
7
  const protocol = '((http|https|ftp):\\/\\/)?';
8
8
  const domain = '([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}';
@@ -295,18 +295,12 @@ const iterateFootnoteObj = (notesObjResultTemp, node, parentUid) => {
295
295
  };
296
296
 
297
297
  export function isValidHTML(htmlString) {
298
- if (
299
- __CLIENT__ &&
300
- typeof window !== 'undefined' &&
301
- typeof DOMParser !== 'undefined'
302
- ) {
303
- // The environment is client-side, and DOMParser is available
304
- const parser = new DOMParser();
305
- const parsedDocument = parser.parseFromString(htmlString, 'text/html');
306
- const errors = parsedDocument.querySelectorAll('parsererror');
307
- return errors.length === 0;
308
- }
309
- return false;
298
+ if (typeof htmlString !== 'string') return false;
299
+ const text = htmlString.trim();
300
+ if (!text) return false;
301
+ // Keep server/client output deterministic for hydration by using
302
+ // the same lightweight HTML detection in both environments.
303
+ return /<\/?[a-z][\s\S]*>/i.test(text);
310
304
  }
311
305
 
312
306
  const cleanUrls = (urls, text) => {
@@ -8,7 +8,7 @@ import {
8
8
  makeFootnoteListOfUniqueItems,
9
9
  } from './utils';
10
10
  import { getAllBlocks } from '@plone/volto-slate/utils';
11
- import { UniversalLink } from '@plone/volto/components';
11
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
12
12
 
13
13
  jest.mock('@plone/volto-slate/utils', () => ({
14
14
  getAllBlocks: jest.fn(),
@@ -279,28 +279,12 @@ describe('getAllBlocksAndSlateFields', () => {
279
279
  });
280
280
 
281
281
  describe('isValidHTML', () => {
282
- beforeAll(() => {
283
- global.DOMParser = class {
284
- parseFromString(str) {
285
- const doc = {
286
- querySelectorAll: (selector) => {
287
- if (selector === 'parsererror' && str.includes('<error>')) {
288
- return [{}]; // Simulate an error
289
- }
290
- return [];
291
- },
292
- };
293
- return doc;
294
- }
295
- };
296
- });
297
-
298
282
  test('returns true for valid HTML', () => {
299
283
  expect(isValidHTML('<div>Hello</div>')).toBe(true);
300
284
  });
301
285
 
302
- test('returns false for invalid HTML', () => {
303
- expect(isValidHTML('<error>Invalid HTML</error>')).toBe(false);
286
+ test('returns false for plain text', () => {
287
+ expect(isValidHTML('Invalid HTML')).toBe(false);
304
288
  });
305
289
  });
306
290
 
@@ -361,12 +345,6 @@ describe('renderTextWithLinks', () => {
361
345
  });
362
346
 
363
347
  it('should render HTML when zoteroId is provided', () => {
364
- global.__CLIENT__ = true;
365
- global.DOMParser = class {
366
- parseFromString() {
367
- return { querySelectorAll: () => [] };
368
- }
369
- };
370
348
  const text = '<em>Test</em> content';
371
349
  const result = renderTextWithLinks(text, 'zotero123');
372
350
  expect(result).toBeDefined();