Make WordPress Core

Changeset 56025


Ignore:
Timestamp:
06/25/2023 07:52:43 PM (13 months ago)
Author:
joedolson
Message:

Editor: Add no-js fallback for site editor.

Add a fallback condition with heading and error notice to handle a no JavaScript state for the site editor, comparable to what already exists in the post editor.

Props afercia, joedolson, fencermonir, zebaafiashama, alexstine, rudlinkon.
Fixes #56228.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/common.css

    r56023 r56025  
    574574}
    575575
    576 .wrap.block-editor-no-js {
     576.wrap.block-editor-no-js,
     577.wrap.site-editor-no-js {
    577578    padding-left: 20px;
    578579}
  • trunk/src/wp-admin/site-editor.php

    r55368 r56025  
    133133?>
    134134
    135 <div id="site-editor" class="edit-site"></div>
     135<div class="edit-site">
     136    <div id="site-editor"></div>
     137
     138    <?php // JavaScript is disabled. ?>
     139    <div class="wrap hide-if-js site-editor-no-js">
     140        <h1 class="wp-heading-inline"><?php _e( 'Edit site' ); ?></h1>
     141        <div class="notice notice-error notice-alt">
     142            <p>
     143                <?php
     144                    /**
     145                     * Filters the message displayed in the site editor interface when JavaScript is
     146                     * not enabled in the browser.
     147                     *
     148                     * @since 6.3.0
     149                     *
     150                     * @param string  $message The message being displayed.
     151                     * @param WP_Post $post    The post being edited.
     152                     */
     153                    echo apply_filters( 'site_editor_no_javascript_message', __( 'The site editor requires JavaScript. Please enable JavaScript in your browser settings.' ), $post );
     154                ?>
     155            </p>
     156        </div>
     157    </div>
     158</div>
    136159
    137160<?php
Note: See TracChangeset for help on using the changeset viewer.