[wp-trac] [WordPress Trac] #57393: CodeMirror Features Disabled by wp_enqueue_code_editor Activation Conditions

WordPress Trac noreply at wordpress.org
Wed Dec 28 16:53:48 UTC 2022


#57393: CodeMirror Features Disabled by wp_enqueue_code_editor Activation
Conditions
--------------------------------+-----------------------------
 Reporter:  mjdewitt            |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  External Libraries  |    Version:  6.1.1
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 CodeMirror highlighting, line numbers, code-folding, brace-matching and
 other customizations are disabled when highlighting is disabled. This is a
 real issue for plugins like code-snippets which rely on these features.

 Here is the condition in question:

 function wp_enqueue_code_editor( $args ) {
 if ( is_user_logged_in() && 'false' ===
 wp_get_current_user()->syntax_highlighting ) {
 return false;
 }

 I believe that the user-form-variable syntax_highlighting is probably
 misnamed as it should be something like disable_syntax_highlighting to
 reflect the choice being made.

 As it is, when ticked (true), highlighting should be disabled. When un-
 ticked (false), highlighting should be enabled.

     if ( ! is_user_logged_in() or 'true' ===
 wp_get_current_user()->syntax_highlighting ) {
             return false;
     }

 NB: Pipe symbol is filtered and so replaced with "or"

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57393>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list