@plone/volto 16.16.0 → 17.0.0-alpha.1
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.draft +23 -1
- package/.storybook/main.js +53 -69
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +51 -3
- package/README.md +21 -19
- package/cypress/support/commands.js +7 -7
- package/cypress/support/guillotina.js +2 -2
- package/cypress/support/reset-fixture.js +2 -2
- package/cypress/support/upgradetests.js +1 -1
- package/cypress.config.js +1 -1
- package/docker-compose.yml +2 -3
- package/locales/pt_BR/LC_MESSAGES/volto.po +1 -1
- package/locales/pt_BR.json +1 -1
- package/locales/volto.pot +1 -1
- package/package.json +22 -20
- package/packages/volto-slate/package.json +1 -1
- package/razzle.config.js +3 -3
- package/src/components/manage/BlockChooser/BlockChooserButton.jsx +63 -29
- package/src/components/manage/BlockChooser/BlockChooserSearch.jsx +0 -1
- package/src/components/manage/Controlpanels/VersionOverview.jsx +6 -10
- package/src/components/manage/Diff/DiffField.jsx +6 -6
- package/src/components/theme/FormattedDate/FormattedDate.jsx +3 -3
- package/src/express-middleware/sitemap.js +1 -1
- package/src/helpers/Blocks/Blocks.test.js +50 -0
- package/src/helpers/Utils/Date.js +4 -2
- package/src/helpers/Utils/Date.test.js +3 -1
- package/src/helpers/index.js +0 -1
- package/theme/themes/pastanaga/extras/blocks.less +0 -9
- package/webpack-plugins/webpack-relative-resolver.js +33 -19
- package/webpack-plugins/webpack-root-resolver.js +25 -14
- package/webpack-plugins/webpack-svg-plugin.js +11 -4
- package/locales/fi/LC_MESSAGES/volto.po +0 -4611
|
@@ -7,14 +7,8 @@ import React from 'react';
|
|
|
7
7
|
import { FormattedMessage } from 'react-intl';
|
|
8
8
|
import { isEmpty } from 'lodash';
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
name as voltoName,
|
|
13
|
-
} from '../../../../package.json';
|
|
14
|
-
import {
|
|
15
|
-
version as projectVersion,
|
|
16
|
-
name as projectName,
|
|
17
|
-
} from '@root/../package.json';
|
|
10
|
+
import voltoPackageJson from '../../../../package.json';
|
|
11
|
+
import projectPackageJson from '@root/../package.json';
|
|
18
12
|
|
|
19
13
|
import { defineMessages, useIntl } from 'react-intl';
|
|
20
14
|
import config from '@plone/volto/registry';
|
|
@@ -26,6 +20,8 @@ const messages = defineMessages({
|
|
|
26
20
|
},
|
|
27
21
|
});
|
|
28
22
|
|
|
23
|
+
const voltoVersion = voltoPackageJson.version;
|
|
24
|
+
|
|
29
25
|
const VersionOverview = ({
|
|
30
26
|
cmf_version,
|
|
31
27
|
debug_mode,
|
|
@@ -37,7 +33,7 @@ const VersionOverview = ({
|
|
|
37
33
|
}) => {
|
|
38
34
|
const intl = useIntl();
|
|
39
35
|
const { addonsInfo } = config.settings;
|
|
40
|
-
const isProject =
|
|
36
|
+
const isProject = voltoPackageJson.name !== projectPackageJson.name;
|
|
41
37
|
|
|
42
38
|
return (
|
|
43
39
|
<>
|
|
@@ -50,7 +46,7 @@ const VersionOverview = ({
|
|
|
50
46
|
>
|
|
51
47
|
{isProject ? (
|
|
52
48
|
<li>
|
|
53
|
-
{
|
|
49
|
+
{projectPackageJson.name} {projectPackageJson.version}
|
|
54
50
|
</li>
|
|
55
51
|
) : null}
|
|
56
52
|
{voltoVersion && <li>Volto {voltoVersion}</li>}
|
|
@@ -61,12 +61,12 @@ const DiffField = ({
|
|
|
61
61
|
break;
|
|
62
62
|
case 'datetime':
|
|
63
63
|
parts = diffWords(
|
|
64
|
-
new Intl.DateTimeFormat(language, readable_date_format)
|
|
65
|
-
new Date(one)
|
|
66
|
-
|
|
67
|
-
new Intl.DateTimeFormat(language, readable_date_format)
|
|
68
|
-
new Date(two)
|
|
69
|
-
|
|
64
|
+
new Intl.DateTimeFormat(language, readable_date_format)
|
|
65
|
+
.format(new Date(one))
|
|
66
|
+
.replace('\u202F', ' '),
|
|
67
|
+
new Intl.DateTimeFormat(language, readable_date_format)
|
|
68
|
+
.format(new Date(two))
|
|
69
|
+
.replace('\u202F', ' '),
|
|
70
70
|
);
|
|
71
71
|
break;
|
|
72
72
|
case 'json':
|
|
@@ -23,9 +23,9 @@ const FormattedDate = ({
|
|
|
23
23
|
<time
|
|
24
24
|
className={className}
|
|
25
25
|
dateTime={date}
|
|
26
|
-
title={new Intl.DateTimeFormat(language, long_date_format)
|
|
27
|
-
new Date(toDate(date))
|
|
28
|
-
|
|
26
|
+
title={new Intl.DateTimeFormat(language, long_date_format)
|
|
27
|
+
.format(new Date(toDate(date)))
|
|
28
|
+
.replace('\u202F', ' ')}
|
|
29
29
|
>
|
|
30
30
|
{children
|
|
31
31
|
? children(
|
|
@@ -744,6 +744,56 @@ describe('Blocks', () => {
|
|
|
744
744
|
},
|
|
745
745
|
});
|
|
746
746
|
});
|
|
747
|
+
|
|
748
|
+
it('Sets data according to schema default values, keeps existing data', () => {
|
|
749
|
+
const schema = {
|
|
750
|
+
properties: {
|
|
751
|
+
style: {
|
|
752
|
+
widget: 'object',
|
|
753
|
+
schema: {
|
|
754
|
+
title: 'Style',
|
|
755
|
+
fieldsets: [
|
|
756
|
+
{
|
|
757
|
+
id: 'default',
|
|
758
|
+
fields: ['color', 'theme'],
|
|
759
|
+
title: 'Default',
|
|
760
|
+
},
|
|
761
|
+
],
|
|
762
|
+
properties: {
|
|
763
|
+
color: {
|
|
764
|
+
title: 'Color',
|
|
765
|
+
default: 'red',
|
|
766
|
+
},
|
|
767
|
+
theme: {
|
|
768
|
+
title: 'Theme',
|
|
769
|
+
default: 'primary',
|
|
770
|
+
},
|
|
771
|
+
},
|
|
772
|
+
required: [],
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
expect(
|
|
779
|
+
applySchemaDefaults({
|
|
780
|
+
schema,
|
|
781
|
+
data: {
|
|
782
|
+
'@type': 'slider',
|
|
783
|
+
style: {
|
|
784
|
+
theme: 'secondary',
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
intl: {},
|
|
788
|
+
}),
|
|
789
|
+
).toEqual({
|
|
790
|
+
'@type': 'slider',
|
|
791
|
+
style: {
|
|
792
|
+
color: 'red',
|
|
793
|
+
theme: 'secondary',
|
|
794
|
+
},
|
|
795
|
+
});
|
|
796
|
+
});
|
|
747
797
|
});
|
|
748
798
|
|
|
749
799
|
describe('applyBlockDefaults', () => {
|
|
@@ -48,7 +48,9 @@ export function formatDate({
|
|
|
48
48
|
: short_date_format;
|
|
49
49
|
|
|
50
50
|
const formatter = new Intl.DateTimeFormat(locale, format);
|
|
51
|
-
return formatToParts
|
|
51
|
+
return formatToParts
|
|
52
|
+
? formatter.formatToParts(date)
|
|
53
|
+
: formatter.format(date).replace('\u202F', ' ');
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export function formatRelativeDate({
|
|
@@ -93,5 +95,5 @@ export function formatRelativeDate({
|
|
|
93
95
|
? ''
|
|
94
96
|
: formatToParts
|
|
95
97
|
? formatter.formatToParts(v, tag)
|
|
96
|
-
: formatter.format(v, tag); // use "now" ?
|
|
98
|
+
: formatter.format(v, tag).replace('\u202F', ' '); // use "now" ?
|
|
97
99
|
}
|
|
@@ -192,6 +192,8 @@ describe('formatRelativeDate helper', () => {
|
|
|
192
192
|
it('can use alternate style narrow', () => {
|
|
193
193
|
const now = Date.now();
|
|
194
194
|
const d = new Date(now + 3 * MONTH);
|
|
195
|
-
expect(
|
|
195
|
+
expect(['in 3 mo.', 'in 3mo']).toContain(
|
|
196
|
+
formatRelativeDate({ date: d, style: 'narrow' }),
|
|
197
|
+
);
|
|
196
198
|
});
|
|
197
199
|
});
|
package/src/helpers/index.js
CHANGED
|
@@ -482,7 +482,6 @@ body.has-toolbar.has-sidebar-collapsed .ui.wrapper > .ui.inner.block.full {
|
|
|
482
482
|
border: none !important;
|
|
483
483
|
background: white !important;
|
|
484
484
|
border-radius: 50% !important;
|
|
485
|
-
transform: translateX(-50%);
|
|
486
485
|
}
|
|
487
486
|
|
|
488
487
|
&:not(.new-add-block) {
|
|
@@ -712,20 +711,12 @@ body.has-toolbar.has-sidebar-collapsed .ui.wrapper > .ui.inner.block.full {
|
|
|
712
711
|
}
|
|
713
712
|
|
|
714
713
|
.blocks-chooser {
|
|
715
|
-
position: absolute;
|
|
716
|
-
z-index: 10;
|
|
717
|
-
top: 100%;
|
|
718
|
-
left: 50%;
|
|
719
714
|
width: 310px;
|
|
720
715
|
padding: 4px;
|
|
721
716
|
background-color: rgba(255, 255, 255, 0.975);
|
|
722
717
|
border-radius: 2px;
|
|
723
718
|
box-shadow: 0 0 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
|
|
724
719
|
|
|
725
|
-
&.new-add-block {
|
|
726
|
-
transform: translate(-50%, 22px);
|
|
727
|
-
}
|
|
728
|
-
|
|
729
720
|
&:not(.new-add-block) {
|
|
730
721
|
top: -12px;
|
|
731
722
|
left: -9px;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
3
|
class RelativeResolverPlugin {
|
|
4
|
-
constructor(registry) {
|
|
4
|
+
constructor(registry, source, target) {
|
|
5
|
+
this.source = source || 'resolve';
|
|
6
|
+
this.target = target || 'resolve';
|
|
5
7
|
this.registry = registry;
|
|
6
8
|
this.voltoPaths = Object.assign(
|
|
7
9
|
{ '@plone/volto/': `${registry.voltoPath}/src` },
|
|
@@ -33,24 +35,36 @@ class RelativeResolverPlugin {
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
apply(resolver) {
|
|
36
|
-
resolver.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
var target = resolver.ensureHook(this.target);
|
|
39
|
+
resolver
|
|
40
|
+
.getHook(this.source)
|
|
41
|
+
.tapAsync(
|
|
42
|
+
'RelativeResolverPlugin',
|
|
43
|
+
(request, resolveContext, callback) => {
|
|
44
|
+
if (
|
|
45
|
+
request.request.startsWith('.') &&
|
|
46
|
+
request.context &&
|
|
47
|
+
request.context.issuer &&
|
|
48
|
+
this.isAddon(request)
|
|
49
|
+
) {
|
|
50
|
+
const normalizedResourceName = this.getResolvePath(request);
|
|
51
|
+
const nextRequest = Object.assign({}, request, {
|
|
52
|
+
request: normalizedResourceName,
|
|
53
|
+
path: this.registry.projectRootPath,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return resolver.doResolve(
|
|
57
|
+
target,
|
|
58
|
+
nextRequest,
|
|
59
|
+
null,
|
|
60
|
+
resolveContext,
|
|
61
|
+
callback,
|
|
62
|
+
);
|
|
63
|
+
} else {
|
|
64
|
+
callback();
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
);
|
|
54
68
|
}
|
|
55
69
|
}
|
|
56
70
|
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
3
|
class RootResolverPlugin {
|
|
4
|
+
constructor(source, target) {
|
|
5
|
+
this.source = source || 'resolve';
|
|
6
|
+
this.target = target || 'resolve';
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
apply(resolver) {
|
|
5
|
-
resolver.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
var target = resolver.ensureHook(this.target);
|
|
11
|
+
resolver
|
|
12
|
+
.getHook(this.source)
|
|
13
|
+
.tapAsync('RootResolverPlugin', (request, resolveContext, callback) => {
|
|
14
|
+
if (request.request.startsWith('~/../')) {
|
|
15
|
+
const resourcePath = request.request.substr(5);
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
const nextRequest = Object.assign({}, request, {
|
|
18
|
+
request: path.resolve(`./${resourcePath}`),
|
|
19
|
+
});
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
resolver.doResolve(
|
|
22
|
+
target,
|
|
23
|
+
nextRequest,
|
|
24
|
+
null,
|
|
25
|
+
resolveContext,
|
|
26
|
+
callback,
|
|
27
|
+
);
|
|
28
|
+
} else {
|
|
29
|
+
callback();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
21
32
|
}
|
|
22
33
|
}
|
|
23
34
|
|
|
@@ -16,10 +16,17 @@ module.exports = {
|
|
|
16
16
|
loader: 'svgo-loader',
|
|
17
17
|
options: {
|
|
18
18
|
plugins: [
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
{
|
|
20
|
+
name: 'preset-default',
|
|
21
|
+
params: {
|
|
22
|
+
overrides: {
|
|
23
|
+
convertPathData: false,
|
|
24
|
+
removeViewBox: false,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
'removeTitle',
|
|
29
|
+
'removeUselessStrokeAndFill',
|
|
23
30
|
],
|
|
24
31
|
},
|
|
25
32
|
},
|