@eeacms/volto-slate-footnote 6.1.3 → 6.1.4
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
CHANGED
|
@@ -4,6 +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
|
+
### [6.1.4](https://github.com/eea/volto-slate-footnote/compare/6.1.3...6.1.4) - 1 September 2023
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix: force footnotes to open in the same tab - refs #257251 [dobri1408 - [`20bb988`](https://github.com/eea/volto-slate-footnote/commit/20bb988534413a837786ab10cc09244498dbcb7e)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- increase code coverage [Dobricean Ioan Dorian - [`3ba3ef3`](https://github.com/eea/volto-slate-footnote/commit/3ba3ef3187b1119d7be96ac2f952a36368163b97)]
|
|
7
16
|
### [6.1.3](https://github.com/eea/volto-slate-footnote/compare/6.1.2...6.1.3) - 30 August 2023
|
|
8
17
|
|
|
9
18
|
#### :bug: Bug Fixes
|
|
@@ -44,6 +44,28 @@ describe('Slate citations', () => {
|
|
|
44
44
|
cy.get('[aria-label="Back to content"]').first().click();
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
it('Test cancel Button', () => {
|
|
48
|
+
cy.getSlateEditorAndType('Colorless green ideas sleep furiously.')
|
|
49
|
+
.type('{selectAll}')
|
|
50
|
+
.dblclick();
|
|
51
|
+
|
|
52
|
+
// Footnote
|
|
53
|
+
cy.setSlateCursor('Colorless').dblclick();
|
|
54
|
+
cy.setSlateSelection('Colorless', 'green');
|
|
55
|
+
cy.clickSlateButton('Footnote');
|
|
56
|
+
|
|
57
|
+
cy.get('.sidebar-container .field-wrapper-footnote .react-select-container')
|
|
58
|
+
.click()
|
|
59
|
+
.type('Citation{enter}');
|
|
60
|
+
|
|
61
|
+
//click on the cancel button
|
|
62
|
+
cy.get('.sidebar-container .form .header button').first().next().click();
|
|
63
|
+
|
|
64
|
+
// Save
|
|
65
|
+
cy.get('#toolbar-save').click();
|
|
66
|
+
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
|
|
67
|
+
});
|
|
68
|
+
|
|
47
69
|
it('Add Footnotes block and create multiple citations', () => {
|
|
48
70
|
// Complete chained commands
|
|
49
71
|
cy.getSlateEditorAndType('Colorless green ideas sleep furiously.')
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
openAccordionIfContainsFootnoteReference,
|
|
4
4
|
getAllBlocksAndSlateFields,
|
|
@@ -7,6 +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
|
+
|
|
10
12
|
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -20,18 +22,10 @@ const alphabet = 'abcdefghijklmnopqrstuvwxyz';
|
|
|
20
22
|
const FootnotesBlockView = (props) => {
|
|
21
23
|
const { data, properties } = props;
|
|
22
24
|
const { title, global, placeholder = 'Footnotes' } = data;
|
|
23
|
-
const [notesObj, setNodesObjs] = useState(null);
|
|
24
25
|
const metadata = props.metadata ? props.metadata : properties;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const globalMetadata = global ? metadata : properties;
|
|
29
|
-
const blocks = getAllBlocksAndSlateFields(globalMetadata);
|
|
30
|
-
const notesObjResult = makeFootnoteListOfUniqueItems(blocks);
|
|
31
|
-
|
|
32
|
-
setNodesObjs(notesObjResult);
|
|
33
|
-
}
|
|
34
|
-
}, [properties]); // eslint-disable-line
|
|
26
|
+
const globalMetadata = global ? metadata : properties;
|
|
27
|
+
const blocks = getAllBlocksAndSlateFields(globalMetadata);
|
|
28
|
+
const notesObj = makeFootnoteListOfUniqueItems(blocks);
|
|
35
29
|
|
|
36
30
|
return (
|
|
37
31
|
<div className="footnotes-listing-block">
|
|
@@ -62,7 +56,7 @@ const FootnotesBlockView = (props) => {
|
|
|
62
56
|
id={`cite_ref-${refsList[0]}`}
|
|
63
57
|
key={`indice-${refsList[0]}`}
|
|
64
58
|
>
|
|
65
|
-
<
|
|
59
|
+
<UniversalLink
|
|
66
60
|
href={`#ref-${parentUid || uid}`}
|
|
67
61
|
aria-label="Back to content"
|
|
68
62
|
onClick={() =>
|
|
@@ -72,12 +66,12 @@ const FootnotesBlockView = (props) => {
|
|
|
72
66
|
}
|
|
73
67
|
>
|
|
74
68
|
{alphabet[0]}
|
|
75
|
-
</
|
|
69
|
+
</UniversalLink>{' '}
|
|
76
70
|
</sup>
|
|
77
71
|
{/** following refs will have the uid of the one that references it*/}
|
|
78
72
|
{refsList.slice(1).map((ref, index) => (
|
|
79
73
|
<sup id={`cite_ref-${ref}`} key={`indice-${ref}`}>
|
|
80
|
-
<
|
|
74
|
+
<UniversalLink
|
|
81
75
|
href={`#ref-${ref}`}
|
|
82
76
|
aria-label="Back to content"
|
|
83
77
|
onClick={() =>
|
|
@@ -87,14 +81,14 @@ const FootnotesBlockView = (props) => {
|
|
|
87
81
|
}
|
|
88
82
|
>
|
|
89
83
|
{alphabet[index + 1]}
|
|
90
|
-
</
|
|
84
|
+
</UniversalLink>{' '}
|
|
91
85
|
</sup>
|
|
92
86
|
))}
|
|
93
87
|
</>
|
|
94
88
|
) : (
|
|
95
89
|
<sup id={`cite_ref-${uid}`}>
|
|
96
90
|
{/** some footnotes are never parent so we need the parent to reference */}
|
|
97
|
-
<
|
|
91
|
+
<UniversalLink
|
|
98
92
|
href={`#ref-${parentUid || uid}`}
|
|
99
93
|
aria-label="Back to content"
|
|
100
94
|
onClick={() =>
|
|
@@ -104,7 +98,7 @@ const FootnotesBlockView = (props) => {
|
|
|
104
98
|
}
|
|
105
99
|
>
|
|
106
100
|
↵
|
|
107
|
-
</
|
|
101
|
+
</UniversalLink>{' '}
|
|
108
102
|
</sup>
|
|
109
103
|
)}
|
|
110
104
|
</li>
|
package/src/editor/render.jsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from './utils';
|
|
9
9
|
import { isEmpty } from 'lodash';
|
|
10
10
|
import { useSelector } from 'react-redux';
|
|
11
|
+
import { UniversalLink } from '@plone/volto/components';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Removes '<?xml version="1.0"?>' from footnote
|
|
@@ -110,7 +111,7 @@ export const FootnoteElement = (props) => {
|
|
|
110
111
|
<Popup.Content>
|
|
111
112
|
<List divided relaxed selection>
|
|
112
113
|
<List.Item
|
|
113
|
-
as=
|
|
114
|
+
as={UniversalLink}
|
|
114
115
|
href={`#footnote-${citationRefId}`}
|
|
115
116
|
onClick={() =>
|
|
116
117
|
openAccordionIfContainsFootnoteReference(
|
|
@@ -132,7 +133,7 @@ export const FootnoteElement = (props) => {
|
|
|
132
133
|
{data.extra &&
|
|
133
134
|
data.extra.map((item) => (
|
|
134
135
|
<List.Item
|
|
135
|
-
as=
|
|
136
|
+
as={UniversalLink}
|
|
136
137
|
href={`#footnote-${item.zoteroId || item.uid}`}
|
|
137
138
|
onClick={() =>
|
|
138
139
|
openAccordionIfContainsFootnoteReference(
|
|
@@ -174,7 +175,7 @@ export const FootnoteElement = (props) => {
|
|
|
174
175
|
<Popup.Content>
|
|
175
176
|
<List divided relaxed selection>
|
|
176
177
|
<List.Item
|
|
177
|
-
as=
|
|
178
|
+
as={UniversalLink}
|
|
178
179
|
href={`#footnote-${citationRefId}`}
|
|
179
180
|
onClick={() =>
|
|
180
181
|
openAccordionIfContainsFootnoteReference(
|
|
@@ -196,7 +197,7 @@ export const FootnoteElement = (props) => {
|
|
|
196
197
|
{data.extra &&
|
|
197
198
|
data.extra.map((item) => (
|
|
198
199
|
<List.Item
|
|
199
|
-
as=
|
|
200
|
+
as={UniversalLink}
|
|
200
201
|
href={`#footnote-${item.zoteroId || item.uid}`}
|
|
201
202
|
onClick={() =>
|
|
202
203
|
openAccordionIfContainsFootnoteReference(
|