Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #52440, comment 28


Ignore:
Timestamp:
02/05/2021 08:39:10 PM (4 years ago)
Author:
hwk-fr
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #52440, comment 28

    v1 v2  
    44- [https://core.trac.wordpress.org/raw-attachment/ticket/52440/2021-02-05_19h21_41.mp4 Video: Final Fix Behavior]
    55
    6 In the file `wp-includes/js/autosave.js:704`, rewrite the `postChanged()` to:
     6For Core developers: In the file `wp-includes/js/autosave.js:709`, rewrite the `window.tinymce.each` loop to:
    77
    88{{{#!js
    9 function postChanged() {
    10     var changed = false;
     9window.tinymce.each( [ 'content', 'excerpt' ], function( field ) {
     10    var editor = window.tinymce.get( field );
    1111
    12     // If there are TinyMCE instances, loop through them.
    13     if ( window.tinymce ) {
    14         window.tinymce.each( [ 'content', 'excerpt' ], function( field ) {
    15             var editor = window.tinymce.get( field );
    16 
    17             if ( ( editor && editor.isDirty() ) || ( $( '#' + field ).val() || '' ) !== initialCompareData[ field ] ) {
    18                 changed = true;
    19                 return false;
    20             }
    21 
    22         } );
    23 
    24         if ( $( '#title' ).val() !== initialCompareData.post_title ) {
    25             changed = true;
    26         }
    27 
    28         return changed;
     12    if ( ( editor && editor.isDirty() ) || ( $( '#' + field ).val() || '' ) !== initialCompareData[ field ] ) {
     13        changed = true;
     14        return false;
    2915    }
    3016
    31     return getCompareString() !== initialCompareString;
    32 }
     17} );
    3318}}}
    3419
    35 Standalone fix for webmasters: In the `functions.php` file, add the following code.
     20For Webmasters: Here is the Standalone Fix. In the `functions.php` file, add the following code.
    3621
    3722{{{#!php