2

When I insert a image in the wysiwyg editor (TinyMCE) the image shows properly in the frontend but gets a broken thumbnail image in the editor.

tinymce_broken_thumbnail_image

The url it generates in the editor is similar to this:

http://domain.extension/admin_url/cms/wysiwyg/directive/___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvcGRmL3BkZi5wbmcifX0,/key/8590a46185af57614af635e08360284c95f20261aa5adaf006acc019ed2e87ca/

Is there a way to show the image properly in the editor?

I'm using magento version 2.1.7

2 Answers 2

3

I solved this problem by adding this line:

'add_directives' => true,

in this file

/vendor/magento/module-cms/Model/Wysiwyg/Config.php

the block should looks like this:

 $config->setData(
        [
            'enabled' => $this->isEnabled(),
            'hidden' => $this->isHidden(),
            'use_container' => false,
            'add_variables' => true,
            'add_widgets' => true,
            'no_display' => false,
            'encode_directives' => true,
            'baseStaticUrl' => $this->_assetRepo->getStaticViewFileContext()->getBaseUrl(),
            'baseStaticDefaultUrl' => str_replace('index.php/', '', $this->_backendUrl->getBaseUrl())
                . $this->filesystem->getUri(DirectoryList::STATIC_VIEW) . '/',
            'directives_url' => $this->_backendUrl->getUrl('cms/wysiwyg/directive'),
            'popup_css' => $this->_assetRepo->getUrl(
                'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'
            ),
            'content_css' => $this->_assetRepo->getUrl(
                'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css'
            ),
            'width' => '100%',
            'height' => '500px',
            'plugins' => [],
            'add_directives' => true,
        ]
    );

It is working in Magento 2.1.7

4
0

You should check Wysiwyg in backend Stores / Configuration / General / Content Management / Make sure wysiwyg enabled

'add_directives' => true in wysiwyg config

Magento\Cms\Model\Wysiwyg\Config

You can see xample in Magento_Cms

Your Answer

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

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