Commit e38c66d
feat(image-editor): wire Save and focal-point persistence for the new image editor (#36350)
## Summary
Wires the new Angular image editor's **Save** to the temp-file flow and
completes
**focal-point persistence** for the new Edit Content.
On Save, the editor GETs the contentAsset filter URL it already builds
for preview, with
`binaryFieldId=<fieldVar>&_imageToolSaveFile=true` appended; the servlet
stages the filtered
render as a `DotCMSTempFile`, the dialog closes returning it, and the
field stages it (preview
refreshes; the temp id is sent as the field value on check-in — the
source binary is never
overwritten). A focal point is folded into the same request
(`/filter/FocalPoint/fp/x,y` +
`overwrite=true`) and committed via `copyMetadata`; the editor seeds the
marker from the asset's
stored focal on open and treats a focal-only change as dirty.
Closes #36067.
## What changed
**Image editor (`libs/image-editor`)** — new `withSave` feature +
`saveRequested/saveSucceeded/saveFailed`
events + `saveEditedImage` GET; `buildSaveUrl` reuses the preview filter
chain, appends the save
flags, and folds in the focal point (epsilon-compared against the seeded
baseline — recenter-to-clear
and untouched-seed both handled); the dialog closes with the temp on
success and stays open + surfaces
the error on failure; focal seeded on open from
`ImageEditorOpenParams.focalPoint`; `isDirty` widened to
detect a focal move (epsilon-tolerant); footer **Save** button (+ i18n)
shows a loading spinner while the
editor is busy applying a filter **or** saving.
**Binary field (`libs/edit-content`)** — `onEditImage` reads the asset's
stored focal
(`{field}MetaData.focalPoint`, via `parseFocalPoint`) and passes it to
the launcher so the marker
re-seeds on reopen; null-metadata guards (`handleTempFile`,
`getFileMetadata`) so the image-tool temp
(`metadata: null`) renders instead of crashing.
**Backend** — `BinaryExporterServlet` re-wraps the temp after copying
the rendered bytes so it carries
real metadata (`image`/`mimeType`/dimensions) — it was returning
`metadata:null/image:false/mimeType:unknown`,
which left the field showing a file icon — mirroring
`TempFileAPI.createTempFile`;
`DefaultTransformStrategy.addBinaries` exposes `focalPoint` on the
content REST read path (mirrors
`BinaryViewStrategy`) so the editor can re-seed.
## Acceptance criteria
- [x] Save builds the contentAsset filter URL + `binaryFieldId` +
`_imageToolSaveFile=true` and GETs it
- [x] Returned temp id used; dialog closes with the temp file; field
preview refreshes (on check-in)
- [x] Error → dialog stays open, error surfaced, field value unchanged
- [x] `binaryFieldId` is the dynamic field variable
- [x] Focal point folded into the save chain + committed; seeded on
open; focal-only change marks dirty
- [x] `focalPoint` exposed on the content read path
- [ ] Download / Cancel — verified, implemented in part 1 (#36236)
- [ ] Enterprise availability gate — #36058
## Test plan
Unit: `buildSaveUrl` (filters, focal seed-vs-centre, recenter-to-clear,
epsilon), `withSave` (status
transitions + the built Save URL), footer Save (click, loading spinner
on busy/saving), dialog
close-on-success / no-close-on-failure, focal seeding, `isDirty`
(epsilon), `parseFocalPoint`,
null-metadata guards, `DefaultTransformStrategy` focalPoint — **334
(image-editor) + 1980 (edit-content)
passing**, lint clean, backend compiles.
Manual (local, `FEATURE_FLAG_NEW_IMAGE_EDITOR=true`): open the editor on
a Binary field → apply a filter /
move the focal point → Save → the dialog closes; after **Publish** the
field shows the edited image;
reopen the editor → the focal marker is restored.
## Notes
- Branched off the in-flight part-1 branch (#36063, currently in the
merge queue), so until that merges the
diff includes its commits — rebase onto `main` once #36063 lands.
- Out of scope (#36058): the new unified File field's Edit action +
`setPreviewFile` consumption and the
Enterprise availability gate. The committed-thumbnail "shows the old
image until Publish" behaviour is the
expected publish lifecycle (the field renders the committed binary), not
a bug.
---------
Co-authored-by: Adrian Molina <adrian.molina@dotcms.com>1 parent 8828680 commit e38c66d
53 files changed
Lines changed: 1175 additions & 174 deletions
File tree
- core-web
- apps/dotcms-ui-e2e/src/tests/edit-content/fields/file-upload-fields/binary-field
- helpers
- libs
- dotcms-models/src/lib
- edit-content/src/lib/fields
- dot-edit-content-calendar-field/components/calendar-field
- dot-edit-content-file-field
- components/dot-file-field
- utils
- image-editor/src/lib
- components
- dot-image-editor-canvas
- dot-image-editor-focal-overlay
- dot-image-editor
- models
- services
- store
- features
- utils
- sdk/ai/scripts
- dotCMS/src
- main
- java/com
- dotcms
- featureflag
- rest/api/v1/system
- dotmarketing
- portlets/contentlet/transform/strategy
- servlets
- resources
- webapp/WEB-INF/messages
- test/java/com/dotmarketing/portlets/contentlet/transform/strategy
- dotcms-integration/src/test/java/com/dotmarketing/image/focalpoint
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
Lines changed: 6 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 109 | + | |
113 | 110 | | |
114 | 111 | | |
115 | 112 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
14 | 19 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
578 | 585 | | |
579 | 586 | | |
580 | 587 | | |
| |||
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
408 | 409 | | |
409 | 410 | | |
410 | 411 | | |
411 | | - | |
412 | | - | |
413 | | - | |
| 412 | + | |
| 413 | + | |
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
418 | 422 | | |
419 | 423 | | |
420 | 424 | | |
| |||
424 | 428 | | |
425 | 429 | | |
426 | 430 | | |
427 | | - | |
| 431 | + | |
| 432 | + | |
428 | 433 | | |
429 | 434 | | |
430 | 435 | | |
| |||
0 commit comments