extract code to angular-text-edit.js