Couldn't the two functions from 2. be invoked by the TabsEditingDescriptor? All of the javascript in codemirror-edit.html is initialization code that I'd expect to only get called when the editor is actually needed. And then if those two functions are called when the edit button is clicked, we don't need to put TabsEditingDescriptorModel in the global namespace either.