-
Notifications
You must be signed in to change notification settings - Fork 9.4k
file upload issue in WYSIWYG editor on product page #38025
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
Conversation
Hi @DhruvBasan. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run Unit Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento create issue |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
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.
Hello @DhruvBasan
Thank you for your contribution
Could you please check my suggestions and fix PR
Thank you in advance.
lib/web/mage/backend/tree-suggest.js
Outdated
init: function (el,options) { | ||
init.call(this,el,options); |
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.
Let's add spaces between params
init: function (el,options) { | |
init.call(this,el,options); | |
init: function (el, options) { | |
init.call(this, el, options); |
Perhaps JS Coding Style requires it
https://javascript.info/coding-style
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.
Hello @andrewbess , I have implemented the suggestions you provided on my pull request
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Functional Tests B2B, Functional Tests EE, Integration Tests, WebAPI Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
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.
Hello @DhruvBasan,
Thanks for the collaboration!
The code changes seems good to us. But in accordance of DOD, please cover the changes with some automated test.
Thanks
@engcom-Echo your changes in the test file (app/code/Magento/Cms/Test/Mftf/Section/TinyMCESection/MediaGallerySection.xml) are conflicting with the developer branch. Could you please review and resolve the conflict? |
@magento run all tests |
@magento run Static Tests |
@magento run Static Tests,Integration Tests,Functional Tests CE,Functional Tests B2B |
@magento run all tests |
@magento run all tests |
@magento run all tests |
@magento run WebAPI Tests,Functional Tests B2B |
@magento run all tests |
@magento run Functional Tests EE,Functional Tests B2B,Integration Tests,WebAPI Tests |
@magento run Functional Tests EE ,Integration Tests |
Looks like this was merged in 2.4-develop recently in c6bc830 However, PR isn't marked as merged, probably because of the last 2 merge commits part of this PR. |
Closing this PR as it is merged to 2.4-develop. Commit link can be found here |
Title
The folder-tree are not visible and getting error “We can't upload the file to the current folder right now. Please try another folder.” when we try to upload image
Description (*)
There is an issue encountered when attempting to upload an image to a folder within the WYSIWYG editor on a product page, specifically within the short description in content section. The folders are not visible, and as a result, we cannot upload the image and we receive an error message stating, 'We can't upload the file to the current folder right now. Please try another folder.' This problem only occurs when you expand the 'Image and Video' tab first. And getting the error in console as shown in below image
Manual testing scenarios (*)
1: Access the Magento admin panel and navigate to 'Catalog' -> 'Products.' and Select any product.
2: in the product page, first, expand the 'Image and Videos' tab, as shown in the image below.
3: Next, expand the 'Content' tab and in 'Short Description' section click on the 'Insert Image' button and select the 'Source' button in the WYSIWYG editor, as indicated in the image below
4: after clicking the 'Source' button, you may notice that the folders are not displayed, and as a result, you are unable to upload images within the 'Short Description.' as you can see in below image
**Expected result **
After expanding image and videos tab first we should be able to see folder option and can insert image in short description
**Actual result **
After expanding image and videos tab first we can not see folder option and can not insert image in short-description
Aditional information
In this issue, when we expand the 'Image and Videos' tab and then attempt to upload an image within the 'Short Description' content section, it triggers the 'tmp.init(el,options);' in the lib/web/jquery/jstree/jquery.jstree.js file at line 123, as illustrated in the image below.
After the 'tmp.init(el, options)' function is triggered in the 'jquery.jstree.js' file, it call the init function in the 'tree-suggest.js' file. Please note that it call init function in the 'tree-suggest.js' file only when we initially expand the 'Image and Videos' tab first.
In the lib/web/mage/backend/tree-suggest.js file, it calls the ‘init’ function at line 58 however, an issue arises because the ‘init’ function does not receive the element. Consequently, ‘this.get_container’ becomes undefined
This issue likely plays a significant role in the failure to display folders in the WYSIWYG editor when attempting to upload an image.the element contains the data of folder-tree so if it not assign correct we can not see folder tree when we try to insert image using WYSIWYG editor in short-description
In the image provided above, you can see on line 77 and also on line 102, there is a call to the '_get_node' method. However, there isn't a method with this name in the file or jquery.jstree.js file. Instead, the correct method name is 'get_node.' Therefore, we need to make this correction to ensure the proper function is called.
Solution
To resolve the issue, we need to make changes in the 'lib/web/mage/backend/tree-suggest.js' file. Specifically, we should pass the 'element' in the 'init' function at line 58. Afterward, we should call the 'init' function before 'get_container' and pass the 'data' (consisting of 'element' and 'option') to ensure that the 'init' function receives the required element. This modification ensures that the 'container' variable is not undefined.
Additionally, we should replace instances of '_get_node' with 'get_node' on lines 77 and 102 to ensure that the correct method is called.
Once these modifications are implemented, the issue should be successfully resolved.you can see changes in below image
Questions or comments
Contribution checklist (*)
Resolved issues: