Skip to content
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

BUG: Using an Image in CreationDialog #3472

Open
paavo opened this issue May 1, 2023 · 15 comments
Open

BUG: Using an Image in CreationDialog #3472

paavo opened this issue May 1, 2023 · 15 comments
Labels
8.2 8.3 Accessibility Bug Label to mark the change as bugfix UI & UX

Comments

@paavo
Copy link

paavo commented May 1, 2023

I just experienced a weird Issue with Neos UI in multiple Neos 8.2 Projects.
If i add a Node with an Image set in the CreationDialog, it throws a JS-Error and fails.

image:
  type: Neos\Media\Domain\Model\ImageInterface
  ui:
    label: 'Bild (16:9)'
    showInCreationDialog: true

Error shim.js

caught at addNode 
 at hT 
 at _callee 
 at Tg 
 at Tg 
 at Tg 
 TypeError: Cannot read properties of undefined (reading 'get')

Affected Versions

Neos: 8.2.x
UI: 8.2.x

Works well with Neos 5.3 and Neos 7.3

@paavo
Copy link
Author

paavo commented May 1, 2023

@Sebobo we talked about that in Slack

@grebaldi grebaldi added Bug Label to mark the change as bugfix UI & UX Accessibility 8.2 8.3 labels May 1, 2023
@paavo
Copy link
Author

paavo commented May 2, 2023

i can reproduce the same issue in Neos 8.3

Affected Versions
Neos: 8.3.x
UI: 8.3.x

@paavo
Copy link
Author

paavo commented Jan 16, 2024

Can anyone else reproduce this issue?
Any workaround? Its pretty nasty for Nodes with required Images 🤔
@Sebobo @grebaldi

@grebaldi
Copy link
Contributor

Hi @paavo,

I cannot reproduce this issue on 8.2 with the above configuration alone.

Error shim.js sounds like some plugin interfering with the dialog. Do you have anything installed that may hook into the ImageEditor (like the new Media UI)?

@Sebobo
Copy link
Member

Sebobo commented Jan 16, 2024

A full js stack trace and list of installed packages would be helpful

@adrian-cerdeira
Copy link

@grebaldi @Sebobo
I could reproduce this issue on Neos 8.3.
The problem is the forceCrop feature on ImageInterface:

            imageThreeTwo:
              type: Neos\Media\Domain\Model\ImageInterface
              ui:
                label: 'Image (3:2) [S]'
                reloadIfChanged: true
                inspector:
                  group: settings
                  editorOptions:
                    required: true
                    features:
                      crop: true
                    crop:
                      aspectRatio:
                        forceCrop: true
                        locked:
                          width: 3
                          height: 2

This creates in the creation dialog that you cannot apply the crop on the image.
Bildschirm­foto 2024-01-24 um 09 15 39
And also an error on the console, because the image is undefined:
Bildschirm­foto 2024-01-24 um 08 28 11

I hope this can help you further.

@Sebobo
Copy link
Member

Sebobo commented Jan 30, 2024

@adrian-cerdeira still cannot reproduce this with your example.
The crop is immediately shown, no error appears and close the crop selection again with the little arrow on the top right of it.
Though I noticed that the crop button in the image controls doesn't close the crop selection. So the whole dialog is a bit confusing in this case.

@paavo
Copy link
Author

paavo commented Jan 30, 2024

@Sebobo
I can reproduce the issue when an Image with forceCrop is shown in the CreationDialog.

              type: Neos\Media\Domain\Model\ImageInterface
              ui:
                showInCreationDialog: true
                inspector:
                  editorOptions:
                    required: true
                    features:
                      crop: true
                    crop:
                      aspectRatio:
                        forceCrop: true
                        locked:
                          width: 3
                          height: 2
                          ```

@Sebobo
Copy link
Member

Sebobo commented Jan 30, 2024

That's what I tried. Can one of you try to reproduce it in the Neos.Demo and make a video?

@bwaidelich
Copy link
Member

I could not reproduce this issue with Neos.Demo and upon further investigation I realized that we had the following piece of configuration in our project:

Neos:
  Neos:
    userInterface:
      inspector:
        dataTypes:
          Neos\Media\Domain\Model\ImageInterface:
            editorOptions:
              crop:
                aspectRatio:
                  options: null

By setting this to an empty array instead, or adding the empty options array in the respective property configuration:

                    crop:
                      aspectRatio:
                        forceCrop: true
                        locked:
                          width: 3
                          height: 2
                        options: []

the error is gone for me.

@paavo can you confirm?

@Sebobo
Copy link
Member

Sebobo commented Mar 6, 2024

We should then create an issue in the UI to handle this case and not break.
We have far too many places in Neos which crash due to null values :(

@bwaidelich
Copy link
Member

We should then create an issue in the UI to handle this case and not break.

we could just use this one :)

@Sebobo
Copy link
Member

Sebobo commented Mar 6, 2024

Ah sorry 🤦 I was mentally in a different repo...

@adrian-cerdeira
Copy link

I could not reproduce this issue with Neos.Demo and upon further investigation I realized that we had the following piece of configuration in our project:

Neos:
  Neos:
    userInterface:
      inspector:
        dataTypes:
          Neos\Media\Domain\Model\ImageInterface:
            editorOptions:
              crop:
                aspectRatio:
                  options: null

By setting this to an empty array instead, or adding the empty options array in the respective property configuration:

                    crop:
                      aspectRatio:
                        forceCrop: true
                        locked:
                          width: 3
                          height: 2
                        options: []

the error is gone for me.

@paavo can you confirm?

I testet this but sadly for me it doesn't resolve, the error is still present:

            imageThreeTwo:
              type: Neos\Media\Domain\Model\ImageInterface
              ui:
                label: 'Bild (3:2)'
                reloadIfChanged: true
                inspector:
                  group: settings
                  editorOptions:
                    required: true
                    features:
                      crop: true
                    crop:
                      aspectRatio:
                        forceCrop: true
                        locked:
                          width: 3
                          height: 2
                        options: []

@bwaidelich
Copy link
Member

@adrian-cerdeira I just tested your settings and it works for me with Neos 8.3.
Maybe it's a different issue for you? You could install the "React Developer Tools" extension to see which options are passed to the component:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.2 8.3 Accessibility Bug Label to mark the change as bugfix UI & UX
Projects
None yet
Development

No branches or pull requests

5 participants