Please wrap the code below as well. editorSession can be undefined/null.