update library.js so drag revert only happens on invalid drop