@eeacms/volto-marine-policy 2.0.23 → 2.0.24
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 +14 -0
- package/package.json +1 -1
- package/src/customizations/@eeacms/volto-block-toc/Block/schema.js +73 -0
- package/src/customizations/@eeacms/volto-block-toc/Block/variations/DefaultTocRenderer.jsx +85 -0
- package/src/customizations/@eeacms/volto-block-toc/Block/variations/helpers.js +8 -0
- package/src/index.js +1 -19
- package/src/less/toc-title-sizes.less +17 -0
- package/theme/extras/tocnav.less +25 -0
- package/theme/globals/site.overrides +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ 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
|
+
### [2.0.24](https://github.com/eea/volto-marine-policy/compare/2.0.23...2.0.24) - 27 August 2025
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: select font size for title [Teodor - [`74a1526`](https://github.com/eea/volto-marine-policy/commit/74a1526e7267d72cab7cd1fac838f26f08d51d47)]
|
|
12
|
+
|
|
13
|
+
#### :house: Internal changes
|
|
14
|
+
|
|
15
|
+
- style: Automated code fix [eea-jenkins - [`c30a127`](https://github.com/eea/volto-marine-policy/commit/c30a12768f15e1f325d7cabc42660657002ec2b5)]
|
|
16
|
+
|
|
17
|
+
#### :hammer_and_wrench: Others
|
|
18
|
+
|
|
19
|
+
- fix EEA colors for background [Teodor - [`73fed1a`](https://github.com/eea/volto-marine-policy/commit/73fed1a8129ed4730bf4e695c8c1feabd2d4391e)]
|
|
20
|
+
- toc styles [narcis2005 - [`687008b`](https://github.com/eea/volto-marine-policy/commit/687008be99f618cb0f2ca98304c9fe04d0aaefc8)]
|
|
7
21
|
### [2.0.23](https://github.com/eea/volto-marine-policy/compare/2.0.22...2.0.23) - 26 August 2025
|
|
8
22
|
|
|
9
23
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const TableOfContentsSchema = ({ data }) => {
|
|
2
|
+
const { variation = 'default' } = data;
|
|
3
|
+
|
|
4
|
+
return {
|
|
5
|
+
title: 'Table of Contents',
|
|
6
|
+
fieldsets: [
|
|
7
|
+
{
|
|
8
|
+
id: 'default',
|
|
9
|
+
title: 'Default',
|
|
10
|
+
fields: [
|
|
11
|
+
'title',
|
|
12
|
+
'hide_title',
|
|
13
|
+
'title_font_size',
|
|
14
|
+
...(variation === 'default' ? ['ordered'] : []),
|
|
15
|
+
...(variation === 'horizontalMenu' ? ['sticky'] : []),
|
|
16
|
+
...(variation === 'accordionMenu' ? ['sticky', 'side_menu'] : []),
|
|
17
|
+
...(variation === 'accordionMenu' ? ['bulleted_list'] : []),
|
|
18
|
+
'levels',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
properties: {
|
|
23
|
+
title: {
|
|
24
|
+
title: 'Block title',
|
|
25
|
+
},
|
|
26
|
+
hide_title: {
|
|
27
|
+
title: 'Hide title',
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
},
|
|
30
|
+
title_font_size: {
|
|
31
|
+
title: 'Title font size',
|
|
32
|
+
choices: [
|
|
33
|
+
['small', 'Small'],
|
|
34
|
+
['medium', 'Medium'],
|
|
35
|
+
['large', 'Large'],
|
|
36
|
+
],
|
|
37
|
+
default: 'medium',
|
|
38
|
+
},
|
|
39
|
+
sticky: {
|
|
40
|
+
title: 'Sticky on top',
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
},
|
|
43
|
+
side_menu: {
|
|
44
|
+
title: 'Use as side menu',
|
|
45
|
+
type: 'boolean',
|
|
46
|
+
},
|
|
47
|
+
levels: {
|
|
48
|
+
title: 'Entries',
|
|
49
|
+
isMulti: true,
|
|
50
|
+
choices: [
|
|
51
|
+
['h1', 'h1'],
|
|
52
|
+
['h2', 'h2'],
|
|
53
|
+
['h3', 'h3'],
|
|
54
|
+
['h4', 'h4'],
|
|
55
|
+
['h5', 'h5'],
|
|
56
|
+
['h6', 'h6'],
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
ordered: {
|
|
60
|
+
title: 'Ordered',
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
},
|
|
63
|
+
bulleted_list: {
|
|
64
|
+
title: 'Use bullet list',
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
description: 'Bullet point for child items',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
required: [],
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default TableOfContentsSchema;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View toc block.
|
|
3
|
+
* @module components/manage/Blocks/ToC/View
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { map } from 'lodash';
|
|
9
|
+
import { List } from 'semantic-ui-react';
|
|
10
|
+
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
11
|
+
import AnchorLink from 'react-anchor-link-smooth-scroll';
|
|
12
|
+
import Slugger from 'github-slugger';
|
|
13
|
+
import { normalizeString } from './helpers';
|
|
14
|
+
import cx from 'classnames';
|
|
15
|
+
|
|
16
|
+
const RenderListItems = ({ items, data }) => {
|
|
17
|
+
return map(items, (item) => {
|
|
18
|
+
const { id, level, title, override_toc, plaintext } = item;
|
|
19
|
+
const slug = override_toc
|
|
20
|
+
? Slugger.slug(normalizeString(plaintext))
|
|
21
|
+
: Slugger.slug(normalizeString(title)) || id;
|
|
22
|
+
return (
|
|
23
|
+
item && (
|
|
24
|
+
<List.Item key={id} className={`item headline-${level}`} as="li">
|
|
25
|
+
<AnchorLink href={`#${slug}`}>{title}</AnchorLink>
|
|
26
|
+
{item.items?.length > 0 && (
|
|
27
|
+
<List
|
|
28
|
+
ordered={data.ordered}
|
|
29
|
+
bulleted={!data.ordered}
|
|
30
|
+
as={data.ordered ? 'ol' : 'ul'}
|
|
31
|
+
>
|
|
32
|
+
<RenderListItems items={item.items} data={data} />
|
|
33
|
+
</List>
|
|
34
|
+
)}
|
|
35
|
+
</List.Item>
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* View toc block class.
|
|
43
|
+
* @class View
|
|
44
|
+
* @extends Component
|
|
45
|
+
*/
|
|
46
|
+
const View = ({ data, tocEntries }) => {
|
|
47
|
+
const titleFontSizeClass = data.title_font_size
|
|
48
|
+
? `toc-title-${data.title_font_size}`
|
|
49
|
+
: 'toc-title-medium';
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
{data.title && !data.hide_title ? (
|
|
54
|
+
<h2 className={cx(titleFontSizeClass)}>
|
|
55
|
+
{data.title || (
|
|
56
|
+
<FormattedMessage
|
|
57
|
+
id="Table of Contents"
|
|
58
|
+
defaultMessage="Table of Contents"
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
</h2>
|
|
62
|
+
) : (
|
|
63
|
+
''
|
|
64
|
+
)}
|
|
65
|
+
<List
|
|
66
|
+
ordered={data.ordered}
|
|
67
|
+
bulleted={!data.ordered}
|
|
68
|
+
as={data.ordered ? 'ol' : 'ul'}
|
|
69
|
+
>
|
|
70
|
+
<RenderListItems items={tocEntries} data={data} />
|
|
71
|
+
</List>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Property types.
|
|
78
|
+
* @property {Object} propTypes Property types.
|
|
79
|
+
* @static
|
|
80
|
+
*/
|
|
81
|
+
View.propTypes = {
|
|
82
|
+
properties: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default injectIntl(View);
|
package/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { breadcrumb, localnavigation, workflowProgressPath } from './reducers';
|
|
|
16
16
|
import customBlockTemplates from '@eeacms/volto-marine-policy/components/Blocks/CustomBlockTemplates/customBlockTemplates';
|
|
17
17
|
import TextAlignWidget from './components/Widgets/TextAlign';
|
|
18
18
|
import './slate-styles.less';
|
|
19
|
+
import './less/toc-title-sizes.less';
|
|
19
20
|
|
|
20
21
|
import installSearchEngine from './search';
|
|
21
22
|
|
|
@@ -36,23 +37,6 @@ import eeaWhiteLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/as
|
|
|
36
37
|
import europeanComissionLogo from '@eeacms/volto-marine-policy/static/ec_logo_white.svg';
|
|
37
38
|
import MeasureView from '@eeacms/volto-marine-policy/components/Widgets/MeasureViewWidget';
|
|
38
39
|
|
|
39
|
-
const available_colors = [
|
|
40
|
-
'#ffffff',
|
|
41
|
-
'#f7f3ef',
|
|
42
|
-
'#e3edf7',
|
|
43
|
-
'#002d54',
|
|
44
|
-
'#59d3ff',
|
|
45
|
-
'#2dd2b7',
|
|
46
|
-
'#1271e1',
|
|
47
|
-
'#826A6A',
|
|
48
|
-
'#FAD0C3',
|
|
49
|
-
'#F3E2AB',
|
|
50
|
-
'#C1E1C5',
|
|
51
|
-
'#BEDADC',
|
|
52
|
-
'#BED3F3',
|
|
53
|
-
'#000000',
|
|
54
|
-
];
|
|
55
|
-
|
|
56
40
|
const restrictedBlocks = ['imagecards'];
|
|
57
41
|
|
|
58
42
|
const messages = defineMessages({
|
|
@@ -204,8 +188,6 @@ const applyConfig = (config) => {
|
|
|
204
188
|
|
|
205
189
|
config.settings.navDepth = 3;
|
|
206
190
|
|
|
207
|
-
config.settings.available_colors = available_colors;
|
|
208
|
-
|
|
209
191
|
// config.settings.externalRoutes = [
|
|
210
192
|
// ...(config.settings.externalRoutes || []),
|
|
211
193
|
// ...(config.settings.prefixPath
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* TOC Title Font Size Customizations */
|
|
2
|
+
.table-of-contents {
|
|
3
|
+
.toc-title-small {
|
|
4
|
+
font-size: 1.2rem !important;
|
|
5
|
+
line-height: 1.3;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.toc-title-medium {
|
|
9
|
+
font-size: 1.5rem !important;
|
|
10
|
+
line-height: 1.3;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.toc-title-large {
|
|
14
|
+
font-size: 2rem !important;
|
|
15
|
+
line-height: 1.2;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.table-of-contents.accordionMenu {
|
|
2
|
+
.ui.accordion {
|
|
3
|
+
.accordion {
|
|
4
|
+
margin: 1em 0em 0em !important;
|
|
5
|
+
padding: 0em;
|
|
6
|
+
}
|
|
7
|
+
.title {
|
|
8
|
+
padding: 0.75em 2em;
|
|
9
|
+
}
|
|
10
|
+
.content {
|
|
11
|
+
--bg-color: initial !important;
|
|
12
|
+
ul {
|
|
13
|
+
padding: 0.5rem 10px 1.3rem 50px;
|
|
14
|
+
}
|
|
15
|
+
.accordion-list-bulleted li::marker {
|
|
16
|
+
content: '\25CB';
|
|
17
|
+
color: @secondaryColor;
|
|
18
|
+
font-size: 1.2em;
|
|
19
|
+
}
|
|
20
|
+
.title {
|
|
21
|
+
font-size: 1em;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|