WordPress / better-code-editing

[✅ Merged into 4.9-alpha] Better Code Editing WordPress plugin
https://wordpress.org/plugins/better-code-editing/
37 stars 16 forks source link

Combine wp_code_editor_settings() into wp_enqueue_code_editor() #55

Closed westonruter closed 6 years ago

westonruter commented 7 years ago

For the post editor, there is just wp_enqueue_editor(). The code editor currently has a wp_enqueue_code_editor() function that takes a $settings arg which has the configuration for the desired editor, which is then used to determine which scripts and styles get enqueued. The $settings array is generated by wp_code_editor_settings(). However, having two separate functions may not make sense, and perhaps the arg passed into wp_code_editor_settings() should just be what is passed into wp_enqueue_code_editor().

Additionally, the $context arg that is passed into wp_code_editor_settings() should maybe be cleaned up. If $context['file'] is always required, then maybe it should take a $file arg followed by a $context. Or maybe file shouldn't be required all, and it could accept a type instead, which would make some more sense in the case of Additional CSS and the Custom HTML widget.

westonruter commented 6 years ago

The addition of a type context param was added in #66.