The multiple property of the MediaUpload is mistakenly documented as being boolean here in Gutenberg and in several different WordPress files.
In the gallery-add.js controller, the property is even commented as follows: @todo 'add' doesn't seem to do anything special, and gets used as a boolean.
It is worth noting, though, that the property accepts both true and the string value 'add' with two noticeably different behaviors:
– multiple = true: makes it possible to select multiple items in the Media library but, by default, clicking on the thumbnail of an item automatically deselect the previously selected item. In order to select multiple items, it is necessary to click with SHIFT or CMD/CTRL
– multiple = 'add': makes it possible to select multiple items in the Media library and items keep being added simply clicking on their thumbnails, without any need to use the SHIFT or the CMD/CTRL key. In order to deselect a selected item, one can simply click on its correspondent check mark.
I believe this difference could be better documented in both projects.
The
multipleproperty of the MediaUpload is mistakenly documented as being boolean here in Gutenberg and in several different WordPress files.In the gallery-add.js controller, the property is even commented as follows:
@todo 'add' doesn't seem to do anything special, and gets used as a boolean.It is worth noting, though, that the property accepts both
trueand the string value'add'with two noticeably different behaviors:–
multiple = true: makes it possible to select multiple items in the Media library but, by default, clicking on the thumbnail of an item automatically deselect the previously selected item. In order to select multiple items, it is necessary to click with SHIFT or CMD/CTRL–
multiple = 'add': makes it possible to select multiple items in the Media library and items keep being added simply clicking on their thumbnails, without any need to use the SHIFT or the CMD/CTRL key. In order to deselect a selected item, one can simply click on its correspondent check mark.I believe this difference could be better documented in both projects.