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

imageInsert and imageUpload commands should also accept singular params? #5174

Closed
Reinmar opened this issue Nov 19, 2018 · 4 comments · Fixed by ckeditor/ckeditor5-image#250
Labels
package:image status:discussion type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented Nov 19, 2018

It's just so weird and unclear:

editor.execute( 'imageInsert', { sources: urls } );

Did you think that it inserts a single image with multiple sources (i.e. a responsive image). Cause I did.

Initially imageUpload command accepted just a single file, but for some reason we needed it to accept multiple files. Now, the imageInsert command follows that... and it's just confusing. What could help is if:

  • the param name was singular and just allow passing arrays,
  • support singular and plural forms at the same time.
@Reinmar
Copy link
Member Author

Reinmar commented Nov 19, 2018

cc @jodator @pjasiun @oskarwrobel

@pjasiun
Copy link

pjasiun commented Nov 19, 2018

Support for uploading multiple images in one command was introduced when we wanted to disable image upload when the image is selected. When we used the command for single images we were not able to do it because after the first image was uploaded the selection was moved on that image so you were not able to upload the next image.

  • the param name was singular and just allow passing arrays,
  • support singular and plural forms at the same time.

I am fine with both options. We should have some global rules for such parameters and just follow them. AFAIR we already have some rules for options which can be singular or plural.

@jodator
Copy link
Contributor

jodator commented Nov 19, 2018

So to referesh: The image upload (which was the only method to insert images back then) was changed to support multiple images due to a bug which disallowed to insert multiple images. Here is the long commented PR: ckeditor/ckeditor5-image#228.

The sources name might be unfortunate though.. so I'm OK with changing it in the PR.

@Reinmar
Copy link
Member Author

Reinmar commented Nov 20, 2018

AFAIR we already have some rules for options which can be singular or plural.

The rule is, start with a singular, add support for plural (which often happens later), but don't make it plural then. That's for param names. Example – DowncastWriter#setStyle(). It's different for object definitions of some types (ViewElementDefinition) when the plural is often the default.

So, I think that both those commands should accept a param being a singular name (file, source). But this param should also accept an array.

Reinmar referenced this issue in ckeditor/ckeditor5-image Nov 22, 2018
Feature: Introduced the `'imageInsert'` command. Closes #245. Closes #251.

BREAKING CHANGE: The `'imageUpload'` command's `files` parameter was renamed to `file`. It still can accept an array of files.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-image Oct 9, 2019
@mlewand mlewand added this to the iteration 21 milestone Oct 9, 2019
@mlewand mlewand added status:discussion type:improvement This issue reports a possible enhancement of an existing feature. package:image labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:image status:discussion type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants