derbyjs/d-codemirror — pull request #2 by codingisacopingstrategy (2014-12-13 14:36:42+00:00)
Title: Auto load modes

This PR dynamically loads the necessary files for the CodeMirror mode set through the `mode` option, where mode can either be a mime-type `text/html` or a CodeMirror mode-name `htmlmixed`.

The code was partly based on http://codemirror.net/demo/loadmode.html and requires a new version of CodeMirror (bumped here).

In this way, the component becomes easier set up. Otherwise, the developer would have to include the JavaScript files specific to the mode used in addition to instantiating the component. The PR also allows a scenario where the editor can switch between editing various kinds of documents.

Of course this might be suboptimal if the app is using only one mode, and the developer doesn’t mind setting up the extra `` tags. What do you think?