PluginProbe
Customify / 2.10.1
Customify v2.10.1
2.10.9 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.7.1 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.6.0 1.6.0.1 1.6.5 1.7.0 1.7.1 All 77 releases
← All changes | includes/class-customify-block-editor.php +14 -48 2.10.92.10.1 View file →
@@ -25,11 +25,11 @@
25 25
26 26 /*
27 27 * Selectors that we will use to constrain CSS rules to certain scopes.
28 28 */
29 - public static $editor_namespace_selector = '.editor-styles-wrapper';
30 - public static $title_namespace_selector = '.editor-styles-wrapper .editor-post-title';
31 - public static $title_input_namespace_selector = '.editor-styles-wrapper .editor-post-title';
29 + public static $editor_namespace_selector = '.edit-post-visual-editor.editor-styles-wrapper';
30 + public static $title_namespace_selector = '.editor-styles-wrapper .editor-post-title__block';
31 + public static $title_input_namespace_selector = '.editor-styles-wrapper .editor-post-title__block .editor-post-title__input';
32 32 public static function get_block_namespace_selector() {
33 33 global $wp_version;
34 34
35 35 $is_old_wp_version = version_compare($wp_version, '5.4', '<');
@@ -34,18 +34,18 @@
34 34
35 35 $is_old_wp_version = version_compare($wp_version, '5.4', '<');
36 36
37 37 if( $is_old_wp_version ) {
38 - return '.editor-styles-wrapper .editor-block-list__block';
38 + return '.edit-post-visual-editor.editor-styles-wrapper .editor-block-list__block';
39 39 }
40 40
41 - return '.editor-styles-wrapper .block-editor-block-list__block';
41 + return '.edit-post-visual-editor.editor-styles-wrapper .block-editor-block-list__block';
42 42 }
43 43
44 44 /**
45 45 * Regexes
46 46 */
47 - public static $gutenbergy_selector_regex = '/^(\.edit-post-visual-editor|\.editor-visual-editor|\.editor-styles-wrapper|\.editor-block-list__block).*$/';
47 + public static $gutenbergy_selector_regex = '/^(\.edit-post-visual-editor|\.editor-block-list__block).*$/';
48 48 public static $root_regex = '/^(body|html).*$/';
49 49 public static $title_regex = '/^(h1|h1\s+.*|\.single\s*\.entry-title.*|\.entry-title.*|\.page-title.*|\.article__?title.*)$/';
50 50 /* Regexes based on which we will ignore selectors = do not include them in the selector list for a certain rule. */
51 51 public static $excluded_selectors_regex = array(
@@ -129,9 +129,9 @@
129 129 */
130 130 public function add_hooks() {
131 131
132 132 // Styles and scripts when editing.
133 - add_action( 'enqueue_block_assets', array( $this, 'dynamic_styles_scripts' ), 999 );
133 + add_action( 'enqueue_block_editor_assets', array( $this, 'dynamic_styles_scripts' ), 999 );
134 134
135 135 // Styles on the front end.
136 136 add_action( 'enqueue_block_assets', array( $this, 'frontend_styles' ), 999 );
137 137
@@ -231,12 +231,8 @@
231 231 *
232 232 * @since 2.2.0
233 233 */
234 234 public function dynamic_styles_scripts() {
235 - if ( ! $this->is_admin_block_editor_screen() ) {
236 - return;
237 - }
238 -
239 235 if ( ! PixCustomifyPlugin()->settings->get_plugin_setting( 'enable_editor_style', true ) ) {
240 236 return;
241 237 }
242 238
@@ -241,19 +237,15 @@
241 237 }
242 238
243 239 require_once( PixCustomifyPlugin()->get_base_path() . 'includes/class-customify-fonts-global.php' );
244 240
245 - $enqueue_parent_handle = PixCustomifyPlugin()->get_slug() . '-editor-dynamic';
246 - wp_register_style( $enqueue_parent_handle, false, array(), PixCustomifyPlugin()->get_version() );
247 - wp_enqueue_style( $enqueue_parent_handle );
241 + $enqueue_parent_handle = $this->get_editor_style_handle();
242 + if ( empty( $enqueue_parent_handle ) ) {
243 + return;
244 + }
248 245
249 - wp_register_script(
250 - PixCustomifyPlugin()->get_slug() . '-web-font-loader',
251 - plugins_url( 'js/vendor/webfontloader-1-6-28.min.js', PixCustomifyPlugin()->get_file() ),
252 - array( 'wp-block-editor' ),
253 - PixCustomifyPlugin()->get_version(),
254 - false
255 - );
246 + wp_register_script( PixCustomifyPlugin()->get_slug() . '-web-font-loader',
247 + plugins_url( 'js/vendor/webfontloader-1-6-28.min.js', PixCustomifyPlugin()->get_file() ), array('wp-editor'), null );
256 248
257 249 add_filter( 'customify_font_css_selector', array( $this, 'gutenbergify_font_css_selectors' ), 10, 2 );
258 250 Customify_Fonts_Global::instance()->enqueue_frontend_scripts_styles();
259 251 wp_add_inline_style( $enqueue_parent_handle, Customify_Fonts_Global::instance()->getFontsDynamicStyle() );
@@ -266,30 +258,8 @@
266 258 // Add color palettes classes.
267 259 wp_add_inline_style( $enqueue_parent_handle, $this->editor_color_palettes_css_classes() );
268 260 }
269 261
270 - /**
271 - * Determine whether the current request is for an admin block editor canvas.
272 - *
273 - * @return bool
274 - */
275 - protected function is_admin_block_editor_screen() {
276 - if ( ! is_admin() || ! function_exists( 'get_current_screen' ) ) {
277 - return false;
278 - }
279 -
280 - $current_screen = get_current_screen();
281 - if ( ! $current_screen ) {
282 - return false;
283 - }
284 -
285 - if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
286 - return true;
287 - }
288 -
289 - return in_array( $current_screen->id, array( 'site-editor', 'site-editor-v2' ), true );
290 - }
291 -
292 262 public function frontend_styles() {
293 263 $enqueue_parent_handle = $this->get_frontend_style_handle();
294 264 if ( empty( $enqueue_parent_handle ) ) {
295 265 return;
@@ -546,13 +516,9 @@
546 516 return wp_strip_all_tags( $css );
547 517 }
548 518
549 519 public static function to_kebab_case( $string ) {
550 - $parts = preg_split( "/[\n\r\t -_]+/", preg_replace( "/['\x{2019}]/u", '', $string ), - 1, PREG_SPLIT_NO_EMPTY );
551 - if ( ! is_array( $parts ) ) {
552 - return '';
553 - }
554 - return implode( '-', array_map( '\strtolower', $parts ) );
520 + return implode( '-', array_map( '\strtolower', preg_split( "/[\n\r\t -_]+/", preg_replace( "/['\x{2019}]/u", '', $string ), - 1, PREG_SPLIT_NO_EMPTY ) ) );
555 521 }
556 522
557 523 /**
558 524 * Main Customify_Block_Editor Instance