Implement a new input type to open the media selector and use it to find/add images to templates based on the process outlined in the investigation ticket, T258195: Investigation: Link to VE media selector. Add this functionality to the 'file' parameter type.
Requirements
- Parameter type 'file' gets custom behavior, based on OOUI 'SelectFileInputWidget'.
- Placeholder text says "No file is selected" unless there is a default value. If there is, display the default in the input like other VE dialog input types. The button text should say 'Add file'
- Clicking 'Add file' opens the media selector to the 'Search' tab
- Once the selector is open, the user is able to switch between the two tabs.
- The media selector opens on top of the VE template dialog, covering it (so it looks like it's part of the same dialog) and expanding in size for search, staying the same size for upload
- The media selector allows a user to proceed through the screens to the point of clicking the button 'Use this image,' without inputing additional information (such as caption or alt text). Screenshots detail this in the investigation ticket T258195.
- When a user clicks, 'Use this image,' the file name is passed into the VE template dialog without the prefix.
- Users can type in or paste in a file name without using the button to find a file.
- Users can still use the button to add a file name when there is text inside the input field. If the user closes out of the media selector, the existing text stays. If the user selects a new image or uploads a new one, the text is replaced.
- Allow to use the media selector to choose the following media types on commons: image, movie, pdf, audio.
- Once a file has been selected and added to the template, or when editing a template where a file has already been selected, the button text should be changed to "Change file".
- Clicking the "Change file" button should open the media selector in the 'Search' tab and follow the same behaviour as specified above.
Nice to have
- If the parameter is missing example and default values, show placeholder text 'No file is selected'
Mock