@plone/volto 17.6.1 → 17.8.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 +37 -0
- package/addon-registry.js +34 -1
- package/package.json +1 -1
- package/packages/volto-slate/news/5347.bugfix +1 -0
- package/packages/volto-slate/news/5517.feature +1 -0
- package/packages/volto-slate/package.json +1 -1
- package/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx +4 -0
- package/packages/volto-slate/src/editor/extensions/insertData.js +3 -1
- package/packages/volto-slate/src/editor/extensions/normalizeExternalData.js +1 -1
- package/packages/volto-slate/src/utils/blocks.js +6 -2
- package/src/components/manage/Add/Add.jsx +6 -0
- package/src/components/manage/BlockChooser/BlockChooser.jsx +3 -1
- package/src/components/manage/BlockChooser/BlockChooserButton.jsx +5 -0
- package/src/components/manage/Blocks/Block/BlocksForm.jsx +4 -0
- package/src/components/manage/Blocks/Block/DefaultEdit.jsx +3 -1
- package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +10 -2
- package/src/components/manage/Blocks/Block/Settings.jsx +10 -1
- package/src/components/manage/Blocks/Block/StyleWrapper.jsx +7 -1
- package/src/components/manage/Blocks/Container/Data.jsx +4 -1
- package/src/components/manage/Blocks/Grid/View.jsx +2 -1
- package/src/components/manage/Blocks/HeroImageLeft/Data.jsx +3 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.jsx +4 -1
- package/src/components/manage/Blocks/Image/View.jsx +2 -1
- package/src/components/manage/Blocks/Listing/ListingData.jsx +4 -1
- package/src/components/manage/Blocks/Listing/View.jsx +2 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.jsx +3 -1
- package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +4 -0
- package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +46 -4
- package/src/components/manage/Blocks/Teaser/Data.jsx +4 -1
- package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +2 -2
- package/src/components/manage/Blocks/ToC/Edit.jsx +2 -0
- package/src/components/manage/Blocks/Video/Body.jsx +52 -22
- package/src/components/manage/Blocks/Video/Body.test.jsx +167 -0
- package/src/components/manage/Blocks/Video/VideoSidebar.jsx +3 -1
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx +2 -2
- package/src/components/manage/Edit/Edit.jsx +1 -0
- package/src/components/manage/Form/Form.jsx +14 -3
- package/src/components/manage/Sidebar/SidebarPopup.jsx +1 -1
- package/src/components/manage/Widgets/RecurrenceWidget/EndField.jsx +7 -1
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +79 -31
- package/src/components/theme/Image/Image.jsx +4 -2
- package/src/components/theme/Image/Image.test.jsx +32 -0
- package/src/components/theme/Login/Login.jsx +12 -2
- package/src/components/theme/Navigation/Navigation.jsx +34 -32
- package/src/components/theme/PreviewImage/PreviewImage.jsx +7 -2
- package/src/components/theme/Sitemap/Sitemap.jsx +4 -4
- package/src/components/theme/Sitemap/Sitemap.test.jsx +52 -0
- package/src/components/theme/Unauthorized/Unauthorized.jsx +12 -11
- package/src/helpers/Blocks/Blocks.js +67 -3
- package/src/helpers/Blocks/Blocks.test.js +57 -0
- package/src/helpers/Extensions/withBlockSchemaEnhancer.js +20 -9
- package/src/helpers/Url/Url.js +5 -4
- package/src/helpers/Url/Url.test.js +52 -0
- package/src/helpers/index.js +1 -0
- package/types/components/manage/Blocks/Image/View.d.ts +2 -1
- package/types/components/manage/Blocks/Video/Body.d.ts +5 -0
- package/types/components/manage/Blocks/Video/Body.test.d.ts +1 -0
- package/types/helpers/Blocks/Blocks.d.ts +3 -1
- package/types/helpers/Extensions/withBlockSchemaEnhancer.d.ts +3 -1
- package/apps/plone/node_modules/.bin/acorn +0 -17
- package/apps/plone/node_modules/.bin/addon +0 -17
- package/apps/plone/node_modules/.bin/autoprefixer +0 -17
- package/apps/plone/node_modules/.bin/browserslist +0 -17
- package/apps/plone/node_modules/.bin/build-storybook +0 -17
- package/apps/plone/node_modules/.bin/changelogupdater +0 -17
- package/apps/plone/node_modules/.bin/eslint +0 -17
- package/apps/plone/node_modules/.bin/eslint-config-prettier +0 -17
- package/apps/plone/node_modules/.bin/i18n +0 -17
- package/apps/plone/node_modules/.bin/jest +0 -17
- package/apps/plone/node_modules/.bin/lessc +0 -17
- package/apps/plone/node_modules/.bin/missdev +0 -17
- package/apps/plone/node_modules/.bin/prettier +0 -17
- package/apps/plone/node_modules/.bin/razzle +0 -17
- package/apps/plone/node_modules/.bin/server-test +0 -17
- package/apps/plone/node_modules/.bin/start-server-and-test +0 -17
- package/apps/plone/node_modules/.bin/start-storybook +0 -17
- package/apps/plone/node_modules/.bin/start-test +0 -17
- package/apps/plone/node_modules/.bin/storybook-server +0 -17
- package/apps/plone/node_modules/.bin/stylelint +0 -17
- package/apps/plone/node_modules/.bin/tlds +0 -17
- package/apps/plone/node_modules/.bin/ts-jest +0 -17
- package/apps/plone/node_modules/.bin/tsc +0 -17
- package/apps/plone/node_modules/.bin/tsserver +0 -17
- package/apps/plone/node_modules/.bin/uuid +0 -17
- package/apps/plone/node_modules/.bin/webpack +0 -17
- package/apps/plone/node_modules/.bin/webpack-dev-server +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/acorn +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/addon +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/browserslist +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/changelogupdater +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint-config-prettier +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/i18n +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/prettier +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/release-it +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/stylelint +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/tsc +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/tsserver +0 -17
- package/packages/volto-slate/build/messages/src/blocks/Table/TableBlockEdit.json +0 -90
- package/packages/volto-slate/build/messages/src/blocks/Text/DefaultTextBlockEditor.json +0 -6
- package/packages/volto-slate/build/messages/src/blocks/Text/DetachedTextBlockEditor.json +0 -6
- package/packages/volto-slate/build/messages/src/blocks/Text/SlashMenu.json +0 -6
- package/packages/volto-slate/build/messages/src/editor/plugins/AdvancedLink/index.json +0 -10
- package/packages/volto-slate/build/messages/src/editor/plugins/Link/index.json +0 -10
- package/packages/volto-slate/build/messages/src/editor/plugins/Table/index.json +0 -30
- package/packages/volto-slate/build/messages/src/elementEditor/messages.json +0 -10
- package/packages/volto-slate/build/messages/src/widgets/HtmlSlateWidget.json +0 -6
- package/packages/volto-slate/build/messages/src/widgets/RichTextWidgetView.json +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,43 @@ myst:
|
|
|
17
17
|
|
|
18
18
|
<!-- towncrier release notes start -->
|
|
19
19
|
|
|
20
|
+
## 17.8.0 (2024-01-02)
|
|
21
|
+
|
|
22
|
+
### Feature
|
|
23
|
+
|
|
24
|
+
- Added support for custom CSS properties in the `StyleWrapper`. @sneridagh [#5581](https://github.com/plone/volto/issues/5581)
|
|
25
|
+
|
|
26
|
+
### Bugfix
|
|
27
|
+
|
|
28
|
+
- Fixed utc problems in RecurrenceWidget [#5002](https://github.com/plone/volto/issues/5002)
|
|
29
|
+
- The hamburger icon to open the mobile/tablet navigation is now hidden if there are no navigation items. @Aarav238 [#5353](https://github.com/plone/volto/issues/5353)
|
|
30
|
+
- Fix preview image component @steffenri [#5379](https://github.com/plone/volto/issues/5379)
|
|
31
|
+
- Fix autopopulated value of facet when settings the value for another one. @iFlameing [#5432](https://github.com/plone/volto/issues/5432)
|
|
32
|
+
- Fix sitemap for multilingual sites
|
|
33
|
+
[erral] [#5501](https://github.com/plone/volto/issues/5501)
|
|
34
|
+
- Replace createRef with useRef in SidebarPopup
|
|
35
|
+
[razvanMiu] [#5519](https://github.com/plone/volto/issues/5519)
|
|
36
|
+
- Fixed edge case error in Unauthorised page and Login route behavior @sneridagh [#5536](https://github.com/plone/volto/issues/5536)
|
|
37
|
+
|
|
38
|
+
### Internal
|
|
39
|
+
|
|
40
|
+
- Update Plone to 6.0.9 @sneridagh [#5562](https://github.com/plone/volto/issues/5562)
|
|
41
|
+
|
|
42
|
+
## 17.7.0 (2023-12-13)
|
|
43
|
+
|
|
44
|
+
### Feature
|
|
45
|
+
|
|
46
|
+
- Added conditional variations support. @sneridagh @robgietema [#5424](https://github.com/plone/volto/issues/5424)
|
|
47
|
+
- Added `navRoot` and `contentType` to `restricted` key in blocks configuration. @sneridagh [#5517](https://github.com/plone/volto/issues/5517)
|
|
48
|
+
- Add support for `preview_image_link` behavior in Volto Image component @sneridagh [#5523](https://github.com/plone/volto/issues/5523)
|
|
49
|
+
|
|
50
|
+
### Bugfix
|
|
51
|
+
|
|
52
|
+
- Fix the right order of parameters in normalizeExternalData.js @dobri1408 [#5347](https://github.com/plone/volto/issues/5347)
|
|
53
|
+
- Refactoring the code for extraction of videoDetails from the video URL, adding code for extracting videoDetails from youtube video URLs with '/live/' in its URL which previously used to throw an error and adding jest tests for same. @IshaanDasgupta [#5416](https://github.com/plone/volto/issues/5416)
|
|
54
|
+
- Initialize data in form before the checks for the `blocks` and `blocks_layout` are done This fix an edge case when the data from the server content is empty, then the fields are populated, but the initialized data is snapshot after the check (and amendments) are done. @sneridagh [#5445](https://github.com/plone/volto/issues/5445)
|
|
55
|
+
- Replaced `toNumber` with `parseFloat` to avoid an error when validating the `plone.restapi` version. @shibbu264 [#5448](https://github.com/plone/volto/issues/5448)
|
|
56
|
+
|
|
20
57
|
## 17.6.1 (2023-11-27)
|
|
21
58
|
|
|
22
59
|
### Bugfix
|
package/addon-registry.js
CHANGED
|
@@ -482,8 +482,41 @@ class AddonConfigurationRegistry {
|
|
|
482
482
|
`${customPath}/**/*.*(svg|png|jpg|jpeg|gif|ico|less|js|jsx|ts|tsx)`,
|
|
483
483
|
),
|
|
484
484
|
(filename) => {
|
|
485
|
+
function changeFileExtension(filePath) {
|
|
486
|
+
// Extract the current file extension
|
|
487
|
+
const currentExtension = filePath.split('.').pop();
|
|
488
|
+
|
|
489
|
+
// Define the mapping between file extensions
|
|
490
|
+
const extensionMapping = {
|
|
491
|
+
jsx: 'tsx',
|
|
492
|
+
tsx: 'jsx',
|
|
493
|
+
js: 'ts',
|
|
494
|
+
ts: 'js',
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
// Check if the current extension is in the mapping
|
|
498
|
+
if (currentExtension in extensionMapping) {
|
|
499
|
+
// Replace the current extension with the corresponding one from the mapping
|
|
500
|
+
const newExtension = extensionMapping[currentExtension];
|
|
501
|
+
const newPath = filePath.replace(
|
|
502
|
+
`.${currentExtension}`,
|
|
503
|
+
`.${newExtension}`,
|
|
504
|
+
);
|
|
505
|
+
return newPath;
|
|
506
|
+
} else {
|
|
507
|
+
// If the current extension is not in the mapping, return the original path
|
|
508
|
+
return filePath;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
485
512
|
const targetPath = filename.replace(customPath, sourcePath);
|
|
486
|
-
|
|
513
|
+
// We try to find the source to shadow with the exact path
|
|
514
|
+
// and we try also with the extension changed in search for JS<->TS
|
|
515
|
+
// correspondence
|
|
516
|
+
if (
|
|
517
|
+
fs.existsSync(targetPath) ||
|
|
518
|
+
fs.existsSync(changeFileExtension(targetPath))
|
|
519
|
+
) {
|
|
487
520
|
aliases[
|
|
488
521
|
filename
|
|
489
522
|
.replace(customPath, name)
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Fix the right order of parameters in normalizeExternalData.js @dobri1408
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Added `navRoot` and `contentType` to `restricted` key in blocks configuration. @sneridagh
|
|
@@ -70,6 +70,8 @@ export const DefaultTextBlockEditor = (props) => {
|
|
|
70
70
|
allowedBlocks,
|
|
71
71
|
formTitle,
|
|
72
72
|
formDescription,
|
|
73
|
+
navRoot,
|
|
74
|
+
contentType,
|
|
73
75
|
} = props;
|
|
74
76
|
|
|
75
77
|
const { slate } = config.settings;
|
|
@@ -267,6 +269,8 @@ export const DefaultTextBlockEditor = (props) => {
|
|
|
267
269
|
blocksConfig={blocksConfig}
|
|
268
270
|
size="24px"
|
|
269
271
|
properties={properties}
|
|
272
|
+
navRoot={navRoot}
|
|
273
|
+
contentType={contentType}
|
|
270
274
|
/>
|
|
271
275
|
)}
|
|
272
276
|
|
|
@@ -98,7 +98,9 @@ export const insertData = (editor) => {
|
|
|
98
98
|
if (Editor.string(editor, [])) {
|
|
99
99
|
if (
|
|
100
100
|
Array.isArray(fragment) &&
|
|
101
|
-
fragment.findIndex(
|
|
101
|
+
fragment.findIndex(
|
|
102
|
+
(b) => Editor.isInline(editor, b) || Text.isText(b),
|
|
103
|
+
) > -1
|
|
102
104
|
) {
|
|
103
105
|
// console.log('insert fragment', fragment);
|
|
104
106
|
// TODO: we want normalization also when dealing with fragments
|
|
@@ -2,7 +2,7 @@ import { normalizeExternalData as normalize } from '@plone/volto-slate/utils';
|
|
|
2
2
|
|
|
3
3
|
export function normalizeExternalData(editor) {
|
|
4
4
|
editor.normalizeExternalData = (fragment) => {
|
|
5
|
-
return normalize(fragment);
|
|
5
|
+
return normalize(editor, fragment);
|
|
6
6
|
};
|
|
7
7
|
return editor;
|
|
8
8
|
}
|
|
@@ -73,7 +73,10 @@ export const normalizeExternalData = (editor, nodes) => {
|
|
|
73
73
|
// put all the non-blocks (e.g. images which are inline Elements) inside p-s
|
|
74
74
|
Editor.withoutNormalizing(fakeEditor, () => {
|
|
75
75
|
//for htmlSlateWidget compatibility
|
|
76
|
-
if (
|
|
76
|
+
if (
|
|
77
|
+
nodes &&
|
|
78
|
+
(!Editor.isBlock(fakeEditor, nodes[0]) || Text.isText(nodes[0]))
|
|
79
|
+
)
|
|
77
80
|
Transforms.wrapNodes(
|
|
78
81
|
fakeEditor,
|
|
79
82
|
{ type: 'p' },
|
|
@@ -81,7 +84,8 @@ export const normalizeExternalData = (editor, nodes) => {
|
|
|
81
84
|
at: [],
|
|
82
85
|
match: (node, path) =>
|
|
83
86
|
(!Editor.isEditor(node) && !Editor.isBlock(fakeEditor, node)) ||
|
|
84
|
-
fakeEditor.isInline(node)
|
|
87
|
+
fakeEditor.isInline(node) ||
|
|
88
|
+
Text.isText(node),
|
|
85
89
|
mode: 'highest',
|
|
86
90
|
},
|
|
87
91
|
);
|
|
@@ -315,6 +315,9 @@ class Add extends Component {
|
|
|
315
315
|
<Form
|
|
316
316
|
ref={this.form}
|
|
317
317
|
key="translated-or-new-content-form"
|
|
318
|
+
navRoot={
|
|
319
|
+
this.props.content?.['@components']?.navroot?.navroot || {}
|
|
320
|
+
}
|
|
318
321
|
schema={this.props.schema}
|
|
319
322
|
type={this.props.type}
|
|
320
323
|
formData={{
|
|
@@ -334,6 +337,9 @@ class Add extends Component {
|
|
|
334
337
|
// Copy the Language Independent Fields values from the to-be translated content
|
|
335
338
|
// into the default values of the translated content Add form.
|
|
336
339
|
...lifData(),
|
|
340
|
+
parent: {
|
|
341
|
+
'@id': this.props.content?.['@id'] || '',
|
|
342
|
+
},
|
|
337
343
|
}}
|
|
338
344
|
requestError={this.state.error}
|
|
339
345
|
onSubmit={this.onSubmit}
|
|
@@ -31,6 +31,8 @@ const BlockChooser = ({
|
|
|
31
31
|
blocksConfig = config.blocks.blocksConfig,
|
|
32
32
|
blockChooserRef,
|
|
33
33
|
properties = {},
|
|
34
|
+
navRoot,
|
|
35
|
+
contentType,
|
|
34
36
|
}) => {
|
|
35
37
|
const intl = useIntl();
|
|
36
38
|
const hasAllowedBlocks = !isEmpty(allowedBlocks);
|
|
@@ -55,7 +57,7 @@ const BlockChooser = ({
|
|
|
55
57
|
// depending on this function, given properties (current present blocks) and the
|
|
56
58
|
// block being evaluated
|
|
57
59
|
return typeof item.restricted === 'function'
|
|
58
|
-
? !item.restricted({ properties, block: item })
|
|
60
|
+
? !item.restricted({ properties, block: item, navRoot, contentType })
|
|
59
61
|
: !item.restricted;
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -54,7 +54,10 @@ const BlockChooserButton = (props) => {
|
|
|
54
54
|
blocksConfig,
|
|
55
55
|
buttonComponent,
|
|
56
56
|
properties,
|
|
57
|
+
navRoot,
|
|
58
|
+
contentType,
|
|
57
59
|
} = props;
|
|
60
|
+
|
|
58
61
|
const { disableNewBlocks } = data;
|
|
59
62
|
const [addNewBlockOpened, setAddNewBlockOpened] = React.useState(false);
|
|
60
63
|
|
|
@@ -142,6 +145,8 @@ const BlockChooserButton = (props) => {
|
|
|
142
145
|
properties={properties}
|
|
143
146
|
showRestricted={showRestricted}
|
|
144
147
|
ref={blockChooserRef}
|
|
148
|
+
navRoot={navRoot}
|
|
149
|
+
contentType={contentType}
|
|
145
150
|
/>
|
|
146
151
|
</div>
|
|
147
152
|
</Portal>
|
|
@@ -28,6 +28,8 @@ const BlocksForm = (props) => {
|
|
|
28
28
|
pathname,
|
|
29
29
|
onChangeField,
|
|
30
30
|
properties,
|
|
31
|
+
type,
|
|
32
|
+
navRoot,
|
|
31
33
|
onChangeFormData,
|
|
32
34
|
selectedBlock,
|
|
33
35
|
multiSelected,
|
|
@@ -260,6 +262,8 @@ const BlocksForm = (props) => {
|
|
|
260
262
|
pathname,
|
|
261
263
|
metadata,
|
|
262
264
|
properties,
|
|
265
|
+
contentType: type,
|
|
266
|
+
navRoot,
|
|
263
267
|
blocksConfig,
|
|
264
268
|
selected: selectedBlock === childId,
|
|
265
269
|
multiSelected: multiSelected?.includes(childId),
|
|
@@ -7,7 +7,7 @@ import DefaultBlockView from './DefaultView';
|
|
|
7
7
|
|
|
8
8
|
const DefaultBlockEdit = (props) => {
|
|
9
9
|
const { blocksConfig = config.blocks.blocksConfig } = props;
|
|
10
|
-
const { data, onChangeBlock, block, selected } = props;
|
|
10
|
+
const { data, onChangeBlock, block, selected, navRoot, contentType } = props;
|
|
11
11
|
const intl = useIntl();
|
|
12
12
|
const blockSchema = blocksConfig?.[data['@type']]?.blockSchema;
|
|
13
13
|
const schema =
|
|
@@ -32,6 +32,8 @@ const DefaultBlockEdit = (props) => {
|
|
|
32
32
|
});
|
|
33
33
|
}}
|
|
34
34
|
formData={data}
|
|
35
|
+
navRoot={navRoot}
|
|
36
|
+
contentType={contentType}
|
|
35
37
|
/>
|
|
36
38
|
</SidebarPortal>
|
|
37
39
|
) : (
|
|
@@ -3,6 +3,7 @@ import { Icon } from '@plone/volto/components';
|
|
|
3
3
|
import {
|
|
4
4
|
blockHasValue,
|
|
5
5
|
buildStyleClassNamesFromData,
|
|
6
|
+
buildStyleObjectFromData,
|
|
6
7
|
} from '@plone/volto/helpers';
|
|
7
8
|
import dragSVG from '@plone/volto/icons/drag.svg';
|
|
8
9
|
import { Button } from 'semantic-ui-react';
|
|
@@ -47,14 +48,18 @@ const EditBlockWrapper = (props) => {
|
|
|
47
48
|
editable,
|
|
48
49
|
properties,
|
|
49
50
|
showBlockChooser,
|
|
51
|
+
navRoot,
|
|
52
|
+
contentType,
|
|
50
53
|
} = blockProps;
|
|
54
|
+
|
|
51
55
|
const visible = selected && !hideHandler(data);
|
|
52
56
|
|
|
53
57
|
const required = isBoolean(data.required)
|
|
54
58
|
? data.required
|
|
55
59
|
: includes(config.blocks.requiredBlocks, type);
|
|
56
60
|
|
|
57
|
-
const
|
|
61
|
+
const classNames = buildStyleClassNamesFromData(data.styles);
|
|
62
|
+
const style = buildStyleObjectFromData(data.styles);
|
|
58
63
|
|
|
59
64
|
return (
|
|
60
65
|
<div
|
|
@@ -63,9 +68,10 @@ const EditBlockWrapper = (props) => {
|
|
|
63
68
|
// Right now, we can have the alignment information in the styles property or in the
|
|
64
69
|
// block data root, we inject the classname here for having control over the whole
|
|
65
70
|
// Block Edit wrapper
|
|
66
|
-
className={cx(`block-editor-${data['@type']}`,
|
|
71
|
+
className={cx(`block-editor-${data['@type']}`, classNames, {
|
|
67
72
|
[data.align]: data.align,
|
|
68
73
|
})}
|
|
74
|
+
style={style}
|
|
69
75
|
>
|
|
70
76
|
<div style={{ position: 'relative' }}>
|
|
71
77
|
<div
|
|
@@ -107,6 +113,8 @@ const EditBlockWrapper = (props) => {
|
|
|
107
113
|
blocksConfig={blocksConfig}
|
|
108
114
|
size="24px"
|
|
109
115
|
properties={properties}
|
|
116
|
+
navRoot={navRoot}
|
|
117
|
+
contentType={contentType}
|
|
110
118
|
/>
|
|
111
119
|
)}
|
|
112
120
|
</div>
|
|
@@ -3,7 +3,14 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { injectIntl } from 'react-intl';
|
|
4
4
|
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
5
5
|
|
|
6
|
-
const Settings = ({
|
|
6
|
+
const Settings = ({
|
|
7
|
+
data,
|
|
8
|
+
block,
|
|
9
|
+
onChangeBlock,
|
|
10
|
+
schema,
|
|
11
|
+
navRoot,
|
|
12
|
+
contentType,
|
|
13
|
+
}) => {
|
|
7
14
|
return (
|
|
8
15
|
<BlockDataForm
|
|
9
16
|
schema={schema}
|
|
@@ -17,6 +24,8 @@ const Settings = ({ data, block, onChangeBlock, schema }) => {
|
|
|
17
24
|
onChangeBlock={onChangeBlock}
|
|
18
25
|
formData={data}
|
|
19
26
|
applySchemaEnhancers={false}
|
|
27
|
+
navRoot={navRoot}
|
|
28
|
+
contentType={contentType}
|
|
20
29
|
/>
|
|
21
30
|
);
|
|
22
31
|
};
|
|
@@ -3,10 +3,12 @@ import cx from 'classnames';
|
|
|
3
3
|
import {
|
|
4
4
|
buildStyleClassNamesFromData,
|
|
5
5
|
buildStyleClassNamesExtenders,
|
|
6
|
+
buildStyleObjectFromData,
|
|
6
7
|
} from '@plone/volto/helpers';
|
|
7
8
|
|
|
8
9
|
const StyleWrapper = (props) => {
|
|
9
|
-
let classNames
|
|
10
|
+
let classNames,
|
|
11
|
+
style = [];
|
|
10
12
|
const { children, content, data = {}, block } = props;
|
|
11
13
|
classNames = buildStyleClassNamesFromData(data.styles);
|
|
12
14
|
|
|
@@ -16,11 +18,15 @@ const StyleWrapper = (props) => {
|
|
|
16
18
|
data,
|
|
17
19
|
classNames,
|
|
18
20
|
});
|
|
21
|
+
|
|
22
|
+
style = buildStyleObjectFromData(data.styles);
|
|
23
|
+
|
|
19
24
|
const rewrittenChildren = React.Children.map(children, (child) => {
|
|
20
25
|
if (React.isValidElement(child)) {
|
|
21
26
|
const childProps = {
|
|
22
27
|
...props,
|
|
23
28
|
className: cx([child.props.className, ...classNames]),
|
|
29
|
+
style: { ...child.props.style, ...style },
|
|
24
30
|
};
|
|
25
31
|
return React.cloneElement(child, childProps);
|
|
26
32
|
}
|
|
@@ -2,7 +2,8 @@ import { useIntl } from 'react-intl';
|
|
|
2
2
|
import { BlockDataForm } from '@plone/volto/components';
|
|
3
3
|
|
|
4
4
|
const ContainerData = (props) => {
|
|
5
|
-
const { block, blocksConfig, data, onChangeBlock } =
|
|
5
|
+
const { block, blocksConfig, data, onChangeBlock, navRoot, contentType } =
|
|
6
|
+
props;
|
|
6
7
|
const intl = useIntl();
|
|
7
8
|
|
|
8
9
|
const schema = blocksConfig[data['@type']].blockSchema({ intl });
|
|
@@ -25,6 +26,8 @@ const ContainerData = (props) => {
|
|
|
25
26
|
block={block}
|
|
26
27
|
onChangeBlock={onChangeBlock}
|
|
27
28
|
blocksConfig={blocksConfig}
|
|
29
|
+
navRoot={navRoot}
|
|
30
|
+
contentType={contentType}
|
|
28
31
|
/>
|
|
29
32
|
);
|
|
30
33
|
};
|
|
@@ -5,7 +5,7 @@ import { withBlockExtensions } from '@plone/volto/helpers';
|
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
6
|
|
|
7
7
|
const GridBlockView = (props) => {
|
|
8
|
-
const { data, path, className } = props;
|
|
8
|
+
const { data, path, className, style } = props;
|
|
9
9
|
const metadata = props.metadata || props.properties;
|
|
10
10
|
const columns = data.blocks_layout.items;
|
|
11
11
|
const blocksConfig =
|
|
@@ -22,6 +22,7 @@ const GridBlockView = (props) => {
|
|
|
22
22
|
three: columns?.length === 3,
|
|
23
23
|
four: columns?.length === 4,
|
|
24
24
|
})}
|
|
25
|
+
style={style}
|
|
25
26
|
>
|
|
26
27
|
{data.headline && <h2 className="headline">{data.headline}</h2>}
|
|
27
28
|
|
|
@@ -4,7 +4,7 @@ import schemaHero from './schema.js';
|
|
|
4
4
|
import { BlockDataForm } from '@plone/volto/components';
|
|
5
5
|
|
|
6
6
|
const HeroImageLeftBlockData = (props) => {
|
|
7
|
-
const { block, data, onChangeBlock } = props;
|
|
7
|
+
const { block, data, onChangeBlock, navRoot, contentType } = props;
|
|
8
8
|
const intl = useIntl();
|
|
9
9
|
const schema = schemaHero({ ...props, intl });
|
|
10
10
|
return (
|
|
@@ -20,6 +20,8 @@ const HeroImageLeftBlockData = (props) => {
|
|
|
20
20
|
onChangeBlock={onChangeBlock}
|
|
21
21
|
formData={data}
|
|
22
22
|
block={block}
|
|
23
|
+
navRoot={navRoot}
|
|
24
|
+
contentType={contentType}
|
|
23
25
|
/>
|
|
24
26
|
);
|
|
25
27
|
};
|
|
@@ -9,7 +9,8 @@ import imageSVG from '@plone/volto/icons/image.svg';
|
|
|
9
9
|
import trashSVG from '@plone/volto/icons/delete.svg';
|
|
10
10
|
|
|
11
11
|
const ImageSidebar = (props) => {
|
|
12
|
-
const { blocksConfig, data, block, onChangeBlock } =
|
|
12
|
+
const { blocksConfig, data, block, onChangeBlock, navRoot, contentType } =
|
|
13
|
+
props;
|
|
13
14
|
const intl = useIntl();
|
|
14
15
|
const schema = ImageSchema({ formData: data, intl });
|
|
15
16
|
return (
|
|
@@ -94,6 +95,8 @@ const ImageSidebar = (props) => {
|
|
|
94
95
|
formData={data}
|
|
95
96
|
block={block}
|
|
96
97
|
blocksConfig={blocksConfig}
|
|
98
|
+
navRoot={navRoot}
|
|
99
|
+
contentType={contentType}
|
|
97
100
|
/>
|
|
98
101
|
</>
|
|
99
102
|
);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@plone/volto/helpers';
|
|
10
10
|
import config from '@plone/volto/registry';
|
|
11
11
|
|
|
12
|
-
export const View = ({ className, data, detached, properties }) => {
|
|
12
|
+
export const View = ({ className, data, detached, properties, style }) => {
|
|
13
13
|
const href = data?.href?.[0]?.['@id'] || '';
|
|
14
14
|
|
|
15
15
|
const Image = config.getComponent({ name: 'Image' }).component;
|
|
@@ -25,6 +25,7 @@ export const View = ({ className, data, detached, properties }) => {
|
|
|
25
25
|
data.align,
|
|
26
26
|
className,
|
|
27
27
|
)}
|
|
28
|
+
style={style}
|
|
28
29
|
>
|
|
29
30
|
{data.url && (
|
|
30
31
|
<>
|
|
@@ -4,7 +4,8 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
import { BlockDataForm } from '@plone/volto/components';
|
|
5
5
|
|
|
6
6
|
const ListingData = (props) => {
|
|
7
|
-
const { data, block, blocksConfig, onChangeBlock } =
|
|
7
|
+
const { data, block, blocksConfig, onChangeBlock, navRoot, contentType } =
|
|
8
|
+
props;
|
|
8
9
|
const intl = useIntl();
|
|
9
10
|
const schema = blocksConfig.listing.blockSchema({
|
|
10
11
|
...props,
|
|
@@ -25,6 +26,8 @@ const ListingData = (props) => {
|
|
|
25
26
|
formData={data}
|
|
26
27
|
blocksConfig={blocksConfig}
|
|
27
28
|
block={block}
|
|
29
|
+
navRoot={navRoot}
|
|
30
|
+
contentType={contentType}
|
|
28
31
|
/>
|
|
29
32
|
);
|
|
30
33
|
};
|
|
@@ -6,11 +6,12 @@ import { withBlockExtensions } from '@plone/volto/helpers';
|
|
|
6
6
|
import { ListingBlockBody as ListingBody } from '@plone/volto/components';
|
|
7
7
|
|
|
8
8
|
const View = (props) => {
|
|
9
|
-
const { data, path, pathname, className } = props;
|
|
9
|
+
const { data, path, pathname, className, style } = props;
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
<div
|
|
13
13
|
className={cx('block listing', data.variation || 'default', className)}
|
|
14
|
+
style={style}
|
|
14
15
|
>
|
|
15
16
|
<ListingBody {...props} path={path ?? pathname} />
|
|
16
17
|
</div>
|
|
@@ -18,7 +18,7 @@ const messages = defineMessages({
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
const MapsSidebar = (props) => {
|
|
21
|
-
const { data, block, onChangeBlock } = props;
|
|
21
|
+
const { data, block, onChangeBlock, navRoot, contentType } = props;
|
|
22
22
|
const intl = useIntl();
|
|
23
23
|
const schema = MapsSchema({ ...props, intl });
|
|
24
24
|
|
|
@@ -42,6 +42,8 @@ const MapsSidebar = (props) => {
|
|
|
42
42
|
onChangeBlock={onChangeBlock}
|
|
43
43
|
formData={data}
|
|
44
44
|
block={block}
|
|
45
|
+
navRoot={navRoot}
|
|
46
|
+
contentType={contentType}
|
|
45
47
|
/>
|
|
46
48
|
)}
|
|
47
49
|
</>
|
|
@@ -26,6 +26,8 @@ const SearchBlockEdit = (props) => {
|
|
|
26
26
|
data,
|
|
27
27
|
selected,
|
|
28
28
|
intl,
|
|
29
|
+
navRoot,
|
|
30
|
+
contentType,
|
|
29
31
|
onTriggerSearch,
|
|
30
32
|
querystring = {},
|
|
31
33
|
} = props;
|
|
@@ -83,6 +85,8 @@ const SearchBlockEdit = (props) => {
|
|
|
83
85
|
}}
|
|
84
86
|
onChangeBlock={onChangeBlock}
|
|
85
87
|
formData={data}
|
|
88
|
+
navRoot={navRoot}
|
|
89
|
+
contentType={contentType}
|
|
86
90
|
/>
|
|
87
91
|
</SidebarPortal>
|
|
88
92
|
</>
|
|
@@ -96,9 +96,21 @@ function normalizeState({
|
|
|
96
96
|
const { types: facetWidgetTypes } =
|
|
97
97
|
config.blocks.blocksConfig.search.extensions.facetWidgets;
|
|
98
98
|
|
|
99
|
+
// Here, we are removing the QueryString of the Listing ones, which is present in the Facet
|
|
100
|
+
// because we already initialize the facet with those values.
|
|
101
|
+
const configuredFacets = facetSettings
|
|
102
|
+
? facetSettings.map((facet) => facet?.field?.value)
|
|
103
|
+
: [];
|
|
104
|
+
|
|
105
|
+
let copyOfQuery = query.query ? [...query.query] : [];
|
|
106
|
+
|
|
107
|
+
const queryWithoutFacet = copyOfQuery.filter((query) => {
|
|
108
|
+
return !configuredFacets.includes(query.i);
|
|
109
|
+
});
|
|
110
|
+
|
|
99
111
|
const params = {
|
|
100
112
|
query: [
|
|
101
|
-
...(
|
|
113
|
+
...(queryWithoutFacet || []),
|
|
102
114
|
...(facetSettings || []).map((facet) => {
|
|
103
115
|
if (!facet?.field) return null;
|
|
104
116
|
|
|
@@ -261,14 +273,34 @@ const withSearch = (options) => (WrappedComponent) => {
|
|
|
261
273
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
262
274
|
const configuredFacets =
|
|
263
275
|
data.facets?.map((facet) => facet?.field?.value) || [];
|
|
276
|
+
|
|
277
|
+
// Here we are getting the initial value of the facet if Listing Query contains the same criteria as
|
|
278
|
+
// facet.
|
|
279
|
+
const queryData = data?.query?.query
|
|
280
|
+
? deserializeQuery(JSON.stringify(data?.query?.query))
|
|
281
|
+
: [];
|
|
282
|
+
|
|
283
|
+
let intializeFacetWithQueryValue = [];
|
|
284
|
+
|
|
285
|
+
for (let value of configuredFacets) {
|
|
286
|
+
const queryString = queryData.find((item) => item.i === value);
|
|
287
|
+
if (queryString) {
|
|
288
|
+
intializeFacetWithQueryValue = [
|
|
289
|
+
...intializeFacetWithQueryValue,
|
|
290
|
+
{ [queryString.i]: queryString.v },
|
|
291
|
+
];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
264
295
|
const multiFacets = data.facets
|
|
265
296
|
?.filter((facet) => facet?.multiple)
|
|
266
297
|
.map((facet) => facet?.field?.value);
|
|
267
298
|
const [facets, setFacets] = React.useState(
|
|
268
299
|
Object.assign(
|
|
269
300
|
{},
|
|
270
|
-
...urlQuery.map(({ i, v }) => ({ [i]: v })),
|
|
271
|
-
|
|
301
|
+
...urlQuery.map(({ i, v }) => ({ [i]: v })),
|
|
302
|
+
// TODO: the 'o' should be kept. This would be a major refactoring of the facets
|
|
303
|
+
...intializeFacetWithQueryValue,
|
|
272
304
|
// support for simple filters like ?Subject=something
|
|
273
305
|
// TODO: since the move to hash params this is no longer working.
|
|
274
306
|
// We'd have to treat the location.search and manage it just like the
|
|
@@ -288,8 +320,17 @@ const withSearch = (options) => (WrappedComponent) => {
|
|
|
288
320
|
);
|
|
289
321
|
const previousUrlQuery = usePrevious(urlQuery);
|
|
290
322
|
|
|
323
|
+
// During first render the previousUrlQuery is undefined and urlQuery
|
|
324
|
+
// is empty so it ressetting the facet when you are navigating but during reload we have urlQuery and we need
|
|
325
|
+
// to set the facet at first render.
|
|
326
|
+
const preventOverrideOfFacetState =
|
|
327
|
+
previousUrlQuery === undefined && urlQuery.length === 0;
|
|
328
|
+
|
|
291
329
|
React.useEffect(() => {
|
|
292
|
-
if (
|
|
330
|
+
if (
|
|
331
|
+
!isEqual(urlQuery, previousUrlQuery) &&
|
|
332
|
+
!preventOverrideOfFacetState
|
|
333
|
+
) {
|
|
293
334
|
setFacets(
|
|
294
335
|
Object.assign(
|
|
295
336
|
{},
|
|
@@ -319,6 +360,7 @@ const withSearch = (options) => (WrappedComponent) => {
|
|
|
319
360
|
locationSearchData,
|
|
320
361
|
multiFacets,
|
|
321
362
|
previousUrlQuery,
|
|
363
|
+
preventOverrideOfFacetState,
|
|
322
364
|
]);
|
|
323
365
|
|
|
324
366
|
const [sortOn, setSortOn] = React.useState(data?.query?.sort_on);
|
|
@@ -14,7 +14,8 @@ const messages = defineMessages({
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
const TeaserData = (props) => {
|
|
17
|
-
const { block, blocksConfig, data, onChangeBlock } =
|
|
17
|
+
const { block, blocksConfig, data, onChangeBlock, navRoot, contentType } =
|
|
18
|
+
props;
|
|
18
19
|
const intl = useIntl();
|
|
19
20
|
|
|
20
21
|
const reset = () => {
|
|
@@ -64,6 +65,8 @@ const TeaserData = (props) => {
|
|
|
64
65
|
block={block}
|
|
65
66
|
blocksConfig={blocksConfig}
|
|
66
67
|
headerActions={HeaderActions}
|
|
68
|
+
navRoot={navRoot}
|
|
69
|
+
contentType={contentType}
|
|
67
70
|
/>
|
|
68
71
|
);
|
|
69
72
|
};
|