wordpress编辑器_如何在WordPress中禁用全屏编辑器

wordpress编辑器

Do you want to disable the fullscreen editor in WordPress?

您是否要在WordPress中禁用全屏编辑器?

After the update, WordPress 5.4 now opens the post and page editor in fullscreen mode by default. While this distraction-free mode offers a clean and easy to use experience, some users may want to go back to the regular compact view.

更新后, WordPress 5.4现在默认情况下以全屏模式打开帖子和页面编辑器。 尽管这种无干扰的模式提供了干净且易于使用的体验,但某些用户可能希望返回常规的紧凑视图。

In this article, we’ll show you how to easily disable the fullscreen editor in WordPress.

在本文中,我们将向您展示如何轻松地在WordPress中禁用全屏编辑器。

Turning off the fullscreen mode in WordPress post editor
为什么WordPress会切换到编辑器的全屏模式? (Why WordPress Switched to Fullscreen Mode for The Editor?)

WordPress introduced a new editor called The Block Editor (aka Gutenberg) in WordPress 5.0. This new editor allow users to use blocks for common elements and create beautiful content layouts.

WordPress在WordPress 5.0中引入了一个名为The Block Editor (又名Gutenberg)的新编辑 。 这个新的编辑器允许用户将块用于通用元素并创建漂亮的内容布局。

It also mimics how your article or pages will look by using the same fonts and colors as your WordPress theme.

它还使用与WordPress主题相同的字体和颜色来模仿您的文章或页面的外观。

However, an admin menu on the left and one on top made it look a bit cluttered. There were just too many options on the screen, which you don’t need if you are focusing on writing content.

但是,左侧的管理菜单和顶部的管理菜单显得有些混乱。 屏幕上有太多选项,如果您专注于编写内容,则不需要这些选项。

WordPress editor without fullscreen mode

To deal with this, the WordPress core team decided to make the editor fullscreen by default, so users can have a distraction-free writing experience.

为了解决这个问题,WordPress核心团队决定默认使编辑器为全屏显示,以便用户可以享受无干扰的写作体验。

Fullscreen editor in WordPress

Now, it’s important to note that this fullscreen mode is nothing new. It was already there, and users were able to turn it on / off.

现在,需要注意的是,这种全屏模式并不是什么新鲜事物。 它已经在那里,用户可以打开/关闭它。

What’s changed now is that the fullscreen mode will now be the default view when writing posts in WordPress.

现在更改的是,当在WordPress中撰写帖子时,全屏模式将成为默认视图。

如何为WordPress编辑器禁用全屏模式(简便方法) (How to Disable The Fullscreen Mode for WordPress Editor (Easy Way))

It is super easy to turn off the fullscreen mode for block editor in WordPress.

关闭WordPress中块编辑器的全屏模式非常容易。

Simply edit a post or page and click on the three-dot menu on the top-right corner of the screen. This will display the settings menu for the post editor.

只需编辑帖子或页面,然后单击屏幕右上角的三点菜单。 这将显示帖子编辑器的设置菜单。

From here, you simply need to click on the ‘Fullscreen Mode’ to turn it off.

从这里,您只需要单击“全屏模式”将其关闭。

Turn off fullscreen mode in WordPress

Post editor will instantly exit the fullscreen mode, and it will start showing the admin sidebar and the top toolbar.

帖子编辑器将立即退出全屏模式,并开始显示管理员侧边栏和顶部工具栏。

Exiting fullscreen mode

WordPress will store your fullscreen mode preference in your browser’s temporary storage.

WordPress会将您的全屏模式首选项存储在浏览器的临时存储中。

However if you switched to a different browser, used incognito mode, or accessed the admin area from a different device, then you’ll again see the fullscreen editor.

但是,如果您切换到其他浏览器,使用隐身模式或从其他设备访问管理区域,那么您将再次看到全屏编辑器。

If you use multiple devices, user accounts, or browsers to access your WordPress admin area, then this may be a little annoying to switch it back every time.

如果您使用多个设备,用户帐户或浏览器访问WordPress管理区域,那么每次将其切换回原来的位置可能会有些烦人。

This next method helps you fix that, permanently.

下一个方法可帮助您永久修复该问题。

永久禁用WordPress中的全屏模式(摘要) (Permanently Disable Fullscreen Mode in WordPress (Snippet))

This method requires you to manually add code to your WordPress site. If you have not done this before, then see our guide on how to easily add code snippets in WordPress.

此方法要求您手动将代码添加到WordPress网站。 如果您以前没有做过,请参阅我们的指南, 了解如何在WordPress中轻松添加代码段

You’ll need to simply enter the following code in your WordPress theme’s functions.php file, or in a site-specific plugin. You can also use the custom code snippets plugin to add this code to your site without conflicts.

您只需要在WordPress主题的functions.php文件或特定站点的插件中输入以下代码即可。 您还可以使用自定义代码段插件将该代码添加到您的网站中,而不会发生冲突。


if (is_admin()) { 
	function jba_disable_editor_fullscreen_by_default() {
	$script = "jQuery( window ).load(function() { const isFullscreenMode = wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ); if ( isFullscreenMode ) { wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' ); } });";
	wp_add_inline_script( 'wp-blocks', $script );
}
add_action( 'enqueue_block_editor_assets', 'jba_disable_editor_fullscreen_by_default' );
}

This code first checks if a user is viewing an admin area page. If they are, then it checks the status of the fullscreen editor.

此代码首先检查用户是否正在查看管理区域页面。 如果是这样,则它将检查全屏编辑器的状态。

If the fullscreen editor is enabled, then it simply turns it off.

如果启用了全屏编辑器,则只需将其关闭即可。

You can still manually turn-on the fullscreen mode from the post edit screen, and your post editor would work just fine.

您仍然可以从帖子编辑屏幕手动打开全屏模式,而帖子编辑器也可以正常工作。

However, if you return back, then it will automatically turn it off. This behavior applies to all users who can access the post editor on your website.

但是,如果您返回,它将自动将其关闭。 此行为适用于可以访问您网站上的帖子编辑器的所有用户。

We hope this article helped you learn how to disable the fullscreen mode in WordPress post editor. For more productivity tips, see our tips for mastering the WordPress content editor.

我们希望本文能帮助您学习如何在WordPress帖子编辑器中禁用全屏模式。 有关更多生产力的技巧,请参阅我们的WordPress内容编辑器技巧

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

Code credit: Jean-Baptiste Audras

代码提供者:Jean-Baptiste Audras

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-disable-fullscreen-editor-in-wordpress/

wordpress编辑器

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值