给blog加了一个插件 Advanced WYSIWYG Editor ,可以打开wp使用的tinymce编辑器的一些功能。例如他网站上面列出来的那些:

  • Format selection: paragraph, formatted, headers, etc.

  • Underline.

  • Full justification.

  • Anchor.

  • Horizontal line.

  • Copy, cut, paste.

  • Insert table.

  • Subscript, superscript.

  • Foreground color, background color.

  • Character map.

  • Full screen editing.


吸引我的功能是那个insert table。按照其它插件的安装方法,激活之后,再看发表文章的编辑器,发现确实多了很多按钮。不过多了太多了,工具栏一行都显示不下啦,怎么分行呢?wp还是很牛的,好像就已经预料到这种问题了,直接修改advanced-wysiwyg.php就可以了。例如我的:
return array(
"formatselect", "bold", "italic", "underline", "strikethrough", "separator",
"bullist", "numlist", "indent", "outdent", "separator",
"justifyleft", "justifycenter", "justifyright", "justifyfull","separator",
"link", "unlink", "anchor", "image", "hr");
}function extended_editor_mce_buttons_2($buttons) {
// Add buttons on the second toolbar line
//    return $buttons;
return array(
"cut", "copy", "paste", "undo", "redo", "separator",
"sub", "sup", "forecolor", "backcolor", "charmap", "separator",
"code", "fullscreen", "wordpress", "wphelp","separator","tablecontrols");
}
这样就分两行了,当然还可以编辑extended_editor_mce_buttons_3函数让他出来第三行。 好了,看着是不是挺爽的?可是发现我要的insert table功能怎么没出来?再仔细看作者的网页,有个提示”需要去tinymce的网站上面下载关于table等的plugin,默认的wp 2.0版本没有包括这些“。这样去下载了,将其中的plugin里面的东西放出来,找到table和fullscreen文件夹,放到服务器的tinymce的plugin下面,再访问一下发帖页面,是不是发现工具栏都变巨丑的按钮了?呵呵。 用Firefox的话,打开错误控制台,可以看到刚加的tinymce的plugin出错了。提示是: tinyMCE.addPlugin is not a function 找到plugin里面的js文件看看,和其它比较一下,确实是多了这么一个函数调用。删掉之后工具栏能出来了,可是还是没有这个按钮,是啥问题呢?上作者blog看了一下,原来是tinymce的版本太高了。
eduo Says: March 19th, 2006 at 5:08 pm To all having issues with the rich editor disappearing: Yes, the version of TinyMCE changed. I’ve been checking the versions and it’s possible to download the latest one that works with this plug-in (which in reality just extends the stock WP-included TinyMCE, itself a very good thing) from the “older versions” page of the TinyMCE SF site included as part of the 2.02 files: http://sourceforge.net/project/showfiles.php?group_id=103281&package_id=111430 The page for direct download is: http://prdownloads.sourceforge.net/tinymce/tinymce_1_45.tgz?download Using the “table” and “fullscreen” from this file is all that’s needed. Other plug-ins from this same package should work as well.
除了使用上面的版本,还可以使用一个2.0 RC4这个版本。
PS: The table controls and full screen editing rely on additional TinyMCE plugins. So if you want these two features as well, you’ll have to download TinyMCE plugins and install those separately. For WordPress 2.0.4 users, try the TinyMCE 2.0 RC4 plugins. Or check the comments to find out what works for other people.
这个版本的table功能更加高级一点,推荐使用这个。