给WordPress quicktags编辑器添加自定义按钮的正确方法[3.3修正]

原文见这里:《给WordPress quicktags编辑器添加自定义按钮的正确方法

WP 3.3起,quicktags引入了新的API,添加按钮更加方便了,用法:

1
QTags.addButton( 'my_id', 'my button', '<span>', '</span>' );

我添加的一些经常要用到的按钮:

1
        QTags.addButton( 'pre', 'pre', "<pre>\n", "\n

" );
QTags.addButton( 'pre_smooth', 'pre.sm', "

1
\n", "\n

" );
QTags.addButton( '<', '<', '<', '' );
QTags.addButton( '>', '>', '>', '' );
QTags.addButton( 'hr', 'hr', "\n


\n", '' );
QTags.addButton( 'h1', 'h1', "\n

", "

\n" );
QTags.addButton( 'h2', 'h2', "\n

", "

\n" );
QTags.addButton( 'h3', 'h3', "\n

", "

\n" );

更多
6 Responses Post a comment
  1. 小七

    自己还是习惯WLW了,不过实时预览不如自带编辑器好用

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS