@eeacms/volto-slate-footnote 8.0.1 → 8.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,7 +4,13 @@ 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
- ### [8.0.1](https://github.com/eea/volto-slate-footnote/compare/8.0.0...8.0.1) - 8 April 2026
7
+ ### [8.0.2](https://github.com/eea/volto-slate-footnote/compare/8.0.1...8.0.2) - 23 April 2026
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: Hydration warnings - refs #302095 [Alin Voinea - [`6dc22d5`](https://github.com/eea/volto-slate-footnote/commit/6dc22d5e7f459d2177dbafb1fbb02e5e71a6734c)]
12
+
13
+ ### [8.0.1](https://github.com/eea/volto-slate-footnote/compare/8.0.0...8.0.1) - 9 April 2026
8
14
 
9
15
  ## [8.0.0](https://github.com/eea/volto-slate-footnote/compare/7.2.6...8.0.0) - 30 March 2026
10
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-slate-footnote",
3
- "version": "8.0.1",
3
+ "version": "8.0.2",
4
4
  "description": "volto-slate-footnote: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -295,18 +295,12 @@ const iterateFootnoteObj = (notesObjResultTemp, node, parentUid) => {
295
295
  };
296
296
 
297
297
  export function isValidHTML(htmlString) {
298
- if (
299
- __CLIENT__ &&
300
- typeof window !== 'undefined' &&
301
- typeof DOMParser !== 'undefined'
302
- ) {
303
- // The environment is client-side, and DOMParser is available
304
- const parser = new DOMParser();
305
- const parsedDocument = parser.parseFromString(htmlString, 'text/html');
306
- const errors = parsedDocument.querySelectorAll('parsererror');
307
- return errors.length === 0;
308
- }
309
- return false;
298
+ if (typeof htmlString !== 'string') return false;
299
+ const text = htmlString.trim();
300
+ if (!text) return false;
301
+ // Keep server/client output deterministic for hydration by using
302
+ // the same lightweight HTML detection in both environments.
303
+ return /<\/?[a-z][\s\S]*>/i.test(text);
310
304
  }
311
305
 
312
306
  const cleanUrls = (urls, text) => {
@@ -279,28 +279,12 @@ describe('getAllBlocksAndSlateFields', () => {
279
279
  });
280
280
 
281
281
  describe('isValidHTML', () => {
282
- beforeAll(() => {
283
- global.DOMParser = class {
284
- parseFromString(str) {
285
- const doc = {
286
- querySelectorAll: (selector) => {
287
- if (selector === 'parsererror' && str.includes('<error>')) {
288
- return [{}]; // Simulate an error
289
- }
290
- return [];
291
- },
292
- };
293
- return doc;
294
- }
295
- };
296
- });
297
-
298
282
  test('returns true for valid HTML', () => {
299
283
  expect(isValidHTML('<div>Hello</div>')).toBe(true);
300
284
  });
301
285
 
302
- test('returns false for invalid HTML', () => {
303
- expect(isValidHTML('<error>Invalid HTML</error>')).toBe(false);
286
+ test('returns false for plain text', () => {
287
+ expect(isValidHTML('Invalid HTML')).toBe(false);
304
288
  });
305
289
  });
306
290
 
@@ -361,12 +345,6 @@ describe('renderTextWithLinks', () => {
361
345
  });
362
346
 
363
347
  it('should render HTML when zoteroId is provided', () => {
364
- global.__CLIENT__ = true;
365
- global.DOMParser = class {
366
- parseFromString() {
367
- return { querySelectorAll: () => [] };
368
- }
369
- };
370
348
  const text = '<em>Test</em> content';
371
349
  const result = renderTextWithLinks(text, 'zotero123');
372
350
  expect(result).toBeDefined();