Commit Graph

20 Commits

Author SHA1 Message Date
Anders Kaseorg ba8b9a445b eslint: Fix unicorn/prefer-node-protocol.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-08 16:54:15 -07:00
evykassirer 261f01ede8 input_pill: Highlight previous pill after backspace deletion.
This is helpful for when a user wants to delete multiple pills
in a row, now that a pill needs to be highlighted before it can
be deleted.

It makes more sense intuitively for the previous pill to be selected
after backspace, since the direction of deletion is backwards. We
still potentially focus next() if there is no previous pill, which
is most helpful when the input element has no more pills left, since
this focuses the text field.
2024-09-30 16:37:12 -07:00
evykassirer 6e85fa8fcc input_pill: Highlight/focus pill before removing it.
Select the pill on the first backspace and delete the whole pill on
the second backspace. If the pill is already highlighted from
left-pressing, then backspace would delete it right away.

We're making this change because it can be quite annoying to
re-type out a pill that's accidentally deleted, and users might
think pills are editable and accidentally delete the whole thing
with a backspace stroke.
2024-09-30 16:37:12 -07:00
evykassirer d9f25d01a1 web: Use util.the for accessing element of single-item lists. 2024-08-20 09:48:15 -07:00
evykassirer 00e74d0de2 search: Move group user remove logic out of input_pill. 2024-08-12 11:37:31 -07:00
evykassirer 271efb70fa input_pill: Remove InputPillItem now that details are handled elsewhere. 2024-08-01 17:31:59 -07:00
evykassirer 6e47d851ec input_pill: Remove display_value in favor of module-specific values.
This commit is part of a bigger project to remove custom logic in
the input_pill module. This commit move us away from a world where
we have a `display_value` that's used as identifying information
for a pill as well as for what we display to the user. Now individual
widgets can configure how they come up with a display value based
on the data of that type of pill.

Note: The change in the stream pill test for setting subscribers
for denmark is fixing an issue that wasn't discoverable before.
There always should have been three subscribers.
2024-08-01 17:31:59 -07:00
evykassirer 2b7d14084b input pill: Move user pill rendering code to user_pill.
This is part of a larger effort to refactor input_pill to
remove custom logic and move it into relevant modules.
2024-08-01 17:31:59 -07:00
evykassirer 23e7363850 input pills: Focus input after removing a pill with x button.
We decided this is more likely to be where the user wants the
focus to be after exiting a pill with the x button.

CZO:
https://chat.zulip.org/#narrow/stream/9-issues/topic/.F0.9F.8E.AF.20message.20search.20'x'.2Fdelete/near/1886757
2024-07-14 22:10:24 -07:00
evykassirer 11bb44c7cc search pills: Direct message group pill support.
This supports adding users to DM pills by simply typing
a user's name in the text input directly after a complete
dm pill. It only works for DM pills at the end of search
input.

Clicking the X button removes a user from its user pill
container, and if that user was the last user left in the
container, then the whole container is also removed.
2024-07-09 17:08:45 -07:00
Lalit 5ea98cba54 input_pill: Add test for `input` event handler. 2024-05-20 09:13:26 -07:00
Anders Kaseorg fe6744ae54 input_pill: Fix implicit use of any.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-05-03 15:39:55 -07:00
Lalit 0a66fada64 input_pill: Use "input" event handler for `textInputHook`.
Register our `onTextInputHook` to be called on "input" events so that
the hook receives the updated text content of the input unlike the "keydown"
event which does not update the text content before running the hook.
2024-05-02 12:01:30 -07:00
adnan-td 87dee7a9b2 invite_user_modal: Replaced email text_area with input_pill.
This makes the widget considerably more attractive, and probably a bit
more usable.

Fixes #29391.
2024-03-29 11:13:03 -07:00
evykassirer 3208235e79 emoji: Remove number as possible type for emoji_code.
More details here:
https://github.com/zulip/zulip/pull/28375#issuecomment-1878073956
2024-01-28 14:17:15 -08:00
Evy Kassirer 6e902defba
node tests: Use noop helper function pattern in test files.
Some files already were using `noop` in place of `() => {}`.
It's both clearer what it means and is easier to type.
This updates all test files to fully use `noop`, and
adds a shared import from the test lib file.
2023-12-14 14:51:33 -08:00
Lalit 151d51acfa input_pill: Remove over defensive if checks for `create` function.
We should remove this overly defensive code and remove the `undefined`
type from the return type of this function to avoid handling unexpected
`undefined` values in the downstream code.
2023-10-27 13:11:37 -07:00
Anders Kaseorg 9c9c453d5a web: Remove unchecked casts of event objects.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 13:08:36 -07:00
Lalit 833cc71181 ts: Convert input_pill.js to TypeScript.
Migrated input_pill subsystem to TypeScript, used generics to make
it a generic module so that it works with different implementations
like stream_pill or user_pill.
2023-04-25 09:09:48 -07:00
Anders Kaseorg cea1119423 node_tests: Move to web/tests.
This lets us simplify the long-ish ‘../../static/js’ paths, and will
remove the need for the ‘zrequire’ wrapper.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-23 16:04:17 -08:00