Rich text editor(TinyMCE) is an often requirement for Admin Module as it makes the content editing work much more easier.
In order to enable TinyMCE editor in textarea field, You need to do the following two things:
1> Including TincyMCE in Head
Add the following function in your Adminhtml Edit Class (MagePsycho_Demomodule_Block_Adminhtml_Demomodule_Edit):
protected function _prepareLayout() {
parent::_prepareLayout();
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
}
2> Enabling in Form Field
Add the following content field in your Adminhtml Form class (MagePsycho_Demomodule_Block_Adminhtml_Demomodule_Edit_Tab_Form):
$fieldset->addField('content', 'editor', array(
'name' => 'content',
'label' => Mage::helper('demomodule')->__('Content'),
'title' => Mage::helper('demomodule')->__('Content'),
'style' => 'height:15em',
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
'wysiwyg' => true,
'required' => false,
));
Note
: Field Type must be ‘editor’ and ‘wysiwyg’ must be true
3> That’s All.
Here is what it looks like when loaded:
TinyMCE Editor
Note
that this code was tested in Magento Version 1.6.1.0
Happy Editing!
来源:http://www.blog.magepsycho.com/how-to-use-wysiwyg-editor-tinymce-in-custom-admin-magento-module/
分享到:
相关推荐
Magento的更好的所见即所得2编辑TinyMCE4通过 概述 通过此扩展程序,您可以扩展Magento 2中的TinyMCE 4工具,例如:添加文本颜色,图像,html代码,撤消重做,样式选择,fontsizeselect,前景色背景色,粗体,斜体...
magento-community/BouncingOrange_TinyMCE和magento-community/Fontis_Wysiwyg插件提供了直观的文本编辑功能,包括格式化、插入图片、链接等,大大提升了内容管理的效率和便捷性。 ### 主题与模板 Magento提供了...
- 这样的编辑器通常使用JavaScript和HTML5技术实现,如WYSIWYG(所见即所得)编辑器,例如TinyMCE、CKEditor等。 - 图片上传功能涉及到文件上传API,HTML5的FormData对象和服务器端处理图片的脚本,可能包括图像...
向 Magento 使用的 TinyMCE 编辑器添加一个小部件。 这允许用户搜索/选择要嵌入到他们选择的内容中的视频。 ##我如何使用它? 只需将文件复制到您的 magento 安装,维护由 repo 设置的目录结构。 为了将此小部件...
欢迎使用 Magento 的 Mgt Amazing WYSIWYG 编辑器 WYSIWYG (/ˈwɪziwɪɡ/ wiz-ee-wig) 是所见即所得的首字母缩写词。 该术语在计算中用于描述一种系统,其中在编辑期间显示在屏幕上的内容(文本和图形)以与打印或...
这通常指的是一个基于WYSIWYG(所见即所得)的富文本编辑工具,如TinyMCE或CKEditor。这种编辑器允许管理员在后台直接编辑产品描述或其他内容,无需掌握HTML代码,大大降低了使用门槛。 接着,图表效果可能意味着...