How can I make widgets show properly in tinymce in magento 2.3?












0















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
enter image description here
Any idea how to fix this issue?



I used the following code to retrieve the tinymce config settings



<?php 

Class MyClass
/**
* @var MagentoCmsModelWysiwygConfig
*/
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.










share|improve this question



























    0















    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
    enter image description here
    Any idea how to fix this issue?



    I used the following code to retrieve the tinymce config settings



    <?php 

    Class MyClass
    /**
    * @var MagentoCmsModelWysiwygConfig
    */
    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.










    share|improve this question

























      0












      0








      0








      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
      enter image description here
      Any idea how to fix this issue?



      I used the following code to retrieve the tinymce config settings



      <?php 

      Class MyClass
      /**
      * @var MagentoCmsModelWysiwygConfig
      */
      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.










      share|improve this question














      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
      enter image description here
      Any idea how to fix this issue?



      I used the following code to retrieve the tinymce config settings



      <?php 

      Class MyClass
      /**
      * @var MagentoCmsModelWysiwygConfig
      */
      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.







      wysiwyg magento2.3.0 tinymce






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 21 at 19:00









      gabtzigabtzi

      83110




      83110






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f258622%2fhow-can-i-make-widgets-show-properly-in-tinymce-in-magento-2-3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f258622%2fhow-can-i-make-widgets-show-properly-in-tinymce-in-magento-2-3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Eda skans

          William S. Burroughs

          What is the difference between apt, apt-get and git?