Make WordPress Core

Changeset 51768


Ignore:
Timestamp:
09/08/2021 11:28:43 PM (3 years ago)
Author:
azaozz
Message:

Editor: Revert [51748] and [51649]. They intorduced a bug where wp.editor may be replaced with wp.oldEditor in certain cases.

Props desrosj, davidbinda, azaozz.
Fixes #53762.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/quicktags.js

    r51649 r51768  
    436436            val = this.display ? ' value="' + _escape( this.display ) + '"' : '',
    437437            id = this.id ? ' id="' + _escape( idPrefix + this.id ) + '"' : '',
    438             dfw = ( wp = window.wp ) && wp.oldEditor && wp.oldEditor.dfw;
     438            dfw = ( wp = window.wp ) && wp.editor && wp.editor.dfw;
    439439
    440440        if ( this.id === 'fullscreen' ) {
     
    682682        var wp;
    683683
    684         if ( ! ( wp = window.wp ) || ! wp.oldEditor || ! wp.oldEditor.dfw ) {
     684        if ( ! ( wp = window.wp ) || ! wp.editor || ! wp.editor.dfw ) {
    685685            return;
    686686        }
    687687
    688         window.wp.oldEditor.dfw.toggle();
     688        window.wp.editor.dfw.toggle();
    689689    };
    690690
  • trunk/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js

    r51649 r51768  
    1313        $ = window.jQuery,
    1414        wp = window.wp,
    15         hasWpautop = ( wp && wp.oldEditor && wp.oldEditor.autop && editor.getParam( 'wpautop', true ) ),
     15        hasWpautop = ( wp && wp.editor && wp.editor.autop && editor.getParam( 'wpautop', true ) ),
    1616        wpTooltips = false;
    1717
     
    131131            if ( event.load && event.format !== 'raw' ) {
    132132                if ( hasWpautop ) {
    133                     event.content = wp.oldEditor.autop( event.content );
     133                    event.content = wp.editor.autop( event.content );
    134134                } else {
    135135                    // Prevent creation of paragraphs out of multiple HTML comments.
     
    602602
    603603        if ( hasWpautop ) {
    604             event.content = wp.oldEditor.removep( event.content );
     604            event.content = wp.editor.removep( event.content );
    605605        } else {
    606606            // Restore formatting of block boundaries.
  • trunk/src/js/_enqueues/wp/editor/base.js

    r51649 r51768  
    66
    77( function( $, wp ) {
    8     wp.editor = wp.oldEditor = wp.oldEditor || {};
     8    wp.editor = wp.editor || {};
    99
    1010    /**
     
    11921192        }
    11931193
    1194         wp.oldEditor.autop = wpautop;
    1195         wp.oldEditor.removep = pre_wpautop;
     1194        wp.editor.autop = wpautop;
     1195        wp.editor.removep = pre_wpautop;
    11961196
    11971197        exports = {
     
    12421242     * }
    12431243     */
    1244     wp.oldEditor.initialize = function( id, settings ) {
     1244    wp.editor.initialize = function( id, settings ) {
    12451245        var init;
    12461246        var defaults;
    12471247
    1248         if ( ! $ || ! id || ! wp.oldEditor.getDefaultSettings ) {
     1248        if ( ! $ || ! id || ! wp.editor.getDefaultSettings ) {
    12491249            return;
    12501250        }
    12511251
    1252         defaults = wp.oldEditor.getDefaultSettings();
     1252        defaults = wp.editor.getDefaultSettings();
    12531253
    12541254        // Initialize TinyMCE by default.
     
    13501350     * Remove one editor instance.
    13511351     *
    1352      * Intended for use with editors that were initialized with wp.oldEditor.initialize().
     1352     * Intended for use with editors that were initialized with wp.editor.initialize().
    13531353     *
    13541354     * @since 4.8.0
     
    13561356     * @param {string} id The HTML id of the editor textarea.
    13571357     */
    1358     wp.oldEditor.remove = function( id ) {
     1358    wp.editor.remove = function( id ) {
    13591359        var mceInstance, qtInstance,
    13601360            $wrap = $( '#wp-' + id + '-wrap' );
     
    13891389     * Get the editor content.
    13901390     *
    1391      * Intended for use with editors that were initialized with wp.oldEditor.initialize().
     1391     * Intended for use with editors that were initialized with wp.editor.initialize().
    13921392     *
    13931393     * @since 4.8.0
     
    13961396     * @return The editor content.
    13971397     */
    1398     wp.oldEditor.getContent = function( id ) {
     1398    wp.editor.getContent = function( id ) {
    13991399        var editor;
    14001400
  • trunk/src/js/_enqueues/wp/editor/dfw.js

    r51649 r51768  
    3434            $postboxContainer = $( '#postbox-container-1' ),
    3535            $postBody = $('#post-body'),
    36             fullscreen = window.wp.oldEditor && window.wp.oldEditor.fullscreen,
     36            fullscreen = window.wp.editor && window.wp.editor.fullscreen,
    3737            mceEditor,
    3838            mceBind = function(){},
     
    16041604
    16051605        window.wp = window.wp || {};
    1606         window.wp.oldEditor = window.wp.oldEditor || {};
    1607         window.wp.oldEditor.dfw = {
     1606        window.wp.editor = window.wp.editor || {};
     1607        window.wp.editor.dfw = {
    16081608            activate: activate,
    16091609            deactivate: deactivate,
  • trunk/src/wp-includes/class-wp-editor.php

    r51748 r51768  
    971971        window.wp = window.wp || {};
    972972        window.wp.editor = window.wp.editor || {};
    973         window.wp.oldEditor = window.wp.oldEditor || {};
    974 
    975         // Add getDefaultSettings() to both wp.editor and wp.oldEditor for back compat.
    976         // Use of wp.editor for "old editor" functionality should be deprecated.
    977         window.wp.editor.getDefaultSettings = window.wp.oldEditor.getDefaultSettings = function() {
     973        window.wp.editor.getDefaultSettings = function() {
    978974            return {
    979975                tinymce: <?php echo $settings; ?>,
  • trunk/src/wp-includes/general-template.php

    r51649 r51768  
    35253525 *
    35263526 * The editor can be initialized when needed after page load.
    3527  * See wp.oldEditor.initialize() in wp-admin/js/editor.js for initialization options.
     3527 * See wp.editor.initialize() in wp-admin/js/editor.js for initialization options.
    35283528 *
    35293529 * @uses _WP_Editors
Note: See TracChangeset for help on using the changeset viewer.