@eeacms/volto-eea-website-theme 1.28.0 → 1.28.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/CHANGELOG.md +23 -1
- package/README.md +3 -1
- package/package.json +2 -2
- package/src/components/manage/Blocks/LayoutSettings/index.js +0 -1
- package/src/customizations/@plone/volto-slate/editor/render.jsx +18 -4
- package/src/customizations/volto/components/manage/Form/Form.jsx +4 -0
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +1 -1
- package/src/customizations/volto/components/theme/View/EventDatesInfo.jsx +149 -0
- package/src/customizations/@plone/volto-slate/editor/extensions/normalizeExternalData.js +0 -9
package/CHANGELOG.md
CHANGED
@@ -4,7 +4,29 @@ 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
|
-
### [1.28.
|
7
|
+
### [1.28.2](https://github.com/eea/volto-eea-website-theme/compare/1.28.1...1.28.2) - 29 February 2024
|
8
|
+
|
9
|
+
#### :bug: Bug Fixes
|
10
|
+
|
11
|
+
- fix(event): add permalink in customization to the original volto component [kreafox - [`c662aae`](https://github.com/eea/volto-eea-website-theme/commit/c662aae7c271fa1170dd2dbd8cc9a374fed59a2f)]
|
12
|
+
|
13
|
+
#### :nail_care: Enhancements
|
14
|
+
|
15
|
+
- refactor: Remove volto-slate patch normalizeExternalData.js - requires Volto 16.28.1+ [alin - [`6ea61da`](https://github.com/eea/volto-eea-website-theme/commit/6ea61dabfae9a755f09dbd588a378c4a2b5338f5)]
|
16
|
+
|
17
|
+
#### :hammer_and_wrench: Others
|
18
|
+
|
19
|
+
- Allow hit Enter in the LayoutSettings block to create a new block [Tiberiu Ichim - [`ecde522`](https://github.com/eea/volto-eea-website-theme/commit/ecde52263ce6f989936962bda7bc1213b2750d7d)]
|
20
|
+
### [1.28.1](https://github.com/eea/volto-eea-website-theme/compare/1.28.0...1.28.1) - 19 February 2024
|
21
|
+
|
22
|
+
#### :bug: Bug Fixes
|
23
|
+
|
24
|
+
- fix: Don't crash when rendering invalid slate [Tiberiu Ichim - [`9b7bc96`](https://github.com/eea/volto-eea-website-theme/commit/9b7bc9622d55f0912f13252ef80255f9cbb778d5)]
|
25
|
+
|
26
|
+
#### :hammer_and_wrench: Others
|
27
|
+
|
28
|
+
- update readme [Razvan - [`ba82be2`](https://github.com/eea/volto-eea-website-theme/commit/ba82be250e82120958d18137c5972150db977b6b)]
|
29
|
+
### [1.28.0](https://github.com/eea/volto-eea-website-theme/compare/1.27.2...1.28.0) - 19 February 2024
|
8
30
|
|
9
31
|
#### :bug: Bug Fixes
|
10
32
|
|
package/README.md
CHANGED
@@ -27,7 +27,9 @@ See [Storybook](https://eea.github.io/eea-storybook/).
|
|
27
27
|
|
28
28
|
## Volto customizations
|
29
29
|
|
30
|
-
- `volto-slate/editor/SlateEditor` ->
|
30
|
+
- `volto-slate/editor/SlateEditor` -> When two slates looks at the same prop changing one slate and updating the other should be handled properly. This change makes replacing the old value of slate work in sync with the other slates that watches the same prop [ref](https://taskman.eionet.europa.eu/issues/264239#note-11).
|
31
|
+
|
32
|
+
**!!IMPORTANT**: This change requires volto@^16.26.1
|
31
33
|
|
32
34
|
- `volto/components/manage/Sidebar/SidebarPopup` -> https://github.com/plone/volto/pull/5520
|
33
35
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eeacms/volto-eea-website-theme",
|
3
|
-
"version": "1.28.
|
3
|
+
"version": "1.28.2",
|
4
4
|
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
@@ -79,4 +79,4 @@
|
|
79
79
|
"cypress:open": "make cypress-open",
|
80
80
|
"prepare": "husky install"
|
81
81
|
}
|
82
|
-
}
|
82
|
+
}
|
@@ -70,10 +70,11 @@ export const Leaf = ({ children, ...rest }) => {
|
|
70
70
|
typeof children === 'string' ? (
|
71
71
|
children.split('\n').map((t, i) => {
|
72
72
|
// Softbreak support. Should do a plugin?
|
73
|
+
const hasSoftBreak =
|
74
|
+
children.indexOf('\n') > -1 && children.split('\n').length - 1 > i;
|
73
75
|
return (
|
74
76
|
<React.Fragment key={`${i}`}>
|
75
|
-
{
|
76
|
-
children.split('\n').length - 1 > i ? (
|
77
|
+
{hasSoftBreak ? (
|
77
78
|
<>
|
78
79
|
{klass ? <span className={klass}>{t}</span> : t}
|
79
80
|
<br />
|
@@ -104,7 +105,20 @@ export const serializeNodes = (nodes, getAttributes, extras = {}) => {
|
|
104
105
|
const editor = { children: nodes || [] };
|
105
106
|
|
106
107
|
const _serializeNodes = (nodes) => {
|
107
|
-
return (nodes || []).map(([node, path]
|
108
|
+
return (nodes || []).map(([node, path]) => {
|
109
|
+
let _serialized;
|
110
|
+
const isTextNode = Text.isText(node);
|
111
|
+
try {
|
112
|
+
if (!isTextNode) {
|
113
|
+
_serialized = _serializeNodes(
|
114
|
+
Array.from(Node.children(editor, path)),
|
115
|
+
);
|
116
|
+
}
|
117
|
+
} catch {
|
118
|
+
// eslint-disable-next-line no-console
|
119
|
+
console.error('Error in serializing nodes', editor, path);
|
120
|
+
}
|
121
|
+
|
108
122
|
return Text.isText(node) ? (
|
109
123
|
<Leaf path={path} leaf={node} text={node} mode="view" key={path}>
|
110
124
|
{node.text}
|
@@ -125,7 +139,7 @@ export const serializeNodes = (nodes, getAttributes, extras = {}) => {
|
|
125
139
|
}
|
126
140
|
extras={extras}
|
127
141
|
>
|
128
|
-
{
|
142
|
+
{_serialized}
|
129
143
|
</Element>
|
130
144
|
);
|
131
145
|
});
|
@@ -138,6 +138,10 @@ class Form extends Component {
|
|
138
138
|
text: uuid(),
|
139
139
|
};
|
140
140
|
let { formData } = props;
|
141
|
+
// TODO Tiberiu: customized here
|
142
|
+
formData = formData || {}; // when coming from login screen, formData is null
|
143
|
+
// this fixes a bug where, if you go to an /edit page, it will show login (you need to wait the 5 seconds timeout), after login you get redirected back to the edit, then it crashes
|
144
|
+
// end customized
|
141
145
|
const blocksFieldname = getBlocksFieldname(formData);
|
142
146
|
const blocksLayoutFieldname = getBlocksLayoutFieldname(formData);
|
143
147
|
|
@@ -0,0 +1,149 @@
|
|
1
|
+
/* Original: https://github.com/plone/volto/blob/16.x.x/src/components/theme/View/EventDatesInfo.jsx */
|
2
|
+
|
3
|
+
import React from 'react';
|
4
|
+
import PropTypes from 'prop-types';
|
5
|
+
import { List } from 'semantic-ui-react';
|
6
|
+
import cx from 'classnames';
|
7
|
+
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
8
|
+
import config from '@plone/volto/registry';
|
9
|
+
// import { toBackendLang } from '@plone/volto/helpers';
|
10
|
+
// import { useSelector } from 'react-redux';
|
11
|
+
|
12
|
+
export const datesForDisplay = (start, end, moment) => {
|
13
|
+
const mStart = moment(start);
|
14
|
+
const mEnd = moment(end);
|
15
|
+
if (!mStart.isValid() || !mEnd.isValid()) {
|
16
|
+
return null;
|
17
|
+
}
|
18
|
+
const sameDay = mStart.isSame(mEnd, 'day');
|
19
|
+
const sameTime = mStart.isSame(mEnd, 'minute');
|
20
|
+
return {
|
21
|
+
sameDay,
|
22
|
+
sameTime,
|
23
|
+
startDate: mStart.format('ll'),
|
24
|
+
startTime: mStart.format('LT'),
|
25
|
+
endDate: mEnd.format('ll'),
|
26
|
+
endTime: mEnd.format('LT'),
|
27
|
+
};
|
28
|
+
};
|
29
|
+
|
30
|
+
const When_ = ({ start, end, whole_day, open_end, moment: momentlib }) => {
|
31
|
+
// Customization:
|
32
|
+
// Fix date format by using dateLocale instead of language from Redux
|
33
|
+
// const lang = useSelector((state) => state.intl.locale);
|
34
|
+
const dateLocale = config.settings.dateLocale || 'en-gb';
|
35
|
+
|
36
|
+
const moment = momentlib.default;
|
37
|
+
moment.locale(dateLocale);
|
38
|
+
// end customization
|
39
|
+
|
40
|
+
const datesInfo = datesForDisplay(start, end, moment);
|
41
|
+
if (!datesInfo) {
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
// TODO I18N INTL
|
45
|
+
|
46
|
+
return (
|
47
|
+
<p
|
48
|
+
className={cx('event-when', {
|
49
|
+
'same-day': datesInfo.sameDay,
|
50
|
+
'same-time': datesInfo.sameTime,
|
51
|
+
'whole-day': whole_day,
|
52
|
+
'open-end': open_end,
|
53
|
+
})}
|
54
|
+
>
|
55
|
+
{!datesInfo.sameDay ? (
|
56
|
+
<>
|
57
|
+
<span className="start">
|
58
|
+
<span className="start-date">{datesInfo.startDate}</span>
|
59
|
+
{!whole_day && (
|
60
|
+
<>
|
61
|
+
{/* Plone has an optional word based on locale here */}
|
62
|
+
<span> </span>
|
63
|
+
<span className="start-time">{datesInfo.startTime}</span>
|
64
|
+
</>
|
65
|
+
)}
|
66
|
+
</span>
|
67
|
+
{!open_end && (
|
68
|
+
<>
|
69
|
+
to
|
70
|
+
<span className="end">
|
71
|
+
<span className="end-date">{datesInfo.endDate}</span>
|
72
|
+
{!whole_day && (
|
73
|
+
<>
|
74
|
+
{/* Plone has an optional word based on locale here */}
|
75
|
+
<span> </span>
|
76
|
+
<span className="end-time">{datesInfo.endTime}</span>
|
77
|
+
</>
|
78
|
+
)}
|
79
|
+
</span>
|
80
|
+
</>
|
81
|
+
)}
|
82
|
+
</>
|
83
|
+
) : (
|
84
|
+
<>
|
85
|
+
{whole_day && (
|
86
|
+
<span className="start-date">{datesInfo.startDate}</span>
|
87
|
+
)}
|
88
|
+
{open_end && !whole_day && (
|
89
|
+
<>
|
90
|
+
<span className="start-date">{datesInfo.startDate}</span>
|
91
|
+
from
|
92
|
+
<span className="start-time">{datesInfo.startTime}</span>
|
93
|
+
</>
|
94
|
+
)}
|
95
|
+
{!(whole_day || open_end) && (
|
96
|
+
<>
|
97
|
+
<span className="start-date">{datesInfo.startDate}</span>
|
98
|
+
from
|
99
|
+
<span className="start-time">{datesInfo.startTime}</span>
|
100
|
+
to
|
101
|
+
<span className="end-time">{datesInfo.endTime}</span>
|
102
|
+
</>
|
103
|
+
)}
|
104
|
+
</>
|
105
|
+
)}
|
106
|
+
</p>
|
107
|
+
);
|
108
|
+
};
|
109
|
+
|
110
|
+
export const When = injectLazyLibs(['moment'])(When_);
|
111
|
+
|
112
|
+
When.propTypes = {
|
113
|
+
start: PropTypes.string.isRequired,
|
114
|
+
end: PropTypes.string,
|
115
|
+
whole_day: PropTypes.bool,
|
116
|
+
open_end: PropTypes.bool,
|
117
|
+
};
|
118
|
+
|
119
|
+
export const Recurrence_ = ({
|
120
|
+
recurrence,
|
121
|
+
start,
|
122
|
+
moment: momentlib,
|
123
|
+
rrule,
|
124
|
+
}) => {
|
125
|
+
const moment = momentlib.default;
|
126
|
+
const { RRule, rrulestr } = rrule;
|
127
|
+
if (recurrence.indexOf('DTSTART') < 0) {
|
128
|
+
var dtstart = RRule.optionsToString({
|
129
|
+
dtstart: new Date(start),
|
130
|
+
});
|
131
|
+
recurrence = dtstart + '\n' + recurrence;
|
132
|
+
}
|
133
|
+
const rule = rrulestr(recurrence, { unfold: true, forceset: true });
|
134
|
+
|
135
|
+
return (
|
136
|
+
<List
|
137
|
+
items={rule
|
138
|
+
.all()
|
139
|
+
.map((date) => datesForDisplay(date, undefined, moment))
|
140
|
+
.map((date) => date.startDate)}
|
141
|
+
/>
|
142
|
+
);
|
143
|
+
};
|
144
|
+
export const Recurrence = injectLazyLibs(['moment', 'rrule'])(Recurrence_);
|
145
|
+
|
146
|
+
Recurrence.propTypes = {
|
147
|
+
recurrence: PropTypes.string.isRequired,
|
148
|
+
start: PropTypes.string.isRequired,
|
149
|
+
};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
// To be removed when https://github.com/plone/volto/pull/5347 is merged and released in Volto 16.x
|
2
|
-
import { normalizeExternalData as normalize } from '@plone/volto-slate/utils';
|
3
|
-
|
4
|
-
export function normalizeExternalData(editor) {
|
5
|
-
editor.normalizeExternalData = (fragment) => {
|
6
|
-
return normalize(editor, fragment);
|
7
|
-
};
|
8
|
-
return editor;
|
9
|
-
}
|