Moved contenteditable code to within switch