function _createEditorForDocument(doc, makeMasterEditor, container, range, editorOptions) {
        var editor = new Editor(doc, makeMasterEditor, container, range, editorOptions);

        editor.on("focus", function () {
            _notifyActiveEditorChanged(editor);
        });

        editor.on("beforeDestroy", function () {
            if (editor.$el.is(":visible")) {
                _saveEditorViewState(editor);
            }
        });

        return editor;
    }
Creates a new Editor bound to the given Document.
The editor is appended to the given container as a visible child.
@private
@param {!Document} doc  Document for the Editor's content
@param {!boolean} makeMasterEditor  If true, the Editor will set itself as the private "master"
         Editor for the Document. If false, the Editor will attach to the Document as a "slave."
@param {!jQueryObject} container  Container to add the editor to.
@param {{startLine: number, endLine: number}=} range If specified, range of lines within the document
         to display in this editor. Inclusive.
@param {!Object} editorOptions If specified, contains editor options that can be passed to CodeMirror
@return {Editor} the newly created editor.