@plone-collective/volto-image-editor 1.1.0 → 1.2.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.draft CHANGED
@@ -1,7 +1,9 @@
1
- ## 1.1.0 (2026-10-07)
1
+ ## 1.2.0 (2026-10-12)
2
+
2
3
 
3
4
  ### Internal
4
5
 
5
- - Updated according to the figma-design and improved styles for usage with the distributions @TimoBroeskamp
6
+ - Fixed the image being displaced on first edit. @TimoBroeskamp [#27](https://github.com/collective/volto-image-editor/issues/27)
7
+ - Updated the add-on boilerplate to the latest cookieplone-templates frontend add-on template: Volto 19.5.0, pnpm 10, Vitest for unit tests, and updated GitHub workflows. @ericof [#29](https://github.com/collective/volto-image-editor/issues/29)
6
8
 
7
9
 
package/CHANGELOG.md CHANGED
@@ -8,6 +8,14 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 1.2.0 (2026-10-12)
12
+
13
+
14
+ ### Internal
15
+
16
+ - Fixed the image being displaced on first edit. @TimoBroeskamp [#27](https://github.com/collective/volto-image-editor/issues/27)
17
+ - Updated the add-on boilerplate to the latest cookieplone-templates frontend add-on template: Volto 19.5.0, pnpm 10, Vitest for unit tests, and updated GitHub workflows. @ericof [#29](https://github.com/collective/volto-image-editor/issues/29)
18
+
11
19
  ## 1.1.0 (2026-10-07)
12
20
 
13
21
  ### Internal
@@ -0,0 +1,15 @@
1
+ {% if sections[""] %}
2
+ {% for category, val in definitions.items() if category in sections[""] %}
3
+
4
+ ### {{ definitions[category]['name'] }}
5
+
6
+ {% for text, values in sections[""][category].items() %}
7
+ - {{ text }} {{ values|join(', ') }}
8
+ {% endfor %}
9
+
10
+ {% endfor %}
11
+ {% else %}
12
+ No significant changes.
13
+
14
+
15
+ {% endif %}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone-collective/volto-image-editor",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "An image editor to be used with Plone and Volto.",
5
5
  "main": "src/index.ts",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "url": "https://github.com/sponsors/plone"
25
25
  },
26
26
  "bugs": {
27
- "url": "https://github.com/collective/volto-image-edito/issues"
27
+ "url": "https://github.com/collective/volto-image-editor/issues"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"
@@ -33,21 +33,26 @@
33
33
  "dependencies": {
34
34
  "context-filter-polyfill": "0.3.23",
35
35
  "react-advanced-cropper": "0.20.1",
36
- "@plone/components": "4.0.0-alpha.6"
36
+ "@plone/components": "4.2.2"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "advanced-cropper": "~0.17.1",
40
40
  "classnames": "*",
41
- "react": "18.2.0",
41
+ "react": "^18.2.0",
42
42
  "react-aria-components": "*",
43
- "react-dom": "18.2.0",
44
- "@plone/registry": "3.0.0-alpha.9",
45
- "@plone/types": "2.0.0-alpha.14"
43
+ "react-dom": "^18.2.0"
46
44
  },
47
45
  "devDependencies": {
46
+ "@testing-library/react": "^16.2.0",
48
47
  "@types/node": "^20.2.5",
48
+ "@types/react": "^18.3.1",
49
+ "@types/react-dom": "^18.3.1",
49
50
  "release-it": "^19.0.5",
50
- "@plone/scripts": "4.0.0-alpha.5"
51
+ "typescript": "^5.7.3",
52
+ "vitest": "^3.1.2",
53
+ "@plone/scripts": "4.0.2",
54
+ "@plone/registry": "3.0.3",
55
+ "@plone/types": "2.1.0"
51
56
  },
52
57
  "scripts": {
53
58
  "i18n": "rm -rf build/messages && NODE_ENV=production i18n --addon",
@@ -1,4 +1,3 @@
1
- @import '~react-advanced-cropper/dist/style.css';
2
1
  @import '../../../theme/variables';
3
2
  @import '../../../theme/constants';
4
3
 
@@ -1,4 +1,4 @@
1
- import React, { useState, useRef, useLayoutEffect } from 'react';
1
+ import React, { useState, useRef, useLayoutEffect, useEffect } from 'react';
2
2
  import cn from 'classnames';
3
3
  import {
4
4
  Cropper,
@@ -16,6 +16,9 @@ import { AdjustableCropperBackground } from '@plone-collective/volto-image-edito
16
16
  import { SettingsModal } from '@plone-collective/volto-image-editor/components/ImageEditor/components/SettingsModal/SettingsModal';
17
17
  import type { ImageSettings } from '@plone-collective/volto-image-editor/types/ImageSettings';
18
18
  import { ResetIcon } from '@plone-collective/volto-image-editor/icons/ResetIcon';
19
+ // Plain CSS must not go through the SCSS loader chain: resolve-url-loader 5
20
+ // (Volto 19.5) fails the CI build when an upstream loader gives no source map.
21
+ import 'react-advanced-cropper/dist/style.css';
19
22
  import './ImageEditor.scss';
20
23
 
21
24
  if (typeof window !== 'undefined') {
@@ -24,6 +27,7 @@ if (typeof window !== 'undefined') {
24
27
 
25
28
  const ImageEditor = ({ src, onImageSave, onCancel }) => {
26
29
  const cropperRef = useRef<CropperRef>(null);
30
+ const containerRef = useRef<HTMLDivElement>(null);
27
31
  const previewRef = useRef<CropperPreviewRef>(null);
28
32
 
29
33
  const [mode, setMode] = useState('crop');
@@ -105,6 +109,14 @@ const ImageEditor = ({ src, onImageSave, onCancel }) => {
105
109
  return () => clearTimeout(timer);
106
110
  }, [src]);
107
111
 
112
+ useEffect(() => {
113
+ const el = containerRef.current;
114
+ if (!el) return;
115
+ const ro = new ResizeObserver(() => cropperRef.current?.refresh());
116
+ ro.observe(el);
117
+ return () => ro.disconnect();
118
+ }, []);
119
+
108
120
  const onSave = () => {
109
121
  if (cropperRef.current) {
110
122
  const canvas = cropperRef.current.getCanvas();
@@ -213,7 +225,7 @@ const ImageEditor = ({ src, onImageSave, onCancel }) => {
213
225
 
214
226
  return (
215
227
  <div className={'image-editor'}>
216
- <div className="image-editor__cropper">
228
+ <div ref={containerRef} className="image-editor__cropper">
217
229
  <Cropper
218
230
  src={src}
219
231
  ref={cropperRef}
package/towncrier.toml CHANGED
@@ -3,9 +3,9 @@ filename = "CHANGELOG.md"
3
3
  directory = "news/"
4
4
  title_format = "## {version} ({project_date})"
5
5
  underlines = ["", "", ""]
6
- template = "./node_modules/@plone/scripts/templates/towncrier_template.jinja"
6
+ template = "./news/.changelog_template.jinja"
7
7
  start_string = "<!-- towncrier release notes start -->\n"
8
- issue_format = "[#{issue}](https://github.com/collective/volto-image-editor/issue/{issue})"
8
+ issue_format = "[#{issue}](https://github.com/collective/volto-image-editor/issues/{issue})"
9
9
 
10
10
  [[tool.towncrier.type]]
11
11
  directory = "breaking"
@@ -31,3 +31,8 @@ showcontent = true
31
31
  directory = "documentation"
32
32
  name = "Documentation"
33
33
  showcontent = true
34
+
35
+ [[tool.towncrier.type]]
36
+ directory = "tests"
37
+ name = "Tests"
38
+ showcontent = true
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import voltoVitestConfig from '@plone/volto/vitest.config.mjs';
3
+ import path from 'path';
4
+
5
+ export default defineConfig({
6
+ ...voltoVitestConfig,
7
+ resolve: {
8
+ alias: {
9
+ '@plone/volto': path.resolve(__dirname, '../../core/packages/volto/src'), // Add paths accordingly
10
+ // 'promise-file-reader': require.resolve('promise-file-reader') // Add to identify dependency from package
11
+ },
12
+ },
13
+ });