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

FEATURE: Make accepted filetypes configurable #1900

Merged
merged 6 commits into from
Jun 26, 2018

Conversation

mstruebing
Copy link
Contributor

@mstruebing mstruebing commented Jun 15, 2018

This makes accepted filetypes configurable via the mime type.

If nothing is set for an image editor image/* is used.

You can add accepted filetypes to the editoroptions e.g:

    'chapterImage':
      type: 'Neos\Media\Domain\Model\ImageInterface'
      ui:
        label: i18n
        reloadIfChanged: TRUE
        inspector:
          group: 'document'
          editorOptions:
            accept: 'image/jpeg, image/bmp, image/png'
    'asset':
      type: 'Neos\Media\Domain\Model\Asset'
      ui:
        label: 'Neos.Demo:NodeTypes.Page:properties.image'
        reloadIfChanged: TRUE
        inspector:
          group: 'image'
          position: 50
          editorOptions:
            accept: 'application/pdf'

closes #1879

return this.props.imagesOnly ? 'Image' : 'Asset';
}

acceptedFileTypes = () => {
if (this.props.imagesOnly) {
return ['.jpg', '.jpeg', '.png'].reduce((fileTypeString, fileType) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure which image formats I should allow here. Do we have a definition somewhere?

We could/should make it configurable later on I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, seeing SVG more and more. Absolutely needs to be configurable. What about jp2, webm, …?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question.
I work on a configurable solution soon.

@mstruebing mstruebing self-assigned this Jun 25, 2018
@mstruebing mstruebing changed the title BUGFIX: Let ImageEditor only accept images FEATURE: Make accepted filetypes configurable Jun 25, 2018
mstruebing added a commit to mstruebing/neos-development-collection that referenced this pull request Jun 25, 2018
mstruebing added a commit to mstruebing/neos-development-collection that referenced this pull request Jun 25, 2018
@@ -64,6 +65,7 @@ export default class PreviewScreen extends PureComponent {
highlight={highlight}
ref={this.setAssetUploadReference}
imagesOnly={true}
accept={accept === undefined ? 'image/*' : accept}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could as well be accept || 'image/*'?

Copy link
Contributor

@dimaip dimaip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a small comment, feel free to ignore and merge as is.

@mstruebing mstruebing merged commit b00a6e5 into neos:master Jun 26, 2018
gerhard-boden added a commit to neos/neos-development-collection that referenced this pull request Jun 26, 2018
DOCS: Add accept option to Asset- and Image-Editor 

Documenting the new accept-option.

See: neos/neos-ui#1900
neos-bot pushed a commit to neos/neos that referenced this pull request Jun 27, 2018
neos-bot pushed a commit to neos/neos that referenced this pull request Jun 27, 2018
DOCS: Add accept option to Asset- and Image-Editor 

Documenting the new accept-option.

See: neos/neos-ui#1900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants