- |
+ |
@@ -434,17 +433,32 @@ class Classic_Editor {
}
public static function network_settings() {
- $is_checked = ( get_network_option( null, 'classic-editor-allow-sites' ) === 'allow' );
+ $editor = get_network_option( null, 'classic-editor-replace' );
+ $is_checked = ( get_network_option( null, 'classic-editor-allow-sites' ) === 'allow' );
?>
+
@@ -457,6 +471,11 @@ class Classic_Editor {
current_user_can( 'manage_network_options' ) &&
wp_verify_nonce( $_POST['classic-editor-network-settings'], 'allow-site-admin-settings' )
) {
+ if ( isset( $_POST['classic-editor-replace'] ) && $_POST['classic-editor-replace'] === 'block' ) {
+ update_network_option( null, 'classic-editor-replace', 'block' );
+ } else {
+ update_network_option( null, 'classic-editor-replace', 'classic' );
+ }
if ( isset( $_POST['classic-editor-allow-sites'] ) && $_POST['classic-editor-allow-sites'] === 'allow' ) {
update_network_option( null, 'classic-editor-allow-sites', 'allow' );
} else {
@@ -472,7 +491,7 @@ class Classic_Editor {
if (
$pagenow !== 'about.php' ||
$settings['hide-settings-ui'] ||
- $settings['editor'] === 'block' ||
+ $settings['editor'] === 'block' ||
$settings['allow-users'] ||
! current_user_can( 'edit_posts' )
) {
@@ -485,7 +504,13 @@ class Classic_Editor {
$message = __( 'The Classic Editor plugin prevents use of the new Block Editor.', 'classic-editor' );
if ( current_user_can( 'manage_options' ) ) {
- $message .= ' ' . sprintf( __( 'Change the %1$sClassic Editor settings%2$s.', 'classic-editor' ), '', '' );
+ if ( is_network_admin() ) {
+ $url = 'settings.php#classic-editor-options';
+ } else {
+ $url = 'options-writing.php#classic-editor-options';
+ }
+
+ $message .= ' ' . sprintf( __( 'Change the %1$sClassic Editor settings%2$s.', 'classic-editor' ), sprintf( '', $url ), '' );
}
$margin = is_rtl() ? 'margin: 1em 0 0 160px;' : 'margin: 1em 160px 0 0;';
@@ -618,33 +643,25 @@ class Classic_Editor {
$id = 'classic-editor-switch-editor';
$title = __( 'Editor', 'classic-editor' );
$callback = array( __CLASS__, 'do_meta_box' );
- /* Add when the Block Editor plugin is enabled.
$args = array(
'__back_compat_meta_box' => true,
);
- */
- add_meta_box( $id, $title, $callback, null, 'side', 'default' );
+ add_meta_box( $id, $title, $callback, null, 'side', 'default', $args );
}
public static function do_meta_box( $post ) {
$edit_url = get_edit_post_link( $post->ID, 'raw' );
- if ( did_action( 'enqueue_block_editor_assets' ) ) {
- // Block Editor is loading, switch to Classic Editor.
- $edit_url = add_query_arg( 'classic-editor', '', $edit_url );
- $link_text = __( 'Switch to Classic Editor', 'classic-editor' );
- } else {
- // Switch to Block Editor.
- $edit_url = remove_query_arg( 'classic-editor', $edit_url );
- $link_text = __( 'Switch to Block Editor', 'classic-editor' );
- }
-
+ // Switching to Block Editor.
+ $edit_url = remove_query_arg( 'classic-editor', $edit_url );
// Forget the previous value when going to a specific editor.
$edit_url = add_query_arg( 'classic-editor__forget', '', $edit_url );
?>
-
+
+
+
__( 'Switch to Classic Editor', 'classic-editor' ) )
);
@@ -678,7 +695,15 @@ class Classic_Editor {
$settings = self::get_settings();
if ( $file === 'classic-editor/classic-editor.php' && ! $settings['hide-settings-ui'] && current_user_can( 'manage_options' ) ) {
- (array) $links[] = sprintf( '%s', admin_url( 'options-writing.php#classic-editor-options' ), __( 'Settings', 'classic-editor' ) );
+ if ( current_filter() === 'plugin_action_links' ) {
+ $url = admin_url( 'options-writing.php#classic-editor-options' );
+ } else {
+ $url = admin_url( '/network/settings.php#classic-editor-options' );
+ }
+
+ // Prevent warnings in PHP 7.0+ when a plugin uses this filter incorrectly.
+ $links = (array) $links;
+ $links[] = sprintf( '%s', $url, __( 'Settings', 'classic-editor' ) );
}
return $links;
@@ -793,14 +818,14 @@ class Classic_Editor {
// Link to the Block Editor.
$url = remove_query_arg( 'classic-editor', $edit_url );
- $text = _x( 'Block Editor', 'Editor Name', 'classic-editor' );
+ $text = _x( 'Edit (Block Editor)', 'Editor Name', 'classic-editor' );
/* translators: %s: post title */
$label = sprintf( __( 'Edit “%s” in the Block Editor', 'classic-editor' ), $title );
$edit_block = sprintf( '%s', esc_url( $url ), esc_attr( $label ), $text );
// Link to the Classic Editor.
$url = add_query_arg( 'classic-editor', '', $edit_url );
- $text = _x( 'Classic Editor', 'Editor Name', 'classic-editor' );
+ $text = _x( 'Edit (Classic Editor)', 'Editor Name', 'classic-editor' );
/* translators: %s: post title */
$label = sprintf( __( 'Edit “%s” in the Classic Editor', 'classic-editor' ), $title );
$edit_classic = sprintf( '%s', esc_url( $url ), esc_attr( $label ), $text );
@@ -884,6 +909,7 @@ class Classic_Editor {
*/
public static function activate() {
if ( is_multisite() ) {
+ add_network_option( null, 'classic-editor-replace', 'classic' );
add_network_option( null, 'classic-editor-allow-sites', 'disallow' );
}
@@ -896,6 +922,7 @@ class Classic_Editor {
*/
public static function uninstall() {
if ( is_multisite() ) {
+ delete_network_option( null, 'classic-editor-replace' );
delete_network_option( null, 'classic-editor-allow-sites' );
}
diff --git a/wp-content/plugins/classic-editor/js/block-editor-plugin.js b/wp-content/plugins/classic-editor/js/block-editor-plugin.js
index 39889e6f6e944834849c130e908b18f9c9016174..a3d76b23eafe16daeea00147f99e7ec5eb619ba5 100644
--- a/wp-content/plugins/classic-editor/js/block-editor-plugin.js
+++ b/wp-content/plugins/classic-editor/js/block-editor-plugin.js
@@ -1,23 +1,23 @@
-( function() {
- const { get } = lodash;
- const { createElement } = wp.element;
- const { PluginMoreMenuItem } = wp.editPost;
- const { addQueryArgs } = wp.url;
- const { registerPlugin } = wp.plugins;
+( function( wp ) {
+ if ( ! wp ) {
+ return;
+ }
- registerPlugin( 'classic-editor-add-submenu', {
+ wp.plugins.registerPlugin( 'classic-editor-plugin', {
render() {
- const url = addQueryArgs( document.location.href, { 'classic-editor': null } );
- const linkText = get( window, [ 'classicEditorPluginL10n', 'linkText' ] ) || 'Switch to Classic Editor';
+ var createElement = wp.element.createElement;
+ var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;
+ var url = wp.url.addQueryArgs( document.location.href, { 'classic-editor': '', 'classic-editor__forget': '' } );
+ var linkText = lodash.get( window, [ 'classicEditorPluginL10n', 'linkText' ] ) || 'Switch to Classic Editor';
return createElement(
PluginMoreMenuItem,
{
icon: 'editor-kitchensink',
- url: url,
+ href: url,
},
linkText
);
},
} );
-} )();
+} )( window.wp );
diff --git a/wp-content/plugins/classic-editor/readme.txt b/wp-content/plugins/classic-editor/readme.txt
index cabf5512de55c572fbc345e0d50a1f6564aa175e..55e709fef9bfd4ee58fee6f7a0c9f174140bd3c6 100644
--- a/wp-content/plugins/classic-editor/readme.txt
+++ b/wp-content/plugins/classic-editor/readme.txt
@@ -29,6 +29,12 @@ By default, this plugin hides all functionality available in the new Block Edito
== Changelog ==
+= 1.4 =
+* On network installations removed the restriction for only network activation.
+* Added support for network administrators to choose the default network-wide editor.
+* Fixed the settings link in the warning on network About screen.
+* Properly added the "Switch to Classic Editor" menu item to the Block Editor menu.
+
= 1.3 =
* Fixed removal of the "Try Gutenberg" dashboard widget.
* Fixed condition for displaying of the after upgrade notice on the "What's New" screen. Shown when the Classic Editor is selected and users cannot switch editors.
@@ -79,10 +85,30 @@ Fixed a bug where it may attempt to load the Block Editor for post types that do
= 0.1 =
Initial release.
+== Frequently Asked Questions ==
+
+= Default settings =
+
+When activated this plugin will restore the previous ("classic") WordPress editor and hide the new Block Editor ("Gutenberg").
+These settings can be changed at the Settings => Writing screen.
+
+= Default settings for network installation =
+
+There are two options:
+
+* When network-activated this plugin will set the Classic Editor as default and prevent site administrators and users from changing editors.
+The settings can be changed and default network-wide editor can be selected on the Network Settings screen.
+* When not network-activated each site administrator will be able to activate the plugin and choose options for their users.
+
+= Cannot find the "Switch to Classic Editor" link =
+
+It is in the main Block Editor menu, see this [screenshot](https://ps.w.org/classic-editor/assets/screenshot-7.png?rev=2023480).
+
== Screenshots ==
1. Admin settings on the Settings -> Writing screen.
2. User settings on the Profile screen. Visible when the users are allowed to switch editors.
3. "Action links" to choose alternative editor. Visible when the users are allowed to switch editors.
4. Link to switch to the Block Editor while editing a post in the Classic Editor. Visible when the users are allowed to switch editors.
5. Link to switch to the Classic Editor while editing a post in the Block Editor. Visible when the users are allowed to switch editors.
-6. Network setting to allow site admins to change the default options.
+6. Network settings to select the default editor for the network and allow site admins to change it.
+7. The "Switch to Classic Editor" link.
|