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

Conversation

Projects
None yet
5 participants
@mkaz
Member

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.

mkaz added some commits Nov 16, 2018

Add checks for user_can_richedit() to show plain-text editor
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 Nov 16, 2018

mkaz added some commits Nov 17, 2018

Update user_can_richedit added to filter
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 );
Update with just plugin changes
* 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

@youknowriad

LGTM 👍

@gziolo gziolo merged commit 095d18f into master Nov 19, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@gziolo gziolo deleted the try/4634/editor-flag branch Nov 19, 2018

@danielbachhuber

This comment has been minimized.

Member

danielbachhuber commented Nov 19, 2018

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

@youknowriad

This comment has been minimized.

Contributor

youknowriad commented Nov 19, 2018

@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

This comment has been minimized.

Member

danielbachhuber commented Nov 19, 2018

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;
}

This comment has been minimized.

@youknowriad

youknowriad Nov 19, 2018

Contributor

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

This comment has been minimized.

Contributor

youknowriad commented Nov 19, 2018

@mkaz

This comment has been minimized.

Member

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.

noisysocks added a commit that referenced this pull request Nov 21, 2018

youknowriad added a commit that referenced this pull request Nov 21, 2018

Revert "Honor the Disable Visual Editor setting (#12000)" (#12151)
* Revert "Honor the Disable Visual Editor setting (#12000)"

This reverts commit 095d18f.

* Add support for RichEditing in Gutenberg

* Typo

grey-rsi pushed a commit to OnTheGoSystems/gutenberg that referenced this pull request Nov 22, 2018

Honor the Disable Visual Editor setting (WordPress#12000)
* Do not override user_can_richedit option

* Add checks for user_can_richedit() to show plain-text editor

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.

* Update user_can_richedit added to filter

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 );

* Update with just plugin changes

* 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

* Fix comment

grey-rsi pushed a commit to OnTheGoSystems/gutenberg that referenced this pull request Nov 22, 2018

Revert "Honor the Disable Visual Editor setting (WordPress#12000)" (W…
…ordPress#12151)

* Revert "Honor the Disable Visual Editor setting (WordPress#12000)"

This reverts commit 095d18f.

* Add support for RichEditing in Gutenberg

* Typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment