0

I am adding a wysiwyg editor to one of the page in admin panel. The editor displays properly before I the javascript files to head section. After adding the javascript files in the layout file, the layout of the page goes into the editor. However, I just copy and paste the code from another custom module and it works properly in that module without any warning message. How to fix it? Thank you in advance.

Warning Message in Console

tiny_mce.js:1 'webkitMovementX' is deprecated. Please use 'movementX' instead.
tiny_mce.js:1 'webkitMovementY' is deprecated. Please use 'movementY' instead.

Before adding the javascript files to head section

Before adding javascript files

After adding the javascript files to head section

After adding javascript files

layout.xml

<layout version="0.1.0">
<handleName_index>
    <reference name="content">
        <block type="module/adminhtml_block01" name="block01"/>
    </reference>
</handleName_index>
<handleName_edit>
    <reference name="head">
        <action method="setCanLoadExtJs"><flag>1</flag></action>
        <action method="setCanLoadTinyMce"><flag>1</flag></action>
        <action method="addJs"><script>mage/adminhtml/variables.js</script></action>
        <action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
        <action method="addJs"><script>lib/flex.js</script></action>
        <action method="addJs"><script>lib/FABridge.js</script></action>
        <action method="addJs"><script>mage/adminhtml/flexuploader.js</script></action>
        <action method="addJs"><script>mage/adminhtml/browser.js</script></action>
        <action method="addJs"><script>prototype/window.js</script></action>
        <action method="addJs"><script>prototype/prototype.js</script></action>
        <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
        <action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
    </reference>
</handleName_edit>

Form.php

class ModuleName_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {

protected function _prepareForm() {
    $form = new Varien_Data_Form();
    $this->setForm($form);

    if(Mage::registry('module_data')) {
        $data = Mage::registry('module_data')->getData();
    }

    $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig();
    $wysiwygConfig->addData(array(
        'add_variables'             => false,
        'plugins'                   => array(),
        'widget_window_url'         => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/widget/index'),
        'directives_url'            => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'),
        'directives_url_quoted'     => preg_quote(Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive')),
        'files_browser_window_url'  => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'),
    ));

    $fieldset = $form->addFieldSet('module_form', array('legend' => 'Editor'));
    $fieldset->addField('title', 'text', array(
            'label' => 'Title',
            'name' => 'title'
        ));
    $fieldset->addField('content', 'editor', array(
        'name' => 'content',
        'label' => 'Content',
        'title' => 'Content',
        'style' => 'width:700px; height:150px;',
        'wysiwyg' => true,
        'required' => false,
        'config' => $wysiwygConfig
    ));
    $form->setValues($data);
    return parent::_prepareForm();

}

protected function _prepareLayout() {
    parent::_prepareLayout();
    if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
        $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
    }
}

}

1 Answer 1

0

You just need to change one thing

Replace this

$fieldset->addField('content', 'editor', array(
        'name' => 'content',
        'label' => 'Content',
        'title' => 'Content',
        'style' => 'width:700px; height:150px;',
        'wysiwyg' => true,
        'required' => false,
        'config' => $wysiwygConfig
    ));

with

$fieldset->addField('description', 'editor', array(
        'name' => 'content',
        'label' => 'Content',
        'title' => 'Content',
        'style' => 'width:700px; height:150px;',
        'wysiwyg' => true,
        'required' => false,
        'config' => $wysiwygConfig
    ));

You will need to change 'content' title to other title as I changed it to 'description'.

0

Your Answer

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

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