Dispatch a 'cancel' event if the user hits escape

This commit is contained in:
Bryan Housel
2018-12-11 00:09:55 -05:00
parent 6cf1d63b48
commit ff646fa2c8
2 changed files with 11 additions and 1 deletions
+7
View File
@@ -159,6 +159,13 @@ export function uiFieldLocalized(field, context) {
utilGetSetValue(input, tags.name);
dispatch.call('change', this, tags);
})
.on('cancel', function() {
// user hit escape, remove whatever is after the '-'
var name = utilGetSetValue(input);
name = name.split('-', 2)[0].trim();
utilGetSetValue(input, name);
dispatch.call('change', this, { name: name });
})
);
}
}