Added the javascript logic to the editor