WordPress: Adding a Proper Visual Editor to Your Plugin

When developing a new plugin for WordPress, sometimes you want to add a visual/WYSIWYG editor to one of your plugin’s settings fields. Unfortunately, most of the tutorials you’ll find online only explain part of what needs to be done in order to get that working. The main problem I have encountered when looking at these tutorials and example plugins is the fact that they only invoke the visual editor; they don’t offer any way for the user to use the editor in HTML mode.