-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve and Extend Input classes for Mentions and Drafts. #42
Conversation
if (customOnPaste && customOnPaste(e)) { | ||
// custom logic already handled input, exit here | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is customOnPaste conditionally passed in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or else it would early execute every time even if there isn't anything to paste right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
customOnPaste
from our flows is always defined. This entire function usePaste
is hooked into the onPaste
of the input div
component, so our callback gets called every time there's a paste event in the div
. The idea here is that we have a nice way of getting the callback first and handling it ourselves before letting UIKit do its thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think just need to remove customOnPaste
cuz it's unused?
src/types.ts
Outdated
// fork note: the minimum amount of information needed to save and restore | ||
// an *unsent* message as a draft | ||
export interface DraftMessage { | ||
messageId: number | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why we need a special DraftMessage type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! DraftMessage
is used to support save/load of draft messages that have mentions with minimal code changes and maximum compatibility with UIKit. UIKit already has all code related to extracting, displaying, sending, et, of messages with mentions, and it only requires the data present in the DraftMessage
interface. This is the code that is also used for "editing" messages.
The DraftMessage
interface is also handy as the interface between Gather-Browser <-> UIKIt, and the draft code.
The alternative would be us implementing additional custom code which handles extracting, saving, and re-loading draft messages that have mentions.
|
* Improve and Extend Input classes for Mentions and Drafts. * Add fork note comment. * Improve types.
* Improve and Extend Input classes for Mentions and Drafts. * Add fork note comment. * Improve types.
Description
Linear: https://linear.app/gather-town/issue/APP-7842/implement-fork-changes
This PR follows up on #41 in supporting Mentions on the Gather App. It provides the necessary support for https://github.com/gathertown/gather-town/pull/25766
The changes are around 2 components:
MessageInput
: Adds support for all functionalities Gather App needs to make this the main message input componentDraftMessage
(also a new type), which is the data required for an unsent messageonPaste
and renderers)SuggestedMentionListView
: UX improvements and made extensible (custom rendering)Test Plan
Mentions in input with custom rendering
Mentions in edit with custom rendering
Attachment preview
CC
@gathertown/chat