Skip to content

Commit 9548718

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@59696 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e12e1f9 commit 9548718

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

src/js/_enqueues/lib/link.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
if ( wpLink.isMCE() ) {
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' );
168168
}

src/js/_enqueues/wp/autosave.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ window.autosave = function() {
559559
});
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' );
565565

src/js/_enqueues/wp/editor/base.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ window.wp = window.wp || {};
2222
$$ = tinymce.$;
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
2828
*
@@ -62,7 +62,7 @@ window.wp = window.wp || {};
6262
}
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
6868
*
@@ -838,7 +838,7 @@ window.wp = window.wp || {};
838838
}
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 ) {
844844
focusHTMLBookmarkInVisualEditor( editor );
@@ -1203,7 +1203,7 @@ window.wp = window.wp || {};
12031203
/**
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
*
12091209
* Settings for both TinyMCE and Quicktags can be passed on initialization, and are "filtered"
@@ -1246,7 +1246,7 @@ window.wp = window.wp || {};
12461246
};
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 );
12521252

@@ -1293,7 +1293,7 @@ window.wp = window.wp || {};
12931293
.append( $button.attr({
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
);
12991299

src/wp-admin/edit-form-advanced.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@
283283
);
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>';
291291
$title_and_editor .= '<p>' . sprintf(
@@ -314,7 +314,7 @@
314314
);
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(
320320
array(

src/wp-includes/class-wp-editor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private function __construct() {}
5454
* @type string|int $tabindex Tabindex value to use. Default empty.
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.
6060
* @type bool $teeny Whether to output the minimal editor config. Examples include
@@ -184,7 +184,7 @@ public static function editor( $content, $editor_id, $settings = array() ) {
184184

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';
190190
}
@@ -194,7 +194,7 @@ public static function editor( $content, $editor_id, $settings = array() ) {
194194
$buttons .= '<button type="button" id="' . $editor_id_attr . '-tmce"' . $html_active . ' class="wp-switch-editor switch-tmce"' .
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';
200200
}
@@ -272,7 +272,7 @@ public static function editor( $content, $editor_id, $settings = array() ) {
272272
'id="' . $editor_id_attr . '">%s</textarea></div>'
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 );
278278
}
@@ -627,7 +627,7 @@ public static function editor_settings( $editor_id, $set ) {
627627
);
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
633633
* @since 3.3.0 The `$editor_id` parameter was added.
@@ -1396,7 +1396,7 @@ private static function get_translation() {
13961396
'Apply' => __( 'Apply' ), // Tooltip for the 'apply' button in the inline link dialog.
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

14021402
// Shortcuts help modal.

src/wp-includes/general-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3792,7 +3792,7 @@ function user_can_richedit() {
37923792
* Finds out which editor should be displayed by default.
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
37983798
*

src/wp-includes/widgets/class-wp-widget-text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public static function render_control_template_scripts() {
557557
<div hidden class="wp-pointer paste-html-pointer wp-pointer-top">
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>
563563
</div>

0 commit comments

Comments
 (0)