mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
add_subscribers_pill: Add button should show error on pending text.
This commit only changes the behaviour for edit screen of this setting. We'll tackle the create screens in further commits.
This commit is contained in:
committed by
Tim Abbott
parent
0ee2543a49
commit
f6bedceab3
@@ -256,14 +256,23 @@ export function set_up_handlers({
|
||||
}
|
||||
|
||||
$parent_container.on("keyup", pill_selector, (e) => {
|
||||
if (keydown_util.is_enter_event(e)) {
|
||||
const pill_widget = get_pill_widget();
|
||||
if (!pill_widget.is_pending() && keydown_util.is_enter_event(e)) {
|
||||
e.preventDefault();
|
||||
callback();
|
||||
}
|
||||
});
|
||||
|
||||
$parent_container.on("click", button_selector, (e) => {
|
||||
const pill_widget = get_pill_widget();
|
||||
if (!pill_widget.is_pending()) {
|
||||
e.preventDefault();
|
||||
callback();
|
||||
} else {
|
||||
// We are not appending any value here, but instead this is
|
||||
// a proxy to invoke the error state for a pill widget
|
||||
// that would usually get triggered on pressing enter.
|
||||
pill_widget.appendValue(pill_widget.getCurrentText()!);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user