correct editor's mode when editing javascript