Make WordPress Core

Changeset 59696


Ignore:
Timestamp:
01/23/2025 11:52:04 PM (8 weeks ago)
Author:
joedolson
Message:

Editor: Change the Text editor label to Code.

Rename the 'Text' tab of the classic editor to 'Code', mimicking the labels used in the block editor: "Visual editor" and "Code editor".

Update code comment and Help documentation to reference the editor using the new label.

Props lukecavanagh, ctienshi, travel_girl, audrasjb, sabernhardt, joedolson, rseigel, mark-k, sergeybiryukov, presskopp, giuriani, afercia, knutsp, audrasjb, sukhendu2002.
Fixes #38061.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/link.js

    r59120 r59696  
    163163                wpLink.mceRefresh( url, text );
    164164            } else {
    165                 // For the Text editor the "Link text" field is always shown.
     165                // For the Code editor the "Link text" field is always shown.
    166166                if ( ! inputs.wrap.hasClass( 'has-text-field' ) ) {
    167167                    inputs.wrap.addClass( 'has-text-field' );
  • trunk/src/js/_enqueues/wp/autosave.js

    r50547 r59696  
    560560                    } else {
    561561
    562                         // Make sure the Text editor is selected.
     562                        // Make sure the Code editor is selected.
    563563                        $( '#content-html' ).trigger( 'click' );
    564564                        $( '#content' ).trigger( 'focus' );
  • trunk/src/js/_enqueues/wp/editor/base.js

    r59188 r59696  
    2323
    2424                /**
    25                  * Handles onclick events for the Visual/Text tabs.
     25                 * Handles onclick events for the Visual/Code tabs.
    2626                 *
    2727                 * @since 4.3.0
     
    6363
    6464        /**
    65          * Switches the editor between Visual and Text mode.
     65         * Switches the editor between Visual and Code mode.
    6666         *
    6767         * @since 2.5.0
     
    839839        }
    840840
    841         // Restore the selection when the editor is initialized. Needed when the Text editor is the default.
     841        // Restore the selection when the editor is initialized. Needed when the Code editor is the default.
    842842        $( document ).on( 'tinymce-editor-init.keep-scroll-position', function( event, editor ) {
    843843            if ( editor.$( '.mce_SELRES_start' ).length ) {
     
    12041204     * Initialize TinyMCE and/or Quicktags. For use with wp_enqueue_editor() (PHP).
    12051205     *
    1206      * Intended for use with an existing textarea that will become the Text editor tab.
     1206     * Intended for use with an existing textarea that will become the Code editor tab.
    12071207     * The editor width will be the width of the textarea container, height will be adjustable.
    12081208     *
     
    12471247        }
    12481248
    1249         // Add wrap and the Visual|Text tabs.
     1249        // Add wrap and the Visual|Code tabs.
    12501250        if ( settings.tinymce && settings.quicktags ) {
    12511251            var $textarea = $( '#' + id );
     
    12941294                            id: id + '-html',
    12951295                            'class': 'wp-switch-editor switch-html'
    1296                         }).text( window.tinymce.translate( 'Text' ) ) )
     1296                        }).text( window.tinymce.translate( 'Code' ) ) )
    12971297                    ).append( $editorContainer )
    12981298            );
  • trunk/src/wp-admin/edit-form-advanced.php

    r59522 r59696  
    284284
    285285    $title_and_editor  = '<p>' . __( '<strong>Title</strong> &mdash; Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.' ) . '</p>';
    286     $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> &mdash; Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>';
     286    $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> &mdash; Enter the text for your post. There are two modes of editing: Visual and Code. Choose the mode by clicking on the appropriate tab.' ) . '</p>';
    287287    $title_and_editor .= '<p>' . __( 'Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls.' ) . '</p>';
    288     $title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Note that &lt;p&gt; and &lt;br&gt; tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing &lt;br&gt;, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '</p>';
     288    $title_and_editor .= '<p>' . __( 'The Code mode allows you to enter HTML along with your post text. Note that &lt;p&gt; and &lt;br&gt; tags are converted to line breaks when switching to the Code editor to make it less cluttered. When you type, a single line break can be used instead of typing &lt;br&gt;, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '</p>';
    289289    $title_and_editor .= '<p>' . __( 'You can insert media files by clicking the button above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>';
    290290    $title_and_editor .= '<p>' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '</p>';
     
    315315} elseif ( 'page' === $post_type ) {
    316316    $about_pages = '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.' ) . '</p>' .
    317         '<p>' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '</p>';
     317        '<p>' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Code modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '</p>';
    318318
    319319    get_current_screen()->add_help_tab(
  • trunk/src/wp-includes/class-wp-editor.php

    r59188 r59696  
    5555     *     @type string     $tabfocus_elements The previous and next element ID to move the focus to
    5656     *                                         when pressing the Tab key in TinyMCE. Default ':prev,:next'.
    57      *     @type string     $editor_css        Intended for extra styles for both Visual and Text editors.
     57     *     @type string     $editor_css        Intended for extra styles for both Visual and Code editors.
    5858     *                                         Should include `<style>` tags, and can use "scoped". Default empty.
    5959     *     @type string     $editor_class      Extra classes to add to the editor textarea element. Default empty.
     
    185185            if ( self::$this_quicktags ) {
    186186                $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
    187                 // 'html' is used for the "Text" editor tab.
     187                // 'html' is used for the "Code" editor tab.
    188188                if ( 'html' !== $default_editor ) {
    189189                    $default_editor = 'tinymce';
     
    195195                    ' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Visual', 'Name for the Visual editor tab' ) . "</button>\n";
    196196                $buttons .= '<button type="button" id="' . $editor_id_attr . '-html"' . $tmce_active . ' class="wp-switch-editor switch-html"' .
    197                     ' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ) . "</button>\n";
     197                    ' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Code', 'Name for the Code editor tab (formerly Text)' ) . "</button>\n";
    198198            } else {
    199199                $default_editor = 'tinymce';
     
    273273        );
    274274
    275         // Prepare the content for the Visual or Text editor, only when TinyMCE is used (back-compat).
     275        // Prepare the content for the Visual or Code editor, only when TinyMCE is used (back-compat).
    276276        if ( self::$this_tinymce ) {
    277277            add_filter( 'the_editor_content', 'format_for_editor', 10, 2 );
     
    628628
    629629                /**
    630                  * Filters the list of teenyMCE buttons (Text tab).
     630                 * Filters the list of teenyMCE buttons (Code tab).
    631631                 *
    632632                 * @since 2.7.0
     
    13971397                'Link options'                         => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog.
    13981398                'Visual'                               => _x( 'Visual', 'Name for the Visual editor tab' ),             // Editor switch tab label.
    1399                 'Text'                                 => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), // Editor switch tab label.
     1399                'Code'                                 => _x( 'Code', 'Name for the Code editor tab (formerly Text)' ), // Editor switch tab label.
    14001400                'Add Media'                            => array( __( 'Add Media' ), 'accessM' ), // Tooltip for the 'Add Media' button in the block editor Classic block.
    14011401
  • trunk/src/wp-includes/general-template.php

    r59692 r59696  
    37933793 *
    37943794 * Works out which of the editors to display as the current editor for a
    3795  * user. The 'html' setting is for the "Text" editor tab.
     3795 * user. The 'html' setting is for the "Code" editor tab.
    37963796 *
    37973797 * @since 2.5.0
  • trunk/src/wp-includes/widgets/class-wp-widget-text.php

    r59120 r59696  
    558558                    <div class="wp-pointer-content">
    559559                        <h3><?php _e( 'Did you just paste HTML?' ); ?></h3>
    560                         <p><?php _e( 'Hey there, looks like you just pasted HTML into the &#8220;Visual&#8221; tab of the Text widget. You may want to paste your code into the &#8220;Text&#8221; tab instead. Alternately, try out the new &#8220;Custom HTML&#8221; widget!' ); ?></p>
     560                        <p><?php _e( 'Hey there, looks like you just pasted HTML into the &#8220;Visual&#8221; tab of the Text widget. You may want to paste your code into the &#8220;Code&#8221; tab instead. Alternately, try out the new &#8220;Custom HTML&#8221; widget!' ); ?></p>
    561561                        <div class="wp-pointer-buttons">
    562562                            <a class="close" href="#"><?php _e( 'Dismiss' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.