如何在管理员中的textarea上默认启用所见即所得? [英] How to enable wysiwyg by default on textarea in admin?

查看:74
本文介绍了如何在管理员中的textarea上默认启用所见即所得?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本区域上默认启用所见即所得?我的意思是,我不想单击所见即所得"按钮以显示带有tinyMCE的区域:

How can I enable wysiwyg by default on textarea? I mean, I do not want to click on the wysiwyg button to display the area with tinyMCE :

我直接想要这个:

推荐答案

经过一番研究,我发现了它.

After a little research i found it.

1)将此代码放在您希望编辑器直接显示的.phtml文件中.

1) Put this code in the .phtml file you want the editor to appear directly.

2)在代码的第6行中,您可以看到elements: "short_description".您可以使用所需的元素ID更改"short_description".您可以添加多个元素ID,以逗号分隔且不包含空格.

2) In the 6th line of the code you can see elements: "short_description". You can change "short_description" with the element id you want. You can add more than one element id separated with comma and without spaces.

示例:我将此代码放在app/design/adminhtml/default/default/template/catalog/product/edit.phtml中,因为我希望编辑器在编辑产品的说明,简短说明等时直接显示.

Example: I put this code in app/design/adminhtml/default/default/template/catalog/product/edit.phtml because i want the editor to appear directly when i edit product's description, short description etc.

代码:

<script type="text/javascript">
window.onload=function()
{
   tinyMCE.init({
    mode : "exact",
    elements: "short_description",
    theme : "advanced",
    plugins : "inlinepopups,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
    theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
    theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
    theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,|,visualchars,nonbreaking",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_location : "bottom",
    extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
    theme_advanced_resize_horizontal : 'true',
    theme_advanced_resizing : 'true',
    apply_source_formatting : 'true',
    convert_urls : 'false',
    force_br_newlines : 'true',
    doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'

  });
};
</script>

这篇关于如何在管理员中的textarea上默认启用所见即所得?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆