This function is triggered two times when click event on editor