Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor the Disable Visual Editor setting #12000

Merged
merged 5 commits into from
Nov 19, 2018
Merged

Honor the Disable Visual Editor setting #12000

merged 5 commits into from
Nov 19, 2018

Conversation

mkaz
Copy link
Member

@mkaz mkaz commented Nov 16, 2018

Description

Closes #4634.

Show the plain text editor if the user checks the "Disable the visual editor when writing" option
See #4634

How has this been tested?

From user settings, check option to Disable the visual editor:

  • Edit post from Post list open in plain text editor
  • Edit post from link on page view opens in plain text
  • Switching back to disable option brings back block editor
  • Confirm paragraphs, embeds, and other content works as expected

Types of changes

  • Removes the forcing of user_can_richedit to false
  • Disables Gutenberg init by returning if user_can_richedit()
  • Removes Gutenberg admin menu item
  • Removes Classic Editor link in post view

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

Honors the user setting for `Disable the visual editor when writing`

If the user checks the option to disable visual editor:
- Returns from Gutenberg init
- Removes the links to Classic Editor in post list
- Removes the Gutenberg menu item

When editing a post, it will load the plain text editor.
@mkaz mkaz requested a review from mtias November 16, 2018 20:12
Moves the user_can_richedit to attach just on the filters
and not spread through out different fucntions.

add_filter( 'gutenberg_can_edit_post_type', 'user_can_richedit', 5 );
add_filter( 'gutenberg_can_edit_post', 'user_can_richedit', 5 );
add_filter( 'use_block_editor_for_post', 'user_can_richedit', 5 );
* Don't include core function use_block_editor_for_post

* Don't show Gutenberg menu in admin sidebar, since Demo link will
not load block editor, still plain text editor
@mtias mtias added this to the 4.5 milestone Nov 17, 2018
@mtias mtias added the Backwards Compatibility Issues or PRs that impact backwards compatability label Nov 17, 2018
@gziolo gziolo added the [Priority] High Used to indicate top priority items that need quick attention label Nov 19, 2018
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@gziolo gziolo merged commit 095d18f into master Nov 19, 2018
@gziolo gziolo deleted the try/4634/editor-flag branch November 19, 2018 10:27
@danielbachhuber
Copy link
Member

@gziolo @youknowriad Is there a core Trac ticket for this?

@youknowriad
Copy link
Contributor

@danielbachhuber Not that I'm aware of? Is the process to create a trac ticket for each php change? Or do we do git diffs since last updates or something? Just trying to understand the process here?

@danielbachhuber
Copy link
Member

Is the process to create a trac ticket for each php change?

Yes.

@@ -67,6 +67,9 @@ function the_gutenberg_project() {
* @since 0.1.0
*/
function gutenberg_menu() {
if ( ! gutenberg_can_edit_post( $post ) ) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is creating a warning and for me it doesn't make sense to check this here at all. It's being addressed in #12053

@youknowriad
Copy link
Contributor

Trac ticket https://core.trac.wordpress.org/ticket/45375

@mkaz
Copy link
Member Author

mkaz commented Nov 19, 2018

Thanks @youknowriad for shepherding the issue through. Plus creating the trac ticket, I had a mental note to ask about the process for keeping plugin/core in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Priority] High Used to indicate top priority items that need quick attention
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants