refactor plus fix contenteditable bug introduced yesterday