@eeacms/volto-cca-policy 0.3.64 → 0.3.66
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 +83 -0
- package/locales/bg/LC_MESSAGES/volto.po +31 -39
- package/locales/cs/LC_MESSAGES/volto.po +31 -39
- package/locales/da/LC_MESSAGES/volto.po +31 -39
- package/locales/de/LC_MESSAGES/volto.po +31 -39
- package/locales/el/LC_MESSAGES/volto.po +31 -39
- package/locales/en/LC_MESSAGES/volto.po +31 -38
- package/locales/es/LC_MESSAGES/volto.po +31 -39
- package/locales/et/LC_MESSAGES/volto.po +31 -39
- package/locales/fi/LC_MESSAGES/volto.po +31 -39
- package/locales/fr/LC_MESSAGES/volto.po +31 -39
- package/locales/ga/LC_MESSAGES/volto.po +31 -39
- package/locales/hr/LC_MESSAGES/volto.po +31 -39
- package/locales/hu/LC_MESSAGES/volto.po +31 -39
- package/locales/is/LC_MESSAGES/volto.po +31 -39
- package/locales/it/LC_MESSAGES/volto.po +31 -39
- package/locales/lt/LC_MESSAGES/volto.po +31 -39
- package/locales/lv/LC_MESSAGES/volto.po +31 -39
- package/locales/mt/LC_MESSAGES/volto.po +31 -39
- package/locales/nl/LC_MESSAGES/volto.po +31 -39
- package/locales/nn/LC_MESSAGES/volto.po +31 -39
- package/locales/pl/LC_MESSAGES/volto.po +31 -39
- package/locales/pt/LC_MESSAGES/volto.po +31 -39
- package/locales/ro/LC_MESSAGES/volto.po +31 -39
- package/locales/sk/LC_MESSAGES/volto.po +31 -39
- package/locales/sl/LC_MESSAGES/volto.po +31 -39
- package/locales/sv/LC_MESSAGES/volto.po +31 -39
- package/locales/tr/LC_MESSAGES/volto.po +309 -351
- package/locales/volto.pot +22 -39
- package/package.json +2 -2
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +6 -6
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.test.jsx +2 -2
- package/src/components/theme/Header/Header.jsx +49 -28
- package/src/components/theme/Header/LanguageSwitch.jsx +41 -68
- package/src/components/theme/ImageGallery/ImageGallery.jsx +2 -2
- package/src/components/theme/ImageGallery/ImageGallery.test.jsx +38 -0
- package/src/components/theme/MissionSignatoryProfile/TabSections/PlanningTab.test.jsx +3 -2
- package/src/components/theme/PortalMessage/PortalMessage.jsx +6 -4
- package/src/components/theme/PortalMessage/PortalMessage.test.jsx +24 -0
- package/src/components/theme/Widgets/PromotionalImageWidget.jsx +35 -13
- package/src/components/theme/Widgets/PromotionalImageWidget.test.jsx +1 -1
- package/src/customizations/volto/components/theme/View/DefaultView.jsx +5 -1
- package/src/index.js +3 -3
- package/src/utils.js +11 -6
- package/theme/extras/header.overrides +14 -0
|
@@ -72,6 +72,24 @@ const messages = defineMessages({
|
|
|
72
72
|
* ```
|
|
73
73
|
*
|
|
74
74
|
*/
|
|
75
|
+
function parseDataURL(dataUrl) {
|
|
76
|
+
if (!dataUrl.startsWith('data:')) return null;
|
|
77
|
+
|
|
78
|
+
const commaIndex = dataUrl.indexOf(',');
|
|
79
|
+
if (commaIndex === -1) return null;
|
|
80
|
+
|
|
81
|
+
const meta = dataUrl.slice(5, commaIndex);
|
|
82
|
+
const data = dataUrl.slice(commaIndex + 1);
|
|
83
|
+
|
|
84
|
+
const [contentType, encoding] = meta.split(';');
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
'content-type': contentType || '',
|
|
88
|
+
encoding: encoding || '',
|
|
89
|
+
data: data || '',
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
75
93
|
const FileWidget = (props) => {
|
|
76
94
|
const { id, value, onChange, isDisabled } = props;
|
|
77
95
|
const [fileType, setFileType] = React.useState(false);
|
|
@@ -99,27 +117,31 @@ const FileWidget = (props) => {
|
|
|
99
117
|
const file = files[0];
|
|
100
118
|
if (!validateFileUploadSize(file, intl.formatMessage)) return;
|
|
101
119
|
readAsDataURL(file).then((data) => {
|
|
102
|
-
const fields =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
120
|
+
const fields = parseDataURL(data);
|
|
121
|
+
if (fields) {
|
|
122
|
+
onChange(id, {
|
|
123
|
+
data: fields.data,
|
|
124
|
+
encoding: fields.encoding,
|
|
125
|
+
'content-type': fields['content-type'],
|
|
126
|
+
filename: file.name,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
109
129
|
});
|
|
110
130
|
|
|
111
|
-
|
|
131
|
+
const reader = new FileReader();
|
|
112
132
|
reader.onload = function () {
|
|
113
|
-
const
|
|
114
|
-
if (imageMimetypes.includes(
|
|
133
|
+
const parsed = parseDataURL(reader.result);
|
|
134
|
+
if (parsed && imageMimetypes.includes(parsed['content-type'])) {
|
|
115
135
|
setFileType(true);
|
|
116
|
-
|
|
117
|
-
imagePreview
|
|
136
|
+
const imagePreview = document.getElementById(`field-${id}-image`);
|
|
137
|
+
if (imagePreview) {
|
|
138
|
+
imagePreview.src = reader.result;
|
|
139
|
+
}
|
|
118
140
|
} else {
|
|
119
141
|
setFileType(false);
|
|
120
142
|
}
|
|
121
143
|
};
|
|
122
|
-
reader.readAsDataURL(
|
|
144
|
+
reader.readAsDataURL(file);
|
|
123
145
|
};
|
|
124
146
|
|
|
125
147
|
return (
|
|
@@ -24,6 +24,7 @@ import ContextNavigation from '@plone/volto/components/theme/Navigation/ContextN
|
|
|
24
24
|
import {
|
|
25
25
|
BannerTitle,
|
|
26
26
|
ASTNavigation,
|
|
27
|
+
PortalMessage,
|
|
27
28
|
} from '@eeacms/volto-cca-policy/components';
|
|
28
29
|
|
|
29
30
|
import { isEqual } from 'lodash';
|
|
@@ -92,6 +93,7 @@ const DefaultView = (props) => {
|
|
|
92
93
|
<>
|
|
93
94
|
{currentNavigation ? (
|
|
94
95
|
<Container id="page-document">
|
|
96
|
+
<PortalMessage content={content} />
|
|
95
97
|
<Grid>
|
|
96
98
|
<Grid.Column width={12 - gridColumns}>
|
|
97
99
|
<BannerTitle {...props} />
|
|
@@ -113,6 +115,7 @@ const DefaultView = (props) => {
|
|
|
113
115
|
</Container>
|
|
114
116
|
) : astNavigation ? (
|
|
115
117
|
<Container id="page-document">
|
|
118
|
+
<PortalMessage content={content} />
|
|
116
119
|
<Grid>
|
|
117
120
|
<Grid.Column mobile={12} tablet={12} computer={4}>
|
|
118
121
|
<ASTNavigation astNavigation={astNavigation} />
|
|
@@ -124,7 +127,8 @@ const DefaultView = (props) => {
|
|
|
124
127
|
</Grid>
|
|
125
128
|
</Container>
|
|
126
129
|
) : (
|
|
127
|
-
<Container id="page-document"
|
|
130
|
+
<Container id="page-document">
|
|
131
|
+
<PortalMessage content={content} />
|
|
128
132
|
{!isChromeless && <BannerTitle {...props} />}
|
|
129
133
|
<RenderBlocks {...props} path={path} />
|
|
130
134
|
</Container>
|
package/src/index.js
CHANGED
|
@@ -522,7 +522,7 @@ const applyConfig = (config) => {
|
|
|
522
522
|
},
|
|
523
523
|
{
|
|
524
524
|
match: {
|
|
525
|
-
path:
|
|
525
|
+
path: /^.*\/add$/,
|
|
526
526
|
},
|
|
527
527
|
component: RedirectToLogin,
|
|
528
528
|
},
|
|
@@ -532,13 +532,13 @@ const applyConfig = (config) => {
|
|
|
532
532
|
...config.settings.apiExpanders,
|
|
533
533
|
{
|
|
534
534
|
match: {
|
|
535
|
-
path:
|
|
535
|
+
path: /\/policy-context\/country-profiles\/.+/,
|
|
536
536
|
},
|
|
537
537
|
GET_CONTENT: ['siblings'],
|
|
538
538
|
},
|
|
539
539
|
{
|
|
540
540
|
match: {
|
|
541
|
-
path:
|
|
541
|
+
path: /\/countries-regions\/countries\/.+/,
|
|
542
542
|
},
|
|
543
543
|
GET_CONTENT: ['siblings'],
|
|
544
544
|
},
|
package/src/utils.js
CHANGED
|
@@ -101,6 +101,15 @@ export const formatTextToHTML = (text) => {
|
|
|
101
101
|
: `<p>${formattedText}</p>`;
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
+
const trimTrailingChars = (str) => {
|
|
105
|
+
const charsToTrim = ['-', '–', ';', ',', ':', ' '];
|
|
106
|
+
let end = str.length;
|
|
107
|
+
while (end > 0 && charsToTrim.includes(str[end - 1])) {
|
|
108
|
+
end--;
|
|
109
|
+
}
|
|
110
|
+
return str.substring(0, end);
|
|
111
|
+
};
|
|
112
|
+
|
|
104
113
|
export const extractPlanNameAndURL = (text) => {
|
|
105
114
|
if (!text) return { name: '', url: '' };
|
|
106
115
|
|
|
@@ -114,12 +123,8 @@ export const extractPlanNameAndURL = (text) => {
|
|
|
114
123
|
|
|
115
124
|
if (url) {
|
|
116
125
|
// Remove URL and any punctuation before it
|
|
117
|
-
name = name
|
|
118
|
-
|
|
119
|
-
.replace(url, '')
|
|
120
|
-
.replace(/[-–;,:\s]+$/, '')
|
|
121
|
-
.replace(/[-–;,:\s]+$/, '')
|
|
122
|
-
.trim();
|
|
126
|
+
name = name.replace(`(${url})`, '').replace(url, '');
|
|
127
|
+
name = trimTrailingChars(name).trim();
|
|
123
128
|
}
|
|
124
129
|
|
|
125
130
|
return {
|