@eeacms/volto-eea-website-theme 1.8.0 → 1.8.2

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 CHANGED
@@ -4,6 +4,46 @@ 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.8.2](https://github.com/eea/volto-eea-website-theme/compare/1.8.1...1.8.2) - 14 February 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: use removeTrailingSlash [Mimi - [`2fa8e23`](https://github.com/eea/volto-eea-website-theme/commit/2fa8e23525af589efb13f5b04e52026a97245556)]
12
+ - feat: compare pathname to contentId to show draft watermark [Mimi - [`de870d8`](https://github.com/eea/volto-eea-website-theme/commit/de870d8be85b7aa64e26697e1e19709c1c4721cb)]
13
+ - feat: show or remove the draft watermark based on the value from the ENV file [Mimi - [`e5d2ce0`](https://github.com/eea/volto-eea-website-theme/commit/e5d2ce00f865cbe5ddb95030cb8ccd8a609ebf02)]
14
+ - feat: remove draft image from control panel and login [Mimi - [`274891a`](https://github.com/eea/volto-eea-website-theme/commit/274891a0810102e445813bb59735c56403125895)]
15
+
16
+ #### :bug: Bug Fixes
17
+
18
+ - fix(search): Fix some issues in the search popup #107 from eea/fix-search-popup [ichim-david - [`07b03df`](https://github.com/eea/volto-eea-website-theme/commit/07b03df36022da21d4c80b220cf529840e00c707)]
19
+ - fix(search): Fix undefined [kreafox - [`613d358`](https://github.com/eea/volto-eea-website-theme/commit/613d35860222ede3d40fc61acc0202b95e53108b)]
20
+ - fix(search): Fix some issues in the search popup [kreafox - [`13b5e64`](https://github.com/eea/volto-eea-website-theme/commit/13b5e64b69eacffacf2e65b9c5336cbcb5a9dfa7)]
21
+
22
+ #### :house: Internal changes
23
+
24
+ - chore: clean up [Mimi - [`b80f1dc`](https://github.com/eea/volto-eea-website-theme/commit/b80f1dcc5e5cd1d369bdcea574dd8158785af6be)]
25
+ - chore: use runtimeConfig for the RAZZLE_DISABLE_DRAFT_WATERMARK variable [Mimi - [`6b6cc83`](https://github.com/eea/volto-eea-website-theme/commit/6b6cc83dd0e6a4820d75acfdc8d41e092831261d)]
26
+ - chore: clean up [Mimi - [`807ca82`](https://github.com/eea/volto-eea-website-theme/commit/807ca82820319c0d45096dcbe228eee4262b602c)]
27
+ - chore: add missing code [Mimi - [`3a93e94`](https://github.com/eea/volto-eea-website-theme/commit/3a93e944613af0ee3ca1ed25c2439d9c504d4591)]
28
+
29
+ ### [1.8.1](https://github.com/eea/volto-eea-website-theme/compare/1.8.0...1.8.1) - 9 February 2023
30
+
31
+ #### :rocket: New Features
32
+
33
+ - feat(NotFound): wrap withRootNavigation in NotFound to have menu in 404 [nileshgulia1 - [`9f66a69`](https://github.com/eea/volto-eea-website-theme/commit/9f66a69b005f1a3d5446c67a1649c895f8c87d87)]
34
+ - feat(search): Make random suggestions to show [kreafox - [`e62041e`](https://github.com/eea/volto-eea-website-theme/commit/e62041ead4895e9c4d85dc2c93895607c71b2f1a)]
35
+ - feat(search): Max 6 suggestions [kreafox - [`99ffc75`](https://github.com/eea/volto-eea-website-theme/commit/99ffc754fddad95f44893f30ac3bfc76aacadb43)]
36
+
37
+ #### :bug: Bug Fixes
38
+
39
+ - fix(search): Fix undefined value [kreafox - [`51d49c2`](https://github.com/eea/volto-eea-website-theme/commit/51d49c2786ce97f7886e3d03d328a3858182b23a)]
40
+
41
+ #### :hammer_and_wrench: Others
42
+
43
+ - do not customize 404 [nileshgulia1 - [`446c1cd`](https://github.com/eea/volto-eea-website-theme/commit/446c1cdd121dd80a9e1efac2ee897b050eb99215)]
44
+ - test(lint): Fix lint [Alin Voinea - [`57722a3`](https://github.com/eea/volto-eea-website-theme/commit/57722a3477295cde2735d8a366c46e4105a9f9a3)]
45
+ - Update config.js [Tiberiu Ichim - [`a1685b8`](https://github.com/eea/volto-eea-website-theme/commit/a1685b85ea0badec5dca8655c2ea7e6d11afbece)]
46
+ - Updated search header configuration [Tiberiu Ichim - [`8e3d9e9`](https://github.com/eea/volto-eea-website-theme/commit/8e3d9e9339919351ac8bb9fffde12744432ce313)]
7
47
  ### [1.8.0](https://github.com/eea/volto-eea-website-theme/compare/1.7.0...1.8.0) - 8 February 2023
8
48
 
9
49
  #### :rocket: New Features
@@ -86,6 +126,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
86
126
 
87
127
  - For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
88
128
  - Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
129
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
89
130
  ### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
90
131
 
91
132
  #### :hammer_and_wrench: Others
@@ -119,6 +160,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
119
160
 
120
161
  - Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
121
162
  - bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
163
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
122
164
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
123
165
  ### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
124
166
 
@@ -128,6 +170,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
128
170
 
129
171
  #### :hammer_and_wrench: Others
130
172
 
173
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
131
174
  - Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
132
175
  - Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
133
176
  ### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
@@ -136,6 +179,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
136
179
 
137
180
  - feat(Footer): Bring back footer contacts extra actions - refs #151856 [Alin Voinea - [`6c19413`](https://github.com/eea/volto-eea-website-theme/commit/6c194139420c9fd847692d180db1c1593e2483de)]
138
181
 
182
+ #### :hammer_and_wrench: Others
183
+
184
+ - yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
139
185
  ### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
140
186
 
141
187
  #### :rocket: New Features
@@ -176,6 +222,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
176
222
  - Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
177
223
  - Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
178
224
  - fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
225
+ - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
179
226
  ### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
180
227
 
181
228
  #### :nail_care: Enhancements
@@ -223,6 +270,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
223
270
 
224
271
  #### :hammer_and_wrench: Others
225
272
 
273
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
226
274
  ### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
227
275
 
228
276
  #### :hammer_and_wrench: Others
@@ -490,6 +538,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
490
538
  - Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
491
539
  - Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
492
540
  - 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)]
541
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
493
542
  - use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
494
543
  - Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
495
544
  - Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
@@ -531,4 +580,5 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
531
580
 
532
581
  #### :hammer_and_wrench: Others
533
582
 
583
+ - yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
534
584
  - Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "@eeacms/volto-eea-website-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -2,15 +2,51 @@ import React from 'react';
2
2
  import { connect } from 'react-redux';
3
3
  import './draft.css';
4
4
  import { BodyClass } from '@plone/volto/helpers';
5
+ import { withRouter } from 'react-router-dom';
6
+ import { compose } from 'redux';
7
+ import { runtimeConfig } from '@plone/volto/runtime_config';
8
+ import { flattenToAppURL } from '@plone/volto/helpers';
5
9
 
6
- const DraftBackground = ({ review_state }) => {
7
- const draftClass = `wf-state-${review_state}`;
8
- return <BodyClass className={draftClass} />;
10
+ const removeTrailingSlash = (str) => {
11
+ return str.replace(/\/+$/, '');
9
12
  };
10
- function propsAreEqual(prevProps, nextProps) {
11
- return prevProps.review_state === nextProps.review_state;
12
- }
13
13
 
14
- export default connect((state) => ({
15
- review_state: state.content.data?.review_state,
16
- }))(React.memo(DraftBackground, propsAreEqual));
14
+ /**
15
+ * The review_state and id don't change everytime the page is changed and because of that the draft background
16
+ * will apear on pages that shouldn't have it. The RAZZLE_DISABLE_DRAFT_WATERMARK varible from ENV file should have two possible values:
17
+ * "Hide-No-Workflow" and "Hide-All". If the variable is not present, it should follow the current logic(show the draft image everywhere),
18
+ * if the value is "Hide-No-Workflow", then the draft image is not shown on pages like login or controlpanel and if the value is "Hide-All", then
19
+ * the draft image is not visible at all.
20
+ * For example, if the current page is /datatable (that has the draft background) and then we go to Content Types page,
21
+ * the review_state and id will be the same as the ones from /datatable, so the draft background will still be present. By checking
22
+ * if the pathname from (from withRouter) is different than the one from state.content.data and based on the varible from ENV,
23
+ * we decide if the draft backgound can be present or not.
24
+ * @param {Object} props
25
+ * @returns
26
+ */
27
+ const DraftBackground = (props) => {
28
+ const draftClass = `wf-state-${props.review_state}`;
29
+ const razzleDraft =
30
+ runtimeConfig['RAZZLE_DISABLE_DRAFT_WATERMARK'] || 'default';
31
+ const isReviewableStateComponent =
32
+ props.review_state &&
33
+ props.contentId === removeTrailingSlash(props.pathname);
34
+
35
+ const draftOptions = {
36
+ 'Hide-All': 'wf-state-published',
37
+ 'Hide-No-Workflow': isReviewableStateComponent
38
+ ? draftClass
39
+ : 'wf-state-published',
40
+ default: draftClass,
41
+ };
42
+
43
+ return <BodyClass className={draftOptions[razzleDraft]} />;
44
+ };
45
+
46
+ export default compose(
47
+ withRouter,
48
+ connect((state, props) => ({
49
+ review_state: state.content.data?.review_state,
50
+ contentId: flattenToAppURL(state.content.data?.['@id']),
51
+ })),
52
+ )(DraftBackground);
@@ -0,0 +1,6 @@
1
+ import { compose } from 'redux';
2
+ import { injectIntl } from 'react-intl';
3
+ import { withRootNavigation } from '@eeacms/volto-eea-website-theme/hocs';
4
+ import { NotFound } from '@plone/volto/components';
5
+
6
+ export default compose(injectIntl, withRootNavigation)(NotFound);
package/src/config.js CHANGED
@@ -258,17 +258,29 @@ export const headerSearchBox = [
258
258
  {
259
259
  isDefault: true,
260
260
  path: '/en/advanced-search',
261
- placeholder: 'Search...',
262
- description:
263
- 'Looking for more information? Try searching the full EEA website content',
264
- buttonTitle: 'Go to full site search',
261
+ placeholder: 'Search or ask your question...',
262
+ description: 'For more search options',
263
+ buttonTitle: 'Go to advanced search',
264
+ searchSuggestions: {
265
+ maxToShow: 6,
266
+ suggestionsTitle: 'Try our suggestions',
267
+ suggestions: [
268
+ 'What is PFAS?',
269
+ 'Which transport mode has the lowest pollution?',
270
+ 'Which countries use most renewable energy?',
271
+ 'How many premature deaths are attributed to PM2.5?',
272
+ 'How many premature deaths are attributed to air pollution?',
273
+ 'How much have new cars co2 emissions decreased?',
274
+ 'What countries had the highest land take in the EEA-39?',
275
+ 'How many people are exposed to air pollution?',
276
+ ],
277
+ },
265
278
  },
266
279
  {
267
280
  path: '/en/datahub',
268
281
  placeholder: 'Search Datahub...',
269
- description:
270
- 'Looking for more information? Try searching the full EEA website content',
271
- buttonTitle: 'Go to full site search',
282
+ description: 'Looking for more information?',
283
+ buttonTitle: 'Go to advanced search',
272
284
  },
273
285
  ];
274
286
 
@@ -1,9 +1,17 @@
1
- import React from 'react';
2
- import { Container, Input } from 'semantic-ui-react';
1
+ import React, { useEffect } from 'react';
2
+ import { Container, Input, List } from 'semantic-ui-react';
3
3
  import { withRouter } from 'react-router-dom';
4
4
  import { useClickOutside } from '@eeacms/volto-eea-design-system/helpers';
5
5
  import config from '@plone/volto/registry';
6
6
 
7
+ const getRandomItems = (arr, max) => {
8
+ return (
9
+ arr?.slice(0, max).map(function () {
10
+ return this.splice(Math.floor(Math.random() * this.length), 1)[0];
11
+ }, arr.slice()) || []
12
+ );
13
+ };
14
+
7
15
  function HeaderSearchPopUp({
8
16
  history,
9
17
  location,
@@ -18,8 +26,23 @@ function HeaderSearchPopUp({
18
26
  location.pathname.includes(v.path),
19
27
  );
20
28
  const activeView = localView.length > 0 ? localView[0] : defaultView[0];
29
+ const {
30
+ path,
31
+ placeholder,
32
+ buttonTitle,
33
+ description,
34
+ searchSuggestions,
35
+ } = activeView;
36
+ const { suggestionsTitle, suggestions, maxToShow } = searchSuggestions || {};
21
37
 
22
38
  const [text, setText] = React.useState('');
39
+ const [visibleSuggestions, setVisibileSuggestions] = React.useState(
40
+ getRandomItems(suggestions, maxToShow),
41
+ );
42
+
43
+ useEffect(() => {
44
+ setVisibileSuggestions(getRandomItems(suggestions, maxToShow));
45
+ }, [maxToShow, suggestions]);
23
46
 
24
47
  useClickOutside({ targetRefs: [nodeRef, ...triggerRefs], callback: onClose });
25
48
 
@@ -29,7 +52,7 @@ function HeaderSearchPopUp({
29
52
  };
30
53
 
31
54
  const onSubmit = (event) => {
32
- history.push(`${activeView.path}?q=${text}`);
55
+ history.push(`${path}?q=${text}`);
33
56
 
34
57
  if (window?.searchContext?.resetSearch) {
35
58
  window.searchContext.resetSearch({ searchTerm: text });
@@ -39,11 +62,21 @@ function HeaderSearchPopUp({
39
62
  event.preventDefault();
40
63
  };
41
64
 
65
+ const onClickHandler = (suggestion) => {
66
+ history.push(`${path}?q=${suggestion}`);
67
+
68
+ if (window?.searchContext?.resetSearch) {
69
+ window.searchContext.resetSearch({ searchTerm: suggestion });
70
+ }
71
+
72
+ onClose();
73
+ };
74
+
42
75
  return (
43
76
  <div id="search-box" ref={nodeRef}>
44
- <form method="get" onSubmit={onSubmit}>
77
+ <div className="wrapper">
45
78
  <Container>
46
- <div className="wrapper">
79
+ <form method="get" onSubmit={onSubmit}>
47
80
  <Input
48
81
  ref={searchInputRef}
49
82
  className="search"
@@ -53,26 +86,41 @@ function HeaderSearchPopUp({
53
86
  link: true,
54
87
  onClick: onSubmit,
55
88
  }}
56
- placeholder={activeView.placeholder}
89
+ placeholder={placeholder}
57
90
  fluid
58
91
  />
59
- </div>
92
+ </form>
93
+ {searchSuggestions && suggestions.length > 0 && (
94
+ <div className="search-suggestions">
95
+ {suggestionsTitle && <h4>{suggestionsTitle}</h4>}
96
+
97
+ <List>
98
+ {visibleSuggestions.map((item, i) => {
99
+ return (
100
+ <List.Item key={i} onClick={() => onClickHandler(item)}>
101
+ {item}
102
+ </List.Item>
103
+ );
104
+ })}
105
+ </List>
106
+ </div>
107
+ )}
60
108
  </Container>
61
- </form>
62
- {activeView.buttonTitle && (
63
- <div className="advanced-search">
64
- <Container>
65
- <p>{activeView.description}</p>
66
- <a
67
- href={defaultView[0].path}
68
- className="ui button white inverted"
69
- title="Advanced search"
70
- >
71
- {activeView.buttonTitle}
72
- </a>
73
- </Container>
74
- </div>
75
- )}
109
+ {buttonTitle && (
110
+ <div className="advanced-search">
111
+ <Container>
112
+ <div>{description}</div>
113
+ <a
114
+ href={defaultView[0].path}
115
+ className="ui button white inverted"
116
+ title="Advanced search"
117
+ >
118
+ {buttonTitle}
119
+ </a>
120
+ </Container>
121
+ </div>
122
+ )}
123
+ </div>
76
124
  </div>
77
125
  );
78
126
  }
@@ -0,0 +1,3 @@
1
+ import withRootNavigation from './withRootNavigation';
2
+
3
+ export { withRootNavigation };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { connect, useDispatch } from 'react-redux';
3
+ import { getBaseUrl, hasApiExpander } from '@plone/volto/helpers';
4
+ import { getNavigation } from '@plone/volto/actions';
5
+ import config from '@plone/volto/registry';
6
+
7
+ export default function withRootNavigation(WrappedComponent) {
8
+ return connect(
9
+ (state) => {
10
+ return {
11
+ items: state.navigation.items,
12
+ lang: state.intl.locale,
13
+ };
14
+ },
15
+ { getNavigation },
16
+ )((props) => {
17
+ const dispatch = useDispatch();
18
+ React.useEffect(() => {
19
+ const { settings } = config;
20
+ const currentLang = props.lang;
21
+ const base_url = getBaseUrl(`/${currentLang}`);
22
+ if (!hasApiExpander('navigation', base_url)) {
23
+ dispatch(getNavigation(base_url, settings.navDepth));
24
+ }
25
+ }, [props.lang, dispatch]);
26
+
27
+ return <WrappedComponent {...props} items={props.items} />;
28
+ });
29
+ }
@@ -0,0 +1,3 @@
1
+ <svg width="36" height="36" version="1.1" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="m14.378 14.247-6.8402 6.8402 7.1774 7.1774h1.6168v-0.0028h1.6195l5.2207-5.2207zm1.954-1.9539 8.7942 8.7942 3.9079-3.9093-8.7942-8.7942zm5.5274 15.969h9.673v2.7637h-12.437l-5.5247 0.002764-8.9641-8.9641a1.3819 1.3819 0 0 1 0-1.954l14.655-14.657a1.3819 1.3819 0 0 1 1.9553 0l10.748 10.748a1.3819 1.3819 0 0 1 0 1.9539z" stroke-width="1.3819"/>
3
+ </svg>
package/src/index.js CHANGED
@@ -2,6 +2,7 @@ import * as eea from './config';
2
2
  import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
3
3
  import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title';
4
4
  import CustomCSS from '@eeacms/volto-eea-website-theme/components/theme/CustomCSS/CustomCSS';
5
+ import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
5
6
  import DraftBackground from '@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground';
6
7
  import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
7
8
  import SubsiteClass from './components/theme/SubsiteClass';
@@ -48,7 +49,10 @@ const applyConfig = (config) => {
48
49
  homepage_view: 'Homepage view',
49
50
  homepage_inverse_view: 'Homepage white view',
50
51
  };
51
-
52
+ config.views.errorViews = {
53
+ ...config.views.errorViews,
54
+ '404': NotFound,
55
+ };
52
56
  // Apply accordion block customization
53
57
  if (config.blocks.blocksConfig.accordion) {
54
58
  config.blocks.blocksConfig.accordion.semanticIcon = 'ri-arrow-down-s-line';
package/src/slate.js CHANGED
@@ -3,10 +3,9 @@ import { List } from 'semantic-ui-react';
3
3
  import { MarkElementButton, ToolbarButton } from '@plone/volto-slate/editor/ui';
4
4
  import installCallout from '@plone/volto-slate/editor/plugins/Callout';
5
5
  import { Icon } from '@plone/volto/components';
6
- import { Editor, Transforms } from 'slate';
6
+ import { Editor, Transforms, Text } from 'slate';
7
7
  import { useSlate } from 'slate-react';
8
8
 
9
- import formatClearIcon from '@plone/volto/icons/format-clear.svg';
10
9
  import paintSVG from '@plone/volto/icons/paint.svg';
11
10
  import alignLeftIcon from '@plone/volto/icons/align-left.svg';
12
11
  import alignRightIcon from '@plone/volto/icons/align-right.svg';
@@ -14,6 +13,7 @@ import alignCenterIcon from '@plone/volto/icons/align-center.svg';
14
13
  import alignJustifyIcon from '@plone/volto/icons/align-justify.svg';
15
14
  import lightIcon from './icons/light.svg';
16
15
  import smallIcon from './icons/small.svg';
16
+ import clearIcon from './icons/eraser.svg';
17
17
 
18
18
  const toggleBlockClassFormat = (editor, format) => {
19
19
  const levels = Array.from(Editor.levels(editor, editor.selection));
@@ -59,6 +59,27 @@ function BlockClassButton({ format, icon, ...props }) {
59
59
  }
60
60
 
61
61
  const clearFormatting = (editor) => {
62
+ const sn = Array.from(
63
+ Editor.nodes(editor, {
64
+ mode: 'lowest',
65
+ match: (n, p) => {
66
+ // console.log('node', n, p);
67
+ return Text.isText(n);
68
+ },
69
+ at: [0], // uncomment if you want everything to be cleared
70
+ }),
71
+ );
72
+
73
+ // console.log('sn', sn);
74
+
75
+ sn.forEach(([n, at]) => {
76
+ const toRemove = Object.keys(n).filter((k) => k.startsWith('style-'));
77
+ if (toRemove.length) {
78
+ Transforms.unsetNodes(editor, toRemove, { at });
79
+ // console.log('unset', n, at, toRemove);
80
+ }
81
+ });
82
+
62
83
  Transforms.setNodes(editor, {
63
84
  type: 'p',
64
85
  styleName: null,
@@ -90,7 +111,7 @@ export default function installSlate(config) {
90
111
  config = installCallout(config);
91
112
 
92
113
  config.settings.slate.buttons.clearformatting = (props) => (
93
- <ClearFormattingButton title="Clear formatting" icon={formatClearIcon} />
114
+ <ClearFormattingButton title="Clear formatting" icon={clearIcon} />
94
115
  );
95
116
 
96
117
  // Remove blockquote, italic, strikethrough slate button from toolbarButtons