-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.1] Media manager refactoring with action items #35332
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
[4.1] Media manager refactoring with action items #35332
Conversation
…nager-action-items
|
NICE, this was bugging me since the beginning. Next step would then be to offer plugins a way to add custom actions :-) |
I was thinking the same as I was reviewing the code here. Also, it shouldn't be that hard but it requires some changes in the PHP world as described here: #34634 (comment) {
supported: [
{
extension: 'png',
mime: 'image/png',
preview: true,
upload: true,
edit: true
}
]
} |
|
I was more referring to custom actions like "Send by Mail" or "Tweet picture" which can be added by plugins. |
| @@ -1,8 +1,10491 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this file. There have been no changes made to the package.json, so this file should not be modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted the package-lock.json to to the stand of this commit. I kinda wonder why this has changed, because I used npm ci to build
|
You still need some of the buttons to be able to act on specific media types or else the API will be an all or nothing. The media types object that I proposed above can be extended by the plugins to add the button name and enable it for whatever extension needs to be enabled (basically the plugin will have to register itself for whatever media type is supporting and append the vue js part before the mediamanager.js) |
|
@dgrammatiko agree. But lets discuss this on another day to not disturb this pr. |
|
@dgrammatiko do you think an intermediate solution would be to define extra fields, in |
We already do something similar, check #34634
The short-time solution is already in place, what is needed (check my last comment in the other PR) is a way to have a pool of the mime/extentions and then a field in the media manager option where users could pick the extensions they want. Since we will provide the pool (similar to apache's or nginx mime.conf) we could hardcode there the buttons: preview, edit, etc and then the plugins would have only to append their name on the supported formats and register the |
|
@JenSeReal some feedback here, regarding the comment of @laoneo about custom buttons: It would make sense to have the button components registered async ( https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components )like: // These will be fetched from the mediamanager options rendered as json in the template layout
const buttons = [
{
name: edit,
url: '',
},
];
// The registration
for (button of buttons) {
Vue.component(
button.name,
// A dynamic import returns a Promise.
() => import(button.url)
);
}This way you have the foundation for any custom button |
|
@bembelimen when you have a look at #35451, then you will see why this one here is needed. |
|
I'm just waiting for the 2 tests to merge ;) |
|
@bembelimen I would trust more the system tests than the human tests 😄 |
|
@dgrammatiko do you give a 👍 for this PR to merge or do you think we should update with your suggestion first? (probably you could then deliver some code, which we can merge with this PR?) |
|
@bembelimen my suggestions can go later, so this one it's fine as is. Probably it would be a good idea to open a project in the GitHub to list the things that should be fixed/improved, get the discussion there and leave the PRs for the code part |
|
Thx, then we just need some approved tests and we're good to go. |
|
Anyone with some successful tests? Would really like to merge it. |
|
We have 6 conflicting vue files. Maybe @dgrammatiko can help to solve the conflicts? I have no knowledge in vue. |
|
@richard67 I don't have sufficient permissions to do anything here, maybe @laoneo could fix the conflict if @JenSeReal can't do it |
|
Closing in favour of #35887 . Thanks @JenSeReal for your contribution. |
|
P.S.: The new PR still contains the commit history of this one here, so @JenSeReal will be at least mentioned as co-author of the new PR when it gets merged. |
Summary of Changes
Refactoring of the Vue components for the Media Manager. Created components for repetitive code, so if you want to modify a button you don't have to change the button in 6 components. Also some logic got capsulated in components so the individual files have a reduced number of code. Everything should work as in previous commits. All this is done in preparation to later add dynamic editable file extensions and a small pdf edtior to edit pdfs in Joomla.
Testing Instructions
Just navigate to
Content->Media. Directories should have buttons to rename and delete, Videos, Audio, Documents and so on should have buttons to preview, rename, share, delete, download. JPG, JPEG and PNG should still be editable. Navigation with the arrow keys between the buttons should also still workActual result BEFORE applying this Pull Request
If you open the media manager you will see several items which are either directories, audio files, video files, image files, document files or if the file extension is unknown to joomla its just a file. If you hover over one item and click the toggle button (3 dots) you get to see the options what you can do with the file (preview, rename, share, delete, download, edit). The revealed buttons then perform the respective actions on click.
Expected result AFTER applying this Pull Request
The described functionality should still be the same.
Documentation Changes Required
No.