@eeacms/volto-eea-website-theme 1.17.2 → 1.18.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 +24 -10
- package/package.json +1 -1
- package/src/components/theme/Widgets/ThemesWidget.jsx +20 -0
- package/src/components/theme/Widgets/TokenWidget.jsx +4 -1
- package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/README.txt +1 -0
- package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/StyleMenu.jsx +157 -0
- package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/utils.js +168 -0
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +5 -5
- package/src/index.js +5 -5
- package/src/slate.js +3 -1
package/CHANGELOG.md
CHANGED
@@ -4,12 +4,36 @@ 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
|
+
### [1.18.0](https://github.com/eea/volto-eea-website-theme/compare/1.17.2...1.18.0) - 20 June 2023
|
8
|
+
|
9
|
+
#### :rocket: New Features
|
10
|
+
|
11
|
+
- feat: ThemesWidget update advanced-search link - refs #145772 [Alin Voinea - [`036f471`](https://github.com/eea/volto-eea-website-theme/commit/036f4711ace0985e2b542c64a1cbe28fd97911bd)]
|
12
|
+
- feat: Add ThemeasWidget for taxonomy_themes and fix tags link - refs #145772 [Alin Voinea - [`903de63`](https://github.com/eea/volto-eea-website-theme/commit/903de638be2e2b2a9c550200706271fc72f09e36)]
|
13
|
+
|
14
|
+
#### :bug: Bug Fixes
|
15
|
+
|
16
|
+
- fix: clearformat only selection [nileshgulia1 - [`e8aab36`](https://github.com/eea/volto-eea-website-theme/commit/e8aab36c0c86e2a2a01ca53673a89c596949a4b1)]
|
17
|
+
- fix(slate): backport feature from volto-slate that sets classes on style options [David Ichim - [`5ed97f3`](https://github.com/eea/volto-eea-website-theme/commit/5ed97f34a4714dcbaa11296ca64d043a24464d3e)]
|
18
|
+
|
19
|
+
#### :nail_care: Enhancements
|
20
|
+
|
21
|
+
- change(footer): removed fallback to empty array for footer actions #153 from eea/footer_actions [ichim-david - [`8fb9c08`](https://github.com/eea/volto-eea-website-theme/commit/8fb9c082a7fac14e31c7e568cc85cb7095b0524d)]
|
22
|
+
|
23
|
+
#### :hammer_and_wrench: Others
|
24
|
+
|
25
|
+
- Refs #254132 - Bump to 1.18.0. [GhitaB - [`51f483b`](https://github.com/eea/volto-eea-website-theme/commit/51f483b3dba6cff13471fc512d372b577991f6f4)]
|
26
|
+
- Refs #254132 - Do not initialize actions with []. Make sure actions in footerOpts are used if set. [GhitaB - [`8c0afb5`](https://github.com/eea/volto-eea-website-theme/commit/8c0afb539b0c96928545bc9a6974a189c9e886b8)]
|
27
|
+
- test: Fix sonarqube - Convert the conditional to a boolean to avoid leaked value [Alin Voinea - [`195eb19`](https://github.com/eea/volto-eea-website-theme/commit/195eb19b8aa40a95bca6aafc7720bdc6b8e02340)]
|
7
28
|
### [1.17.2](https://github.com/eea/volto-eea-website-theme/compare/1.17.1...1.17.2) - 14 June 2023
|
8
29
|
|
9
30
|
#### :rocket: New Features
|
10
31
|
|
11
32
|
- feat: config nextcloud subtitles languages - refs #253430 [dobri1408 - [`1fc72df`](https://github.com/eea/volto-eea-website-theme/commit/1fc72df37adbb9f9c03f4adb6ad800d7e603ed90)]
|
12
33
|
|
34
|
+
#### :hammer_and_wrench: Others
|
35
|
+
|
36
|
+
- Release #150 from eea/develop [ichim-david - [`52f1f78`](https://github.com/eea/volto-eea-website-theme/commit/52f1f782a1d815c6df5be1aabe34f67715637d0f)]
|
13
37
|
### [1.17.1](https://github.com/eea/volto-eea-website-theme/compare/1.17.0...1.17.1) - 12 June 2023
|
14
38
|
|
15
39
|
#### :nail_care: Enhancements
|
@@ -62,7 +86,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
62
86
|
|
63
87
|
#### :house: Internal changes
|
64
88
|
|
65
|
-
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`370dcbf`](https://github.com/eea/volto-eea-website-theme/commit/370dcbfbf1a8135ce7b1b3b271b004552a631837)]
|
66
89
|
|
67
90
|
#### :hammer_and_wrench: Others
|
68
91
|
|
@@ -218,7 +241,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
218
241
|
|
219
242
|
#### :hammer_and_wrench: Others
|
220
243
|
|
221
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6c5e2f8`](https://github.com/eea/volto-eea-website-theme/commit/6c5e2f80456e2061d9e9c15fd0a0b91b9ac70568)]
|
222
244
|
### [1.9.1](https://github.com/eea/volto-eea-website-theme/compare/1.9.0...1.9.1) - 28 February 2023
|
223
245
|
|
224
246
|
#### :bug: Bug Fixes
|
@@ -365,7 +387,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
365
387
|
|
366
388
|
- For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
|
367
389
|
- Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
|
368
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
|
369
390
|
### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
|
370
391
|
|
371
392
|
#### :hammer_and_wrench: Others
|
@@ -399,7 +420,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
399
420
|
|
400
421
|
- Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
|
401
422
|
- bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
|
402
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
|
403
423
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
|
404
424
|
### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
|
405
425
|
|
@@ -409,7 +429,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
409
429
|
|
410
430
|
#### :hammer_and_wrench: Others
|
411
431
|
|
412
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
|
413
432
|
- Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
|
414
433
|
- Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
|
415
434
|
### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
|
@@ -420,7 +439,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
420
439
|
|
421
440
|
#### :hammer_and_wrench: Others
|
422
441
|
|
423
|
-
- yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
|
424
442
|
### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
|
425
443
|
|
426
444
|
#### :rocket: New Features
|
@@ -461,7 +479,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
461
479
|
- Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
|
462
480
|
- Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
|
463
481
|
- fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
|
464
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
|
465
482
|
### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
|
466
483
|
|
467
484
|
#### :nail_care: Enhancements
|
@@ -509,7 +526,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
509
526
|
|
510
527
|
#### :hammer_and_wrench: Others
|
511
528
|
|
512
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
|
513
529
|
### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
|
514
530
|
|
515
531
|
#### :hammer_and_wrench: Others
|
@@ -777,7 +793,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
777
793
|
- Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
|
778
794
|
- Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
|
779
795
|
- feature(breadcrumbs): implement eea-design-system breadcrumb as Volto component #32 #7 [ichim-david - [`181af41`](https://github.com/eea/volto-eea-website-theme/commit/181af4125ce2b9ddac56dab4723cb11c26633221)]
|
780
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
|
781
796
|
- use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
|
782
797
|
- Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
|
783
798
|
- Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
|
@@ -819,5 +834,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
819
834
|
|
820
835
|
#### :hammer_and_wrench: Others
|
821
836
|
|
822
|
-
- yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
|
823
837
|
- Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
|
package/package.json
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import cx from 'classnames';
|
3
|
+
import Tag from '@eeacms/volto-eea-design-system/ui/Tag/Tag';
|
4
|
+
|
5
|
+
export const ThemesWidget = ({ value, children, className }) => {
|
6
|
+
return value ? (
|
7
|
+
<span className={cx(className, 'token', 'widget')}>
|
8
|
+
{value.map((tag) => (
|
9
|
+
<Tag
|
10
|
+
href={`https://www.eea.europa.eu/en/advanced-search?filters[0][field]=topic&filters[0][values][0]=${tag.title}&filters[0][type]=any&filters[1][field]=language&filters[1][type]=any&filters[1][values][0]=en&sort-field=issued.date&sort-direction=desc`}
|
11
|
+
key={tag.token}
|
12
|
+
>
|
13
|
+
{children ? children(tag.title) : tag.title}
|
14
|
+
</Tag>
|
15
|
+
))}
|
16
|
+
</span>
|
17
|
+
) : (
|
18
|
+
''
|
19
|
+
);
|
20
|
+
};
|
@@ -6,7 +6,10 @@ export const TokenWidget = ({ value, children, className }) =>
|
|
6
6
|
value ? (
|
7
7
|
<span className={cx(className, 'token', 'widget')}>
|
8
8
|
{value.map((tag) => (
|
9
|
-
<Tag
|
9
|
+
<Tag
|
10
|
+
href={`https://www.eea.europa.eu/en/advanced-search?q=${tag}`}
|
11
|
+
key={tag}
|
12
|
+
>
|
10
13
|
{children ? children(tag) : tag}
|
11
14
|
</Tag>
|
12
15
|
))}
|
@@ -0,0 +1 @@
|
|
1
|
+
This customization fixes bugs with styleMenu not highlighting selected styles in some scenarios. This should be removed after https://github.com/plone/volto/pull/4852
|
@@ -0,0 +1,157 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { useSlate } from 'slate-react';
|
3
|
+
import { Dropdown } from 'semantic-ui-react';
|
4
|
+
import { useIntl, defineMessages } from 'react-intl';
|
5
|
+
import cx from 'classnames';
|
6
|
+
import { omit } from 'lodash';
|
7
|
+
import { isBlockStyleActive, isInlineStyleActive, toggleStyle } from './utils';
|
8
|
+
import config from '@plone/volto/registry';
|
9
|
+
import { ToolbarButton } from '@plone/volto-slate/editor/ui';
|
10
|
+
import paintSVG from '@plone/volto/icons/paint.svg';
|
11
|
+
|
12
|
+
const messages = defineMessages({
|
13
|
+
inlineStyle: {
|
14
|
+
id: 'Inline Style',
|
15
|
+
defaultMessage: 'Inline Style',
|
16
|
+
},
|
17
|
+
paragraphStyle: {
|
18
|
+
id: 'Paragraph Style',
|
19
|
+
defaultMessage: 'Paragraph Style',
|
20
|
+
},
|
21
|
+
additionalStyles: {
|
22
|
+
id: 'Additional Styles',
|
23
|
+
defaultMessage: 'Additional Styles',
|
24
|
+
},
|
25
|
+
});
|
26
|
+
|
27
|
+
const StyleMenuButton = ({ icon, active, ...props }) => (
|
28
|
+
<ToolbarButton {...props} icon={icon} active={active} />
|
29
|
+
);
|
30
|
+
|
31
|
+
const MenuOpts = ({ editor, toSelect, option, type }) => {
|
32
|
+
const isActive = toSelect.includes(option);
|
33
|
+
return (
|
34
|
+
<Dropdown.Item
|
35
|
+
as="span"
|
36
|
+
active={isActive}
|
37
|
+
className={cx(`${type}-${option.value}`, { active: isActive })}
|
38
|
+
{...omit(option, ['isBlock'])}
|
39
|
+
data-isblock={option.isBlock}
|
40
|
+
onClick={(event, selItem) => {
|
41
|
+
toggleStyle(editor, {
|
42
|
+
cssClass: selItem.value,
|
43
|
+
isBlock: selItem.isBlock,
|
44
|
+
});
|
45
|
+
}}
|
46
|
+
/>
|
47
|
+
);
|
48
|
+
};
|
49
|
+
|
50
|
+
const StylingsButton = (props) => {
|
51
|
+
const editor = useSlate();
|
52
|
+
const intl = useIntl();
|
53
|
+
|
54
|
+
// Converting the settings to a format that is required by dropdowns.
|
55
|
+
const inlineOpts = [
|
56
|
+
...config.settings.slate.styleMenu.inlineStyles.map((def) => {
|
57
|
+
return {
|
58
|
+
value: def.cssClass,
|
59
|
+
text: def.label,
|
60
|
+
icon: def.icon,
|
61
|
+
isBlock: false,
|
62
|
+
};
|
63
|
+
}),
|
64
|
+
];
|
65
|
+
const blockOpts = [
|
66
|
+
...config.settings.slate.styleMenu.blockStyles.map((def) => {
|
67
|
+
return {
|
68
|
+
value: def.cssClass,
|
69
|
+
text: def.label,
|
70
|
+
icon: def.icon,
|
71
|
+
isBlock: true,
|
72
|
+
};
|
73
|
+
}),
|
74
|
+
];
|
75
|
+
|
76
|
+
// Calculating the initial selection.
|
77
|
+
const toSelect = [];
|
78
|
+
// block styles
|
79
|
+
for (const val of blockOpts) {
|
80
|
+
const ia = isBlockStyleActive(editor, val.value);
|
81
|
+
if (ia) {
|
82
|
+
toSelect.push(val);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
// inline styles
|
86
|
+
for (const val of inlineOpts) {
|
87
|
+
const ia = isInlineStyleActive(editor, val.value);
|
88
|
+
if (ia) {
|
89
|
+
toSelect.push(val);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
const menuItemProps = {
|
94
|
+
toSelect,
|
95
|
+
editor,
|
96
|
+
};
|
97
|
+
const showMenu = inlineOpts.length || blockOpts.length;
|
98
|
+
return showMenu ? (
|
99
|
+
<Dropdown
|
100
|
+
id="style-menu"
|
101
|
+
pointing="top left"
|
102
|
+
multiple
|
103
|
+
value={toSelect}
|
104
|
+
disabled={config.settings.slate.styleMenu.disabled ?? false}
|
105
|
+
additionLabel={intl.formatMessage(messages.additionalStyles)}
|
106
|
+
trigger={
|
107
|
+
<StyleMenuButton
|
108
|
+
title={intl.formatMessage(messages.additionalStyles)}
|
109
|
+
icon={paintSVG}
|
110
|
+
active={toSelect.length > 0}
|
111
|
+
/>
|
112
|
+
}
|
113
|
+
>
|
114
|
+
<Dropdown.Menu>
|
115
|
+
{inlineOpts.length ? (
|
116
|
+
<>
|
117
|
+
<Dropdown.Header
|
118
|
+
content={intl.formatMessage(messages.inlineStyle)}
|
119
|
+
/>
|
120
|
+
{inlineOpts.map((option, index) => (
|
121
|
+
<MenuOpts
|
122
|
+
{...menuItemProps}
|
123
|
+
type="inline-style"
|
124
|
+
option={option}
|
125
|
+
key={index}
|
126
|
+
/>
|
127
|
+
))}
|
128
|
+
</>
|
129
|
+
) : (
|
130
|
+
''
|
131
|
+
)}
|
132
|
+
|
133
|
+
{blockOpts.length ? (
|
134
|
+
<>
|
135
|
+
<Dropdown.Header
|
136
|
+
content={intl.formatMessage(messages.paragraphStyle)}
|
137
|
+
/>
|
138
|
+
{blockOpts.map((option, index) => (
|
139
|
+
<MenuOpts
|
140
|
+
{...menuItemProps}
|
141
|
+
type="block-style"
|
142
|
+
option={option}
|
143
|
+
key={index}
|
144
|
+
/>
|
145
|
+
))}
|
146
|
+
</>
|
147
|
+
) : (
|
148
|
+
''
|
149
|
+
)}
|
150
|
+
</Dropdown.Menu>
|
151
|
+
</Dropdown>
|
152
|
+
) : (
|
153
|
+
''
|
154
|
+
);
|
155
|
+
};
|
156
|
+
|
157
|
+
export default StylingsButton;
|
@@ -0,0 +1,168 @@
|
|
1
|
+
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
|
2
|
+
import { Editor, Transforms } from 'slate';
|
3
|
+
import { isBlockActive } from '@plone/volto-slate/utils';
|
4
|
+
import config from '@plone/volto/registry';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Toggles a style (e.g. in the StyleMenu plugin).
|
8
|
+
* @param {Editor} editor
|
9
|
+
* @param {object} options
|
10
|
+
* @param {boolean} options.isRequested Whether the given style is requested by
|
11
|
+
* the user. The style is only applied if it is requested and only removed if it
|
12
|
+
* is not requested.
|
13
|
+
*/
|
14
|
+
export const toggleStyle = (editor, { cssClass, isBlock, isRequested }) => {
|
15
|
+
if (isBlock) {
|
16
|
+
toggleBlockStyle(editor, cssClass);
|
17
|
+
} else {
|
18
|
+
toggleInlineStyle(editor, cssClass);
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
export const toggleBlockStyle = (editor, style) => {
|
23
|
+
// We have 6 boolean variables which need to be accounted for.
|
24
|
+
// See https://docs.google.com/spreadsheets/d/1mVeMuqSTMABV2BhoHPrPAFjn7zUksbNgZ9AQK_dcd3U/edit?usp=sharing
|
25
|
+
const { slate } = config.settings;
|
26
|
+
|
27
|
+
const isListItem = isBlockActive(editor, slate.listItemType);
|
28
|
+
const isActive = isBlockStyleActive(editor, style);
|
29
|
+
const wantsList = false;
|
30
|
+
|
31
|
+
if (isListItem && !wantsList) {
|
32
|
+
toggleBlockStyleAsListItem(editor, style);
|
33
|
+
} else if (isListItem && wantsList && !isActive) {
|
34
|
+
// switchListType(editor, format); // this will deconstruct to Volto blocks
|
35
|
+
} else if (!isListItem && wantsList) {
|
36
|
+
// changeBlockToList(editor, format);
|
37
|
+
} else if (!isListItem && !wantsList) {
|
38
|
+
internalToggleBlockStyle(editor, style);
|
39
|
+
} else {
|
40
|
+
console.warn('toggleBlockStyle case not covered, please examine:', {
|
41
|
+
wantsList,
|
42
|
+
isActive,
|
43
|
+
isListItem,
|
44
|
+
});
|
45
|
+
}
|
46
|
+
};
|
47
|
+
|
48
|
+
export const toggleInlineStyle = (editor, style) => {
|
49
|
+
// We have 6 boolean variables which need to be accounted for.
|
50
|
+
// See https://docs.google.com/spreadsheets/d/1mVeMuqSTMABV2BhoHPrPAFjn7zUksbNgZ9AQK_dcd3U/edit?usp=sharing
|
51
|
+
const { slate } = config.settings;
|
52
|
+
|
53
|
+
const isListItem = isBlockActive(editor, slate.listItemType);
|
54
|
+
const isActive = isInlineStyleActive(editor, style);
|
55
|
+
const wantsList = false;
|
56
|
+
|
57
|
+
if (isListItem && !wantsList) {
|
58
|
+
toggleInlineStyleAsListItem(editor, style);
|
59
|
+
} else if (isListItem && wantsList && !isActive) {
|
60
|
+
// switchListType(editor, format); // this will deconstruct to Volto blocks
|
61
|
+
} else if (!isListItem && wantsList) {
|
62
|
+
// changeBlockToList(editor, format);
|
63
|
+
} else if (!isListItem && !wantsList) {
|
64
|
+
internalToggleInlineStyle(editor, style);
|
65
|
+
} else {
|
66
|
+
console.warn('toggleInlineStyle case not covered, please examine:', {
|
67
|
+
wantsList,
|
68
|
+
isActive,
|
69
|
+
isListItem,
|
70
|
+
});
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
export const isBlockStyleActive = (editor, style) => {
|
75
|
+
const keyName = `style-${style}`;
|
76
|
+
const sn = Array.from(
|
77
|
+
Editor.nodes(editor, {
|
78
|
+
match: (n) => {
|
79
|
+
const isStyle = typeof n.styleName === 'string' || n[keyName];
|
80
|
+
return !Editor.isEditor(n) && isStyle;
|
81
|
+
},
|
82
|
+
mode: 'all',
|
83
|
+
}),
|
84
|
+
);
|
85
|
+
|
86
|
+
for (const [n] of sn) {
|
87
|
+
if (typeof n.styleName === 'string') {
|
88
|
+
if (n.styleName.split(' ').filter((x) => x === style).length > 0) {
|
89
|
+
return true;
|
90
|
+
}
|
91
|
+
} else if (
|
92
|
+
n[keyName] &&
|
93
|
+
keyName.split('-').filter((x) => x === style).length > 0
|
94
|
+
)
|
95
|
+
return true;
|
96
|
+
}
|
97
|
+
return false;
|
98
|
+
};
|
99
|
+
|
100
|
+
export const isInlineStyleActive = (editor, style) => {
|
101
|
+
const m = Editor.marks(editor);
|
102
|
+
const keyName = `style-${style}`;
|
103
|
+
if (m && m[keyName]) {
|
104
|
+
return true;
|
105
|
+
}
|
106
|
+
return false;
|
107
|
+
};
|
108
|
+
|
109
|
+
export const internalToggleBlockStyle = (editor, style) => {
|
110
|
+
toggleBlockStyleInSelection(editor, style);
|
111
|
+
};
|
112
|
+
|
113
|
+
export const internalToggleInlineStyle = (editor, style) => {
|
114
|
+
toggleInlineStyleInSelection(editor, style);
|
115
|
+
};
|
116
|
+
|
117
|
+
/*
|
118
|
+
* Applies a block format unto a list item. Will split the list and deconstruct the
|
119
|
+
* block
|
120
|
+
*/
|
121
|
+
export const toggleBlockStyleAsListItem = (editor, style) => {
|
122
|
+
toggleBlockStyleInSelection(editor, style);
|
123
|
+
};
|
124
|
+
|
125
|
+
/*
|
126
|
+
* Applies an inline style unto a list item.
|
127
|
+
*/
|
128
|
+
export const toggleInlineStyleAsListItem = (editor, style) => {
|
129
|
+
toggleInlineStyleInSelection(editor, style);
|
130
|
+
};
|
131
|
+
|
132
|
+
function toggleInlineStyleInSelection(editor, style) {
|
133
|
+
const m = Editor.marks(editor);
|
134
|
+
const keyName = 'style-' + style;
|
135
|
+
|
136
|
+
if (m && m[keyName]) {
|
137
|
+
Editor.removeMark(editor, keyName);
|
138
|
+
} else {
|
139
|
+
Editor.addMark(editor, keyName, true);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
function toggleBlockStyleInSelection(editor, style) {
|
144
|
+
const sn = Array.from(
|
145
|
+
Editor.nodes(editor, {
|
146
|
+
mode: 'highest',
|
147
|
+
match: (n) => {
|
148
|
+
return !Editor.isEditor(n);
|
149
|
+
},
|
150
|
+
}),
|
151
|
+
);
|
152
|
+
|
153
|
+
for (const [n, p] of sn) {
|
154
|
+
let cn = n.styleName;
|
155
|
+
if (typeof n.styleName !== 'string') {
|
156
|
+
cn = style;
|
157
|
+
} else if (n.styleName.split(' ').filter((x) => x === style).length > 0) {
|
158
|
+
cn = cn
|
159
|
+
.split(' ')
|
160
|
+
.filter((x) => x !== style)
|
161
|
+
.join(' ');
|
162
|
+
} else {
|
163
|
+
// the style is not set but other styles are set
|
164
|
+
cn = cn.split(' ').concat(style).join(' ');
|
165
|
+
}
|
166
|
+
Transforms.setNodes(editor, { styleName: cn }, { at: p });
|
167
|
+
}
|
168
|
+
}
|
@@ -13,11 +13,11 @@ import isArray from 'lodash/isArray';
|
|
13
13
|
const Footer = () => {
|
14
14
|
const { eea } = config.settings;
|
15
15
|
const {
|
16
|
-
footerActions
|
17
|
-
copyrightActions
|
18
|
-
socialActions
|
19
|
-
contactActions
|
20
|
-
contactExtraActions
|
16
|
+
footerActions,
|
17
|
+
copyrightActions,
|
18
|
+
socialActions,
|
19
|
+
contactActions,
|
20
|
+
contactExtraActions,
|
21
21
|
} = useSelector(
|
22
22
|
(state) => ({
|
23
23
|
footerActions: state.actions?.actions?.footer_actions,
|
package/src/index.js
CHANGED
@@ -7,6 +7,7 @@ import CustomCSS from '@eeacms/volto-eea-website-theme/components/theme/CustomCS
|
|
7
7
|
import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
|
8
8
|
import DraftBackground from '@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground';
|
9
9
|
import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
|
10
|
+
import { ThemesWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/ThemesWidget';
|
10
11
|
import SubsiteClass from './components/theme/SubsiteClass';
|
11
12
|
import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
|
12
13
|
import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
|
@@ -111,11 +112,10 @@ const applyConfig = (config) => {
|
|
111
112
|
config.blocks.blocksConfig.hero.copyrightPrefix = 'Image';
|
112
113
|
}
|
113
114
|
|
114
|
-
// Custom
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
}
|
115
|
+
// Custom Widgets
|
116
|
+
config.widgets.views.id.taxonomy_themes = ThemesWidget;
|
117
|
+
config.widgets.views.id.subjects = TokenWidget;
|
118
|
+
config.widgets.views.widget.tags = TokenWidget;
|
119
119
|
|
120
120
|
// /voltoCustom.css express-middleware
|
121
121
|
// /ok express-middleware - see also: https://github.com/plone/volto/pull/4432
|
package/src/slate.js
CHANGED
@@ -66,7 +66,7 @@ const clearFormatting = (editor) => {
|
|
66
66
|
// console.log('node', n, p);
|
67
67
|
return Text.isText(n);
|
68
68
|
},
|
69
|
-
at: [0], // uncomment if you want everything to be cleared
|
69
|
+
//at: [0], // uncomment if you want everything to be cleared
|
70
70
|
}),
|
71
71
|
);
|
72
72
|
|
@@ -215,6 +215,8 @@ export default function installSlate(config) {
|
|
215
215
|
</List.Item>
|
216
216
|
);
|
217
217
|
|
218
|
+
config.settings.slate.allowedHeadlineElements.push('zotero');
|
219
|
+
|
218
220
|
// Slate StyleMenu configuration
|
219
221
|
config.settings.slate.styleMenu = {
|
220
222
|
...(config.settings.slate.styleMenu || {}),
|