JavaScript to create a  small editor