this needs to be below the if (!editor) check.