@eeacms/volto-slate-footnote 6.2.2 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -27
- package/Jenkinsfile +1 -1
- package/package.json +1 -1
- package/src/Blocks/Footnote/FootnotesBlockView.jsx +4 -4
- package/src/editor/render.jsx +6 -6
- package/src/editor/utils.js +20 -1
- package/src/editor/utils.test.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ 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
|
+
### [6.3.0](https://github.com/eea/volto-slate-footnote/compare/6.2.3...6.3.0) - 27 March 2024
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Update package.json [ichim-david - [`497b720`](https://github.com/eea/volto-slate-footnote/commit/497b720a79a9debff93b677d7289de3f2766a9ea)]
|
|
12
|
+
- (fix): Make tabs open when footnote in it #63 from eea/table-and-tabs [ichim-david - [`bcd71a4`](https://github.com/eea/volto-slate-footnote/commit/bcd71a441bdbf28927cbac8a50094fac4606f58d)]
|
|
13
|
+
- Update extensions.js [dobri1408 - [`1245061`](https://github.com/eea/volto-slate-footnote/commit/124506189082d04bcf7d4c47efb4be7b8381cb09)]
|
|
14
|
+
- fix eslint [Dobricean Ioan Dorian - [`f11cd5e`](https://github.com/eea/volto-slate-footnote/commit/f11cd5ed4063e648741bc583f5c20b14c73fba66)]
|
|
15
|
+
- fix issue in table [Dobricean Ioan Dorian - [`3f8a31a`](https://github.com/eea/volto-slate-footnote/commit/3f8a31afbbb2917d02ceb831e7be46ce7f69e893)]
|
|
16
|
+
- open tab if footnote in it [Dobricean Ioan Dorian - [`191c39a`](https://github.com/eea/volto-slate-footnote/commit/191c39aef5f03649db8cdd170afdee1ca17c1392)]
|
|
17
|
+
### [6.2.3](https://github.com/eea/volto-slate-footnote/compare/6.2.2...6.2.3) - 6 March 2024
|
|
18
|
+
|
|
19
|
+
#### :bug: Bug Fixes
|
|
20
|
+
|
|
21
|
+
- fix(slate-notes): crash when hovering over notes due to faulty ref initialization #64 from eea/develop [ichim-david - [`cc5e9ac`](https://github.com/eea/volto-slate-footnote/commit/cc5e9ac269f324e5d35117b348ebf41f93f34bfa)]
|
|
22
|
+
- fix: Refs#265202 - footnotes hover crash [Claudia Ifrim - [`71e236d`](https://github.com/eea/volto-slate-footnote/commit/71e236df5785a0878a243658601030f3d7e670c9)]
|
|
23
|
+
|
|
24
|
+
#### :hammer_and_wrench: Others
|
|
25
|
+
|
|
7
26
|
### [6.2.2](https://github.com/eea/volto-slate-footnote/compare/6.2.1...6.2.2) - 20 January 2024
|
|
8
27
|
|
|
9
28
|
#### :hammer_and_wrench: Others
|
|
@@ -28,15 +47,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
28
47
|
|
|
29
48
|
#### :house: Internal changes
|
|
30
49
|
|
|
31
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`5a5e1ad`](https://github.com/eea/volto-slate-footnote/commit/5a5e1adf997af84e93a4015dc66b7299abba0874)]
|
|
32
50
|
|
|
33
51
|
#### :hammer_and_wrench: Others
|
|
34
52
|
|
|
35
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`af6d78f`](https://github.com/eea/volto-slate-footnote/commit/af6d78f60dd040fe61ebb225f4a689ac21ffb55c)]
|
|
36
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`7f4c07f`](https://github.com/eea/volto-slate-footnote/commit/7f4c07f1fc2e9893d1f925152a473855a7e0f064)]
|
|
37
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`0670217`](https://github.com/eea/volto-slate-footnote/commit/0670217cca01571e8a3bd64ee3d85bb53ce447be)]
|
|
38
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`ec08749`](https://github.com/eea/volto-slate-footnote/commit/ec08749f9547d2c133b2174ab8d60cf2bdb1b23a)]
|
|
39
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`237e6a3`](https://github.com/eea/volto-slate-footnote/commit/237e6a331e3608aa35d1c93a03c435daf330c2bd)]
|
|
40
53
|
### [6.1.8](https://github.com/eea/volto-slate-footnote/compare/6.1.7...6.1.8) - 22 October 2023
|
|
41
54
|
|
|
42
55
|
#### :house: Internal changes
|
|
@@ -106,25 +119,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
106
119
|
|
|
107
120
|
#### :house: Internal changes
|
|
108
121
|
|
|
109
|
-
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`ded882a`](https://github.com/eea/volto-slate-footnote/commit/ded882a1ca1183c2ba74ff4246111123ee36e6cb)]
|
|
110
122
|
|
|
111
123
|
#### :hammer_and_wrench: Others
|
|
112
124
|
|
|
113
125
|
- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`3e0749c`](https://github.com/eea/volto-slate-footnote/commit/3e0749cc5bd7f5810ac6fd7a3feee4df0435ee0a)]
|
|
114
126
|
- test: Add unit tests for utils - refs #253277 [ana-oprea - [`a709895`](https://github.com/eea/volto-slate-footnote/commit/a709895d9953742ef6d39f8d9673c06b2efe6a64)]
|
|
115
127
|
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`dc4d6dc`](https://github.com/eea/volto-slate-footnote/commit/dc4d6dc9b39bfe2c892156f32c764153d1366486)]
|
|
116
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`4f0ecee`](https://github.com/eea/volto-slate-footnote/commit/4f0ecee224d5d6604dfbb562556e45437edbb8ec)]
|
|
117
128
|
### [6.1.0](https://github.com/eea/volto-slate-footnote/compare/6.0.2...6.1.0) - 27 March 2023
|
|
118
129
|
|
|
119
130
|
#### :hammer_and_wrench: Others
|
|
120
131
|
|
|
121
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`23959ee`](https://github.com/eea/volto-slate-footnote/commit/23959ee43d45ec5eaa483590415a75fc58faae03)]
|
|
122
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`7aa6f34`](https://github.com/eea/volto-slate-footnote/commit/7aa6f3439953cc3d8f28875eff9fbcc24084cbc7)]
|
|
123
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`b117d15`](https://github.com/eea/volto-slate-footnote/commit/b117d15e51b3cf10717b9dd9dfef8304d46ad556)]
|
|
124
132
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`97ed8fb`](https://github.com/eea/volto-slate-footnote/commit/97ed8fbd92f76c2b3128b62cdc1a77611e79410a)]
|
|
125
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`cb22f5e`](https://github.com/eea/volto-slate-footnote/commit/cb22f5e8e9d3aed0a3b4374b6d4d80c8c2bb66e1)]
|
|
126
|
-
- yarn 3 [Alin Voinea - [`f5bb904`](https://github.com/eea/volto-slate-footnote/commit/f5bb904eecf740ffd57dbccf9a597c99ea2dfc0c)]
|
|
127
|
-
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`59cf6d3`](https://github.com/eea/volto-slate-footnote/commit/59cf6d334a460e373dda3e2e28754fcdd9fb0281)]
|
|
128
133
|
### [6.0.2](https://github.com/eea/volto-slate-footnote/compare/6.0.1...6.0.2) - 16 November 2022
|
|
129
134
|
|
|
130
135
|
#### :hammer_and_wrench: Others
|
|
@@ -140,37 +145,27 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
140
145
|
|
|
141
146
|
#### :hammer_and_wrench: Others
|
|
142
147
|
|
|
143
|
-
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`dc3c7de`](https://github.com/eea/volto-slate-footnote/commit/dc3c7deaa8c692689ea0cec66cf019f05f9c4e22)]
|
|
144
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`133969a`](https://github.com/eea/volto-slate-footnote/commit/133969a37a6153a19af121d2f6031a70bc67cc9d)]
|
|
145
148
|
### [5.0.1](https://github.com/eea/volto-slate-footnote/compare/5.0.0...5.0.1) - 30 June 2022
|
|
146
149
|
|
|
147
150
|
#### :hammer_and_wrench: Others
|
|
148
151
|
|
|
149
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`4d5af13`](https://github.com/eea/volto-slate-footnote/commit/4d5af1345aad9071c031f7f00efd6bc5da04541f)]
|
|
150
152
|
## [5.0.0](https://github.com/eea/volto-slate-footnote/compare/4.0.5...5.0.0) - 19 May 2022
|
|
151
153
|
|
|
152
154
|
### [4.0.5](https://github.com/eea/volto-slate-footnote/compare/4.0.4...4.0.5) - 17 May 2022
|
|
153
155
|
|
|
154
156
|
#### :hammer_and_wrench: Others
|
|
155
157
|
|
|
156
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`85a16ee`](https://github.com/eea/volto-slate-footnote/commit/85a16ee73d21d696282dc24933169d3c31383027)]
|
|
157
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`418349c`](https://github.com/eea/volto-slate-footnote/commit/418349ce22d98bf5dee58130d6f1cb9f45bbaa46)]
|
|
158
158
|
### [4.0.4](https://github.com/eea/volto-slate-footnote/compare/4.0.3...4.0.4) - 3 January 2022
|
|
159
159
|
|
|
160
160
|
### [4.0.3](https://github.com/eea/volto-slate-footnote/compare/4.0.2...4.0.3) - 18 December 2021
|
|
161
161
|
|
|
162
162
|
#### :hammer_and_wrench: Others
|
|
163
163
|
|
|
164
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`ad06940`](https://github.com/eea/volto-slate-footnote/commit/ad0694074a06eb56ec1891256b262e9854c0303d)]
|
|
165
164
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`1081079`](https://github.com/eea/volto-slate-footnote/commit/1081079444f5ac806e9d56765c4ccf0b9e415a73)]
|
|
166
|
-
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`307687b`](https://github.com/eea/volto-slate-footnote/commit/307687b93d966e0df5c4a3f813dbb19442d2e169)]
|
|
167
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0460e2a`](https://github.com/eea/volto-slate-footnote/commit/0460e2a73a4c8ede00b0c1fc3f05624eaa345a33)]
|
|
168
|
-
- Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`8aecee9`](https://github.com/eea/volto-slate-footnote/commit/8aecee99f11387e4ce31825209798772d7fee060)]
|
|
169
165
|
### [4.0.2](https://github.com/eea/volto-slate-footnote/compare/4.0.1...4.0.2) - 30 September 2021
|
|
170
166
|
|
|
171
167
|
#### :hammer_and_wrench: Others
|
|
172
168
|
|
|
173
|
-
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`cf33efe`](https://github.com/eea/volto-slate-footnote/commit/cf33efec91b4b8d13562b8c8f660e7a78191d9e0)]
|
|
174
169
|
- Remove :asDefault dependency from volto-slate [Alin Voinea - [`13dad5e`](https://github.com/eea/volto-slate-footnote/commit/13dad5ed23043fa7a24682e1ac6addc86632bfe0)]
|
|
175
170
|
### [4.0.1](https://github.com/eea/volto-slate-footnote/compare/4.0.0...4.0.1) - 29 September 2021
|
|
176
171
|
|
|
@@ -178,7 +173,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
178
173
|
|
|
179
174
|
#### :hammer_and_wrench: Others
|
|
180
175
|
|
|
181
|
-
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`80a159b`](https://github.com/eea/volto-slate-footnote/commit/80a159bb67698cddedadc494e7ae2da32a96faea)]
|
|
182
176
|
### [3.2.0](https://github.com/eea/volto-slate-footnote/compare/3.1.1...3.2.0) - 13 September 2021
|
|
183
177
|
|
|
184
178
|
#### :hammer_and_wrench: Others
|
|
@@ -191,7 +185,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
191
185
|
- Remove console.log [Alin Voinea - [`b5d83e7`](https://github.com/eea/volto-slate-footnote/commit/b5d83e7c13240151f602d122ecf09ba9b8e335f3)]
|
|
192
186
|
- Fix slate json field default value in DX layout [Alin Voinea - [`f2805bb`](https://github.com/eea/volto-slate-footnote/commit/f2805bbc15c51ebd914ee5f4eb9dd34ef32e095b)]
|
|
193
187
|
- Fix cypress api_url [Alin Voinea - [`6a4966a`](https://github.com/eea/volto-slate-footnote/commit/6a4966a2f92e932e1d0df35351989cda535f15c8)]
|
|
194
|
-
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`aed3984`](https://github.com/eea/volto-slate-footnote/commit/aed39840ecd467689eaf0adb352bd00ce95bdbbe)]
|
|
195
188
|
### [3.1.0](https://github.com/eea/volto-slate-footnote/compare/3.0.0...3.1.0) - 9 September 2021
|
|
196
189
|
|
|
197
190
|
#### :hammer_and_wrench: Others
|
|
@@ -212,7 +205,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
212
205
|
- Bump version to 2.4.0 [Alin Voinea - [`bef0d34`](https://github.com/eea/volto-slate-footnote/commit/bef0d34c2b9c20915578ffaefb4fd30cbf42f0a1)]
|
|
213
206
|
- Fix Slate point from DOM crash [Alin Voinea - [`c852f79`](https://github.com/eea/volto-slate-footnote/commit/c852f7987ffe8db433235b70792002d40ade690f)]
|
|
214
207
|
- Fix crash on copy&paste beforeInsert condition [Alin Voinea - [`85172cf`](https://github.com/eea/volto-slate-footnote/commit/85172cff3e2ea95a86d4b4fb452f3c0287b80e8f)]
|
|
215
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`b471c41`](https://github.com/eea/volto-slate-footnote/commit/b471c418d198b1bde95acfe0b256f642bacc6865)]
|
|
216
208
|
### [2.3.1](https://github.com/eea/volto-slate-footnote/compare/2.3.0...2.3.1) - 25 June 2021
|
|
217
209
|
|
|
218
210
|
### [2.3.0](https://github.com/eea/volto-slate-footnote/compare/2.2.2...2.3.0) - 12 June 2021
|
package/Jenkinsfile
CHANGED
|
@@ -9,7 +9,7 @@ pipeline {
|
|
|
9
9
|
environment {
|
|
10
10
|
GIT_NAME = "volto-slate-footnote"
|
|
11
11
|
NAMESPACE = "@eeacms"
|
|
12
|
-
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en"
|
|
12
|
+
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu"
|
|
13
13
|
DEPENDENCIES = ""
|
|
14
14
|
BACKEND_PROFILES = "eea.kitkat:testing"
|
|
15
15
|
BACKEND_ADDONS = ""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
openAccordionOrTabIfContainsFootnoteReference,
|
|
4
4
|
getAllBlocksAndSlateFields,
|
|
5
5
|
makeFootnoteListOfUniqueItems,
|
|
6
6
|
makeFootnote,
|
|
@@ -107,7 +107,7 @@ const FootnotesBlockView = (props) => {
|
|
|
107
107
|
href={`#ref-${parentUid || uid}`}
|
|
108
108
|
aria-label="Back to content"
|
|
109
109
|
onClick={() =>
|
|
110
|
-
|
|
110
|
+
openAccordionOrTabIfContainsFootnoteReference(
|
|
111
111
|
`#ref-${parentUid || uid}`,
|
|
112
112
|
)
|
|
113
113
|
}
|
|
@@ -122,7 +122,7 @@ const FootnotesBlockView = (props) => {
|
|
|
122
122
|
href={`#ref-${ref}`}
|
|
123
123
|
aria-label="Back to content"
|
|
124
124
|
onClick={() =>
|
|
125
|
-
|
|
125
|
+
openAccordionOrTabIfContainsFootnoteReference(
|
|
126
126
|
`#ref-${ref}`,
|
|
127
127
|
)
|
|
128
128
|
}
|
|
@@ -139,7 +139,7 @@ const FootnotesBlockView = (props) => {
|
|
|
139
139
|
href={`#ref-${parentUid || uid}`}
|
|
140
140
|
aria-label="Back to content"
|
|
141
141
|
onClick={() =>
|
|
142
|
-
|
|
142
|
+
openAccordionOrTabIfContainsFootnoteReference(
|
|
143
143
|
`#ref-${parentUid || uid}`,
|
|
144
144
|
)
|
|
145
145
|
}
|
package/src/editor/render.jsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useEditorContext } from '@plone/volto-slate/hooks';
|
|
|
4
4
|
import { getAllBlocksAndSlateFields } from '@eeacms/volto-slate-footnote/editor/utils';
|
|
5
5
|
import {
|
|
6
6
|
makeFootnoteListOfUniqueItems,
|
|
7
|
-
|
|
7
|
+
openAccordionOrTabIfContainsFootnoteReference,
|
|
8
8
|
} from './utils';
|
|
9
9
|
import { isEmpty } from 'lodash';
|
|
10
10
|
import { useSelector } from 'react-redux';
|
|
@@ -24,7 +24,7 @@ export const FootnoteElement = (props) => {
|
|
|
24
24
|
const { data = {} } = element;
|
|
25
25
|
const { uid, zoteroId } = data;
|
|
26
26
|
const editor = useEditorContext();
|
|
27
|
-
const ref = React.useRef(
|
|
27
|
+
const ref = React.useRef();
|
|
28
28
|
|
|
29
29
|
const initialFormData = useSelector((state) => state?.content?.data || {});
|
|
30
30
|
const blockProps = editor?.getBlockProps ? editor.getBlockProps() : null;
|
|
@@ -112,7 +112,7 @@ export const FootnoteElement = (props) => {
|
|
|
112
112
|
as={UniversalLink}
|
|
113
113
|
href={`#footnote-${citationRefId}`}
|
|
114
114
|
onClick={() =>
|
|
115
|
-
|
|
115
|
+
openAccordionOrTabIfContainsFootnoteReference(
|
|
116
116
|
`#footnote-${citationRefId}`,
|
|
117
117
|
)
|
|
118
118
|
}
|
|
@@ -134,7 +134,7 @@ export const FootnoteElement = (props) => {
|
|
|
134
134
|
as={UniversalLink}
|
|
135
135
|
href={`#footnote-${item.zoteroId || item.uid}`}
|
|
136
136
|
onClick={() =>
|
|
137
|
-
|
|
137
|
+
openAccordionOrTabIfContainsFootnoteReference(
|
|
138
138
|
`#footnote-${item.zoteroId || item.uid}`,
|
|
139
139
|
)
|
|
140
140
|
}
|
|
@@ -176,7 +176,7 @@ export const FootnoteElement = (props) => {
|
|
|
176
176
|
as={UniversalLink}
|
|
177
177
|
href={`#footnote-${citationRefId}`}
|
|
178
178
|
onClick={() =>
|
|
179
|
-
|
|
179
|
+
openAccordionOrTabIfContainsFootnoteReference(
|
|
180
180
|
`#footnote-${citationRefId}`,
|
|
181
181
|
)
|
|
182
182
|
}
|
|
@@ -198,7 +198,7 @@ export const FootnoteElement = (props) => {
|
|
|
198
198
|
as={UniversalLink}
|
|
199
199
|
href={`#footnote-${item.zoteroId || item.uid}`}
|
|
200
200
|
onClick={() =>
|
|
201
|
-
|
|
201
|
+
openAccordionOrTabIfContainsFootnoteReference(
|
|
202
202
|
`#footnote-${item.zoteroId || item.uid}`,
|
|
203
203
|
)
|
|
204
204
|
}
|
package/src/editor/utils.js
CHANGED
|
@@ -46,15 +46,34 @@ const retriveValuesOfSlateFromNestedPath = (path, value) => {
|
|
|
46
46
|
* Will open accordion if contains footnote reference
|
|
47
47
|
* @param {string} footnoteId
|
|
48
48
|
*/
|
|
49
|
-
export const
|
|
49
|
+
export const openAccordionOrTabIfContainsFootnoteReference = (footnoteId) => {
|
|
50
50
|
if (typeof window !== 'undefined') {
|
|
51
51
|
const footnote = document.querySelector(footnoteId);
|
|
52
|
+
|
|
52
53
|
if (footnote !== null && footnote.closest('.accordion') !== null) {
|
|
53
54
|
const comp = footnote.closest('.accordion').querySelector('.title');
|
|
54
55
|
if (!comp.className.includes('active')) {
|
|
55
56
|
comp.click();
|
|
56
57
|
}
|
|
57
58
|
}
|
|
59
|
+
|
|
60
|
+
if (footnote !== null && footnote.closest('.tab-name') !== null) {
|
|
61
|
+
const idOfTabBlock = footnote.closest('.tabs-block').id;
|
|
62
|
+
|
|
63
|
+
const idOfTabPanel = footnote.closest('.tab-name').id;
|
|
64
|
+
const allTabs = document
|
|
65
|
+
.getElementById(idOfTabBlock)
|
|
66
|
+
.getElementsByClassName('menu-item-text');
|
|
67
|
+
|
|
68
|
+
(Array.from(allTabs) || []).forEach((tab) => {
|
|
69
|
+
if (
|
|
70
|
+
tab.textContent === idOfTabPanel &&
|
|
71
|
+
!tab.parentElement.classList.contains('active')
|
|
72
|
+
) {
|
|
73
|
+
tab.parentElement.click();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
58
77
|
}
|
|
59
78
|
|
|
60
79
|
return true;
|
package/src/editor/utils.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeFootnote,
|
|
3
|
-
|
|
3
|
+
openAccordionOrTabIfContainsFootnoteReference,
|
|
4
4
|
getAllBlocksAndSlateFields,
|
|
5
5
|
} from './utils';
|
|
6
6
|
import { getAllBlocks } from '@plone/volto-slate/utils';
|
|
@@ -22,7 +22,7 @@ describe('makeFootnote', () => {
|
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
describe('
|
|
25
|
+
describe('openAccordionOrTabIfContainsFootnoteReference', () => {
|
|
26
26
|
it('should open accordion if it contains footnote reference', () => {
|
|
27
27
|
document.body.innerHTML = `
|
|
28
28
|
<div class="accordion">
|
|
@@ -34,7 +34,7 @@ describe('openAccordionIfContainsFootnoteReference', () => {
|
|
|
34
34
|
const title = document.querySelector('.title');
|
|
35
35
|
title.click = jest.fn();
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
openAccordionOrTabIfContainsFootnoteReference('#footnote');
|
|
38
38
|
|
|
39
39
|
expect(title.click).toHaveBeenCalled();
|
|
40
40
|
});
|
|
@@ -49,7 +49,7 @@ describe('openAccordionIfContainsFootnoteReference', () => {
|
|
|
49
49
|
const title = document.querySelector('.title');
|
|
50
50
|
title.click = jest.fn();
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
openAccordionOrTabIfContainsFootnoteReference('#footnote');
|
|
53
53
|
|
|
54
54
|
expect(title.click).not.toHaveBeenCalled();
|
|
55
55
|
});
|