`
天梯梦
  • 浏览: 13764061 次
  • 性别: Icon_minigender_2
  • 来自: 洛杉矶
社区版块
存档分类
最新评论

magento变换编辑器How to use WYSIWYG editor (TinyMCE) in custom Admin Magento Module

 
阅读更多

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/

 

分享到:
评论

相关推荐

    module-wysiwyg-advanced:扩展Magento 2中的TinyMCE 4工具

    Magento的更好的所见即所得2编辑TinyMCE4通过 概述 通过此扩展程序,您可以扩展Magento 2中的TinyMCE 4工具,例如:添加文本颜色,图像,html代码,撤消重做,样式选择,fontsizeselect,前景色背景色,粗体,斜体...

    magento常用插件

    magento-community/BouncingOrange_TinyMCE和magento-community/Fontis_Wysiwyg插件提供了直观的文本编辑功能,包括格式化、插入图片、链接等,大大提升了内容管理的效率和便捷性。 ### 主题与模板 Magento提供了...

    ASP.NET.JSP.PHP.rar_php邮箱编辑器_文本编辑器_编辑器

    - 这样的编辑器通常使用JavaScript和HTML5技术实现,如WYSIWYG(所见即所得)编辑器,例如TinyMCE、CKEditor等。 - 图片上传功能涉及到文件上传API,HTML5的FormData对象和服务器端处理图片的脚本,可能包括图像...

    buto_addvideo:将 WYSIWYG 小部件添加到您的 Magento 电子商务平台,以将 Buto Videos 集成到您的内容中

    向 Magento 使用的 TinyMCE 编辑器添加一个小部件。 这允许用户搜索/选择要嵌入到他们选择的内容中的视频。 ##我如何使用它? 只需将文件复制到您的 magento 安装,维护由 repo 设置的目录结构。 为了将此小部件...

    Mgt_AmazingWysiwyg

    欢迎使用 Magento 的 Mgt Amazing WYSIWYG 编辑器 WYSIWYG (/ˈwɪziwɪɡ/ wiz-ee-wig) 是所见即所得的首字母缩写词。 该术语在计算中用于描述一种系统,其中在编辑期间显示在屏幕上的内容(文本和图形)以与打印或...

    mageto超炫后台模板

    这通常指的是一个基于WYSIWYG(所见即所得)的富文本编辑工具,如TinyMCE或CKEditor。这种编辑器允许管理员在后台直接编辑产品描述或其他内容,无需掌握HTML代码,大大降低了使用门槛。 接着,图表效果可能意味着...

Global site tag (gtag.js) - Google Analytics