Plugin Directory

Changeset 3006096


Ignore:
Timestamp:
12/06/2023 09:41:11 AM (2 years ago)
Author:
goqflash
Message:

Fixed conflict of Classic and Gutenberg editors

Location:
ga-admin-taxonomy-search/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ga-admin-taxonomy-search/trunk/ga-admin-taxonomy-search.php

    r2971746 r3006096  
    22/*
    33Plugin Name:    GA Admin Taxonomy Search
    4 Version:    0.0.2
     4Version:    0.0.3
    55Tags: wordpress admin taxonomy search, category search, taxonomy search, search in category, categories search, category filter, filter categories, categories filter, admin filter, taxonomy filter, term filter, terms filter, admin search terms, admin search taxonomy plugin, taxonomy filter plugin, term filter plugin, category filter plugin
    66Plugin URI: https://grigorasatryan.com/plugins/ga-admin-tax-search
     
    1515*/
    1616
    17 // Our prefix is GATS / gats (just 3-4 chars)
     17// Our prefixes are GATS / gats
    1818
    19 define( 'GATSVersion', '0.0.2' );
     19define( 'GATSVersion', '0.0.3' );
    2020define( 'GATS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    2121define( 'GATS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • ga-admin-taxonomy-search/trunk/lib/class.gats-admin.php

    r2292806 r3006096  
    3232            wp_enqueue_style( 'gats-admin-style', GATS_PLUGIN_URL.'resources/style/admin_style.css', null, GATSVersion, 'all' );
    3333            wp_enqueue_script( 'gats-admin-js', GATS_PLUGIN_URL.'resources/js/admin_js.js' , array('jquery'), GATSVersion, true );
     34
     35            if( self::wp_is_gutenberg_editor() ) {
     36                $editor_type = 'Gutenberg';
     37            } else {
     38                $editor_type = 'Classic';
     39            }
     40
    3441            wp_localize_script( 'gats-admin-js', 'gats_infos',
    3542                array(
    36                     'GATS_NAME' => GATS_NAME
     43                    'GATS_NAME' => GATS_NAME,
     44                    'editor_type' => $editor_type
    3745                )
    3846            );
     47        }
     48
     49        public static function wp_is_gutenberg_editor() {
     50            if( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) {
     51                return true;
     52            }
     53
     54            $current_screen = get_current_screen();
     55            if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
     56                return true;
     57            }
     58            return false;
    3959        }
    4060
  • ga-admin-taxonomy-search/trunk/resources/js/admin_js.js

    r2292806 r3006096  
    99    var gats_checkbox_el = '.categorychecklist li';
    1010
    11     var editor_type = 'Classic';
    12     if( typeof wp !== 'undefined' && typeof wp.blocks !== 'undefined' )
    13         editor_type = 'Gutenberg';
     11    var editor_type = gats_infos.editor_type;
    1412
    1513    if( editor_type == 'Classic' ){
Note: See TracChangeset for help on using the changeset viewer.