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

WordPress Trac noreply at wordpress.org
Wed Dec 28 18:59:12 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              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> 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"

New description:

 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() || 'true' ===
 wp_get_current_user()->syntax_highlighting ) {
                 return false;
         }
 }}}

--

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


More information about the wp-trac mailing list