Ticket #45145: 45145.6.diff
File 45145.6.diff, 12.8 KB (added by , 6 years ago) |
---|
-
package.json
39 39 "grunt-replace": "~1.0.1", 40 40 "grunt-rtlcss": "~2.0.1", 41 41 "grunt-sass": "~2.0.0", 42 42 "grunt-webpack": "^3.0.2", 43 43 "ink-docstrap": "^1.3.0", 44 44 "matchdep": "~2.0.0", 45 45 "source-map-loader": "^0.2.4", 46 46 "uglify-js": "^3.4.9", 47 47 "webpack": "^4.24.0", 48 48 "webpack-dev-server": "^3.1.9", 49 49 "webpack-livereload-plugin": "^2.1.1" 50 50 }, 51 51 "dependencies": { 52 52 "@babel/polyfill": "^7.0.0", 53 53 "@wordpress/a11y": "^2.0.2", 54 "@wordpress/annotations": "^1.0. 1",55 "@wordpress/api-fetch": "^2.2. 4",54 "@wordpress/annotations": "^1.0.2", 55 "@wordpress/api-fetch": "^2.2.5", 56 56 "@wordpress/autop": "^2.0.2", 57 57 "@wordpress/blob": "^2.1.0", 58 "@wordpress/block-library": "^2.2. 4",58 "@wordpress/block-library": "^2.2.5", 59 59 "@wordpress/block-serialization-default-parser": "^2.0.0", 60 "@wordpress/blocks": "^6.0. 0",61 "@wordpress/components": "^ 6.0.2",60 "@wordpress/blocks": "^6.0.1", 61 "@wordpress/components": "^7.0.0", 62 62 "@wordpress/compose": "^3.0.0", 63 "@wordpress/core-data": "^2.0.1 3",64 "@wordpress/data": "^4.0. 0",63 "@wordpress/core-data": "^2.0.14", 64 "@wordpress/data": "^4.0.1", 65 65 "@wordpress/date": "^3.0.0", 66 66 "@wordpress/deprecated": "^2.0.3", 67 "@wordpress/dom": "^2.0. 6",67 "@wordpress/dom": "^2.0.7", 68 68 "@wordpress/dom-ready": "^2.0.2", 69 "@wordpress/edit-post": "^3. 0.2",70 "@wordpress/editor": "^ 8.0.0",69 "@wordpress/edit-post": "^3.1.0", 70 "@wordpress/editor": "^9.0.0", 71 71 "@wordpress/element": "^2.1.8", 72 72 "@wordpress/escape-html": "^1.0.1", 73 "@wordpress/format-library": "^1.2. 2",73 "@wordpress/format-library": "^1.2.3", 74 74 "@wordpress/hooks": "^2.0.3", 75 75 "@wordpress/html-entities": "^2.0.2", 76 76 "@wordpress/i18n": "^3.1.0", 77 77 "@wordpress/is-shallow-equal": "^1.1.4", 78 "@wordpress/keycodes": "^2.0. 3",79 "@wordpress/list-reusable-blocks": "^1.1.1 2",80 "@wordpress/notices": "^1. 0.5",81 "@wordpress/nux": "^3.0. 0",78 "@wordpress/keycodes": "^2.0.4", 79 "@wordpress/list-reusable-blocks": "^1.1.13", 80 "@wordpress/notices": "^1.1.0", 81 "@wordpress/nux": "^3.0.1", 82 82 "@wordpress/plugins": "^2.0.9", 83 83 "@wordpress/redux-routine": "^3.0.3", 84 "@wordpress/rich-text": "^3.0. 0",84 "@wordpress/rich-text": "^3.0.1", 85 85 "@wordpress/shortcode": "^2.0.2", 86 "@wordpress/token-list": "^1. 0.2",87 "@wordpress/url": "^2.3. 0",88 "@wordpress/viewport": "^2.0.1 1",86 "@wordpress/token-list": "^1.1.0", 87 "@wordpress/url": "^2.3.1", 88 "@wordpress/viewport": "^2.0.12", 89 89 "@wordpress/wordcount": "^2.0.3", 90 90 "element-closest": "^2.0.2", 91 91 "formdata-polyfill": "^3.0.12", 92 92 "lodash": "^4.17.11", 93 93 "moment": "^2.22.2", 94 94 "polyfill-library": "^3.26.0-0", 95 95 "react": "^16.6.3", 96 96 "react-dom": "^16.6.3", 97 97 "whatwg-fetch": "^3.0.0" 98 98 }, 99 99 "scripts": { 100 100 "grunt": "grunt" 101 101 } 102 102 } -
src/wp-admin/edit-form-blocks.php
165 165 166 166 // Media settings. 167 167 $max_upload_size = wp_max_upload_size(); 168 168 if ( ! $max_upload_size ) { 169 169 $max_upload_size = 0; 170 170 } 171 171 172 172 // Editor Styles. 173 173 $styles = array( 174 174 array( 175 175 'css' => file_get_contents( 176 176 ABSPATH . WPINC . '/css/dist/editor/editor-styles.css' 177 177 ), 178 178 ), 179 179 ); 180 181 /* 182 * Set a locale specific default font. 183 * Translators: Use this to specify the CSS font family for the default font 184 */ 185 $locale_font_family = esc_html_x( 'Noto Serif', 'CSS Font Family for Editor Font' ); 186 $styles[] = array( 187 'css' => "body { font-family: '$locale_font_family' }", 188 ); 189 180 190 if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) { 181 191 foreach ( $editor_styles as $style ) { 182 192 if ( preg_match( '~^(https?:)?//~', $style ) ) { 183 193 $response = wp_remote_get( $style ); 184 194 if ( ! is_wp_error( $response ) ) { 185 195 $styles[] = array( 186 196 'css' => wp_remote_retrieve_body( $response ), 187 197 ); 188 198 } 189 199 } else { 190 200 $file = get_theme_file_path( $style ); 191 201 $styles[] = array( 192 202 'css' => file_get_contents( get_theme_file_path( $style ) ), 193 203 'baseURL' => get_theme_file_uri( $style ), 194 204 ); -
src/wp-includes/script-loader.php
68 68 * `js/dist/vendor/` location. 69 69 * 70 70 * For the order of `$scripts->add` see `wp_default_scripts`. 71 71 * 72 72 * @since 5.0.0 73 73 * 74 74 * @param WP_Scripts $scripts WP_Scripts object. 75 75 */ 76 76 function wp_default_packages_vendor( &$scripts ) { 77 77 $dev_suffix = wp_scripts_get_suffix( 'dev' ); 78 78 79 79 $vendor_scripts = array( 80 80 'react' => array( 'wp-polyfill' ), 81 81 'react-dom' => array( 'react' ), 82 82 'moment', 83 'tinymce-latest-lists' => array( 'wp-tinymce' ), // should be added as tinymce plugin? 83 84 'lodash', 84 85 'wp-polyfill-fetch', 85 86 'wp-polyfill-formdata', 86 87 'wp-polyfill-node-contains', 87 88 'wp-polyfill-element-closest', 88 89 'wp-polyfill', 89 90 ); 90 91 91 92 foreach ( $vendor_scripts as $handle => $dependencies ) { 92 93 if ( is_string( $dependencies ) ) { 93 94 $handle = $dependencies; 94 95 $dependencies = array(); 95 96 } 96 97 97 98 $path = "/wp-includes/js/dist/vendor/$handle$dev_suffix.js"; 98 99 99 100 $scripts->add( $handle, $path, $dependencies, false, 1 ); 100 101 } 101 102 102 103 $scripts->add( 'wp-polyfill', null, array( 'wp-polyfill' ) ); 103 did_action( 'init' ) && $scripts->add_ data(104 did_action( 'init' ) && $scripts->add_inline_script( 104 105 'wp-polyfill', 105 'data',106 106 wp_get_script_polyfill( 107 107 $scripts, 108 108 array( 109 109 '\'fetch\' in window' => 'wp-polyfill-fetch', 110 110 'document.contains' => 'wp-polyfill-node-contains', 111 111 'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata', 112 112 'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest', 113 ) 113 ), 114 'after' 114 115 ) 115 116 ); 116 117 117 118 did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' ); 119 120 did_action( 'init' ) && $scripts->add_inline_script( 121 'moment', 122 sprintf( 123 "moment.locale( '%s', %s );", 124 get_user_locale(), 125 wp_json_encode( 126 array( 127 'months' => array_values( $wp_locale->month ), 128 'monthsShort' => array_values( $wp_locale->month_abbrev ), 129 'weekdays' => array_values( $wp_locale->weekday ), 130 'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ), 131 'week' => array( 132 'dow' => (int) get_option( 'start_of_week', 0 ), 133 ), 134 'longDateFormat' => array( 135 'LT' => get_option( 'time_format', __( 'g:i a', 'default' ) ), 136 'LTS' => null, 137 'L' => null, 138 'LL' => get_option( 'date_format', __( 'F j, Y', 'default' ) ), 139 'LLL' => __( 'F j, Y g:i a', 'default' ), 140 'LLLL' => null, 141 ), 142 ) 143 ) 144 ), 145 'after' 146 ); 118 147 } 119 148 120 149 /** 121 150 * Returns contents of an inline script used in appending polyfill scripts for 122 151 * browsers which fail the provided tests. The provided array is a mapping from 123 152 * a condition to verify feature support to its polyfill script handle. 124 153 * 125 154 * @since 5.0.0 126 155 * 127 156 * @param WP_Scripts $scripts WP_Scripts object. 128 157 * @param array $tests Features to detect. 129 158 * @return string Conditional polyfill inline script. 130 159 */ 131 160 function wp_get_script_polyfill( &$scripts, $tests ) { 132 161 $polyfill = ''; … … 209 238 'wp-i18n', 210 239 'wp-keycodes', 211 240 'wp-polyfill', 212 241 'wp-url', 213 242 'wp-viewport', 214 243 'wp-rich-text', 215 244 ), 216 245 'block-serialization-default-parser' => array(), 217 246 'block-serialization-spec-parser' => array( 'wp-polyfill' ), 218 247 'components' => array( 219 248 'lodash', 220 249 'moment', 221 250 'wp-a11y', 222 251 'wp-api-fetch', 223 252 'wp-compose', 224 'wp-deprecated',225 253 'wp-dom', 226 254 'wp-element', 227 255 'wp-hooks', 228 256 'wp-html-entities', 229 257 'wp-i18n', 230 258 'wp-is-shallow-equal', 231 259 'wp-keycodes', 232 260 'wp-polyfill', 233 261 'wp-rich-text', 234 262 'wp-url', 235 263 ), 236 264 'compose' => array( 237 265 'lodash', 238 266 'wp-element', 239 267 'wp-is-shallow-equal', … … 260 288 'media-views', 261 289 'wp-a11y', 262 290 'wp-api-fetch', 263 291 'wp-block-library', 264 292 'wp-blocks', 265 293 'wp-components', 266 294 'wp-compose', 267 295 'wp-core-data', 268 296 'wp-data', 269 297 'wp-dom-ready', 270 298 'wp-editor', 271 299 'wp-element', 272 300 'wp-embed', 273 301 'wp-i18n', 274 302 'wp-keycodes', 303 'wp-notices', 275 304 'wp-nux', 276 305 'wp-plugins', 277 306 'wp-polyfill', 278 307 'wp-url', 279 308 'wp-viewport', 280 309 ), 281 310 'editor' => array( 282 311 'jquery', 283 312 'lodash', 284 ' wp-tinymce-lists',313 'tinymce-latest-lists', 285 314 'wp-a11y', 286 315 'wp-api-fetch', 287 316 'wp-blob', 288 317 'wp-blocks', 289 318 'wp-components', 290 319 'wp-compose', 291 320 'wp-core-data', 292 321 'wp-data', 293 322 'wp-date', 294 323 'wp-deprecated', 295 324 'wp-dom', 296 325 'wp-element', 297 326 'wp-hooks', 298 327 'wp-html-entities', 299 328 'wp-i18n', … … 332 361 'wp-api-fetch', 333 362 'wp-components', 334 363 'wp-compose', 335 364 'wp-element', 336 365 'wp-i18n', 337 366 'wp-polyfill', 338 367 ), 339 368 'notices' => array( 340 369 'lodash', 341 370 'wp-a11y', 342 371 'wp-data', 343 372 'wp-polyfill', 344 373 ), 345 374 'nux' => array( 346 375 'wp-element', 376 'lodash', 347 377 'wp-components', 348 378 'wp-compose', 349 379 'wp-data', 350 380 'wp-i18n', 351 381 'wp-polyfill', 352 382 'lodash', 353 383 ), 354 384 'plugins' => array( 'lodash', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill' ), 355 385 'redux-routine' => array( 'wp-polyfill' ), 356 386 'rich-text' => array( 357 387 'lodash', 358 'wp-blocks',359 388 'wp-data', 360 389 'wp-escape-html', 361 390 'wp-polyfill', 362 391 ), 363 392 'shortcode' => array( 'wp-polyfill', 'lodash' ), 364 393 'token-list' => array( 'lodash', 'wp-polyfill' ), 365 394 'url' => array( 'wp-polyfill' ), 366 395 'viewport' => array( 'wp-polyfill', 'wp-element', 'wp-data', 'wp-compose', 'lodash' ), 367 396 'wordcount' => array( 'wp-polyfill' ), 368 397 ); 369 398 370 399 $package_translations = array( 371 400 'api-fetch' => 'default', 372 401 'blocks' => 'default', 373 402 'block-library' => 'default', … … 521 550 $toolbar1 = array( 522 551 'formatselect', 523 552 'bold', 524 553 'italic', 525 554 'bullist', 526 555 'numlist', 527 556 'blockquote', 528 557 'alignleft', 529 558 'aligncenter', 530 559 'alignright', 531 560 'link', 532 561 'unlink', 533 562 'wp_more', 534 563 'spellchecker', 535 564 'wp_add_media', 536 'wp_adv', 565 'wp_adv', // FIXME found as 'kitchensink' in Gutenberg 537 566 ); 538 567 539 568 /* This filter is documented in wp-includes/class-wp-editor.php */ 540 569 $toolbar1 = apply_filters( 'mce_buttons', $toolbar1, 'classic-block' ); 541 570 542 571 $toolbar2 = array( 543 572 'strikethrough', 544 573 'hr', 545 574 'forecolor', 546 575 'pastetext', 547 576 'removeformat', 548 577 'charmap', 549 578 'outdent', 550 579 'indent', 551 580 'undo', … … 1655 1684 // deprecated 1656 1685 'deprecated-media', 'farbtastic', 1657 1686 ); 1658 1687 1659 1688 foreach ( $rtl_styles as $rtl_style ) { 1660 1689 $styles->add_data( $rtl_style, 'rtl', 'replace' ); 1661 1690 if ( $suffix ) { 1662 1691 $styles->add_data( $rtl_style, 'suffix', $suffix ); 1663 1692 } 1664 1693 } 1665 1694 1666 1695 // Packages styles 1667 1696 $fonts_url = ''; 1668 1697 1669 1698 /* 1670 * Translators: If there are characters in your language that are not supported 1671 * by Noto Serif, translate this to 'off'. Do not translate into your own language. 1699 * Translators: Use this to specify the proper Google Font name and variants 1700 * to load that is supported by your language. Do not translate. 1701 * Set to 'off' to disable loading. 1672 1702 */ 1673 if ( 'off' !== _x( 'on', 'Noto Serif font: on or off' ) ) { 1674 $fonts_url = 'https://fonts.googleapis.com/css?family=Noto+Serif%3A400%2C400i%2C700%2C700i'; 1703 $font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' ); 1704 if ( 'off' !== $font_family ) { 1705 $query_args = array( 1706 'family' => urlencode( $font_family ), 1707 ); 1708 $fonts_url = esc_url_raw( add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ) ); 1675 1709 } 1676 1710 $styles->add( 'wp-editor-font', $fonts_url ); 1677 1711 1678 1712 $styles->add( 'wp-block-library-theme', "/wp-includes/css/dist/block-library/theme$suffix.css" ); 1679 1713 $styles->add_data( 'wp-block-library-theme', 'rtl', 'replace' ); 1680 1714 1681 1715 $styles->add( 1682 1716 'wp-edit-blocks', 1683 1717 "/wp-includes/css/dist/block-library/editor$suffix.css", 1684 1718 array( 1685 1719 'wp-components', 1686 1720 'wp-editor', 1687 1721 // Always include visual styles so the editor never appears broken. 1688 1722 'wp-block-library-theme', 1689 1723 ) -
tools/webpack/packages.js
213 213 module: { 214 214 rules: [ 215 215 { 216 216 test: /\.js$/, 217 217 use: [ 'source-map-loader' ], 218 218 enforce: 'pre', 219 219 }, 220 220 ], 221 221 }, 222 222 plugins: [ 223 223 new LibraryExportDefaultPlugin( [ 224 224 'api-fetch', 225 225 'deprecated', 226 226 'dom-ready', 227 227 'redux-routine', 228 'token-list', 228 229 ].map( camelCaseDash ) ), 229 230 new CustomTemplatedPathPlugin( { 230 231 basename( path, data ) { 231 232 let rawRequest; 232 233 233 234 const entryModule = get( data, [ 'chunk', 'entryModule' ], {} ); 234 235 switch ( entryModule.type ) { 235 236 case 'javascript/auto': 236 237 rawRequest = entryModule.rawRequest; 237 238 break; 238 239 239 240 case 'javascript/esm': 240 241 rawRequest = entryModule.rootModule.rawRequest; 241 242 break; 242 243 }