Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Rename "Text" tab to "Code" for better clarity #8165

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/js/_enqueues/lib/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
if ( wpLink.isMCE() ) {
wpLink.mceRefresh( url, text );
} else {
// For the Text editor the "Link text" field is always shown.
// For the Code editor the "Link text" field is always shown.
if ( ! inputs.wrap.hasClass( 'has-text-field' ) ) {
inputs.wrap.addClass( 'has-text-field' );
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/_enqueues/wp/autosave.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ window.autosave = function() {
});
} else {

// Make sure the Text editor is selected.
// Make sure the Code editor is selected.
$( '#content-html' ).trigger( 'click' );
$( '#content' ).trigger( 'focus' );

Expand Down
12 changes: 6 additions & 6 deletions src/js/_enqueues/wp/editor/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ window.wp = window.wp || {};
$$ = tinymce.$;

/**
* Handles onclick events for the Visual/Text tabs.
* Handles onclick events for the Visual/Code tabs.
*
* @since 4.3.0
*
Expand Down Expand Up @@ -62,7 +62,7 @@ window.wp = window.wp || {};
}

/**
* Switches the editor between Visual and Text mode.
* Switches the editor between Visual and Code mode.
*
* @since 2.5.0
*
Expand Down Expand Up @@ -838,7 +838,7 @@ window.wp = window.wp || {};
}
}

// Restore the selection when the editor is initialized. Needed when the Text editor is the default.
// Restore the selection when the editor is initialized. Needed when the Code editor is the default.
$( document ).on( 'tinymce-editor-init.keep-scroll-position', function( event, editor ) {
if ( editor.$( '.mce_SELRES_start' ).length ) {
focusHTMLBookmarkInVisualEditor( editor );
Expand Down Expand Up @@ -1203,7 +1203,7 @@ window.wp = window.wp || {};
/**
* Initialize TinyMCE and/or Quicktags. For use with wp_enqueue_editor() (PHP).
*
* Intended for use with an existing textarea that will become the Text editor tab.
* Intended for use with an existing textarea that will become the Code editor tab.
* The editor width will be the width of the textarea container, height will be adjustable.
*
* Settings for both TinyMCE and Quicktags can be passed on initialization, and are "filtered"
Expand Down Expand Up @@ -1246,7 +1246,7 @@ window.wp = window.wp || {};
};
}

// Add wrap and the Visual|Text tabs.
// Add wrap and the Visual|Code tabs.
if ( settings.tinymce && settings.quicktags ) {
var $textarea = $( '#' + id );

Expand Down Expand Up @@ -1293,7 +1293,7 @@ window.wp = window.wp || {};
.append( $button.attr({
id: id + '-html',
'class': 'wp-switch-editor switch-html'
}).text( window.tinymce.translate( 'Text' ) ) )
}).text( window.tinymce.translate( 'Code' ) ) )
).append( $editorContainer )
);

Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/edit-form-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@
);

$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>';
$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>';
$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>';
$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>';
$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>';
$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>';
$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>';
$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>';
$title_and_editor .= '<p>' . sprintf(
Expand Down Expand Up @@ -314,7 +314,7 @@
);
} elseif ( 'page' === $post_type ) {
$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>' .
'<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>';
'<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>';

get_current_screen()->add_help_tab(
array(
Expand Down
12 changes: 6 additions & 6 deletions src/wp-includes/class-wp-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private function __construct() {}
* @type string|int $tabindex Tabindex value to use. Default empty.
* @type string $tabfocus_elements The previous and next element ID to move the focus to
* when pressing the Tab key in TinyMCE. Default ':prev,:next'.
* @type string $editor_css Intended for extra styles for both Visual and Text editors.
* @type string $editor_css Intended for extra styles for both Visual and Code editors.
* Should include `<style>` tags, and can use "scoped". Default empty.
* @type string $editor_class Extra classes to add to the editor textarea element. Default empty.
* @type bool $teeny Whether to output the minimal editor config. Examples include
Expand Down Expand Up @@ -184,7 +184,7 @@ public static function editor( $content, $editor_id, $settings = array() ) {

if ( self::$this_quicktags ) {
$default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
// 'html' is used for the "Text" editor tab.
// 'html' is used for the "Code" editor tab.
if ( 'html' !== $default_editor ) {
$default_editor = 'tinymce';
}
Expand All @@ -194,7 +194,7 @@ public static function editor( $content, $editor_id, $settings = array() ) {
$buttons .= '<button type="button" id="' . $editor_id_attr . '-tmce"' . $html_active . ' class="wp-switch-editor switch-tmce"' .
' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Visual', 'Name for the Visual editor tab' ) . "</button>\n";
$buttons .= '<button type="button" id="' . $editor_id_attr . '-html"' . $tmce_active . ' class="wp-switch-editor switch-html"' .
' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ) . "</button>\n";
' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Code', 'Name for the Code editor tab (formerly Text)' ) . "</button>\n";
} else {
$default_editor = 'tinymce';
}
Expand Down Expand Up @@ -272,7 +272,7 @@ public static function editor( $content, $editor_id, $settings = array() ) {
'id="' . $editor_id_attr . '">%s</textarea></div>'
);

// Prepare the content for the Visual or Text editor, only when TinyMCE is used (back-compat).
// Prepare the content for the Visual or Code editor, only when TinyMCE is used (back-compat).
if ( self::$this_tinymce ) {
add_filter( 'the_editor_content', 'format_for_editor', 10, 2 );
}
Expand Down Expand Up @@ -627,7 +627,7 @@ public static function editor_settings( $editor_id, $set ) {
);

/**
* Filters the list of teenyMCE buttons (Text tab).
* Filters the list of teenyMCE buttons (Code tab).
*
* @since 2.7.0
* @since 3.3.0 The `$editor_id` parameter was added.
Expand Down Expand Up @@ -1396,7 +1396,7 @@ private static function get_translation() {
'Apply' => __( 'Apply' ), // Tooltip for the 'apply' button in the inline link dialog.
'Link options' => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog.
'Visual' => _x( 'Visual', 'Name for the Visual editor tab' ), // Editor switch tab label.
'Text' => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), // Editor switch tab label.
'Code' => _x( 'Code', 'Name for the Code editor tab (formerly Text)' ), // Editor switch tab label.
'Add Media' => array( __( 'Add Media' ), 'accessM' ), // Tooltip for the 'Add Media' button in the block editor Classic block.

// Shortcuts help modal.
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -3792,7 +3792,7 @@ function user_can_richedit() {
* Finds out which editor should be displayed by default.
*
* Works out which of the editors to display as the current editor for a
* user. The 'html' setting is for the "Text" editor tab.
* user. The 'html' setting is for the "Code" editor tab.
*
* @since 2.5.0
*
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/widgets/class-wp-widget-text.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ public static function render_control_template_scripts() {
<div hidden class="wp-pointer paste-html-pointer wp-pointer-top">
<div class="wp-pointer-content">
<h3><?php _e( 'Did you just paste HTML?' ); ?></h3>
<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>
<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>
<div class="wp-pointer-buttons">
<a class="close" href="#"><?php _e( 'Dismiss' ); ?></a>
</div>
Expand Down
Loading