0

我的问题是我在 magento 管理端使用所见即所得编辑器我检查了每一页每件事都是正确的,当单击插入图像时,代码中没有错误,它们会生成错误并且无法正常工作,因此请帮助我遇到此类错误的任何人。错误是“ReferenceError:MediabrowserUtility 未定义”谢谢

  $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,
  ));
4

1 回答 1

0

该错误是由于缺少分配给 WYSWIGaddField()阵列的配置设置。

如果您打开 Form.php,只需在 WYSIWYG 字段上方添加以下内容,

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

然后修改您的 WYSIWYG 表单域(见下方突出显示),

$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
)); 

有关详细信息,您可以查看此链接 并阅读一些评论

希望这对你有帮助

于 2013-09-17T11:32:34.517 回答