Plugin Directory

Changeset 2152249


Ignore:
Timestamp:
09/06/2019 10:30:22 AM (7 years ago)
Author:
hewei0
Message:

supported Gutenberg

Location:
2em/trunk
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • 2em/trunk/iw-2em.php

    r1607079 r2152249  
    44Plugin URI: https://wordpress.org/plugins/2em/
    55Description: add "text-indent:2em" support to editor.
    6 Version: 1.0.1
     6Version: 1.1.0
    77Author: hewei
    88Author URI: http://blog.itfsw.com
     
    2828*/
    2929
    30 if (is_admin()){
     30if ( is_admin() ) {
    3131
    3232    /**
     
    3737     * @return mixed
    3838     */
    39     function iw_add_plugin($plugin_array) {
    40         $plugin_array['iw_2em'] = plugins_url('res/js/iw-2em.js', __FILE__);
     39    function iw_add_plugin( $plugin_array ) {
     40        $plugin_array['iw_2em'] = plugins_url( 'res/js/iw-2em.js', __FILE__ );
     41
    4142        return $plugin_array;
    4243    }
    43     add_filter('mce_external_plugins', 'iw_add_plugin');
     44
     45    add_filter( 'mce_external_plugins', 'iw_add_plugin' );
    4446
    4547    /**
     
    5052     * @return mixed
    5153     */
    52     function iw_register_buttons($buttons) {
    53         array_push($buttons, 'separator', 'iw_2em');
     54    function iw_register_buttons( $buttons ) {
     55        array_push( $buttons, 'separator', 'iw_2em' );
     56
    5457        return $buttons;
    5558    }
    56     add_filter('mce_buttons', 'iw_register_buttons');
     59
     60    add_filter( 'mce_buttons', 'iw_register_buttons' );
     61
     62
     63    /**
     64     * Enqueue Gutenberg block assets for backend editor.
     65     */
     66    function iw_2em_enqueue_block_editor_assets() {
     67        // js
     68        wp_enqueue_script( 'iw-2em-plugin-js', plugins_url( 'build/index.js', __FILE__ ), array( 'wp-block-library' ) );
     69    }
     70
     71    add_action( 'enqueue_block_editor_assets', 'iw_2em_enqueue_block_editor_assets' );
    5772}
     73
     74/**
     75 * 注册block 样式
     76 */
     77function iw_2em_enqueue_block_assets() {
     78    wp_enqueue_style( 'iw-2em-plugin-css',  plugins_url( 'res/css/index.css', __FILE__ ));
     79}
     80add_action( 'enqueue_block_assets', 'iw_2em_enqueue_block_assets' );
  • 2em/trunk/readme.txt

    r1607079 r2152249  
    11=== Plugin Name ===
    22Contributors: He Wei
    3 Donate link: http://blog.itfsw.com/
    4 Tags: tinymce, 2em, style, text-indent, 首行缩进
     3Donate link: http://blog.itfsw.com
     4Tags: style, text-indent, 2em, 首行缩进, Gutenberg, tinymce
    55Requires at least: 3.5.0
    6 Tested up to: 4.7
    7 Stable tag: 1.0.1
     6Tested up to: 5.2
     7Stable tag: 1.1.0
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1010
    11 2em 主要是为官方编辑器增加首行缩进支持
     11首行缩进插件2em 主要是为官方编辑器增加首行缩进支持(text-indent:2em;)
    1212
    1313== Description ==
     
    1616
    1717Features:
    18 1. 编辑器增加缩进按钮,点击切换缩进;
    19 2. tab按键监听(tab增加,shift+tab缩减);
     181. 经典编辑器(tinymce)支持
     19 1.1. 编辑器增加缩进按钮,点击切换缩进;
     20 1.2. tab按键监听(tab增加,shift+tab缩减);
     212. 新版编辑器(Gutenberg)支持,选中或新增段落块
     22 2.1. 右侧面板点击 区块=》式样=》首行缩进样式;
     23 2.2. 直接点击工具栏首行缩进按钮;
    2024
    2125== Installation ==
     
    3337* 增加编辑器的tab按键监听,tab增加,shift+tab缩减。
    3438* 对文章常用块元素增加支持(DIV,P,H1,H2,H3,H4,H5,H6)。
     39
     40= 1.1.0 =
     41* 增加对官方新编辑器(Gutenberg)的支持。
     42* 对段落块增加首行缩进样式(选中段落后右侧面板区块=》式样=》首行缩进),或者在段落块的操作栏上点击首行缩进按钮。
Note: See TracChangeset for help on using the changeset viewer.