| @@ -12,8 +12,16 @@ | ||
| 12 | 12 | 'register_attribute' => array( 'WP_Duotone_Gutenberg', 'register_duotone_support' ), |
| 13 | 13 | ) |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | +// Set up metadata prior to rendering any blocks. | |
| 17 | +if ( class_exists( 'WP_Duotone' ) ) { | |
| 18 | + remove_action( 'wp_loaded', array( 'WP_Duotone', 'set_global_styles_presets' ) ); | |
| 19 | + remove_action( 'wp_loaded', array( 'WP_Duotone', 'set_global_style_block_names' ) ); | |
| 20 | +} | |
| 21 | +add_action( 'wp_loaded', array( 'WP_Duotone_Gutenberg', 'set_global_styles_presets' ), 10 ); | |
| 22 | +add_action( 'wp_loaded', array( 'WP_Duotone_Gutenberg', 'set_global_style_block_names' ), 10 ); | |
| 23 | + | |
| 16 | 24 | // Add classnames to blocks using duotone support. |
| 17 | 25 | if ( function_exists( 'wp_render_duotone_support' ) ) { |
| 18 | 26 | // Deprecated render function. |
| 19 | 27 | remove_filter( 'render_block', 'wp_render_duotone_support' ); |
| @@ -19,12 +27,10 @@ | ||
| 19 | 27 | remove_filter( 'render_block', 'wp_render_duotone_support' ); |
| 20 | 28 | } |
| 21 | 29 | if ( class_exists( 'WP_Duotone' ) ) { |
| 22 | 30 | remove_filter( 'render_block', array( 'WP_Duotone', 'render_duotone_support' ) ); |
| 23 | - remove_filter( 'render_block_core/image', array( 'WP_Duotone', 'restore_image_outer_container' ) ); | |
| 24 | 31 | } |
| 25 | -add_filter( 'render_block', array( 'WP_Duotone_Gutenberg', 'render_duotone_support' ), 10, 3 ); | |
| 26 | -add_filter( 'render_block_core/image', array( 'WP_Duotone_Gutenberg', 'restore_image_outer_container' ), 10, 1 ); | |
| 32 | +add_filter( 'render_block', array( 'WP_Duotone_Gutenberg', 'render_duotone_support' ), 10, 2 ); | |
| 27 | 33 | |
| 28 | 34 | // Enqueue styles. |
| 29 | 35 | // Block styles (core-block-supports-inline-css) before the style engine (gutenberg_enqueue_stored_styles). |
| 30 | 36 | // Global styles (global-styles-inline-css) after the other global styles (gutenberg_enqueue_global_styles). |
| @@ -60,9 +66,9 @@ | ||
| 60 | 66 | /** |
| 61 | 67 | * Direct port of tinycolor's bound01 function, lightly simplified to maintain |
| 62 | 68 | * consistency with tinycolor. |
| 63 | 69 | * |
| 64 | - * @link https://github.com/bgrins/TinyColor | |
| 70 | + * @see https://github.com/bgrins/TinyColor | |
| 65 | 71 | * |
| 66 | 72 | * @deprecated 6.3.0 |
| 67 | 73 | * |
| 68 | 74 | * @param mixed $n Number of unknown type. |
| @@ -95,9 +101,9 @@ | ||
| 95 | 101 | /** |
| 96 | 102 | * Direct port of tinycolor's boundAlpha function to maintain consistency with |
| 97 | 103 | * how tinycolor works. |
| 98 | 104 | * |
| 99 | - * @link https://github.com/bgrins/TinyColor | |
| 105 | + * @see https://github.com/bgrins/TinyColor | |
| 100 | 106 | * |
| 101 | 107 | * @deprecated 6.3.0 |
| 102 | 108 | * |
| 103 | 109 | * @param mixed $n Number of unknown type. |
| @@ -117,9 +123,9 @@ | ||
| 117 | 123 | |
| 118 | 124 | /** |
| 119 | 125 | * Round and convert values of an RGB object. |
| 120 | 126 | * |
| 121 | - * @link https://github.com/bgrins/TinyColor | |
| 127 | + * @see https://github.com/bgrins/TinyColor | |
| 122 | 128 | * |
| 123 | 129 | * @deprecated 6.3.0 |
| 124 | 130 | * |
| 125 | 131 | * @param array $rgb_color RGB object. |
| @@ -137,9 +143,9 @@ | ||
| 137 | 143 | |
| 138 | 144 | /** |
| 139 | 145 | * Helper function for hsl to rgb conversion. |
| 140 | 146 | * |
| 141 | - * @link https://github.com/bgrins/TinyColor | |
| 147 | + * @see https://github.com/bgrins/TinyColor | |
| 142 | 148 | * |
| 143 | 149 | * @deprecated 6.3.0 |
| 144 | 150 | * |
| 145 | 151 | * @param float $p first component. |
| @@ -170,9 +176,9 @@ | ||
| 170 | 176 | |
| 171 | 177 | /** |
| 172 | 178 | * Convert an HSL object to an RGB object with converted and rounded values. |
| 173 | 179 | * |
| 174 | - * @link https://github.com/bgrins/TinyColor | |
| 180 | + * @see https://github.com/bgrins/TinyColor | |
| 175 | 181 | * |
| 176 | 182 | * @deprecated 6.3.0 |
| 177 | 183 | * |
| 178 | 184 | * @param array $hsl_color HSL object. |
| @@ -208,10 +214,10 @@ | ||
| 208 | 214 | /** |
| 209 | 215 | * Parses hex, hsl, and rgb CSS strings using the same regex as tinycolor v1.4.2 |
| 210 | 216 | * used in the JavaScript. Only colors output from react-color are implemented. |
| 211 | 217 | * |
| 212 | - * @link https://github.com/bgrins/TinyColor | |
| 213 | - * @link https://github.com/casesandberg/react-color/ | |
| 218 | + * @see https://github.com/bgrins/TinyColor | |
| 219 | + * @see https://github.com/casesandberg/react-color/ | |
| 214 | 220 | * |
| 215 | 221 | * @deprecated 6.3.0 |
| 216 | 222 | * |
| 217 | 223 | * @param string $color_str CSS color string. |