I modified this to either update selected text OR replace the editor code (default)