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

WordPress Trac noreply at wordpress.org
Tue Jan 31 16:28:09 UTC 2023


#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:  reporter-feedback   |     Focuses:
--------------------------------+------------------------------

Comment (by TobiasBg):

 Hi @mjdewitt,

 thanks for providing feedback here!

 I looked at this again, and still believe that the code logic is correct
 here.
 The variable is called `syntax_highlighting`. If its value is `true`, the
 corresponding features are loaded (by using CodeMirror). Also, the logic
 in `wp_enqueue_code_editor()` is correct: If the value of
 `syntax_highlighting` is `false`, the function is left early (without
 loading the CodeMirror features).

 Now, I do understand that the presentation of that checkbox on the User's
 Profile screen might not be ideal from a usability point of view (in terms
 that toggling a checkbox on turns a feature off). The functionality behind
 this is however working correctly: If the "Disable syntax highlighting
 when editing code" checkbox is toggled on, the internal value of the
 `syntax_highlighting` variable is set to `false`.

 So, to improve usability, it might indeed be worthwhile to look into
 rephrasing the checkbox text here, to e.g. "Enable syntax highlighting
 when editing code" and to then reverse the checkbox states. The same
 should then however be done with the "Disable the visual editor when
 writing" checkbox right above. Given that the "Show Toolbar when viewing
 site" checkbox a bit further down is also using "positive wording" this
 would then indeed bring consistency to that screen a bit.

 But again, the logic behind all this is correct from everything that I can
 see.

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


More information about the wp-trac mailing list