views:

1801

answers:

4

Hi All

Anyone know how to get the new 1.4 WYSIWYG editor (TinyMCE) working with custom admin pages?

I have some modules I made that have input fields in the admin->system->config section, and I’d like to get the new editor to show on the textareas there, but I can't find where they are defined.

+1  A: 
St.Woland
Thanks for this, but unfortunately it's not quite what I needed. I already made my own TinyMCE extension for Magento before, for version 1.3, but since they added it into the new 1.4 version, I want to find out how to use that default TinyMCE package to show the editor on my own custom extensions. I don't see the point of having two separate versions of TinyMCE when surely one can manage to do everything, if I can just find which file specifies the text areas to be used with it.
Sam
I have double-checked, WYSIWYG for content pages works right after installation of v.1.4.0.1Describe your case in more detail, perhaps it's all about your database. Here's a post that might help: http://www.magentocommerce.com/boards/viewthread/77777/
St.Woland
Sam
There is no such file, all you need to do is create your text areas with the following code: `$fieldset->addField('content', 'editor', array( 'wysiwyg' => true ... ) ) ;` Or you may optionally create TinyMCE manually, passing `elements : "my_textarea_id"` as an argument.
St.Woland
Thanks again, but my text area input fields are created via my extension's system.xml file, not through the database, so I can't see any way to add this in. From my own searches through the core files, it seems that it can only be enabled for CMS pages: if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);}Guess I'll just have to use my own one as well as the default.
Sam
A: 

Sam,

If you find the solution, please post it. I'm looking at the same problem.

Made a custom module and would like to use the 1.4 wysiwyg editor in my content fields.

Coen
+1  A: 

To load the TINY MCE on a specific page, use the following function on the Adminhtml Edit block of your module:

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

To enable the editor for a certain editable textfield, just use 'wysiwyg' => true, instead of 'wysiwyg' => false. i.e.:

$fieldset->addField('description', 'editor', array(
    'name'      => 'description',
    'label'     => Mage::helper('sevents')->__('Description'),
    'title'     => Mage::helper('sevents')->__('Description'),
    'style'     => 'height:12em;width:500px;',
    'wysiwyg'   => true,
    'required'  => true,
)); 
Arion
Thanks for this Arion - this has gotten me a little closer - I've overridden **Mage/Adminhtml/Block/System/Config/Edit.php** adding the first section of code above, so I now have the tinymce setup js files loading, as can be seen in my page head. However, my custom modules have their input fields specified through the system.xml file, in **app/code/community/MyName/MyModuleName/etc**, not as per your second block of code. Is there someway to specify, in this file, to load the wysiwyg editor for a particular field?
Sam
A: 

unfortunately i am getting the show editor button even i did everything @Arion told , it doesnot work, and i find this post. i followed it too. Nothing seems to be working. http://www.magentocommerce.com/boards/viewthread/176212/P0/ Any clue?

Ela