I'm trying to add the tinymce wysiwyg editor in a custom field and make it look like in CMS pages however the widgets that I insert appear with an error image X Any idea how to fix this issue?
I used the following code to retrieve the tinymce config settings
<?php
Class MyClass
/**
* @var \Magento\Cms\Model\Wysiwyg\Config
*/
protected $_wysiwygConfig;
.....
$config = $this->_wysiwygConfig->getConfig();
$config = json_encode($config->getData());
?>
And in my js file I'm requiring mage/adminhtml/wysiwyg/tiny_mce/setup
and using the config data I created in my PHP class like this
config.tinymce4.toolbar += " | code";
var newAreaID = $newId;
var editor = new wysiwygSetup(
newAreaID,
config
);
editorFormValidationHandler1 = editor.onFormValidation.bind(editor);
varienGlobalEvents.attachEventHandler("formSubmit", editorFormValidationHandler1);
varienGlobalEvents.clearEventHandlers("open_browser_callback");
varienGlobalEvents.attachEventHandler("open_browser_callback", editor.openFileBrowser);
console.log(editor);
editor.wysiwygInstance.turnOn();
jQuery('#' + newAreaID).addClass('wysiwyg-editor').data('wysiwygEditor', editor);
The widgets are completely usable and I can insert/delete/edit them but I have no clue which one is which because of how they're rendered.
I haven't been able to find something by searching. Any help is appreciated.