@eeacms/volto-cca-policy 0.3.74 → 0.3.75

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,10 +4,15 @@ 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
- ### [0.3.74](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.1...0.3.74) - 29 July 2025
7
+ ### [0.3.75](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.1...0.3.75) - 30 July 2025
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: trailing space issue in HtmlSlateWidget - refs #290137 [kreafox - [`34c1ff6`](https://github.com/eea/volto-cca-policy/commit/34c1ff6896a0fe3fae40527f31ea34220e945163)]
8
12
 
9
13
  #### :house: Internal changes
10
14
 
15
+ - style: Automated code fix [eea-jenkins - [`0e75a69`](https://github.com/eea/volto-cca-policy/commit/0e75a6978a2b43e8ad4545ea5fb41191354fd9d0)]
11
16
  - style: fix item spacing [kreafox - [`7d4535d`](https://github.com/eea/volto-cca-policy/commit/7d4535dbc486e6cb80fc55d6ac8c7c01d9cf48af)]
12
17
 
13
18
  ### [1.0.0-alpha.1](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.0...1.0.0-alpha.1) - 28 July 2025
@@ -91,7 +96,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
91
96
  - Add some loadable for components [Tiberiu Ichim - [`1793962`](https://github.com/eea/volto-cca-policy/commit/179396211c66a6a2465b2d1b6c0f2afc40fc7189)]
92
97
  - Refs #284961 - test [Tripon Eugen - [`c989f1f`](https://github.com/eea/volto-cca-policy/commit/c989f1f8638c0c5233c5c49f8673c9a2cdc7937e)]
93
98
  - Refs #284961 - add translations [Tripon Eugen - [`04ee988`](https://github.com/eea/volto-cca-policy/commit/04ee988c086d393b9b37ce1ea8d24f5e84f266aa)]
94
- ### [1.0.0-alpha.0](https://github.com/eea/volto-cca-policy/compare/0.3.73...1.0.0-alpha.0) - 15 July 2025
99
+ ### [1.0.0-alpha.0](https://github.com/eea/volto-cca-policy/compare/0.3.74...1.0.0-alpha.0) - 15 July 2025
100
+
101
+ ### [0.3.74](https://github.com/eea/volto-cca-policy/compare/0.3.73...0.3.74) - 29 July 2025
102
+
103
+ #### :rocket: Dependency updates
104
+
105
+ - Release @eeacms/volto-searchlib@2.1.6 [EEA Jenkins - [`ae34652`](https://github.com/eea/volto-cca-policy/commit/ae346528ed8e2fb302edb7457310107a733c575c)]
95
106
 
96
107
  #### :bug: Bug Fixes
97
108
 
@@ -110,6 +121,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
110
121
 
111
122
  #### :house: Internal changes
112
123
 
124
+ - style: fix item spacing [kreafox - [`7d4535d`](https://github.com/eea/volto-cca-policy/commit/7d4535dbc486e6cb80fc55d6ac8c7c01d9cf48af)]
113
125
  - chore: code cleanup [kreafox - [`842419b`](https://github.com/eea/volto-cca-policy/commit/842419b1bce3dc624755c81c9dea672198cab9e2)]
114
126
  - style: update teaser block styling [kreafox - [`1e0cad8`](https://github.com/eea/volto-cca-policy/commit/1e0cad8e1ed3ae827ee868dce8ad50b292a937ba)]
115
127
  - chore: update Makefile, run yarn i18n [kreafox - [`61e6962`](https://github.com/eea/volto-cca-policy/commit/61e6962901068ae6512265417a730bd9befd65fe)]
@@ -126,6 +138,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
126
138
 
127
139
  #### :hammer_and_wrench: Others
128
140
 
141
+ - Bump version for volto-plotlycharts [Tiberiu Ichim - [`6ba369b`](https://github.com/eea/volto-cca-policy/commit/6ba369baabfa16e463b4c351f7ff65643047ebbe)]
142
+ - Set volto-embed version to star [Tiberiu Ichim - [`f390ac4`](https://github.com/eea/volto-cca-policy/commit/f390ac41afe77b48502df5ff19ae7b89111498aa)]
143
+ - Set plotlycharts to latest 13.0.0 version [Tiberiu Ichim - [`6ce598a`](https://github.com/eea/volto-cca-policy/commit/6ce598a5187f877ac42bb5b3c966235fb1eaa461)]
144
+ - pin @eeacms/volto-plotlycharts [kreafox - [`c3ed94b`](https://github.com/eea/volto-cca-policy/commit/c3ed94b3a3914d38feb1bc72625d619ae467e96f)]
145
+ - Add dependency for plotly [Tiberiu Ichim - [`b9a3a48`](https://github.com/eea/volto-cca-policy/commit/b9a3a4888043fe1352a2cdcf88d15eeb1154eccf)]
129
146
  - Bump version [Tiberiu Ichim - [`f8e327e`](https://github.com/eea/volto-cca-policy/commit/f8e327e750771576e4f44fa4c27035b6e3b9c9e7)]
130
147
  - Fix eslint [Tiberiu Ichim - [`b6cfdd8`](https://github.com/eea/volto-cca-policy/commit/b6cfdd81c09e523d75ffbf2059008c77240311e2)]
131
148
  - update Jenkinsfile [kreafox - [`c8683c2`](https://github.com/eea/volto-cca-policy/commit/c8683c28ff5272c76ea055ba4e2870d9d8236082)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.3.74",
3
+ "version": "0.3.75",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import React from 'react';
6
+ import { debounce } from 'lodash';
6
7
  import ReactDOMServer from 'react-dom/server';
7
8
  import configureStore from 'redux-mock-store';
8
9
  import { MemoryRouter } from 'react-router-dom';
@@ -14,7 +15,6 @@ import SlateEditor from '@plone/volto-slate/editor/SlateEditor';
14
15
  import { serializeNodes } from '@plone/volto-slate/editor/render';
15
16
  import { makeEditor } from '@plone/volto-slate/utils';
16
17
  import deserialize from '@plone/volto-slate/editor/deserialize';
17
-
18
18
  import {
19
19
  createEmptyParagraph,
20
20
  normalizeExternalData,
@@ -58,8 +58,6 @@ const HtmlSlateWidget = (props) => {
58
58
  <MemoryRouter>{serializeNodes(value || [])}</MemoryRouter>
59
59
  </Provider>,
60
60
  );
61
- // console.log('toHtml value', JSON.stringify(value));
62
- // console.log('toHtml html', html);
63
61
 
64
62
  return {
65
63
  'content-type': value ? value['content-type'] : 'text/html',
@@ -92,6 +90,7 @@ const HtmlSlateWidget = (props) => {
92
90
  parent.removeChild(div);
93
91
  });
94
92
  };
93
+
95
94
  const fromHtml = React.useCallback(
96
95
  (value) => {
97
96
  const html = value?.data || '';
@@ -121,15 +120,38 @@ const HtmlSlateWidget = (props) => {
121
120
  [editor],
122
121
  );
123
122
 
124
- const valueFromHtml = React.useMemo(() => {
125
- return fromHtml(value);
123
+ const lastSavedHtmlRef = React.useRef(value?.data);
124
+
125
+ const [valueFromHtml, setValueFromHtml] = React.useState(() =>
126
+ fromHtml(value),
127
+ );
128
+
129
+ React.useEffect(() => {
130
+ if (value?.data !== lastSavedHtmlRef.current) {
131
+ setValueFromHtml(fromHtml(value));
132
+ }
126
133
  }, [value, fromHtml]);
127
134
 
135
+ const debouncedOnChange = React.useMemo(() => {
136
+ return debounce((newSlateValue) => {
137
+ const htmlValue = toHtml(newSlateValue);
138
+ lastSavedHtmlRef.current = htmlValue.data;
139
+ onChange(id, htmlValue);
140
+ }, 100);
141
+ }, [id, onChange, toHtml]);
142
+
143
+ React.useEffect(() => {
144
+ return () => {
145
+ debouncedOnChange.cancel();
146
+ };
147
+ }, [debouncedOnChange]);
148
+
128
149
  const handleChange = React.useCallback(
129
150
  (newValue) => {
130
- onChange(id, toHtml(newValue));
151
+ setValueFromHtml(newValue);
152
+ debouncedOnChange(newValue);
131
153
  },
132
- [onChange, toHtml, id],
154
+ [debouncedOnChange],
133
155
  );
134
156
 
135
157
  const handleClick = React.useCallback(() => {
@@ -16,4 +16,18 @@ and this:
16
16
  let data = deserialize(editor, body, { collapseWhitespace: true });
17
17
  ```
18
18
 
19
- Also added `unwrapDivs()` to unwrap `<div>` elements and wrap loose text nodes in `<p>` before deserialization. This fixes issues where content inside `<div>` tags was not recognized by the Slate editor and appeared empty or uneditable in edit mode.
19
+ Fix missing content inside `<div>` tag:
20
+
21
+ Added `unwrapDivs()` to unwrap `<div>` elements and wrap loose text nodes in `<p>` before deserialization. This fixes issues where content inside `<div>` tags was not recognized by the Slate editor and appeared empty or uneditable in edit mode.
22
+
23
+ Preserve trailing spaces:
24
+
25
+ Fixes issue where typing a space at the end of a line wouldn’t persist due to `collapseWhitespace: true` during deserialization.
26
+
27
+ ```js
28
+ const [valueFromHtml, setValueFromHtml] = React.useState(() =>
29
+ fromHtml(value),
30
+ );
31
+
32
+ const debouncedOnChange = useMemo(() => debounce(...), [...]);
33
+ ```