@eeacms/volto-eea-website-theme 2.0.1 → 2.0.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,11 +4,9 @@ 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.1](https://github.com/eea/volto-eea-website-theme/compare/2.0.0...2.0.1) - 14 May 2024
7
+ ### [2.0.2](https://github.com/eea/volto-eea-website-theme/compare/2.0.1...2.0.2) - 20 May 2024
8
8
 
9
- #### :nail_care: Enhancements
10
-
11
- - change(draft-image): check if parent has effective date in future for draft image showing [David Ichim - [`608cbb0`](https://github.com/eea/volto-eea-website-theme/commit/608cbb0d06d014c3dc8ba99e2b79cf9103291d68)]
9
+ ### [2.0.1](https://github.com/eea/volto-eea-website-theme/compare/2.0.0...2.0.1) - 15 May 2024
12
10
 
13
11
  #### :hammer_and_wrench: Others
14
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "2.0.1",
3
+ "version": "2.0.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",
@@ -87,10 +87,10 @@ class SlateEditor extends Component {
87
87
  const uid = uuid(); // used to namespace the editor's plugins
88
88
 
89
89
  this.slateSettings = props.slateSettings || config.settings.slate;
90
-
91
- this.initialValue = cloneDeep(
92
- this.props.value || this.slateSettings.defaultValue(),
93
- );
90
+ this.initialValue =
91
+ this.props.value && this.props.value.length > 0
92
+ ? cloneDeep(this.props.value)
93
+ : this.slateSettings.defaultValue();
94
94
 
95
95
  this.state = {
96
96
  editor: this.createEditor(uid),
@@ -182,8 +182,11 @@ class SlateEditor extends Component {
182
182
  this.props.value &&
183
183
  !isEqual(this.props.value, this.state.internalValue)
184
184
  ) {
185
- const newValue = cloneDeep(this.props.value);
186
185
  const { editor } = this.state;
186
+ const newValue =
187
+ this.props.value && this.props.value.length > 0
188
+ ? cloneDeep(this.props.value)
189
+ : this.slateSettings.defaultValue();
187
190
 
188
191
  resetNodes(editor, { nodes: newValue });
189
192
 
@@ -209,7 +212,6 @@ class SlateEditor extends Component {
209
212
 
210
213
  if (!prevProps.selected && this.props.selected) {
211
214
  // if the SlateEditor becomes selected from unselected
212
-
213
215
  if (window.getSelection().type === 'None') {
214
216
  // TODO: why is this condition checked?
215
217
  Transforms.select(
@@ -217,7 +219,6 @@ class SlateEditor extends Component {
217
219
  Editor.range(this.state.editor, Editor.start(this.state.editor, [])),
218
220
  );
219
221
  }
220
-
221
222
  ReactEditor.focus(this.state.editor);
222
223
  }
223
224
 
@@ -331,7 +332,9 @@ class SlateEditor extends Component {
331
332
  this.props.onBlur && this.props.onBlur();
332
333
  return null;
333
334
  }}
334
- onClick={this.props.onClick}
335
+ onClick={(e) => {
336
+ return this.props.onClick && this.props.onClick(e);
337
+ }}
335
338
  onSelect={(e) => {
336
339
  if (!selected && this.props.onFocus) {
337
340
  // we can't overwrite the onFocus of Editable, as the onFocus