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.
Merges [51768] to the 5.8 branch.
Fixes #53762.

Built from https://develop.svn.wordpress.org/branches/5.8@51770


git-svn-id: http://core.svn.wordpress.org/branches/5.8@51377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2021-09-09 02:00:57 +00:00
parent 71adb4a0bf
commit 3744b979ad
12 changed files with 27 additions and 31 deletions

View File

@ -33,7 +33,7 @@
$sideSortables = $( '#side-sortables' ), $sideSortables = $( '#side-sortables' ),
$postboxContainer = $( '#postbox-container-1' ), $postboxContainer = $( '#postbox-container-1' ),
$postBody = $('#post-body'), $postBody = $('#post-body'),
fullscreen = window.wp.oldEditor && window.wp.oldEditor.fullscreen, fullscreen = window.wp.editor && window.wp.editor.fullscreen,
mceEditor, mceEditor,
mceBind = function(){}, mceBind = function(){},
mceUnbind = function(){}, mceUnbind = function(){},
@ -1603,8 +1603,8 @@
} }
window.wp = window.wp || {}; window.wp = window.wp || {};
window.wp.oldEditor = window.wp.oldEditor || {}; window.wp.editor = window.wp.editor || {};
window.wp.oldEditor.dfw = { window.wp.editor.dfw = {
activate: activate, activate: activate,
deactivate: deactivate, deactivate: deactivate,
isActive: isActive, isActive: isActive,

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
window.wp = window.wp || {}; window.wp = window.wp || {};
( function( $, wp ) { ( function( $, wp ) {
wp.editor = wp.oldEditor = wp.oldEditor || {}; wp.editor = wp.editor || {};
/** /**
* Utility functions for the editor. * Utility functions for the editor.
@ -1191,8 +1191,8 @@ window.wp = window.wp || {};
} ); } );
} }
wp.oldEditor.autop = wpautop; wp.editor.autop = wpautop;
wp.oldEditor.removep = pre_wpautop; wp.editor.removep = pre_wpautop;
exports = { exports = {
go: switchEditor, go: switchEditor,
@ -1241,15 +1241,15 @@ window.wp = window.wp || {};
* } * }
* } * }
*/ */
wp.oldEditor.initialize = function( id, settings ) { wp.editor.initialize = function( id, settings ) {
var init; var init;
var defaults; var defaults;
if ( ! $ || ! id || ! wp.oldEditor.getDefaultSettings ) { if ( ! $ || ! id || ! wp.editor.getDefaultSettings ) {
return; return;
} }
defaults = wp.oldEditor.getDefaultSettings(); defaults = wp.editor.getDefaultSettings();
// Initialize TinyMCE by default. // Initialize TinyMCE by default.
if ( ! settings ) { if ( ! settings ) {
@ -1349,13 +1349,13 @@ window.wp = window.wp || {};
/** /**
* Remove one editor instance. * Remove one editor instance.
* *
* Intended for use with editors that were initialized with wp.oldEditor.initialize(). * Intended for use with editors that were initialized with wp.editor.initialize().
* *
* @since 4.8.0 * @since 4.8.0
* *
* @param {string} id The HTML id of the editor textarea. * @param {string} id The HTML id of the editor textarea.
*/ */
wp.oldEditor.remove = function( id ) { wp.editor.remove = function( id ) {
var mceInstance, qtInstance, var mceInstance, qtInstance,
$wrap = $( '#wp-' + id + '-wrap' ); $wrap = $( '#wp-' + id + '-wrap' );
@ -1388,14 +1388,14 @@ window.wp = window.wp || {};
/** /**
* Get the editor content. * Get the editor content.
* *
* Intended for use with editors that were initialized with wp.oldEditor.initialize(). * Intended for use with editors that were initialized with wp.editor.initialize().
* *
* @since 4.8.0 * @since 4.8.0
* *
* @param {string} id The HTML id of the editor textarea. * @param {string} id The HTML id of the editor textarea.
* @return The editor content. * @return The editor content.
*/ */
wp.oldEditor.getContent = function( id ) { wp.editor.getContent = function( id ) {
var editor; var editor;
if ( ! $ || ! id ) { if ( ! $ || ! id ) {

File diff suppressed because one or more lines are too long

View File

@ -970,11 +970,7 @@ final class _WP_Editors {
<script type="text/javascript"> <script type="text/javascript">
window.wp = window.wp || {}; window.wp = window.wp || {};
window.wp.editor = window.wp.editor || {}; window.wp.editor = window.wp.editor || {};
window.wp.oldEditor = window.wp.oldEditor || {}; window.wp.editor.getDefaultSettings = function() {
// Add getDefaultSettings() to both wp.editor and wp.oldEditor for back compat.
// Use of wp.editor for "old editor" functionality should be deprecated.
window.wp.editor.getDefaultSettings = window.wp.oldEditor.getDefaultSettings = function() {
return { return {
tinymce: <?php echo $settings; ?>, tinymce: <?php echo $settings; ?>,
quicktags: { quicktags: {

View File

@ -3524,7 +3524,7 @@ function wp_editor( $content, $editor_id, $settings = array() ) {
* Outputs the editor scripts, stylesheets, and default settings. * Outputs the editor scripts, stylesheets, and default settings.
* *
* The editor can be initialized when needed after page load. * The editor can be initialized when needed after page load.
* See wp.oldEditor.initialize() in wp-admin/js/editor.js for initialization options. * See wp.editor.initialize() in wp-admin/js/editor.js for initialization options.
* *
* @uses _WP_Editors * @uses _WP_Editors
* @since 4.8.0 * @since 4.8.0

View File

@ -435,7 +435,7 @@ window.edToolbar = function(){};
ariaLabel = this.attr && this.attr.ariaLabel ? ' aria-label="' + _escape( this.attr.ariaLabel ) + '"' : '', ariaLabel = this.attr && this.attr.ariaLabel ? ' aria-label="' + _escape( this.attr.ariaLabel ) + '"' : '',
val = this.display ? ' value="' + _escape( this.display ) + '"' : '', val = this.display ? ' value="' + _escape( this.display ) + '"' : '',
id = this.id ? ' id="' + _escape( idPrefix + this.id ) + '"' : '', id = this.id ? ' id="' + _escape( idPrefix + this.id ) + '"' : '',
dfw = ( wp = window.wp ) && wp.oldEditor && wp.oldEditor.dfw; dfw = ( wp = window.wp ) && wp.editor && wp.editor.dfw;
if ( this.id === 'fullscreen' ) { if ( this.id === 'fullscreen' ) {
return '<button type="button"' + id + ' class="ed_button qt-dfw qt-fullscreen"' + title + ariaLabel + '></button>'; return '<button type="button"' + id + ' class="ed_button qt-dfw qt-fullscreen"' + title + ariaLabel + '></button>';
@ -681,11 +681,11 @@ window.edToolbar = function(){};
qt.DFWButton.prototype.callback = function() { qt.DFWButton.prototype.callback = function() {
var wp; var wp;
if ( ! ( wp = window.wp ) || ! wp.oldEditor || ! wp.oldEditor.dfw ) { if ( ! ( wp = window.wp ) || ! wp.editor || ! wp.editor.dfw ) {
return; return;
} }
window.wp.oldEditor.dfw.toggle(); window.wp.editor.dfw.toggle();
}; };
qt.TextDirectionButton = function() { qt.TextDirectionButton = function() {

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
__ = editor.editorManager.i18n.translate, __ = editor.editorManager.i18n.translate,
$ = window.jQuery, $ = window.jQuery,
wp = window.wp, wp = window.wp,
hasWpautop = ( wp && wp.oldEditor && wp.oldEditor.autop && editor.getParam( 'wpautop', true ) ), hasWpautop = ( wp && wp.editor && wp.editor.autop && editor.getParam( 'wpautop', true ) ),
wpTooltips = false; wpTooltips = false;
if ( $ ) { if ( $ ) {
@ -130,7 +130,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
if ( event.load && event.format !== 'raw' ) { if ( event.load && event.format !== 'raw' ) {
if ( hasWpautop ) { if ( hasWpautop ) {
event.content = wp.oldEditor.autop( event.content ); event.content = wp.editor.autop( event.content );
} else { } else {
// Prevent creation of paragraphs out of multiple HTML comments. // Prevent creation of paragraphs out of multiple HTML comments.
event.content = event.content.replace( /-->\s+<!--/g, '--><!--' ); event.content = event.content.replace( /-->\s+<!--/g, '--><!--' );
@ -601,7 +601,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
event.content = event.content.replace( /<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g, '<p>&nbsp;</p>' ); event.content = event.content.replace( /<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g, '<p>&nbsp;</p>' );
if ( hasWpautop ) { if ( hasWpautop ) {
event.content = wp.oldEditor.removep( event.content ); event.content = wp.editor.removep( event.content );
} else { } else {
// Restore formatting of block boundaries. // Restore formatting of block boundaries.
event.content = event.content.replace( /-->\s*<!-- wp:/g, '-->\n\n<!-- wp:' ); event.content = event.content.replace( /-->\s*<!-- wp:/g, '-->\n\n<!-- wp:' );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.8.1-RC1-51767'; $wp_version = '5.8.1-RC1-51770';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.