contenteditable enter functionality, moved functions from view to main