0
votes

my question that i am using wysiwyg editor in magento admin side i checked every page every thing is right no error in code when click on the insert image they generate the error and can not works fine so help me anyone they face this type of error. error is "ReferenceError: MediabrowserUtility is not defined" thanks

  $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => 'form_section'));
  $wysiwygConfig["files_browser_window_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index');
  $wysiwygConfig["directives_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');
  $wysiwygConfig["directives_url_quoted"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');
  $wysiwygConfig["widget_window_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/widget/index');
  $wysiwygConfig["files_browser_window_width"] = (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width');
  $wysiwygConfig["files_browser_window_height"] = (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height');
  $plugins = $wysiwygConfig->getData("plugins");
  $plugins[0]["options"]["url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_variable/wysiwygPlugin');
  $plugins[0]["options"]["onclick"]["subject"] = "MagentovariablePlugin.loadChooser('".Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_variable/wysiwygPlugin')."', '{{html_id}}');";
  $plugins = $wysiwygConfig->setData("plugins",$plugins);

    $fieldset->addField('question_details', 'editor', array(
      'name'      => 'content',
      'label'     => Mage::helper('supportportal')->__('Details'),
      'title'     => Mage::helper('supportportal')->__('Details'),
      'style'     => 'width:600px; height:300px;',
      'config'    => $wysiwygConfig,
      'wysiwyg'   => true,
      'required'  => true,
  ));
1

1 Answers

0
votes

The error is due to a missing configuration setting which is assigned to the WYSWIG addField() array.

If you open your Form.php simply add the following above the WYSIWYG field,

$configSettings = array( 'add_widgets' => false, 'add_variables' => false, 'add_images' => false,  'files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/')); 

Then modify your WYSIWYG form field (see highlighted below),

$fieldset->addField('post_content', 'editor', array(
    'name'      => 'post_content',
    'label'     => Mage::helper('faqs')->__('Answer'),
    'title'     => Mage::helper('faqs')->__('Answer'),
    'style'     => 'width:700px; height:500px;',
    'wysiwyg'   => true,
    'config' => $configSettings
)); 

for detail you can see this link and also read some comments on that

hope this will sure help you