Make WordPress Core

Changeset 64588


Ignore:
Timestamp:
10/20/2026 05:02:48 AM (8 hours ago)
Author:
adamsilverstein
Message:

Media: Enable client-side uploads in the Media Library and modal.

Enable client-side media processing for Uploads from the Media Library grid, the Add New Media File screen and the media modal in the block editor (in supported browsers).

These screens now use the same pipeline as block editor uploads: the original is uploaded through the REST API, sub-sizes are generated in the browser and sideloaded, then the attachment is finalized. wp_set_up_cross_origin_isolation() now also isolates the Media Library grid and the Add New Media File screen using Document Isolation Policy. Uploads huse the client-side processing still use the existing progress, tile and error UI.

When client-side processing is disabled, uploads fall back to the classic flow unchanged. Audio files, uploaders that do not post attachments, and JPEG/PNG files while plupload resizing is enabled also stay on the classic path, and a HEIC the browser cannot decode is handed to the server when its image editor supports HEIC. The Customizer, Site Icon picker and classic editor are not isolated and keep classic uploads.

See ​https://github.com/WordPress/gutenberg/issues/82409.

Props adamsilverstein, westonruter, andrewserong, sanayasir, arkaprabhachowdhury, logicrays.
Fixes #65661. See #66220.

Location:
trunk
Files:
15 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r64581 r64588  
    532532                                        [ WORKING_DIR + 'wp-admin/js/link.js' ]: [ './src/js/_enqueues/admin/link.js' ],
    533533                                        [ WORKING_DIR + 'wp-admin/js/media-gallery.js' ]: [ './src/js/_enqueues/deprecated/media-gallery.js' ],
     534                                        [ WORKING_DIR + 'wp-admin/js/media-frame-upload.js' ]: [ './src/js/_enqueues/admin/media-frame-upload.js' ],
     535                                        [ WORKING_DIR + 'wp-admin/js/media-new-upload.js' ]: [ './src/js/_enqueues/admin/media-new-upload.js' ],
     536                                        [ WORKING_DIR + 'wp-admin/js/media-upload-pipeline.js' ]: [ './src/js/_enqueues/admin/media-upload-pipeline.js' ],
    534537                                        [ WORKING_DIR + 'wp-admin/js/media-upload.js' ]: [ './src/js/_enqueues/admin/media-upload.js' ],
    535538                                        [ WORKING_DIR + 'wp-admin/js/media.js' ]: [ './src/js/_enqueues/admin/media.js' ],
    … …  
    13261329                                        'src/wp-admin/js/link.js': 'src/js/_enqueues/admin/link.js',
    13271330                                        'src/wp-admin/js/media-gallery.js': 'src/js/_enqueues/deprecated/media-gallery.js',
     1331                                        'src/wp-admin/js/media-frame-upload.js': 'src/js/_enqueues/admin/media-frame-upload.js',
     1332                                        'src/wp-admin/js/media-new-upload.js': 'src/js/_enqueues/admin/media-new-upload.js',
     1333                                        'src/wp-admin/js/media-upload-pipeline.js': 'src/js/_enqueues/admin/media-upload-pipeline.js',
    13281334                                        'src/wp-admin/js/media-upload.js': 'src/js/_enqueues/admin/media-upload.js',
    13291335                                        'src/wp-admin/js/media.js': 'src/js/_enqueues/admin/media.js',
  • trunk/package-lock.json

    r64349 r64588  
    4747                                "@playwright/test": "1.61.1",
    4848                                "@pmmmwh/react-refresh-webpack-plugin": "0.6.2",
     49                                "@types/backbone": "1.4.23",
    4950                                "@types/codemirror": "5.60.17",
    5051                                "@types/espree": "10.1.0",
    … …  
    58765877                        }
    58775878                },
     5879                "node_modules/@types/backbone": {
     5880                        "version": "1.4.23",
     5881                        "resolved": "https://registry.npmjs.org/@types/backbone/-/backbone-1.4.23.tgz",
     5882                        "integrity": "sha512-B/hN/DAJdWFOusEkEoa5xgfVuxJJPOR/6JQ2uwURPDyKL24PuC76IR6EcSRJ6lvGWtxHRQYMJQhJYm6KpMDtGQ==",
     5883                        "dev": true,
     5884                        "license": "MIT",
     5885                        "dependencies": {
     5886                                "@types/jquery": "*",
     5887                                "@types/underscore": "*"
     5888                        }
     5889                },
    58785890                "node_modules/@types/body-parser": {
    58795891                        "version": "1.19.5",
  • trunk/package.json

    r64587 r64588  
    4545                "@playwright/test": "1.61.1",
    4646                "@pmmmwh/react-refresh-webpack-plugin": "0.6.2",
     47                "@types/backbone": "1.4.23",
    4748                "@types/codemirror": "5.60.17",
    4849                "@types/espree": "10.1.0",
  • trunk/src/wp-admin/media-new.php

    r61569 r64588  
    1818
    1919wp_enqueue_script( 'plupload-handlers' );
     20wp_enqueue_media_new_upload();
    2021
    2122$post_id = 0;
  • trunk/src/wp-includes/default-filters.php

    r64567 r64588  
    719719add_action( 'load-site-editor.php', 'wp_set_up_cross_origin_isolation' );
    720720add_action( 'load-widgets.php', 'wp_set_up_cross_origin_isolation' );
     721add_action( 'load-upload.php', 'wp_set_up_cross_origin_isolation' );
     722add_action( 'load-media-new.php', 'wp_set_up_cross_origin_isolation' );
    721723// Nav menu.
    722724add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 );
  • trunk/src/wp-includes/functions.php

    r64436 r64588  
    35103510 * @since 6.8.0 Support was added for `audio/x-wav`.
    35113511 *
    3512  * @return string[] Array of mime types keyed by the file extension regex corresponding to those types.
     3512 * @return array<string, string> Array of mime types keyed by the file extension regex corresponding to those types.
    35133513 */
    35143514function wp_get_mime_types() {
    … …  
    35213521         * @since 3.5.0
    35223522         *
    3523          * @param string[] $wp_get_mime_types Mime types keyed by the file extension regex
    3524          *                                    corresponding to those types.
     3523         * @param array<string, string> $wp_get_mime_types Mime types keyed by the file extension regex
     3524         *                                                 corresponding to those types.
    35253525         */
    35263526        return apply_filters(
    … …  
    36463646 * @since 4.6.0
    36473647 *
    3648  * @return array[] Multi-dimensional array of file extensions types keyed by the type of file.
     3648 * @return array<string, string[]> Multi-dimensional array of file extensions types keyed by the type of file.
    36493649 */
    36503650function wp_get_ext_types() {
    … …  
    36573657         * @see wp_ext2type()
    36583658         *
    3659          * @param array[] $ext2type Multi-dimensional array of file extensions types keyed by the type of file.
     3659         * @param array<string, string[]> $ext2type Multi-dimensional array of file extensions types keyed by the type of file.
    36603660         */
    36613661        return apply_filters(
    … …  
    37313731 *
    37323732 * @param int|WP_User $user Optional. User to check. Defaults to current user.
    3733  * @return string[] Array of mime types keyed by the file extension regex corresponding
    3734  *                  to those types.
     3733 * @return array<string, string> Array of mime types keyed by the file extension regex corresponding to those types.
    37353734 */
    37363735function get_allowed_mime_types( $user = null ) {
    … …  
    37513750         * @since 2.0.0
    37523751         *
    3753          * @param array            $t    Mime types keyed by the file extension regex corresponding to those types.
    3754          * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
     3752         * @param array<string, string> $t    Mime types keyed by the file extension regex corresponding to those types.
     3753         * @param int|WP_User|null      $user User ID, User object or null if not provided (indicates current user).
    37553754         */
    37563755        return apply_filters( 'upload_mimes', $t, $user );
  • trunk/src/wp-includes/media.php

    r64489 r64588  
    49144914 *
    49154915 * @since 3.5.0
     4916 * @since 7.2.0 Also enqueues the client-side upload integration for the media frame on cross-origin isolated screens.
    49164917 *
    49174918 * @global int       $content_width
    … …  
    53035304         */
    53045305        wp_enqueue_script( 'media-editor' );
     5306        wp_enqueue_media_frame_upload();
    53055307        wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
    53065308
    … …  
    66116613        wp_add_inline_script( 'wp-block-editor', 'window.__clientSideMediaProcessing = true;', 'before' );
    66126614
    6613         $chromium_version = wp_get_chromium_major_version();
    6614 
    6615         if ( null !== $chromium_version && $chromium_version >= 137 ) {
     6615        if ( wp_is_document_isolation_policy_supported() ) {
    66166616                wp_add_inline_script( 'wp-block-editor', 'window.__documentIsolationPolicy = true;', 'before' );
    66176617        }
    … …  
    66386638
    66396639/**
    6640  * Enables cross-origin isolation in the block editor.
     6640 * Determines whether the current request's browser honors the
     6641 * Document-Isolation-Policy header.
     6642 *
     6643 * Document-Isolation-Policy is how WordPress makes a page cross-origin
     6644 * isolated for client-side media processing. Chromium 137+ is the only
     6645 * engine that implements it; other browsers ignore the header, so the
     6646 * page never becomes isolated and the client-side pipeline cannot run.
     6647 *
     6648 * @since 7.2.0
     6649 *
     6650 * @return bool True when the browser is Chromium 137 or newer.
     6651 */
     6652function wp_is_document_isolation_policy_supported(): bool {
     6653        $chromium_version = wp_get_chromium_major_version();
     6654
     6655        return null !== $chromium_version && $chromium_version >= 137;
     6656}
     6657
     6658/**
     6659 * Enables cross-origin isolation on screens that upload media client-side.
    66416660 *
    66426661 * Required for enabling SharedArrayBuffer for WebAssembly-based
    6643  * media processing in the editor. Uses Document-Isolation-Policy
     6662 * media processing in the block editor, the Media Library grid, and
     6663 * the "Add New Media File" screen. Uses Document-Isolation-Policy
    66446664 * on supported browsers (Chromium 137+).
     6665 *
     6666 * The Media Library is only isolated in grid mode: list mode has no
     6667 * client-side pipeline integration, its uploads go through the
     6668 * "Add New Media File" screen.
    66456669 *
    66466670 * Skips setup when a third-party page builder overrides the block
    … …  
    66496673 *
    66506674 * @since 7.1.0
    6651  * @since 7.2.0 Returns whether the header was sent.
     6675 * @since 7.2.0 Also isolates the Media Library grid and the "Add New Media File" screen.
     6676 *              Returns whether the header was sent.
    66526677 *
    66536678 * @return bool Whether the Document-Isolation-Policy header was sent.
    … …  
    66646689        }
    66656690
    6666         if ( ! $screen->is_block_editor() && 'site-editor' !== $screen->id && ! ( 'widgets' === $screen->id && wp_use_widgets_block_editor() ) ) {
     6691        $is_media_screen = 'media' === $screen->id || ( 'upload' === $screen->id && 'grid' === wp_get_media_library_mode() );
     6692
     6693        if (
     6694                ! $is_media_screen &&
     6695                ! $screen->is_block_editor() &&
     6696                'site-editor' !== $screen->id &&
     6697                ! ( 'widgets' === $screen->id && wp_use_widgets_block_editor() )
     6698        ) {
    66676699                return false;
    66686700        }
    … …  
    66896721         * which blocks same-origin iframe access that these editors rely on.
    66906722         */
    6691         if ( isset( $_GET['action'] ) && 'edit' !== $_GET['action'] ) {
     6723        if ( ! $is_media_screen && isset( $_GET['action'] ) && 'edit' !== $_GET['action'] ) {
    66926724                return false;
    66936725        }
    … …  
    66996731
    67006732        return wp_send_document_isolation_policy_header();
     6733}
     6734
     6735/**
     6736 * Returns the current Media Library mode (grid or list).
     6737 *
     6738 * Replicates the mode resolution in wp-admin/upload.php, which runs after
     6739 * the `load-upload.php` hook, without updating the saved user option.
     6740 *
     6741 * upload.php falls back to grid mode for any falsey saved value and renders
     6742 * grid mode only for the exact value 'grid'. A truthy saved value outside the
     6743 * two known modes - one a plugin stored, say - therefore renders list mode
     6744 * there and resolves to 'list' here, so callers do not isolate a page that
     6745 * the Media Library renders in list mode.
     6746 *
     6747 * @since 7.2.0
     6748 *
     6749 * @return string The Media Library mode, 'grid' when none is saved.
     6750 * @phpstan-return 'grid'|'list'
     6751 */
     6752function wp_get_media_library_mode(): string {
     6753        $valid_modes = array( 'grid', 'list' );
     6754
     6755        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     6756        if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $valid_modes, true ) ) {
     6757                // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     6758                return $_GET['mode'];
     6759        }
     6760
     6761        $mode = get_user_option( 'media_library_mode', get_current_user_id() );
     6762
     6763        if ( in_array( $mode, $valid_modes, true ) ) {
     6764                return $mode;
     6765        }
     6766
     6767        // As in upload.php: nothing saved renders the grid, any other value the list.
     6768        return $mode ? 'list' : 'grid';
     6769}
     6770
     6771/**
     6772 * Returns the image processing settings for client-side media processing.
     6773 *
     6774 * Shared by the REST API index, which the block editor reads, and
     6775 * wp_get_media_library_upload_settings(), so both pipelines apply the
     6776 * same filters.
     6777 *
     6778 * @since 7.2.0
     6779 * @access private
     6780 *
     6781 * @return array<string, mixed> Image processing settings.
     6782 *
     6783 * @phpstan-return array{
     6784 *     image_sizes: array<string, array{
     6785 *         width: non-negative-int,
     6786 *         height: non-negative-int,
     6787 *         crop: array{ 'left'|'center'|'right', 'top'|'center'|'bottom' }|bool,
     6788 *     }>,
     6789 *     image_size_threshold: non-negative-int,
     6790 *     image_strip_meta: bool,
     6791 *     image_max_bit_depth: non-negative-int,
     6792 *     generate_animated_image_subsizes: bool,
     6793 * }
     6794 */
     6795function _wp_get_client_side_media_image_settings(): array {
     6796        /** This filter is documented in wp-admin/includes/image.php */
     6797        $image_size_threshold = max( 0, (int) apply_filters( 'big_image_size_threshold', 2560, array( 0, 0 ), '', 0 ) );
     6798
     6799        /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
     6800        $image_strip_meta = (bool) apply_filters( 'image_strip_meta', true );
     6801
     6802        /*
     6803         * On the server, this filter receives the decoded image's actual bit depth.
     6804         * The client path never decodes the image on the server, so the filter is
     6805         * applied with 16 (the maximum depth the client encoder can produce) as
     6806         * both the value and the current depth. The client caps its output bit
     6807         * depth at the filtered value, so a plugin lowering it (e.g. to 8) takes
     6808         * effect on client-generated images too.
     6809         */
     6810        /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
     6811        $image_max_bit_depth = max( 0, (int) apply_filters( 'image_max_bit_depth', 16, 16 ) );
     6812
     6813        /**
     6814         * Filters whether client-side media processing preserves animation in image sub-sizes.
     6815         *
     6816         * By default, sub-sizes of animated GIF and WebP images retain animation,
     6817         * including cropped sizes. Return false to generate static sub-sizes using
     6818         * only the first frame, reducing processing time in the browser.
     6819         *
     6820         * This setting applies only to client-side media processing. Server-side
     6821         * processing continues to generate static sub-sizes.
     6822         *
     6823         * @since 7.2.0
     6824         *
     6825         * @param bool $generate_animated_image_subsizes Whether to preserve animation in image sub-sizes.
     6826         *                                               Default true.
     6827         */
     6828        $generate_animated_image_subsizes = (bool) apply_filters( 'wp_generate_animated_image_subsizes', true );
     6829
     6830        return array(
     6831                'image_sizes'                      => wp_get_registered_image_subsizes(),
     6832                'image_size_threshold'             => $image_size_threshold,
     6833                'image_strip_meta'                 => $image_strip_meta,
     6834                'image_max_bit_depth'              => $image_max_bit_depth,
     6835                'generate_animated_image_subsizes' => $generate_animated_image_subsizes,
     6836        );
     6837}
     6838
     6839/**
     6840 * Returns the settings for the client-side media processing pipeline
     6841 * in the Media Library.
     6842 *
     6843 * These mirror the values the block editor consumes for the same
     6844 * pipeline: the REST index (the image processing settings, shared through
     6845 * _wp_get_client_side_media_image_settings()) and get_block_editor_settings()
     6846 * (max upload size and allowed mime types).
     6847 *
     6848 * @since 7.2.0
     6849 *
     6850 * @return array<string, mixed> Settings for the client-side media processing pipeline.
     6851 *
     6852 * @phpstan-return array{
     6853 *     maxUploadFileSize: non-negative-int,     // Maximum upload file size in bytes.
     6854 *     allowedMimeTypes: array<string, string>, // Allowed mime types keyed by file extension.
     6855 *     allImageSizes: array<string, array{      // All registered image sub-sizes.
     6856 *                        width: non-negative-int,
     6857 *                        height: non-negative-int,
     6858 *                        crop: array{ 'left'|'center'|'right', 'top'|'center'|'bottom' }|bool,
     6859 *                    }>,
     6860 *     bigImageSizeThreshold: non-negative-int, // Threshold above which originals are scaled down.
     6861 *     imageStripMeta: bool,                    // Whether metadata is stripped from generated images.
     6862 *     imageMaxBitDepth: non-negative-int,      // Maximum bit depth for generated images.
     6863 *     generateAnimatedImageSubsizes: bool,     // Whether sub-sizes of animated images stay animated.
     6864 * }
     6865 */
     6866function wp_get_media_library_upload_settings(): array {
     6867        $image_settings = _wp_get_client_side_media_image_settings();
     6868
     6869        return array(
     6870                'maxUploadFileSize'             => max( 0, (int) wp_max_upload_size() ),
     6871                'allowedMimeTypes'              => get_allowed_mime_types(),
     6872                'allImageSizes'                 => $image_settings['image_sizes'],
     6873                'bigImageSizeThreshold'         => $image_settings['image_size_threshold'],
     6874                'imageStripMeta'                => $image_settings['image_strip_meta'],
     6875                'imageMaxBitDepth'              => $image_settings['image_max_bit_depth'],
     6876                'generateAnimatedImageSubsizes' => $image_settings['generate_animated_image_subsizes'],
     6877        );
     6878}
     6879
     6880/**
     6881 * Enqueues a screen's client-side upload integration script along with the
     6882 * shared pipeline glue and its settings.
     6883 *
     6884 * Nothing is enqueued unless client-side media processing is enabled and the
     6885 * browser honors Document-Isolation-Policy: without isolation the page never
     6886 * becomes cross-origin isolated, the script would no-op, and the whole
     6887 * wp-upload-media dependency chain would be loaded for nothing. The same
     6888 * goes for a screen wp_set_up_cross_origin_isolation() did not isolate,
     6889 * such as the Customizer or the Site Icon picker: the media frame loads
     6890 * there too, but its uploads stay on the classic path.
     6891 *
     6892 * The screen script self-guards at runtime too: when the browser turns out
     6893 * not to be isolated or lacks client-side media support, it no-ops and the
     6894 * classic plupload flow keeps handling uploads.
     6895 *
     6896 * @since 7.2.0
     6897 * @access private
     6898 *
     6899 * @param string $handle The screen script to enqueue.
     6900 *
     6901 * @phpstan-param non-empty-string $handle
     6902 */
     6903function _wp_enqueue_media_upload_pipeline_script( string $handle ): void {
     6904        if (
     6905                ! wp_is_client_side_media_processing_enabled() ||
     6906                ! wp_is_document_isolation_policy_supported() ||
     6907                ! wp_is_cross_origin_isolated_request()
     6908        ) {
     6909                return;
     6910        }
     6911
     6912        wp_enqueue_script( $handle );
     6913
     6914        // Both screen scripts share the pipeline script, so add its settings once.
     6915        if ( wp_scripts()->get_data( 'media-upload-pipeline', 'settings_added' ) ) {
     6916                return;
     6917        }
     6918        wp_scripts()->add_data( 'media-upload-pipeline', 'settings_added', true );
     6919
     6920        $settings = wp_get_media_library_upload_settings();
     6921
     6922        // wp_enqueue_media() can run on the front end, where there is no screen.
     6923        $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
     6924
     6925        // The block editor configures the upload-media store itself; the pipeline waits for it.
     6926        $settings['isBlockEditor'] = $screen && $screen->is_block_editor();
     6927
     6928        $js_function = <<<'JS'
     6929                ( settings ) => {
     6930                        window._wpMediaUploadPipelineSettings = settings;
     6931                }
     6932                JS;
     6933
     6934        wp_add_inline_script(
     6935                'media-upload-pipeline',
     6936                sprintf( '( %s )( %s );', $js_function, wp_json_encode( $settings, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ),
     6937                'before'
     6938        );
     6939}
     6940
     6941/**
     6942 * Enqueues the script that routes uploads started from a media frame
     6943 * through the client-side media processing pipeline.
     6944 *
     6945 * Covers every `wp.media` frame that uploads through `wp.Uploader`: the
     6946 * Media Library grid and the media modal the block editor, the site editor
     6947 * and the block widgets screen open. wp_enqueue_media() calls this on any
     6948 * screen that was cross-origin isolated, so it rarely needs calling directly.
     6949 *
     6950 * @since 7.2.0
     6951 */
     6952function wp_enqueue_media_frame_upload(): void {
     6953        _wp_enqueue_media_upload_pipeline_script( 'media-frame-upload' );
     6954}
     6955
     6956/**
     6957 * Enqueues the script that routes "Add New Media File" screen uploads
     6958 * through the client-side media processing pipeline.
     6959 *
     6960 * @since 7.2.0
     6961 */
     6962function wp_enqueue_media_new_upload(): void {
     6963        _wp_enqueue_media_upload_pipeline_script( 'media-new-upload' );
    67016964}
    67026965
    … …  
    67126975 * @since 7.2.0
    67136976 *
     6977 * @global bool $_wp_cross_origin_isolated Whether the Document-Isolation-Policy header was sent.
     6978 *
    67146979 * @return bool Whether the header was sent. False if the browser does not
    67156980 *              support Document-Isolation-Policy or headers were already sent.
    67166981 */
    67176982function wp_send_document_isolation_policy_header(): bool {
    6718         if ( headers_sent() ) {
     6983        global $_wp_cross_origin_isolated;
     6984
     6985        if ( headers_sent() || ! wp_is_document_isolation_policy_supported() ) {
    67196986                return false;
    67206987        }
    67216988
    6722         $chromium_version = wp_get_chromium_major_version();
    6723 
    6724         if ( null === $chromium_version || $chromium_version < 137 ) {
    6725                 return false;
    6726         }
    6727 
    67286989        header( 'Document-Isolation-Policy: isolate-and-credentialless' );
    67296990
     6991        $_wp_cross_origin_isolated = true;
     6992
    67306993        return true;
    67316994}
    67326995
     6996/**
     6997 * Whether the current request has been set up for cross-origin isolation.
     6998 *
     6999 * True once wp_set_up_cross_origin_isolation() has sent the
     7000 * Document-Isolation-Policy header for the screen being rendered, which is
     7001 * what lets scripts that need a cross-origin isolated page, such as the
     7002 * client-side media upload integration, decide whether to load at all.
     7003 *
     7004 * A plugin can isolate a screen on its own by sending the header directly,
     7005 * as the Gutenberg plugin does on the block editor screens, so a header
     7006 * already queued for the response counts too.
     7007 *
     7008 * @since 7.2.0
     7009 *
     7010 * @global bool $_wp_cross_origin_isolated Whether the Document-Isolation-Policy header was sent.
     7011 *
     7012 * @return bool True when the response will be cross-origin isolated.
     7013 */
     7014function wp_is_cross_origin_isolated_request(): bool {
     7015        global $_wp_cross_origin_isolated;
     7016
     7017        if ( true === $_wp_cross_origin_isolated ) {
     7018                return true;
     7019        }
     7020
     7021        foreach ( headers_list() as $header ) {
     7022                if ( 0 === stripos( $header, 'Document-Isolation-Policy:' ) ) {
     7023                        return true;
     7024                }
     7025        }
     7026
     7027        return false;
     7028}
     7029
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r64527 r64588  
    14661466                // Add media processing settings for users who can upload files.
    14671467                if ( wp_is_client_side_media_processing_enabled() && current_user_can( 'upload_files' ) ) {
    1468                         // Image sizes keyed by name for client-side media processing.
    1469                         $available['image_sizes'] = array();
    1470                         foreach ( wp_get_registered_image_subsizes() as $name => $size ) {
    1471                                 $available['image_sizes'][ $name ] = $size;
    1472                         }
    1473 
    1474                         /** This filter is documented in wp-admin/includes/image.php */
    1475                         $available['image_size_threshold'] = (int) apply_filters( 'big_image_size_threshold', 2560, array( 0, 0 ), '', 0 );
    1476 
    1477                         /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
    1478                         $available['image_strip_meta'] = (bool) apply_filters( 'image_strip_meta', true );
    1479 
    1480                         /*
    1481                          * On the server, this filter receives the decoded image's actual bit depth.
    1482                          * The client path never decodes the image on the server, so the filter is
    1483                          * applied with 16 (the maximum depth the client encoder can produce) as
    1484                          * both the value and the current depth. The client caps its output bit
    1485                          * depth at the filtered value, so a plugin lowering it (e.g. to 8) takes
    1486                          * effect on client-generated images too.
    1487                          */
    1488                         /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
    1489                         $available['image_max_bit_depth'] = (int) apply_filters( 'image_max_bit_depth', 16, 16 );
    1490 
    1491                         /**
    1492                          * Filters whether client-side media processing preserves animation in image sub-sizes.
    1493                          *
    1494                          * By default, sub-sizes of animated GIF and WebP images retain animation,
    1495                          * including cropped sizes. Return false to generate static sub-sizes using
    1496                          * only the first frame, reducing processing time in the browser.
    1497                          *
    1498                          * This setting applies only to client-side media processing. Server-side
    1499                          * processing continues to generate static sub-sizes.
    1500                          *
    1501                          * @since 7.2.0
    1502                          *
    1503                          * @param bool $generate_animated_image_subsizes Whether to preserve animation in image sub-sizes.
    1504                          *                                               Default true.
    1505                          */
    1506                         $available['generate_animated_image_subsizes'] = (bool) apply_filters( 'wp_generate_animated_image_subsizes', true );
     1468                        $available = array_merge( $available, _wp_get_client_side_media_image_settings() );
    15071469                }
    15081470
  • trunk/src/wp-includes/script-loader.php

    r64585 r64588  
    14961496                $scripts->set_translations( 'media' );
    14971497
     1498                $scripts->add( 'media-upload-pipeline', "/wp-admin/js/media-upload-pipeline$suffix.js", array( 'plupload', 'wp-upload-media', 'wp-media-utils', 'wp-api-fetch', 'wp-data', 'wp-element', 'wp-i18n' ), false, 1 );
     1499                $scripts->set_translations( 'media-upload-pipeline' );
     1500
     1501                $scripts->add( 'media-frame-upload', "/wp-admin/js/media-frame-upload$suffix.js", array( 'media-views', 'media-upload-pipeline' ), false, 1 );
     1502
     1503                $scripts->add( 'media-new-upload', "/wp-admin/js/media-new-upload$suffix.js", array( 'plupload-handlers', 'media-upload-pipeline', 'wp-a11y', 'wp-i18n' ), false, 1 );
     1504                $scripts->set_translations( 'media-new-upload' );
     1505
    14981506                $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', 'imgareaselect', 'wp-a11y' ), false, 1 );
    14991507                $scripts->set_translations( 'image-edit' );
  • trunk/tsconfig.json

    r64297 r64588  
    2222                "types": [
    2323                        "node",
     24                        "backbone",
    2425                        "wp-globals",
     26                        "media-uploads",
    2527                        "browser-globals",
    2628                        "wp-emoji",
    … …  
    3133        "include": [],
    3234        "files": [
     35                "src/js/_enqueues/admin/media-frame-upload.js",
     36                "src/js/_enqueues/admin/media-new-upload.js",
     37                "src/js/_enqueues/admin/media-upload-pipeline.js",
    3338                "src/js/_enqueues/lib/accordion.js",
    3439                "src/js/_enqueues/lib/codemirror/htmlhint-kses.js",
  • trunk/typings/wp-globals/index.d.ts

    r61800 r64588  
    22declare var jQuery: import('jquery').JQueryStatic;
    33declare var _: import('underscore');
    4 declare var Backbone: any;
    54declare var HTMLHint: import('htmlhint').HTMLHint;
Note: See TracChangeset for help on using the changeset viewer.