admin管理员组文章数量:1310185
I've been trying to get the TinyMCE editor working in the comments field but I've been unable to do so. Another suggestion I found was , the editor is working but the comments are not saved in rich text.
TinyMCEComments seems to do it but hasn't been updated in a while, it's not working for 3.2.
Did anybody got this working? Thanks!
I've been trying to get the TinyMCE editor working in the comments field but I've been unable to do so. Another suggestion I found was http://nicedit, the editor is working but the comments are not saved in rich text.
TinyMCEComments seems to do it but hasn't been updated in a while, it's not working for 3.2.
Did anybody got this working? Thanks!
Share Improve this question asked Jul 8, 2011 at 15:49 FLXFLX 1,0273 gold badges17 silver badges31 bronze badges2 Answers
Reset to default 1Solved it myself by loading tinymce in the header:
wp_enqueue_script('tiny_mce');
This will include the TinyMCE javascript. Then simply use TinyMCE as you wish
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1 : "save,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,blockquote,|,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,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
skin : "o2k7",
skin_variant : "silver",
});
</script>
Unfortunately your solution has a bug. TinyMCE stops working when used with threaded comments and user clicks reply. This is because it can't be moved around in DOM. TinyMCE must be removed from DOM before comment form is moved on reply and added back after comment form is in place. The same thing needs to be done when/if user clicks cancel reply. I posted a bunch of code for WordPress > 3.3 with two ways to solve this problem in an article on my blog:
http://www.techytalk.info/add-tinymce-quicktags-visual-editors-wordpress-comments-form/
Also my solution makes it possible to use both TinyMCE (Visual) or Quicktags(HTML) editor or both using WordPress 3.3 wp_editor() function.
本文标签: tinymceUse rich text editor in comments
版权声明:本文标题:tinymce - Use rich text editor in comments? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741828006a2399762.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论