Page MenuHomePhabricator

Investigation: Link to VE media selector
Closed, ResolvedPublic2 Estimated Story PointsSpike

Assigned To
Authored By
ECohen_WMDE
Jul 16 2020, 4:22 PM
Referenced Files
F31942932: Media selector upload - screen 1.png
Jul 21 2020, 11:09 AM
F31942933: Media selector upload - screen 2.png
Jul 21 2020, 11:09 AM
F31942925: Media selector search - screen 2.png
Jul 21 2020, 11:09 AM
F31942924: Media selector search - screen 3.png
Jul 21 2020, 11:09 AM
F31942931: Media selector upload - screen 3.png
Jul 21 2020, 11:09 AM
F31942934: Media selector upload - screen 4.png
Jul 21 2020, 11:09 AM
F31942923: Media selector search - screen 1.png
Jul 21 2020, 11:09 AM

Description

Summary
For all 'file' parameter types, in addition to the existing input field for typing a known file name, two buttons would be added: "Search" and "Upload". Both buttons open the existing VE media selector (found by clicking Insert > Images and media), but each open the relevant tab as the starting point. Once open the user can switch tabs.

8a_-_Prototype_Interface_-_Improve_working_with_templates_in_Visual_Editor_-_Add_buttons_to_use_existing_Visual_Editor_media_selector.png (469×1 px, 89 KB)

Double modal interaction
The image does not represent how it should look, only the functionality. The two modals would not be visible at the same time. If a button is clicked, then the media selector replaces/embeds/covers the template dialog as needed to look like it's all one modal. Currently the template dialog is the medium size modal (500x482), the search is the large modal (900x642), and upload is medium adj (500x642). Important: the template dialog max-height should be increased, so the size is 500x642 to match the upload modal size (this design choice supports other improvements as well). Then, just as switching between upload and search adjusts the modal width, the template dialog width will adjust. (Note there is a small bug where there is a transition animation when going from small to large, but it's missing for large to small widths. This should at some point be fixed but is not necessary for this investigation)

Additionally, in the media selector, instead of an "X" button in the top left, it should be a "<" back button, which would take you smoothly back to the template dialog without inserting anything. The title a the top should say "Choose file" instead of "Media settings."

Media selector
The selector would need to be edited to only include the file selection process and not adding captions, alt text, size, position, since these are typically done inside the template itself. When the user clicks the button in the upper right corner, 'Use this image," the file name is inserted into the template dialog into the correct field (from both search and upload flows). All other screens would not be used.

For search, include first three screens: empty search, search results, details about an image.
Media selector search - screen 1.png (1×1 px, 444 KB)
Media selector search - screen 2.png (1×1 px, 2 MB)
Media selector search - screen 3.png (1×1 px, 2 MB)
For upload, include first four screens: select file, upload screen, add details, and detail screen after save.
Media selector upload - screen 1.png (1×1 px, 167 KB)
Media selector upload - screen 2.png (1×1 px, 230 KB)
Media selector upload - screen 3.png (1×1 px, 149 KB)
Media selector upload - screen 4.png (1×1 px, 984 KB)

Questions

  1. Can we re-use the media selector modal but limit its functions as described above? To do this is it possible to use the existing code? Or do we need to start from scratch and then make it look the same?
  2. Can two modals be open at once? Do they crash? How do they interact?
  3. Can the file name be passed into the template dialog after it is selected in the media selector?
  4. From DE TemplateData help page, seems like all parameters using the type "file" do not need a prefix. This would simplify formatting/help messages/validation. Is this true? Is this a reason that people don't use the file type often?

Scope

  • This ticket is limited to learning how this might work or might not work. This ticket does not cover the full implementation. We mainly want a better understanding of the difficulty of the interaction described under summary.

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptJul 16 2020, 4:22 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
ECohen_WMDE renamed this task from [PLACEHOLDER] Investigation: Link to VE media selector to Investigation: Link to VE media selector.Jul 21 2020, 11:09 AM
ECohen_WMDE updated the task description. (Show Details)
ECohen_WMDE set the point value for this task to 5.Jul 21 2020, 12:42 PM

Can we re-use the media selector modal but limit its functions as described above? To do this is it possible to use the existing code? Or do we need to start from scratch and then make it look the same?

We should be able to extend ve.ui.MWMediaDialog

Can two modals be open at once? Do they crash? How do they interact?

Yes, more than one modal can be opened at the same time, in which case they will appear in front of each other.
An example of this happening:

  1. in VisualEditor -> "Insert" -> "More" -> "Gallery"
  2. select the "Options" tab in the popup
  3. in "Gallery caption" -> "Insert" -> "Images and media"

It might be possible to use something similar to this to open the "Images and media" popup:
modules/ve-mw/ui/datatransferhandlers/ve.ui.MWMediaTransferHandler.js#L46-L47

Can the file name be passed into the template dialog after it is selected in the media selector?

In ve.ui.MWMediaDialog.js the chosen image is inserted using ve.dm.MWImageModel.prototype.insertImageNode(), instead we should be be able to use ve.dm.MWImageModel.prototype.getFilename or ve.dm.MWImageModel.prototype.getImageResourceName to get the filename. Passing this information back to the caller might be possible using either the surfaceModel or possibly this.close( {...} ).

From DE TemplateData help page, seems like all parameters using the type "file" do not need a prefix. This would simplify formatting/help messages/validation. Is this true? Is this a reason that people don't use the file type often?

According to the documentation for TemplateData, the type param object with a value of wiki-file-name states that the parameter is:
"A valid MediaWiki file name for the current wiki. Doesn't have to exist, but if not, should be a valid file name which could be uploaded. Should not include the namespace (e.g. "Foo.svg" not "File:Foo.svg" or "Bild:Foo.svg"). "

thiemowmde changed the point value for this task from 5 to 2.Aug 12 2020, 2:10 PM
Lena_WMDE claimed this task.