@eeacms/volto-eea-website-theme 1.17.1 → 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 +30 -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 +13 -5
- package/src/slate.js +3 -1
package/CHANGELOG.md
CHANGED
@@ -4,6 +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)]
|
28
|
+
### [1.17.2](https://github.com/eea/volto-eea-website-theme/compare/1.17.1...1.17.2) - 14 June 2023
|
29
|
+
|
30
|
+
#### :rocket: New Features
|
31
|
+
|
32
|
+
- feat: config nextcloud subtitles languages - refs #253430 [dobri1408 - [`1fc72df`](https://github.com/eea/volto-eea-website-theme/commit/1fc72df37adbb9f9c03f4adb6ad800d7e603ed90)]
|
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)]
|
7
37
|
### [1.17.1](https://github.com/eea/volto-eea-website-theme/compare/1.17.0...1.17.1) - 12 June 2023
|
8
38
|
|
9
39
|
#### :nail_care: Enhancements
|
@@ -56,7 +86,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
56
86
|
|
57
87
|
#### :house: Internal changes
|
58
88
|
|
59
|
-
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`370dcbf`](https://github.com/eea/volto-eea-website-theme/commit/370dcbfbf1a8135ce7b1b3b271b004552a631837)]
|
60
89
|
|
61
90
|
#### :hammer_and_wrench: Others
|
62
91
|
|
@@ -212,7 +241,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
212
241
|
|
213
242
|
#### :hammer_and_wrench: Others
|
214
243
|
|
215
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6c5e2f8`](https://github.com/eea/volto-eea-website-theme/commit/6c5e2f80456e2061d9e9c15fd0a0b91b9ac70568)]
|
216
244
|
### [1.9.1](https://github.com/eea/volto-eea-website-theme/compare/1.9.0...1.9.1) - 28 February 2023
|
217
245
|
|
218
246
|
#### :bug: Bug Fixes
|
@@ -359,7 +387,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
359
387
|
|
360
388
|
- For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
|
361
389
|
- Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
|
362
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
|
363
390
|
### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
|
364
391
|
|
365
392
|
#### :hammer_and_wrench: Others
|
@@ -393,7 +420,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
393
420
|
|
394
421
|
- Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
|
395
422
|
- bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
|
396
|
-
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
|
397
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)]
|
398
424
|
### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
|
399
425
|
|
@@ -403,7 +429,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
403
429
|
|
404
430
|
#### :hammer_and_wrench: Others
|
405
431
|
|
406
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
|
407
432
|
- Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
|
408
433
|
- Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
|
409
434
|
### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
|
@@ -414,7 +439,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
414
439
|
|
415
440
|
#### :hammer_and_wrench: Others
|
416
441
|
|
417
|
-
- yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
|
418
442
|
### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
|
419
443
|
|
420
444
|
#### :rocket: New Features
|
@@ -455,7 +479,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
455
479
|
- Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
|
456
480
|
- Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
|
457
481
|
- fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
|
458
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
|
459
482
|
### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
|
460
483
|
|
461
484
|
#### :nail_care: Enhancements
|
@@ -503,7 +526,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
503
526
|
|
504
527
|
#### :hammer_and_wrench: Others
|
505
528
|
|
506
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
|
507
529
|
### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
|
508
530
|
|
509
531
|
#### :hammer_and_wrench: Others
|
@@ -771,7 +793,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
771
793
|
- Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
|
772
794
|
- Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
|
773
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)]
|
774
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
|
775
796
|
- use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
|
776
797
|
- Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
|
777
798
|
- Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
|
@@ -813,5 +834,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
813
834
|
|
814
835
|
#### :hammer_and_wrench: Others
|
815
836
|
|
816
|
-
- yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
|
817
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';
|
@@ -46,6 +47,14 @@ const applyConfig = (config) => {
|
|
46
47
|
config.blocks.blocksConfig[block].restricted = true;
|
47
48
|
}
|
48
49
|
});
|
50
|
+
// Set Languages in nextcloud-video-block
|
51
|
+
if (
|
52
|
+
config?.blocks?.blocksConfig?.nextCloudVideo?.subtitlesLanguages &&
|
53
|
+
config?.settings?.eea?.languages?.length > 0
|
54
|
+
)
|
55
|
+
config.blocks.blocksConfig.nextCloudVideo.subtitlesLanguages = config.settings.eea.languages.map(
|
56
|
+
(el) => [el.code, el.name],
|
57
|
+
);
|
49
58
|
|
50
59
|
// Enable Title block
|
51
60
|
config.blocks.blocksConfig.title.restricted = false;
|
@@ -103,11 +112,10 @@ const applyConfig = (config) => {
|
|
103
112
|
config.blocks.blocksConfig.hero.copyrightPrefix = 'Image';
|
104
113
|
}
|
105
114
|
|
106
|
-
// Custom
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
}
|
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;
|
111
119
|
|
112
120
|
// /voltoCustom.css express-middleware
|
113
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 || {}),
|