PrestaShop / PrestaShop

PrestaShop is the universal open-source software platform to build your e-commerce solution.
https://www.prestashop-project.org/
Other
7.93k stars 4.76k forks source link

Specific configuration of TinyMCE is not working on every Text Editor #36351

Open PrestaEdit opened 2 weeks ago

PrestaEdit commented 2 weeks ago

Prerequisites

Describe the bug and add attachments

It's seems that ProductPage V2 and also CMS page could not take this benefits (https://devdocs.prestashop-project.org/9/development/components/tinymce/)

Was working great on Product Page v1 (v8.1).

Expected behavior

Having the possibility to use the config extended on every page.

Steps to reproduce

  1. Add a module as mention on the devdocs
  2. Go to product page
  3. See nothing changed

PrestaShop version(s) where the bug happened

9.0.0-alpha.1

PHP version(s) where the bug happened

8.2

If your bug is related to a module, specify its name and its version

No response

Your company or customer's name goes here (if applicable).

No response

florine2623 commented 2 weeks ago

ping @kpodemski 😄

matks commented 22 hours ago

Hello @PrestaEdit

About your bug report

We are not in your brain. You need to explain better ;

Add a module as mention on the devdocs
Go to product page
See nothing changed

3 sentences is not enough at all to understand the problem. It might be crystal clear for you because you just observed the problem but from anybody else it's very confused.

If you wanted to really help this bug being reported, THIS is how to write the "how to reproduce":

Steps to reproduce

  1. Create a module. In the module use the hook actionAdminControllerSetMedia to include an extra JS / CSS link inside all prestashop pages, as explained on the documentation https://devdocs.prestashop-project.org/9/development/components/tinymce/ . Example
    public function hookActionAdminControllerSetMedia()
    {
        $this->context->controller->addJs('myfile.js');
    }
  1. Inside myfile.js add the following JavaScript code to override the default configuration of the TinyMCE component. For example the below configuration will add the ability to paste text to TinyMCE: See nothing changed
    
    var config = {
    plugins: 'align colorpicker link image filemanager table media placeholder advlist code table autoresize paste',
    toolbar1:
      'code,colorpicker,bold,italic,underline,strikethrough,blockquote,link,align,bullist,numlist,table,image,media,formatselect,pastetext',
    };

window.defaultTinyMceConfig = config;



3. Verify on a backoffice page that the "Paste as text" option is now enabled inside a tinyMCE field
![Capture d’écran 2024-07-01 à 22 52 02](https://github.com/PrestaShop/PrestaShop/assets/3830050/f4f9236b-5e6f-48fa-bdd5-61916a61fcf4)

4. Now go to backoffice "Edit a product" page
5. See that the tinyMCE fields do NOT benefit from the "Paste as text" option on the backoffice "Edit a product page"

# About the issue

Now that I have explained how to submit this bug report, I have tested this and on my shop this works perfectly. Here you can see my backoffice "Edit a product" page with "Paste as text" TinyMCE option enabled, thanks to the above module.

![Capture d’écran 2024-07-01 à 22 53 15](https://github.com/PrestaShop/PrestaShop/assets/3830050/cad2b40d-48c6-422c-9148-ad46d237e4c6)

So on my shop Product Page V2 works very well with the TinyMCE config extension system.
PrestaEdit commented 12 hours ago

Hi @matks,

Maybe cause the issue was solved by this : https://github.com/PrestaShop/PrestaShop/pull/36433

I will have a look on this when I've more time.