Ticket #45426: 45426.5.patch
File 45426.5.patch, 12.9 KB (added by , 6 years ago) |
---|
-
src/wp-content/themes/twentyseventeen/assets/css/blocks.css
6 6 /*-------------------------------------------------------------- 7 7 >>> TABLE OF CONTENTS: 8 8 ---------------------------------------------------------------- 9 1.0 Blocks - Common Blocks 10 2.0 Blocks - Formatting 11 3.0 Blocks - Layout Elements 12 4.0 Blocks - Widgets 9 1.0 General Block Styles 10 2.0 Blocks - Common Blocks 11 3.0 Blocks - Formatting 12 4.0 Blocks - Layout Elements 13 5.0 Blocks - Widgets 14 6.0 Blocks - Colors 13 15 --------------------------------------------------------------*/ 14 16 15 17 /*-------------------------------------------------------------- … … 187 189 /* Buttons */ 188 190 189 191 .wp-block-button .wp-block-button__link { 190 background-color: #222;191 192 -webkit-box-shadow: none; 192 193 box-shadow: none; 193 color: #fff;194 194 display: inline-block; 195 195 font-size: 14px; 196 196 font-size: 0.875rem; … … 203 203 white-space: nowrap; 204 204 } 205 205 206 .wp-block-button .wp-block-button__link:hover, 207 .wp-block-button .wp-block-button__link:focus { 206 .entry-content .wp-block-button__link { 207 background-color: #222; 208 color: #fff; 209 } 210 211 .entry-content .is-style-outline .wp-block-button__link:not(.has-background) { 212 background-color: transparent; 213 } 214 215 .entry-content .is-style-outline .wp-block-button__link:not(.has-text-color) { 216 color: #222; 217 } 218 219 .colors-dark .wp-block-button__link { 220 background-color: #fff; 221 color: #000; 222 } 223 224 .entry-content .wp-block-button__link:hover, 225 .entry-content .wp-block-button__link:focus, 226 .entry-content .is-style-outline .wp-block-button__link:not(.has-background):hover, 227 .entry-content .is-style-outline .wp-block-button__link:not(.has-background):focus { 208 228 background-color: #767676; 209 229 -webkit-box-shadow: none; 210 230 box-shadow: none; 231 color: #fff; 211 232 } 212 233 234 .colors-dark .entry-content .wp-block-button__link:hover, 235 .colors-dark .entry-content .wp-block-button__link:focus, 236 .colors-dark .entry-content .is-style-outline .wp-block-button__link:not(.has-background):hover, 237 .colors-dark .entry-content .is-style-outline .wp-block-button__link:not(.has-background):focus { 238 background-color: #bbb; 239 color: #000; 240 } 241 242 .colors-dark .entry-content .is-style-outline .wp-block-button__link:not(.has-text-color) { 243 color: #fff; 244 } 245 246 .colors-dark .entry-content .is-style-outline .wp-block-button__link:not(.has-text-color):hover, 247 .colors-dark .entry-content .is-style-outline .wp-block-button__link:not(.has-text-color):focus { 248 color: #222; 249 } 250 251 .colors-custom .entry-content .wp-block-button__link, 252 .colors-custom .entry-content .wp-block-button__link:hover, 253 .colors-custom .entry-content .wp-block-button__link:focus, 254 .colors-dark .entry-content .wp-block-button__link, 255 .colors-dark .entry-content .wp-block-button__link:hover, 256 .colors-dark .entry-content .wp-block-button__link:focus { 257 -webkit-box-shadow: none; 258 box-shadow: none; 259 } 260 261 .colors-custom .entry-content .wp-block-button__link:hover, 262 .colors-custom .entry-content .wp-block-button__link:focus { 263 color: #fff; 264 } 265 213 266 /* Separator */ 214 267 215 268 .wp-block-separator { … … 293 346 font-size: 14px; 294 347 font-size: 0.875rem; 295 348 } 349 350 /*-------------------------------------------------------------- 351 6.0 Blocks - Colors 352 --------------------------------------------------------------*/ 353 354 .entry-content .has-pale-pink-color { 355 color: #f78da7; 356 } 357 358 .entry-content .has-pale-pink-background-color, 359 .wp-block-button.is-style-outline .has-pale-pink-background-color:link { 360 background-color: #f78da7; 361 } 362 363 .entry-content .has-vivid-red-color { 364 color: #cf2e2e; 365 } 366 367 .entry-content .has-vivid-red-background-color, 368 .wp-block-button.is-style-outline .has-vivid-red-background-color:link { 369 background-color: #cf2e2e; 370 } 371 372 .entry-content .has-luminous-vivid-orange-color { 373 color: #ff6900; 374 } 375 376 .entry-content .has-luminous-vivid-orange-background-color, 377 .wp-block-button.is-style-outline .has-luminous-vivid-orange-background-color:link { 378 background-color: #ff6900; 379 } 380 381 .entry-content .has-luminous-vivid-amber-color { 382 color: #fcb900; 383 } 384 385 .entry-content .has-luminous-vivid-amber-background-color, 386 .wp-block-button.is-style-outline .has-luminous-vivid-amber-background-color:link { 387 background-color: #fcb900; 388 } 389 390 .entry-content .has-light-green-cyan-color { 391 color: #7bdcb5; 392 } 393 394 .entry-content .has-light-green-cyan-background-color, 395 .wp-block-button.is-style-outline .has-light-green-cyan-background-color:link { 396 background-color: #7bdcb5; 397 } 398 399 .entry-content .has-vivid-green-cyan-color { 400 color: #00d084; 401 } 402 403 .entry-content .has-vivid-green-cyan-background-color, 404 .wp-block-button.is-style-outline .has-vivid-green-cyan-background-color:link { 405 background-color: #00d084; 406 } 407 408 .entry-content .has-pale-cyan-blue-color { 409 color: #8ed1fc; 410 } 411 412 .entry-content .has-pale-cyan-blue-background-color, 413 .wp-block-button.is-style-outline .has-pale-cyan-blue-background-color:link { 414 background-color: #8ed1fc; 415 } 416 417 .entry-content .has-vivid-cyan-blue-color { 418 color: #0693e3; 419 } 420 421 .entry-content .has-vivid-cyan-blue-background-color, 422 .wp-block-button.is-style-outline .has-vivid-cyan-blue-background-color:link { 423 background-color: #0693e3; 424 } 425 426 .entry-content .has-very-light-gray-color { 427 color: #eee; 428 } 429 430 .entry-content .has-very-light-gray-background-color, 431 .wp-block-button.is-style-outline .has-very-light-gray-background-color:link { 432 background-color: #eee; 433 } 434 435 .entry-content .has-cyan-bluish-gray-color { 436 color: #abb8c3; 437 } 438 439 .entry-content .has-cyan-bluish-gray-background-color, 440 .wp-block-button.is-style-outline .has-cyan-bluish-gray-background-color:link { 441 background-color: #abb8c3; 442 } 443 444 .entry-content .has-very-dark-gray-color { 445 color: #313131; 446 } 447 448 .entry-content .has-very-dark-gray-background-color, 449 .wp-block-button.is-style-outline .has-very-dark-gray-background-color:link { 450 background-color: #313131; 451 } -
src/wp-content/themes/twentyseventeen/assets/css/editor-blocks.css
492 492 margin-top: 0.075em; 493 493 } 494 494 495 .wp-block-paragraph.has-background { 496 padding: 20px 30px; 497 } 498 495 499 /* Gallery */ 496 500 497 501 .wp-block-gallery figcaption { … … 707 711 /* Buttons */ 708 712 709 713 .wp-block-button .wp-block-button__link { 710 background-color: #222;711 714 -webkit-box-shadow: none; 712 715 box-shadow: none; 713 color: #fff;714 716 display: inline-block; 715 717 font-size: 14px; 716 718 font-size: 0.875rem; … … 723 725 white-space: nowrap; 724 726 } 725 727 728 .wp-block-button__link { 729 background-color: #222; 730 color: #fff; 731 } 732 733 .is-style-outline .wp-block-button__link { 734 color: #222; 735 } 736 726 737 /* Media & Text */ 727 738 728 739 .wp-block-media-text *:last-child { -
src/wp-includes/class-wp-block-parser.php
63 63 public $innerContent; 64 64 65 65 function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) { 66 $this->blockName 67 $this->attrs 68 $this->innerBlocks 69 $this->innerHTML 66 $this->blockName = $name; 67 $this->attrs = $attrs; 68 $this->innerBlocks = $innerBlocks; 69 $this->innerHTML = $innerHTML; 70 70 $this->innerContent = $innerContent; 71 71 } 72 72 } … … 269 269 */ 270 270 if ( 0 === $stack_depth ) { 271 271 if ( isset( $leading_html_start ) ) { 272 $this->output[] = (array) self::freeform( 273 substr( 274 $this->document, 275 $leading_html_start, 276 $start_offset - $leading_html_start 277 ) 278 ); 272 $this->output[] = (array) self::freeform( substr( 273 $this->document, 274 $leading_html_start, 275 $start_offset - $leading_html_start 276 ) ); 279 277 } 280 278 281 279 $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ); 282 $this->offset 280 $this->offset = $start_offset + $token_length; 283 281 return true; 284 282 } 285 283 … … 294 292 295 293 case 'block-opener': 296 294 // track all newly-opened blocks on the stack 297 array_push( 298 $this->stack, 299 new WP_Block_Parser_Frame( 300 new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), 301 $start_offset, 302 $token_length, 303 $start_offset + $token_length, 304 $leading_html_start 305 ) 306 ); 295 array_push( $this->stack, new WP_Block_Parser_Frame( 296 new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), 297 $start_offset, 298 $token_length, 299 $start_offset + $token_length, 300 $leading_html_start 301 ) ); 307 302 $this->offset = $start_offset + $token_length; 308 303 return true; 309 304 … … 334 329 * otherwise we're nested and we have to close out the current 335 330 * block and add it as a new innerBlock to the parent 336 331 */ 337 $stack_top 338 $html 339 $stack_top->block->innerHTML 332 $stack_top = array_pop( $this->stack ); 333 $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset ); 334 $stack_top->block->innerHTML .= $html; 340 335 $stack_top->block->innerContent[] = $html; 341 $stack_top->prev_offset 336 $stack_top->prev_offset = $start_offset + $token_length; 342 337 343 338 $this->add_inner_block( 344 339 $stack_top->block, … … 396 391 return array( 'no-more-tokens', null, null, null, null ); 397 392 } 398 393 399 list( $match, $started_at ) = $matches[ 0];394 list( $match, $started_at ) = $matches[ 0 ]; 400 395 401 396 $length = strlen( $match ); 402 $is_closer = isset( $matches[ 'closer'] ) && -1 !== $matches['closer'][1];403 $is_void = isset( $matches[ 'void'] ) && -1 !== $matches['void'][1];404 $namespace = $matches[ 'namespace'];405 $namespace = ( isset( $namespace ) && -1 !== $namespace[ 1] ) ? $namespace[0] : 'core/';406 $name = $namespace . $matches[ 'name'][0];407 $has_attrs = isset( $matches[ 'attrs'] ) && -1 !== $matches['attrs'][1];397 $is_closer = isset( $matches[ 'closer' ] ) && -1 !== $matches[ 'closer' ][ 1 ]; 398 $is_void = isset( $matches[ 'void' ] ) && -1 !== $matches[ 'void' ][ 1 ]; 399 $namespace = $matches[ 'namespace' ]; 400 $namespace = ( isset( $namespace ) && -1 !== $namespace[ 1 ] ) ? $namespace[ 0 ] : 'core/'; 401 $name = $namespace . $matches[ 'name' ][ 0 ]; 402 $has_attrs = isset( $matches[ 'attrs' ] ) && -1 !== $matches[ 'attrs' ][ 1 ]; 408 403 409 404 /* 410 405 * Fun fact! It's not trivial in PHP to create "an empty associative array" since all arrays … … 411 406 * are associative arrays. If we use `array()` we get a JSON `[]` 412 407 */ 413 408 $attrs = $has_attrs 414 ? json_decode( $matches[ 'attrs'][0], /* as-associative */ true )409 ? json_decode( $matches[ 'attrs' ][ 0 ], /* as-associative */ true ) 415 410 : $this->empty_attrs; 416 411 417 412 /* … … 476 471 * @param int|null $last_offset last byte offset into document if continuing form earlier output 477 472 */ 478 473 function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) { 479 $parent 474 $parent = $this->stack[ count( $this->stack ) - 1 ]; 480 475 $parent->block->innerBlocks[] = (array) $block; 481 $html 476 $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset ); 482 477 483 478 if ( ! empty( $html ) ) { 484 $parent->block->innerHTML 479 $parent->block->innerHTML .= $html; 485 480 $parent->block->innerContent[] = $html; 486 481 } 487 482 488 483 $parent->block->innerContent[] = null; 489 $parent->prev_offset 484 $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length; 490 485 } 491 486 492 487 /** … … 505 500 : substr( $this->document, $prev_offset ); 506 501 507 502 if ( ! empty( $html ) ) { 508 $stack_top->block->innerHTML 503 $stack_top->block->innerHTML .= $html; 509 504 $stack_top->block->innerContent[] = $html; 510 505 } 511 506 512 507 if ( isset( $stack_top->leading_html_start ) ) { 513 $this->output[] = (array) self::freeform( 514 substr( 515 $this->document, 516 $stack_top->leading_html_start, 517 $stack_top->token_start - $stack_top->leading_html_start 518 ) 519 ); 508 $this->output[] = (array) self::freeform( substr( 509 $this->document, 510 $stack_top->leading_html_start, 511 $stack_top->token_start - $stack_top->leading_html_start 512 ) ); 520 513 } 521 514 522 515 $this->output[] = (array) $stack_top->block;