My guess is that setInsertTagFunction should be used when codemirror is used, so that the editor can behave how we expect it to.