Make WordPress Core

Ticket #29838: 29838.diff

File 29838.diff, 5.9 KB (added by afercia, 10 months ago)
Line 
1Index: src/js/_enqueues/admin/post.js
2===================================================================
3--- src/js/_enqueues/admin/post.js      (revision 57158)
4+++ src/js/_enqueues/admin/post.js      (working copy)
5@@ -434,25 +434,6 @@
6                $previewField.val('');
7        });
8 
9-       // This code is meant to allow tabbing from Title to Post content.
10-       $('#title').on( 'keydown.editor-focus', function( event ) {
11-               var editor;
12-
13-               if ( event.keyCode === 9 && ! event.ctrlKey && ! event.altKey && ! event.shiftKey ) {
14-                       editor = typeof tinymce != 'undefined' && tinymce.get('content');
15-
16-                       if ( editor && ! editor.isHidden() ) {
17-                               editor.focus();
18-                       } else if ( $textarea.length ) {
19-                               $textarea.trigger( 'focus' );
20-                       } else {
21-                               return;
22-                       }
23-
24-                       event.preventDefault();
25-               }
26-       });
27-
28        // Auto save new posts after a title is typed.
29        if ( $( '#auto_draft' ).val() ) {
30                $( '#title' ).on( 'blur', function() {
31Index: src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js
32===================================================================
33--- src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js (revision 57158)
34+++ src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js (working copy)
35@@ -1074,6 +1074,16 @@
36                        }
37                } );
38 
39+               editor.on( 'keydown', function( event ) {
40+                       if ( event.keyCode === 9 && event.shiftKey ) {
41+                               var toolbar = editor.theme.panel.find( '.toolbar:not(.menubar)' )[0];
42+                               if ( toolbar ) {
43+                                       toolbar.focus( true );
44+                               }
45+                       }
46+               });
47+
48                editor.on( 'nodechange', function( event ) {
49                        var collapsed = editor.selection.isCollapsed();
50 
51Index: src/js/_enqueues/wp/editor/base.js
52===================================================================
53--- src/js/_enqueues/wp/editor/base.js  (revision 57158)
54+++ src/js/_enqueues/wp/editor/base.js  (working copy)
55@@ -103,19 +103,9 @@
56 
57                                editorHeight = parseInt( textarea.style.height, 10 ) || 0;
58 
59-                               var keepSelection = false;
60-                               if ( editor ) {
61-                                       keepSelection = editor.getParam( 'wp_keep_scroll_position' );
62-                               } else {
63-                                       keepSelection = window.tinyMCEPreInit.mceInit[ id ] &&
64-                                                                       window.tinyMCEPreInit.mceInit[ id ].wp_keep_scroll_position;
65-                               }
66+                               // Save the selection.
67+                               addHTMLBookmarkInTextAreaContent( $textarea );
68 
69-                               if ( keepSelection ) {
70-                                       // Save the selection.
71-                                       addHTMLBookmarkInTextAreaContent( $textarea );
72-                               }
73-
74                                if ( editor ) {
75                                        editor.show();
76 
77@@ -129,11 +119,8 @@
78                                                        editor.theme.resizeTo( null, editorHeight );
79                                                }
80                                        }
81-
82-                                       if ( editor.getParam( 'wp_keep_scroll_position' ) ) {
83-                                               // Restore the selection.
84-                                               focusHTMLBookmarkInVisualEditor( editor );
85-                                       }
86+                                       // Restore the selection.
87+                                       focusHTMLBookmarkInVisualEditor( editor );
88                                } else {
89                                        tinymce.init( window.tinyMCEPreInit.mceInit[ id ] );
90                                }
91@@ -168,9 +155,7 @@
92 
93                                        var selectionRange = null;
94 
95-                                       if ( editor.getParam( 'wp_keep_scroll_position' ) ) {
96-                                               selectionRange = findBookmarkedPosition( editor );
97-                                       }
98+                                       selectionRange = findBookmarkedPosition( editor );
99 
100                                        editor.hide();
101 
102@@ -520,7 +505,7 @@
103                 * Focuses the selection markers in Visual mode.
104                 *
105                 * The method checks for existing selection markers inside the editor DOM (Visual mode)
106-                * and create a selection between the two nodes using the DOM `createRange` selection API
107+                * and create a selection between the two nodes using the DOM `createRange` selection API.
108                 *
109                 * If there is only a single node, select only the single node through TinyMCE's selection API
110                 *
111@@ -545,9 +530,7 @@
112                                }
113                        }
114 
115-                       if ( editor.getParam( 'wp_keep_scroll_position' ) ) {
116-                               scrollVisualModeToStartElement( editor, startNode );
117-                       }
118+                       scrollVisualModeToStartElement( editor, startNode );
119 
120                        removeSelectionMarker( startNode );
121                        removeSelectionMarker( endNode );
122Index: src/wp-admin/edit-form-advanced.php
123===================================================================
124--- src/wp-admin/edit-form-advanced.php (revision 57158)
125+++ src/wp-admin/edit-form-advanced.php (working copy)
126@@ -621,13 +621,11 @@
127                array(
128                        '_content_editor_dfw' => $_content_editor_dfw,
129                        'drag_drop_upload'    => true,
130-                       'tabfocus_elements'   => 'content-html,save-post',
131                        'editor_height'       => 300,
132                        'tinymce'             => array(
133                                'resize'                  => false,
134                                'wp_autoresize_on'        => $_wp_editor_expand,
135                                'add_unload_trigger'      => false,
136-                               'wp_keep_scroll_position' => ! $is_IE,
137                        ),
138                )
139        );
140Index: src/wp-includes/class-wp-editor.php
141===================================================================
142--- src/wp-includes/class-wp-editor.php (revision 57158)
143+++ src/wp-includes/class-wp-editor.php (working copy)
144@@ -1111,7 +1111,6 @@
145                        'end_container_on_empty_block' => true,
146                        'wpeditimage_html5_captions'   => true,
147                        'wp_lang_attr'                 => get_bloginfo( 'language' ),
148-                       'wp_keep_scroll_position'      => false,
149                        'wp_shortcut_labels'           => wp_json_encode( $shortcut_labels ),
150                );
151 
152Index: src/wp-includes/css/editor.css
153===================================================================
154--- src/wp-includes/css/editor.css      (revision 57158)
155+++ src/wp-includes/css/editor.css      (working copy)
156@@ -537,7 +537,7 @@
157 
158 .mce-toolbar .mce-btn-group .mce-btn.mce-listbox:hover,
159 .mce-toolbar .mce-btn-group .mce-btn.mce-listbox:focus {
160-       border-color: #c3c4c7;
161+       border-color: #50575e;
162 }
163 
164 .mce-panel .mce-btn i.mce-caret {
165@@ -1130,23 +1130,17 @@
166        border: 1px solid #dcdcde;
167 }
168 
169-.wp-switch-editor:focus {
170+.wp-switch-editor:focus-visible {
171        box-shadow:
172                0 0 0 1px #4f94d4,
173                0 0 2px 1px rgba(79, 148, 212, 0.8);
174-       outline: none;
175+       /* Only visible in Windows High Contrast mode */
176+       outline: 2px solid transparent;
177        color: #1d2327;
178 }
179 
180-.wp-switch-editor:active,
181-.html-active .switch-html:focus,
182-.tmce-active .switch-tmce:focus {
183-       box-shadow: none;
184-}
185-
186 .wp-switch-editor:active {
187        background-color: #f6f7f7;
188-       box-shadow: none;
189 }
190 
191 .js .tmce-active .wp-editor-area {