@eeacms/volto-cca-policy 0.1.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/.coverage.babel.config.js +9 -0
- package/.i18n.babel.config.js +1 -0
- package/.project.eslintrc.js +48 -0
- package/.release-it.json +17 -0
- package/CHANGELOG.md +30 -0
- package/DEVELOP.md +52 -0
- package/LICENSE.md +9 -0
- package/README.md +85 -0
- package/RELEASE.md +74 -0
- package/babel.config.js +17 -0
- package/bootstrap +41 -0
- package/cypress.config.js +26 -0
- package/jest-addon.config.js +36 -0
- package/locales/volto.pot +0 -0
- package/package.json +51 -0
- package/src/components/index.js +1 -0
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.jsx +31 -0
- package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.jsx +17 -0
- package/src/components/manage/Blocks/ContextNavigation/index.js +26 -0
- package/src/components/manage/Blocks/ContextNavigation/schema.js +81 -0
- package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.jsx +32 -0
- package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsView.jsx +15 -0
- package/src/components/manage/Blocks/LayoutSettings/edit.less +4 -0
- package/src/components/manage/Blocks/LayoutSettings/index.js +24 -0
- package/src/components/manage/Blocks/LayoutSettings/schema.js +32 -0
- package/src/components/manage/Blocks/Title/Edit.jsx +226 -0
- package/src/components/manage/Blocks/Title/View.jsx +35 -0
- package/src/components/manage/Blocks/Title/index.js +13 -0
- package/src/components/manage/Blocks/Title/schema.js +80 -0
- package/src/components/manage/Blocks/schema-utils.js +16 -0
- package/src/components/manage/Blocks/schema.js +52 -0
- package/src/components/theme/Banner/Banner.jsx +99 -0
- package/src/components/theme/Banner/View.jsx +241 -0
- package/src/components/theme/Banner/styles.less +20 -0
- package/src/components/theme/CustomCSS/CustomCSS.jsx +12 -0
- package/src/components/theme/DraftBackground/DraftBackground.jsx +16 -0
- package/src/components/theme/DraftBackground/draft.css +3 -0
- package/src/components/theme/DraftBackground/draft.png +0 -0
- package/src/components/theme/Homepage/HomePageInverseView.jsx +60 -0
- package/src/components/theme/Homepage/HomePageView.jsx +60 -0
- package/src/components/theme/Logo.jsx +34 -0
- package/src/components/theme/SubsiteClass.jsx +23 -0
- package/src/components/theme/Widgets/TokenWidget.jsx +16 -0
- package/src/config.js +307 -0
- package/src/customizations/@eeacms/volto-block-style/StyleWrapper/schema.js +44 -0
- package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +80 -0
- package/src/customizations/@eeacms/volto-tabs-block/components/templates/default/schema.js +109 -0
- package/src/customizations/@eeacms/volto-tabs-block/components/templates/horizontal-responsive/schema.js +109 -0
- package/src/customizations/volto/components/manage/Form/Form.jsx +784 -0
- package/src/customizations/volto/components/manage/Form/ModalForm.jsx +326 -0
- package/src/customizations/volto/components/manage/Sharing/Sharing.jsx +495 -0
- package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +436 -0
- package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +62 -0
- package/src/customizations/volto/components/theme/Comments/Comments.jsx +487 -0
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +90 -0
- package/src/customizations/volto/components/theme/Header/Header.jsx +258 -0
- package/src/customizations/volto/components/theme/Tags/Tags.jsx +53 -0
- package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.jsx +91 -0
- package/src/customizations/volto/components/theme/View/EventView.jsx +90 -0
- package/src/helpers/index.js +44 -0
- package/src/icons/content-box.svg +5 -0
- package/src/icons/image-narrow.svg +5 -0
- package/src/index.js +13 -0
- package/src/middleware/voltoCustom.js +37 -0
- package/src/policy.js +136 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const EditSchema = () => {
|
|
2
|
+
return {
|
|
3
|
+
title: 'Navigation',
|
|
4
|
+
fieldsets: [
|
|
5
|
+
{
|
|
6
|
+
id: 'default',
|
|
7
|
+
title: 'Default',
|
|
8
|
+
fields: [
|
|
9
|
+
'name',
|
|
10
|
+
'root_node',
|
|
11
|
+
'includeTop',
|
|
12
|
+
'currentFolderOnly',
|
|
13
|
+
'topLevel',
|
|
14
|
+
'bottomLevel',
|
|
15
|
+
'no_icons',
|
|
16
|
+
'thumb_scale',
|
|
17
|
+
'no_thumbs',
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
required: [],
|
|
22
|
+
properties: {
|
|
23
|
+
name: {
|
|
24
|
+
title: 'Title',
|
|
25
|
+
description: 'The title of the navigation tree',
|
|
26
|
+
},
|
|
27
|
+
root_node: {
|
|
28
|
+
title: 'Root node',
|
|
29
|
+
description:
|
|
30
|
+
'You may search for and choose a folder to act as the root of the navigation tree. Leave blank to use the Plone site root.',
|
|
31
|
+
widget: 'object_browser',
|
|
32
|
+
// TODO: these don't work. Why?
|
|
33
|
+
mode: 'link',
|
|
34
|
+
selectedItemAttrs: ['Title', 'Description'],
|
|
35
|
+
},
|
|
36
|
+
includeTop: {
|
|
37
|
+
title: 'Include top node',
|
|
38
|
+
description:
|
|
39
|
+
"Whether or not to show the top, or 'root', node in the navigation tree. This is affected by the 'Start level' setting.",
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
},
|
|
42
|
+
currentFolderOnly: {
|
|
43
|
+
title: 'Only show the contents of the current folder',
|
|
44
|
+
description:
|
|
45
|
+
'If selected, the navigation tree will only show the current folder and its children at all times.',
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
topLevel: {
|
|
50
|
+
title: 'Start level',
|
|
51
|
+
description:
|
|
52
|
+
'An integer value that specifies the number of folder levels below the site root that must be exceeded before the navigation tree will display. 0 means that the navigation tree should be displayed everywhere including pages in the root of the site. 1 means the tree only shows up inside folders located in the root and downwards, never showing at the top level.',
|
|
53
|
+
type: 'number',
|
|
54
|
+
default: 1,
|
|
55
|
+
},
|
|
56
|
+
bottomLevel: {
|
|
57
|
+
title: 'Navigation tree depth',
|
|
58
|
+
description:
|
|
59
|
+
'How many folders should be included before the navigation tree stops. 0 means no limit. 1 only includes the root folder.',
|
|
60
|
+
type: 'number',
|
|
61
|
+
default: 0,
|
|
62
|
+
},
|
|
63
|
+
no_icons: {
|
|
64
|
+
title: 'Supress icons',
|
|
65
|
+
description:
|
|
66
|
+
'If enabled, the portlet will not show document type icons.',
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
},
|
|
69
|
+
thumb_scale: {
|
|
70
|
+
title: 'Override thumb scale',
|
|
71
|
+
description:
|
|
72
|
+
"Enter a valid scale name (see 'Image Handling' control panel) to override (e.g. icon, tile, thumb, mini, preview, ... ). Leave empty to use default (see 'Site' control panel).",
|
|
73
|
+
},
|
|
74
|
+
no_thumbs: {
|
|
75
|
+
title: 'Supress thumbs',
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
description: 'If enabled, the portlet will not show thumbs.',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EditSchema } from './schema';
|
|
3
|
+
import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
|
|
4
|
+
import LayoutSettingsView from './LayoutSettingsView';
|
|
5
|
+
import './edit.less';
|
|
6
|
+
|
|
7
|
+
const LayoutSettingsEdit = (props) => {
|
|
8
|
+
const schema = EditSchema();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<h3>Page layout settings</h3>
|
|
12
|
+
<LayoutSettingsView {...props} />
|
|
13
|
+
<SidebarPortal selected={props.selected}>
|
|
14
|
+
{props.selected && (
|
|
15
|
+
<BlockDataForm
|
|
16
|
+
title={schema.title}
|
|
17
|
+
schema={schema}
|
|
18
|
+
formData={props.data}
|
|
19
|
+
onChangeField={(id, value) => {
|
|
20
|
+
props.onChangeBlock(props.block, {
|
|
21
|
+
...props.data,
|
|
22
|
+
[id]: value,
|
|
23
|
+
});
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
)}
|
|
27
|
+
</SidebarPortal>
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default LayoutSettingsEdit;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BodyClass } from '@plone/volto/helpers';
|
|
3
|
+
import { getVoltoStyles } from '../schema-utils';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
|
|
6
|
+
const LayoutSettingsView = (props) => {
|
|
7
|
+
const classNames = getVoltoStyles(props.data);
|
|
8
|
+
return <BodyClass className={cx(classNames)} />;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function propsAreEqual(prevProps, nextProps) {
|
|
12
|
+
return prevProps.data === nextProps.data;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default React.memo(LayoutSettingsView, propsAreEqual);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import codeSVG from '@plone/volto/icons/code.svg';
|
|
2
|
+
import LayoutSettingsView from './LayoutSettingsView';
|
|
3
|
+
import LayoutSettingsEdit from './LayoutSettingsEdit';
|
|
4
|
+
import BlockSettingsSchema from '@plone/volto/components/manage/Blocks/Block/Schema';
|
|
5
|
+
|
|
6
|
+
export default (config) => {
|
|
7
|
+
config.blocks.blocksConfig.layoutSettings = {
|
|
8
|
+
id: 'layoutSettings',
|
|
9
|
+
title: 'Layout settings',
|
|
10
|
+
icon: codeSVG,
|
|
11
|
+
group: 'common',
|
|
12
|
+
view: LayoutSettingsView,
|
|
13
|
+
edit: LayoutSettingsEdit,
|
|
14
|
+
schema: BlockSettingsSchema,
|
|
15
|
+
restricted: ({ properties }) => {
|
|
16
|
+
return !!properties['@type'];
|
|
17
|
+
},
|
|
18
|
+
mostUsed: true,
|
|
19
|
+
blockHasOwnFocusManagement: true,
|
|
20
|
+
sidebarTab: 1,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return config;
|
|
24
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import imageFitSVG from '@plone/volto/icons/image-fit.svg';
|
|
2
|
+
import imageWideSVG from '@plone/volto/icons/image-wide.svg';
|
|
3
|
+
|
|
4
|
+
import imageNarrowSVG from '@eeacms/volto-cca-policy/icons/image-narrow.svg';
|
|
5
|
+
|
|
6
|
+
export const ALIGN_INFO_MAP = {
|
|
7
|
+
narrow_view: [imageNarrowSVG, 'Narrow width'],
|
|
8
|
+
container_view: [imageFitSVG, 'Container width'],
|
|
9
|
+
wide_view: [imageWideSVG, 'Wide width'],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const EditSchema = () => {
|
|
13
|
+
return {
|
|
14
|
+
title: 'Page layout settings',
|
|
15
|
+
fieldsets: [
|
|
16
|
+
{
|
|
17
|
+
id: 'default',
|
|
18
|
+
title: 'Default',
|
|
19
|
+
fields: ['layout_size'],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
required: [],
|
|
23
|
+
properties: {
|
|
24
|
+
layout_size: {
|
|
25
|
+
widget: 'style_align',
|
|
26
|
+
title: 'Layout size',
|
|
27
|
+
actions: Object.keys(ALIGN_INFO_MAP),
|
|
28
|
+
actionsInfoMap: ALIGN_INFO_MAP,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edit title block.
|
|
3
|
+
* @module volto-slate/blocks/Title/TitleBlockEdit
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
7
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { Editor, createEditor, Transforms, Node, Range } from 'slate';
|
|
10
|
+
import { ReactEditor, Editable, Slate, withReact } from 'slate-react';
|
|
11
|
+
import config from '@plone/volto/registry';
|
|
12
|
+
import { SidebarPortal } from '@plone/volto/components';
|
|
13
|
+
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
|
|
14
|
+
import { BannerView } from '@eeacms/volto-cca-policy/components';
|
|
15
|
+
import schema from './schema';
|
|
16
|
+
|
|
17
|
+
const messages = defineMessages({
|
|
18
|
+
title: {
|
|
19
|
+
id: 'Type the title…',
|
|
20
|
+
defaultMessage: 'Type the title…',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function usePrevious(value) {
|
|
25
|
+
const ref = useRef();
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
ref.current = value;
|
|
29
|
+
}, [value]);
|
|
30
|
+
|
|
31
|
+
return ref.current;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const Title = React.forwardRef(({ children, ...rest }, ref) => (
|
|
35
|
+
<h1 {...rest} ref={ref}>
|
|
36
|
+
{children}
|
|
37
|
+
</h1>
|
|
38
|
+
));
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Edit title block component.
|
|
42
|
+
* @class TitleBlockEdit
|
|
43
|
+
* @extends Component
|
|
44
|
+
*/
|
|
45
|
+
export const TitleBlockEdit = (props) => {
|
|
46
|
+
const {
|
|
47
|
+
selected,
|
|
48
|
+
index,
|
|
49
|
+
onChangeField,
|
|
50
|
+
onSelectBlock,
|
|
51
|
+
onAddBlock,
|
|
52
|
+
onFocusPreviousBlock,
|
|
53
|
+
onFocusNextBlock,
|
|
54
|
+
block,
|
|
55
|
+
blockNode,
|
|
56
|
+
data,
|
|
57
|
+
detached,
|
|
58
|
+
editable,
|
|
59
|
+
} = props;
|
|
60
|
+
const metadata = props.metadata || props.properties;
|
|
61
|
+
|
|
62
|
+
const editor = useMemo(() => withReact(createEditor()), []);
|
|
63
|
+
const intl = useIntl();
|
|
64
|
+
|
|
65
|
+
const disableNewBlocks = data.disableNewBlocks || detached;
|
|
66
|
+
|
|
67
|
+
const text = metadata?.['title'] || '';
|
|
68
|
+
|
|
69
|
+
const handleChange = useCallback(
|
|
70
|
+
(value) => {
|
|
71
|
+
const newText = Node.string(editor);
|
|
72
|
+
if (newText !== text) {
|
|
73
|
+
onChangeField('title', newText);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[editor, onChangeField, text],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const prevSelected = usePrevious(selected);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!prevSelected && selected) {
|
|
83
|
+
if (editor.selection && Range.isCollapsed(editor.selection)) {
|
|
84
|
+
// keep selection
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
try {
|
|
87
|
+
ReactEditor.focus(editor);
|
|
88
|
+
} catch {}
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
// nothing is selected, move focus to end
|
|
92
|
+
// with this setTimeout uncommented, the focusing of other Volto-Slate
|
|
93
|
+
// blocks breaks, not sure what was its initial role, but maybe we can
|
|
94
|
+
// delete it one day
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
ReactEditor.focus(editor);
|
|
97
|
+
Transforms.select(editor, Editor.end(editor, []));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, [prevSelected, selected, editor]);
|
|
102
|
+
|
|
103
|
+
const handleKeyDown = useCallback(
|
|
104
|
+
(ev) => {
|
|
105
|
+
if (ev.key === 'Return' || ev.key === 'Enter') {
|
|
106
|
+
ev.preventDefault();
|
|
107
|
+
if (!disableNewBlocks) {
|
|
108
|
+
onSelectBlock(
|
|
109
|
+
onAddBlock(config.settings.defaultBlockType, index + 1),
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
} else if (ev.key === 'ArrowUp') {
|
|
113
|
+
ev.preventDefault();
|
|
114
|
+
onFocusPreviousBlock(block, blockNode.current);
|
|
115
|
+
} else if (ev.key === 'ArrowDown') {
|
|
116
|
+
ev.preventDefault();
|
|
117
|
+
onFocusNextBlock(block, blockNode.current);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
[
|
|
121
|
+
index,
|
|
122
|
+
blockNode,
|
|
123
|
+
disableNewBlocks,
|
|
124
|
+
onSelectBlock,
|
|
125
|
+
onAddBlock,
|
|
126
|
+
onFocusPreviousBlock,
|
|
127
|
+
onFocusNextBlock,
|
|
128
|
+
block,
|
|
129
|
+
],
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const val = useMemo(() => {
|
|
133
|
+
return [
|
|
134
|
+
{
|
|
135
|
+
type: 'p',
|
|
136
|
+
children: [{ text }],
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
}, [text]);
|
|
140
|
+
|
|
141
|
+
const handleFocus = useCallback(() => {
|
|
142
|
+
onSelectBlock(block);
|
|
143
|
+
}, [block, onSelectBlock]);
|
|
144
|
+
|
|
145
|
+
const renderElement = useCallback(
|
|
146
|
+
({ attributes, children, element }) => {
|
|
147
|
+
return (
|
|
148
|
+
<Title {...attributes} className="documentFirstHeading">
|
|
149
|
+
{children}
|
|
150
|
+
</Title>
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
[], // eslint-disable-line react-hooks/exhaustive-deps
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
editor.children = val;
|
|
157
|
+
|
|
158
|
+
if (typeof window.__SERVER__ !== 'undefined' || __SERVER__) {
|
|
159
|
+
return <div />;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const placeholder = data.placeholder || intl.formatMessage(messages['title']);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<React.Fragment>
|
|
166
|
+
<BannerView
|
|
167
|
+
{...props}
|
|
168
|
+
banner={{
|
|
169
|
+
title: {
|
|
170
|
+
view: (
|
|
171
|
+
<Slate editor={editor} onChange={handleChange} value={val}>
|
|
172
|
+
<Editable
|
|
173
|
+
readOnly={!editable}
|
|
174
|
+
onKeyDown={handleKeyDown}
|
|
175
|
+
placeholder={placeholder}
|
|
176
|
+
renderElement={renderElement}
|
|
177
|
+
onFocus={handleFocus}
|
|
178
|
+
></Editable>
|
|
179
|
+
</Slate>
|
|
180
|
+
),
|
|
181
|
+
},
|
|
182
|
+
}}
|
|
183
|
+
fluid
|
|
184
|
+
/>
|
|
185
|
+
<SidebarPortal selected={props.selected}>
|
|
186
|
+
<InlineForm
|
|
187
|
+
schema={schema}
|
|
188
|
+
title={schema.title}
|
|
189
|
+
onChangeField={(id, value) => {
|
|
190
|
+
props.onChangeBlock(props.block, {
|
|
191
|
+
...props.data,
|
|
192
|
+
[id]: value,
|
|
193
|
+
});
|
|
194
|
+
}}
|
|
195
|
+
formData={props.data}
|
|
196
|
+
/>
|
|
197
|
+
</SidebarPortal>
|
|
198
|
+
</React.Fragment>
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
TitleBlockEdit.propTypes = {
|
|
203
|
+
properties: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
204
|
+
selected: PropTypes.bool.isRequired,
|
|
205
|
+
block: PropTypes.string.isRequired,
|
|
206
|
+
index: PropTypes.number.isRequired,
|
|
207
|
+
onChangeField: PropTypes.func.isRequired,
|
|
208
|
+
onSelectBlock: PropTypes.func.isRequired,
|
|
209
|
+
onDeleteBlock: PropTypes.func.isRequired,
|
|
210
|
+
onAddBlock: PropTypes.func.isRequired,
|
|
211
|
+
onFocusPreviousBlock: PropTypes.func.isRequired,
|
|
212
|
+
onFocusNextBlock: PropTypes.func.isRequired,
|
|
213
|
+
data: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
214
|
+
editable: PropTypes.bool,
|
|
215
|
+
detached: PropTypes.bool,
|
|
216
|
+
blockNode: PropTypes.any,
|
|
217
|
+
className: PropTypes.string,
|
|
218
|
+
formFieldName: PropTypes.string,
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
TitleBlockEdit.defaultProps = {
|
|
222
|
+
detached: false,
|
|
223
|
+
editable: true,
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export default TitleBlockEdit;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View title block.
|
|
3
|
+
* @module components/manage/Blocks/Title/View
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Portal } from 'react-portal';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
|
|
10
|
+
import { BannerView } from '@eeacms/volto-cca-policy/components';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* View title block class.
|
|
14
|
+
* @class View
|
|
15
|
+
* @extends Component
|
|
16
|
+
*/
|
|
17
|
+
const View = (props) => {
|
|
18
|
+
if (__SERVER__) return <BannerView {...props} />;
|
|
19
|
+
return (
|
|
20
|
+
<Portal node={document.getElementById('page-header')}>
|
|
21
|
+
<BannerView {...props} />
|
|
22
|
+
</Portal>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Property types.
|
|
28
|
+
* @property {Object} propTypes Property types.
|
|
29
|
+
* @static
|
|
30
|
+
*/
|
|
31
|
+
View.propTypes = {
|
|
32
|
+
properties: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default View;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const infoSchema = {
|
|
2
|
+
title: 'Info',
|
|
3
|
+
fieldsets: [
|
|
4
|
+
{
|
|
5
|
+
id: 'default',
|
|
6
|
+
title: 'Default',
|
|
7
|
+
fields: ['description'],
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
properties: {
|
|
11
|
+
description: {
|
|
12
|
+
title: 'Description',
|
|
13
|
+
widget: 'textarea',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
required: [],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: 'Page header',
|
|
21
|
+
fieldsets: [
|
|
22
|
+
{
|
|
23
|
+
id: 'default',
|
|
24
|
+
title: 'Default',
|
|
25
|
+
fields: [
|
|
26
|
+
'hideContentType',
|
|
27
|
+
'hideCreationDate',
|
|
28
|
+
'hidePublishingDate',
|
|
29
|
+
'hideModificationDate',
|
|
30
|
+
'info',
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'actions',
|
|
35
|
+
title: 'Actions',
|
|
36
|
+
fields: ['hideShareButton', 'hideDownloadButton'],
|
|
37
|
+
},
|
|
38
|
+
// {
|
|
39
|
+
// id: 'advanced',
|
|
40
|
+
// title: 'Advanced options',
|
|
41
|
+
// fields: ['contentType'],
|
|
42
|
+
// },
|
|
43
|
+
],
|
|
44
|
+
properties: {
|
|
45
|
+
hideContentType: {
|
|
46
|
+
title: 'Hide content type',
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
},
|
|
49
|
+
hideCreationDate: {
|
|
50
|
+
title: 'Hide creation date',
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
},
|
|
53
|
+
hidePublishingDate: {
|
|
54
|
+
title: 'Hide publishing date',
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
},
|
|
57
|
+
hideModificationDate: {
|
|
58
|
+
title: 'Hide modification date',
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
},
|
|
61
|
+
hideShareButton: {
|
|
62
|
+
title: 'Hide share button',
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
},
|
|
65
|
+
hideDownloadButton: {
|
|
66
|
+
title: 'Hide download button',
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
},
|
|
69
|
+
info: {
|
|
70
|
+
title: 'Extra info',
|
|
71
|
+
widget: 'object_list',
|
|
72
|
+
schema: infoSchema,
|
|
73
|
+
},
|
|
74
|
+
// contentType: {
|
|
75
|
+
// title: 'Type',
|
|
76
|
+
// description: "Custom content-type's name",
|
|
77
|
+
// },
|
|
78
|
+
},
|
|
79
|
+
required: [],
|
|
80
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const getVoltoStyles = (props) => {
|
|
2
|
+
// return an object with same key and value for cx class setting
|
|
3
|
+
const styles = props ? props : {};
|
|
4
|
+
const output = {};
|
|
5
|
+
for (const [key, value] of Object.entries(styles)) {
|
|
6
|
+
if (key === '@type') {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
if (styles[key] === true) {
|
|
10
|
+
output[key] = key;
|
|
11
|
+
} else {
|
|
12
|
+
output[value] = value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return output;
|
|
16
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash';
|
|
2
|
+
import imageFitSVG from '@plone/volto/icons/image-fit.svg';
|
|
3
|
+
import imageWideSVG from '@plone/volto/icons/image-wide.svg';
|
|
4
|
+
import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
5
|
+
|
|
6
|
+
import imageNarrowSVG from '@eeacms/volto-cca-policy/icons/image-narrow.svg';
|
|
7
|
+
|
|
8
|
+
export const ALIGN_INFO_MAP = {
|
|
9
|
+
narrow_width: [imageNarrowSVG, 'Narrow width'],
|
|
10
|
+
container_width: [imageFitSVG, 'Container width'],
|
|
11
|
+
wide_width: [imageWideSVG, 'Wide width'],
|
|
12
|
+
full: [imageFullSVG, 'Full width'],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const addStylingFieldsetSchemaEnhancer = ({ schema }) => {
|
|
16
|
+
const applied = schema?.properties?.styles;
|
|
17
|
+
|
|
18
|
+
if (!applied) {
|
|
19
|
+
const resSchema = cloneDeep(schema);
|
|
20
|
+
|
|
21
|
+
resSchema.fieldsets.push({
|
|
22
|
+
id: 'styling',
|
|
23
|
+
fields: ['styles'],
|
|
24
|
+
title: 'Styling',
|
|
25
|
+
});
|
|
26
|
+
resSchema.properties.styles = {
|
|
27
|
+
widget: 'object',
|
|
28
|
+
title: 'Styling',
|
|
29
|
+
schema: {
|
|
30
|
+
fieldsets: [
|
|
31
|
+
{
|
|
32
|
+
id: 'default',
|
|
33
|
+
title: 'Default',
|
|
34
|
+
fields: ['size'],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
properties: {
|
|
38
|
+
size: {
|
|
39
|
+
widget: 'style_align',
|
|
40
|
+
title: 'Section size',
|
|
41
|
+
actions: Object.keys(ALIGN_INFO_MAP),
|
|
42
|
+
actionsInfoMap: ALIGN_INFO_MAP,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: [],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
return resSchema;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return schema;
|
|
52
|
+
};
|