when clearing the editor, clear javascript first to avoid errors
fixed #96: switching away from a highcharts gist causes an error