0

Currently i have normal form with editor field (wysiwyg) no-uicomponent implement.
When i insert image magento insertImage to content

<img src="{{media url="wysiwyg/test.png"}}" alt="" />

but after click on button Show / Hide Editor Editor content show

<p><img src="{{media url=" alt="" /></p>

Ofcourse my image not show. I expected that after click editor content must show my current image

What exactly happens, Where in code i should check to solve this problem?
i'm using Magento 2.1.2. Directory wysiwyg had full write permission

1 Answer 1

3

Please change this setting and check

Store -> Configuration -> General -> Content Management -> Use Static URLs for Media Content in

WYSIWYG for Catalog to Yes

But, there are some big drawbacks of doing this. The static URL which is used for media content in WYSIWYG might be non-secure URLs. In such cases, if you change the base URL the URLs on the images will not update to reflect that are two. Although, there is another solution available to fix this problem (not a great alternative in my opinion), but better than changing the static URL option.

Another Solution

Change vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php

Add on line 747:

'add_variables' => false,
    'add_widgets' => false,
    'add_directives' => true,
    'use_container' => true,
    'container_class' => 'hor-scroll',

Change lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js

Add on line 384 below content = editor.getContent();

content = this.decodeContent(content);

Once done the above-mentioned changes follow the below commands

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento cache:flush

Hope this will help. But, keep in mind that you have just made changes in the core files. Once done, move these file to the local folder.

3
  • I found use config add_directives = true solve my problem. No need to enable static url in config settings. But im still accept your answer
    – mrtuvn
    Commented Jan 23, 2017 at 18:33
  • 1
    +mrtuvn could you please elaborate further? where is this configuration add_directive? Commented Feb 6, 2017 at 23:47
  • I m try but not working in M2.
    – Nikul
    Commented Jun 12, 2018 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.