NPM Resource Changed PR-4.3-dev Pending

User tests: Successful: Unsuccessful:

avatar korenevskiy
korenevskiy
27 Feb 2023

When dragging an image in the article editor, a POST request is sent. I added a context with information about the article ID to this POST request. This will allow on the server side to give names to pictures with the content of the article ID. In general, it is useful for the component to know which article this picture belongs to.

Before POST/GET request

option: com_media
format: json
url: 1
task: api.files
path: local-images:

content: "imageData"
name: "____Image.jpg"
parent: "publicacations_2023"

After Fix POST/GET request

option: com_media
format: json
url: 1
task: api.files
path: local-images:

content: "imageData"
name: "____Image.jpg"
parent: "publicacations_2023"

context: "com_content.article:23"

This context will allow you to dynamically manage the saved files when inserting them into the article editor.

  1. Manage the directory depending on which directory the article is saved in. For example, it allows you to automatically store news image files separately in the news directory and separately image files of products and goods separately from each other.
  2. Allows you to set the article ID or module ID in the file name. That will allow you to know the ownership of the image.

And how to find out the ownership and refactoring of a folder of pictures if it's just a bunch of sketched different files.
A specialist site manager in the modern world does not have to worry about the file name, the file should automatically be named itself and saved in the right directory. The site manager should only think about the description of the photo.

This PR does not provide new features. But it gives an additional line of information for plugins and components to implement broad functionality. If even now it will seem superfluous. Then in the near future, administrators will be able to at least download a plugin to manage the location of images. Now every social network uploads images simply. The user has nothing to do with the location of the images on the social network server. We have to take the same step in Joomla

I wanted to add this PR together with #39957 please support this PR

avatar joomla-cms-bot joomla-cms-bot - change - 27 Feb 2023
Category Unit Tests Repository Administration com_admin SQL Postgresql
avatar korenevskiy korenevskiy - open - 27 Feb 2023
avatar korenevskiy korenevskiy - change - 27 Feb 2023
Status New Pending
avatar dgrammatiko
dgrammatiko - comment - 27 Feb 2023

This is not needed at all. For all stages of the model there are corresponding events that actually have the context you are passing here but most importantly in order to tweak the core functionality you are forced to use a plugin thus the whole context idea here is useless. Please check the events here: #28886
and maybe https://github.com/ttc-freebies/plugin-responsive-images/tree/4.0.0/src/plugins/media-action/responsive as a proof of what you're introducing could be done already and it doesn't need the info to be passed in the post request.

avatar korenevskiy
korenevskiy - comment - 27 Feb 2023

This is not needed at all. For all stages of the model there are corresponding events that actually have the context you are passing here but most importantly in order to tweak the core functionality you are forced to use a plugin thus the whole context idea here is useless. Please check the events here: #28886 and maybe https://github.com/ttc-freebies/plugin-responsive-images/tree/4.0.0/src/plugins/media-action/responsive as a proof of what you're introducing could be done already and it doesn't need the info to be passed in the post request.

  • Tell me how you can automatically manage the location of the image file in the desired directory?
  • Tell me how to find out the ID of the material to add it to the image file name?
avatar dgrammatiko
dgrammatiko - comment - 27 Feb 2023

Tell me how you can manage the location of the desired directory automatically?

I was doing that for over a decade and the process is the same although some things have changed in the j4 API: https://github.com/dgrammatiko/imageUploaderHelper

Tell me how to find out the ID of the material to add it to the image file name?

There are many ways to go, the easiest probably is to pass the needed data to the session so the plugin, when it executes, could reuse it. An example could be https://github.com/dgrammatiko/sloth-pkg/blob/8dbe65b679af8ad60c9f9ac36ee54b754300b17f/plg_sampledata/sloth.php#L179

There are other ways though.

avatar richard67
richard67 - comment - 27 Feb 2023

@korenevskiy Besides the above discussion: Can it be that you wanted to make this PR for the 4.3-dev branch but then by mistake have made it for the 4.2-dev branch? The PR shows 2044 changed files.

avatar korenevskiy
korenevskiy - comment - 27 Feb 2023

Besides the above discussion: Can it be that you wanted to make this PR for the 4.3-dev branch but then by mistake have made it for the 4.2-dev branch? The PR shows 2044 changed files.

Yes, you are completely right. I did PR for 4.3 dev, but after publishing the PR, for some reason unknown to me, he ended up in the 4.2 branch. I did PR on the site, without using code editors.

avatar dgrammatiko
dgrammatiko - comment - 27 Feb 2023

@laoneo any thoughts here?

avatar richard67
richard67 - comment - 27 Feb 2023

Yes, you are completely right. I did PR for 4.3 dev, but after publishing the PR, for some reason unknown to me, he ended up in the 4.2 branch.

@korenevskiy You can change the base branch to 4.3-dev by using the "Edit" button right beside the title of this PR on GitHub. After that you can change the base branch from 4.2-dev to 4.3-dev. Let me know if I shall help with doing that.

avatar korenevskiy
korenevskiy - comment - 27 Feb 2023

You can change the base branch to 4.3-dev by using the "Edit" button right beside the title of this PR on GitHub. After that you can change the base branch from 4.2-dev to 4.3-dev. Let me know if I shall help with doing that.

Thank you, if I had known earlier, I wouldn't have created a lot of bad PR here. ??

avatar joomla-cms-bot joomla-cms-bot - change - 27 Feb 2023
Category Unit Tests Repository Administration com_admin SQL Postgresql JavaScript Repository NPM Change
avatar korenevskiy korenevskiy - change - 27 Feb 2023
Labels Added: ? ?
avatar korenevskiy korenevskiy - change - 27 Feb 2023
Labels Added: NPM Resource Changed PR-4.3-dev
Removed: ? ?
avatar korenevskiy
korenevskiy - comment - 27 Feb 2023

There are many ways to go, the easiest probably is to pass the needed data to the session so the plugin,

It looks like we will never get a tool for automatic image management. Plugins are originally designed to work with contextual data. Working with the session is not the task of the plugin, but the task of the kernel. This context is transmitted only by the plugin for which it is intended. In fact, plugins are blind when processing images. This is important information. Very important.

avatar dgrammatiko
dgrammatiko - comment - 27 Feb 2023

Working with the session is not the task of the plugin, but the task of the kernel.

Then make a proposal for those changes to be applied GLOBALLY. Adding sporadically different context, etc is making the system very unpredictable for devs.

To be clear here, I'm not against adding more data, it's that this is not standardised, ie this event will be available only for tinyMCE drag and drop images, but not for any other editor and neither for tinyMCE if you upload a file using the media manager modal. Consistency is key...

avatar korenevskiy
korenevskiy - comment - 27 Feb 2023

@dgrammatiko

  1. I agree. The behavior should be predictable. And it is necessary to define a general rule for the context of all dragged images. Let's think about standardization.
  2. There is no need to consider other code editors here. Since this script only applies to TinyMCE. This means that other code Editors invent this context for themselves. And they will invent until there is no standard.
  3. This context in this PR is not passed to the plugin as a parameter. This context will be located simply in the Input object. Which does not impose new rules. But it is only an option.
  4. Later I will think about adding a context for uploading a file through a modal window. Of course, if everyone supports this PR.
avatar dgrammatiko
dgrammatiko - comment - 27 Feb 2023

Later I will think about adding a context for uploading a file through a modal window. Of course, if everyone supports this PR.

If you manage to cover the modal as well I'm positive on this. Also you need to add the missing code in the media manager that will pass the input data to the events on each adapter (which right now is missing and quite frankly the extra data is useless as is)

avatar korenevskiy
korenevskiy - comment - 27 Feb 2023

If you manage to cover the modal as well I'm positive on this. Also you need to add the missing code in the media manager that will pass the input data to the events on each adapter (which right now is missing and quite frankly the extra data is useless as is)

In the case of a Media Manager, context is useless and unnecessary. Since the Media Manager does not carry information about the Article and Category. I.e., there is nothing to transmit in the context in the Media Manager.
Tell us about your vision of what the context should look like for it to be useful?

avatar HLeithner
HLeithner - comment - 8 May 2023

This pull request has been automatically rebased to 5.0-dev. No new features will be merged into Joomla! 4.3 series. Joomla! 4.4 series is a bridge release to make migration from Joomla! 4 to 5 as smooth as possible.

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar HLeithner
HLeithner - comment - 24 Apr 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
Add text context info for post request for dragging image in editor in article
[5.2] Add text context info for post request for dragging image in editor in article
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] Add text context info for post request for dragging image in editor in article
[5.3] Add text context info for post request for dragging image in editor in article
avatar HLeithner HLeithner - edited - 2 Sep 2024

Add a Comment

Login with GitHub to post a comment