User tests: Successful: Unsuccessful:
Pull Request for Issue # .
selected_items
that can take multiple item paths separated by comma (right now it accepts only one)If you get it this is a missing part for some coherent UI behavior on the item selection (or items)
administrator/index.php?option=com_media&path=local-images:/&selected_items=local-images:/joomla_black.png
administrator/index.php?option=com_media&path=local-images:/&selected_items=local-images:/banners/osmbanner1.png
administrator/index.php?option=com_media&path=local-images:/&selected_items=local-images:/sampledata/parks/landscape/180px_ormiston_pound.jpg
Only one way selection (from media manager to the picker)
Two way selection (from media manager to the picker and through the url)
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
@laoneo @Fedik couple of things here:
Keep the old customEvent till the end of 6.0 but introduce a new one that:
const ev = new Event(); ev.selectedItems = []
ComMedia:selectedItems
or something like that @Fedik your input here?)selectedItems
should ALWAYS be an arrayThese changes will allow better integration with 3rd part extensions
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript Administration com_media NPM Change |
I not realy see use case for multiple select in core (at current point of time).
@Fedik here's my take on the multiple select:
Will it be used by core?
Probably not immediately as it would require a new core field (and|or a custom field)
Anyways the API should not dictate/limit the use cases IMHO
About The parameter can be multiple
, you're right, this was a quick mashup to showcase the idea, but agree to use any of the suggested implementations
Abut the event. I think it should be window.parent.postMessage()
I totally forgot that we had this conversation a few years back and decided to go with postMessage
. Noted so if this gets a consensus will do it like that.
@laoneo or anyone from the production team has any objections here?
When selecting multiple images how do you foresee the ability to add alt text descriptions for each image?
When selecting multiple images how do you foresee the ability to add alt text descriptions for each image?
The same pattern that exists today for the single image could be done (ok with some obvious changes) to accommodate the case of multiple images. The whole alt/lazyloading/etc right now is a component that accepts a single image, could be adjusted for multiple images, nothing really awkward or especially hard to implement.
FWIW I'm not suggesting changing the current media field or the editor image/media picker, just allow the API to expose multiple selected items. For the field probably a new one should be introduced (questionable if this needs to be in the core), same goes for the editor button(?).
any media picker right now is limited to just selecting 1 item. Assuming you want to build a module for an image slider then the user is forced, due to the limitation of the current API, to pick one image
Not fully correct. You can select multiple already.
It is our media field limited to only one (due to hacky approach), but if you want you can.
Here a quick pseudo code, how to:
const myFiles = [];
document.addEventListener('onMediaFileSelected', (e) => {
const myFile = e.detail;
if (myFile in myFiles) {
//.. remove myFile from the list of selected myFiles
} else {
myFiles.push(myFile);
}
});
// ... then can insert these files anywhere you need
but if you want you can.
Sorry but that's too hacky for my taste. Workarounds are always possible but it's better to have a proper API...
I just saying that it is already possible.
It is diferent approach, not realy hacky.
With your changes instead of 1 file, you will send all selected on every "select" event.
That is also fine.
@Fedik my point is that the media manager already has a store that keeps a reference of the selected items and it's easier to send a post message or an event when that value changes. Right now the media manager has multiple event dispatchers inside components and inside the store. So, one improvement would be to have the event dispatching from one place and have the value standardized to whatever is there (an array of items). This simplifies the MM and the picker would have minimal changes but the selected items would be the same on both sides (the picker could filter items, etc it's just an array)
Yeah, I understood.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-08-20 14:12:13 |
Closed_By | ⇒ | dgrammatiko | |
Labels |
Added:
RFC
NPM Resource Changed
PR-5.2-dev
|
Too late for 5.2, maybe someone will be interested to bring this in 5.3 or 6.0
I not realy see use case for multiple select in core (at current point of time).
But probably nice to have.
Few notes for it:
files
(orfile
) oritems
orselected
or anything similar.The comma also fine, just have to do extra spliting.
Abut the event. I think it should be
window.parent.postMessage()
.We already have
joomla:content-select
messageType (I wanted to change it while working on media select field, but there much much much more stuff need to change) :For multiple I thought about something like:
Or maybe more safe, to have another message type 'joomla:content-select-multiple', not sure curently.
Had no chance to test.
I would skip this part for now, it is not used in core anywhere, it will be hard to test.