52 * can be used here. Default $editor_id. |
52 * can be used here. Default $editor_id. |
53 * @type int $textarea_rows Number rows in the editor textarea. Default 20. |
53 * @type int $textarea_rows Number rows in the editor textarea. Default 20. |
54 * @type string|int $tabindex Tabindex value to use. Default empty. |
54 * @type string|int $tabindex Tabindex value to use. Default empty. |
55 * @type string $tabfocus_elements The previous and next element ID to move the focus to |
55 * @type string $tabfocus_elements The previous and next element ID to move the focus to |
56 * when pressing the Tab key in TinyMCE. Default ':prev,:next'. |
56 * 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. |
58 * Should include `<style>` tags, and can use "scoped". Default empty. |
58 * Should include `<style>` tags, and can use "scoped". Default empty. |
59 * @type string $editor_class Extra classes to add to the editor textarea element. Default empty. |
59 * @type string $editor_class Extra classes to add to the editor textarea element. Default empty. |
60 * @type bool $teeny Whether to output the minimal editor config. Examples include |
60 * @type bool $teeny Whether to output the minimal editor config. Examples include |
61 * Press This and the Comment editor. Default false. |
61 * Press This and the Comment editor. Default false. |
62 * @type bool $dfw Deprecated in 4.1. Unused. |
62 * @type bool $dfw Deprecated in 4.1. Unused. |
182 if ( self::$this_tinymce ) { |
182 if ( self::$this_tinymce ) { |
183 $autocomplete = ' autocomplete="off"'; |
183 $autocomplete = ' autocomplete="off"'; |
184 |
184 |
185 if ( self::$this_quicktags ) { |
185 if ( self::$this_quicktags ) { |
186 $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor(); |
186 $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. |
188 if ( 'html' !== $default_editor ) { |
188 if ( 'html' !== $default_editor ) { |
189 $default_editor = 'tinymce'; |
189 $default_editor = 'tinymce'; |
190 } |
190 } |
191 |
191 $tmce_active = ( 'html' === $default_editor ) ? ' aria-pressed="true"' : ''; |
192 $buttons .= '<button type="button" id="' . $editor_id_attr . '-tmce" class="wp-switch-editor switch-tmce"' . |
192 $html_active = ( 'html' === $default_editor ) ? '' : ' aria-pressed="true"'; |
|
193 |
|
194 $buttons .= '<button type="button" id="' . $editor_id_attr . '-tmce"' . $html_active . ' class="wp-switch-editor switch-tmce"' . |
193 ' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Visual', 'Name for the Visual editor tab' ) . "</button>\n"; |
195 ' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Visual', 'Name for the Visual editor tab' ) . "</button>\n"; |
194 $buttons .= '<button type="button" id="' . $editor_id_attr . '-html" class="wp-switch-editor switch-html"' . |
196 $buttons .= '<button type="button" id="' . $editor_id_attr . '-html"' . $tmce_active . ' class="wp-switch-editor switch-html"' . |
195 ' 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"; |
196 } else { |
198 } else { |
197 $default_editor = 'tinymce'; |
199 $default_editor = 'tinymce'; |
198 } |
200 } |
199 } |
201 } |
200 |
202 |
268 $quicktags_toolbar . |
270 $quicktags_toolbar . |
269 '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr( $set['textarea_name'] ) . '" ' . |
271 '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr( $set['textarea_name'] ) . '" ' . |
270 'id="' . $editor_id_attr . '">%s</textarea></div>' |
272 'id="' . $editor_id_attr . '">%s</textarea></div>' |
271 ); |
273 ); |
272 |
274 |
273 // 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). |
274 if ( self::$this_tinymce ) { |
276 if ( self::$this_tinymce ) { |
275 add_filter( 'the_editor_content', 'format_for_editor', 10, 2 ); |
277 add_filter( 'the_editor_content', 'format_for_editor', 10, 2 ); |
276 } |
278 } |
277 |
279 |
278 /** |
280 /** |
1111 'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform', |
1113 'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform', |
1112 |
1114 |
1113 'end_container_on_empty_block' => true, |
1115 'end_container_on_empty_block' => true, |
1114 'wpeditimage_html5_captions' => true, |
1116 'wpeditimage_html5_captions' => true, |
1115 'wp_lang_attr' => get_bloginfo( 'language' ), |
1117 'wp_lang_attr' => get_bloginfo( 'language' ), |
1116 'wp_keep_scroll_position' => false, |
|
1117 'wp_shortcut_labels' => wp_json_encode( $shortcut_labels ), |
1118 'wp_shortcut_labels' => wp_json_encode( $shortcut_labels ), |
1118 ); |
1119 ); |
1119 |
1120 |
1120 $suffix = SCRIPT_DEBUG ? '' : '.min'; |
1121 $suffix = SCRIPT_DEBUG ? '' : '.min'; |
1121 $version = 'ver=' . get_bloginfo( 'version' ); |
1122 $version = 'ver=' . get_bloginfo( 'version' ); |
1393 'Edit|button' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar. |
1394 'Edit|button' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar. |
1394 'Paste URL or type to search' => __( 'Paste URL or type to search' ), // Placeholder for the inline link dialog. |
1395 'Paste URL or type to search' => __( 'Paste URL or type to search' ), // Placeholder for the inline link dialog. |
1395 'Apply' => __( 'Apply' ), // Tooltip for the 'apply' button in the inline link dialog. |
1396 'Apply' => __( 'Apply' ), // Tooltip for the 'apply' button in the inline link dialog. |
1396 'Link options' => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog. |
1397 'Link options' => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog. |
1397 'Visual' => _x( 'Visual', 'Name for the Visual editor tab' ), // Editor switch tab label. |
1398 'Visual' => _x( 'Visual', 'Name for the Visual editor tab' ), // Editor switch tab label. |
1398 'Text' => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), // Editor switch tab label. |
1399 'Code|tab' => _x( 'Code', 'Name for the Code editor tab (formerly Text)' ), // Editor switch tab label. |
1399 'Add Media' => array( __( 'Add Media' ), 'accessM' ), // Tooltip for the 'Add Media' button in the block editor Classic block. |
1400 'Add Media' => array( __( 'Add Media' ), 'accessM' ), // Tooltip for the 'Add Media' button in the block editor Classic block. |
1400 |
1401 |
1401 // Shortcuts help modal. |
1402 // Shortcuts help modal. |
1402 'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts' ), 'accessH' ), |
1403 'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts' ), 'accessH' ), |
1403 'Classic Block Keyboard Shortcuts' => __( 'Classic Block Keyboard Shortcuts' ), |
1404 'Classic Block Keyboard Shortcuts' => __( 'Classic Block Keyboard Shortcuts' ), |