-
Notifications
You must be signed in to change notification settings - Fork 480
feat(image-editor): wire Save and focal-point persistence for the new image editor #36350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
oidacra
wants to merge
20
commits into
main
Choose a base branch
from
issue-36067-wire-image-editor-save
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,175
−174
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
37c4f48
feat(image-editor): wire Save temp-file flow and focal-point persistence
oidacra 96414df
feat(edit-content): seed focal on open and tolerate metadata-less tem…
oidacra dedc5f4
fix(image): populate temp metadata on image-tool save and expose foca…
oidacra f90d991
fix(edit-content): seed image editor focal point from the field metad…
oidacra b143fd5
fix(image-editor): red focal marker and keep it aligned on dialog resize
oidacra e022789
chore(image-editor): address local code-review findings
oidacra 8ac580b
fix(image-editor): persist focal point on image-tool save temp
oidacra 35d8240
docs(edit-content): correct stale comment on binary-field save-temp m…
oidacra f4a24f6
fix(image-editor): URL-encode binaryFieldId in save URL
oidacra af17608
feat(image-editor): GA the new image editor in the new Edit Content (…
oidacra 2a2652c
chore(dotcms-models): drop FEATURE_FLAG_NEW_IMAGE_EDITOR enum + fix p…
oidacra cf9676a
Merge remote-tracking branch 'origin/main' into issue-36067-wire-imag…
oidacra a6c002f
feat(image-editor): port focal-point seeding to the unified file-field
oidacra 3b15607
fix(image-editor): use exhaustMap for the save effect
oidacra 5025a83
fix(sdk-ai): default generate-spec to corpsites-headless instance
oidacra 00659db
fix(image-editor): seed focal point on in-session reopen after save
oidacra aa2c709
Merge remote-tracking branch 'origin/main' into issue-36067-wire-imag…
oidacra 7f85a41
test(e2e): assert the new Angular image editor opens in the new Edit …
oidacra 8d619e9
test(edit-content): fix month-boundary day math in calendar TIME 'now…
oidacra acce7c3
refactor(image-editor): enhance coalescing behavior for history entries
adrianjm-dotCMS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
core-web/libs/dotcms-models/src/lib/dot-contentlets-events.model.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
core-web/libs/dotcms-models/src/lib/dot-http-request-options.model.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| export interface DotHttpRequestOptions { | ||
| method: string; | ||
| headers: { [key: string]: string }; | ||
| body: any; | ||
| body: XMLHttpRequestBodyInit | null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
core-web/libs/dotcms-models/src/lib/page-model-change-event.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...bs/edit-content/src/lib/fields/dot-edit-content-file-field/utils/focal-point.util.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { parseFocalPoint } from './focal-point.util'; | ||
|
|
||
| describe('parseFocalPoint', () => { | ||
| it('parses an "x,y" focal point string into a point', () => { | ||
| expect(parseFocalPoint('0.88,0.31')).toEqual({ x: 0.88, y: 0.31 }); | ||
| }); | ||
|
|
||
| it('returns undefined for an unset/empty value', () => { | ||
| expect(parseFocalPoint(undefined)).toBeUndefined(); | ||
| expect(parseFocalPoint(null)).toBeUndefined(); | ||
| expect(parseFocalPoint('')).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('treats the (0,0) "no focal point" sentinel as undefined', () => { | ||
| // The backend uses (0,0) to mean "no focal point" -> editor opens centred. | ||
| expect(parseFocalPoint('0,0')).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('returns undefined for a malformed or single-value string', () => { | ||
| // "0.0" has no comma -> one token -> the y axis parses to NaN. | ||
| expect(parseFocalPoint('0.0')).toBeUndefined(); | ||
| expect(parseFocalPoint('not-a-point')).toBeUndefined(); | ||
| expect(parseFocalPoint('abc,xyz')).toBeUndefined(); | ||
| }); | ||
| }); |
32 changes: 32 additions & 0 deletions
32
...eb/libs/edit-content/src/lib/fields/dot-edit-content-file-field/utils/focal-point.util.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { NormalizedPoint } from '@dotcms/image-editor'; | ||
|
|
||
| /** | ||
| * Parses a focal point stored as an `"x,y"` string (the backend exposes it on the | ||
| * binary field metadata as a custom `focalPoint` attribute) into a normalized 0..1 | ||
| * point for seeding the image editor. | ||
| * | ||
| * Returns `undefined` for an unset/empty value, the `(0,0)` "no focal point" sentinel, | ||
| * or a malformed/single-value string, so the editor opens centred instead of seeding a | ||
| * bogus marker. | ||
| * | ||
| * @param value - The raw `focalPoint` metadata string (e.g. `"0.88,0.31"`). | ||
| * @returns The parsed point, or `undefined` when there is no usable focal point. | ||
| */ | ||
| export function parseFocalPoint(value: string | null | undefined): NormalizedPoint | undefined { | ||
| if (!value) { | ||
| return undefined; | ||
|
oidacra marked this conversation as resolved.
oidacra marked this conversation as resolved.
|
||
| } | ||
|
|
||
| const [x, y] = value.split(',').map(Number); | ||
|
|
||
| if (!Number.isFinite(x) || !Number.isFinite(y)) { | ||
| return undefined; | ||
| } | ||
|
|
||
| // (0,0) is the backend's "no focal point" sentinel -> open centred. | ||
| if (x === 0 && y === 0) { | ||
| return undefined; | ||
| } | ||
|
|
||
| return { x, y }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.