| @@ -96,22 +96,34 @@ | ||
| 96 | 96 | * |
| 97 | 97 | * @since 1.0.0 |
| 98 | 98 | */ |
| 99 | 99 | protected function wdkit_use_editor() { |
| 100 | - global $current_screen; | |
| 100 | + global $current_screen; | |
| 101 | 101 | |
| 102 | - $editor = 'wdkit'; | |
| 103 | - if ( isset( $_GET['action'] ) && 'elementor' === $_GET['action'] ) { | |
| 104 | - $editor = 'elementor'; | |
| 105 | - } | |
| 102 | + $editor = 'wdkit'; | |
| 106 | 103 | |
| 107 | - if ( $current_screen->is_block_editor() && isset( $_GET['action'] ) && 'elementor' !== $_GET['action'] ) { | |
| 108 | - $editor = 'gutenberg'; | |
| 109 | - } | |
| 104 | + $action = ! empty( $_GET['action'] ) ? $_GET['action'] : ''; | |
| 110 | 105 | |
| 111 | - return $editor; | |
| 112 | - } | |
| 106 | + if( $current_screen->is_block_editor() ){ | |
| 113 | 107 | |
| 108 | + if ( array_key_exists('action', $_GET) && isset( $action ) ) { | |
| 109 | + if ( 'elementor' === $action ) { | |
| 110 | + $editor = 'elementor'; | |
| 111 | + } else if ( 'edit' === $action ) { | |
| 112 | + $editor = 'gutenberg'; | |
| 113 | + } | |
| 114 | + } else { | |
| 115 | + $editor = 'gutenberg'; | |
| 116 | + } | |
| 117 | + } else { | |
| 118 | + if ( 'elementor' === $action ) { | |
| 119 | + $editor = 'elementor'; | |
| 120 | + } | |
| 121 | + } | |
| 122 | + | |
| 123 | + return $editor; | |
| 124 | + } | |
| 125 | + | |
| 114 | 126 | /** |
| 115 | 127 | * Load Admin Scripts. |
| 116 | 128 | * |
| 117 | 129 | * @since 1.0.0 |