Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3357502
D5757.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D5757.diff
View Options
diff --git a/web/chat/chat-input-bar.react.js b/web/chat/chat-input-bar.react.js
--- a/web/chat/chat-input-bar.react.js
+++ b/web/chat/chat-input-bar.react.js
@@ -52,8 +52,8 @@
import { nonThreadCalendarQuery } from '../selectors/nav-selectors';
import SWMansionIcon from '../SWMansionIcon.react';
import css from './chat-input-bar.css';
-import MentionSuggestionTooltip from './mention-suggestion-tooltip.react';
-import { mentionRegex } from './mention-utils';
+import TypeaheadTooltip from './typeahead-tooltip.react';
+import { typeaheadRegex } from './typeahead-utils';
type BaseProps = {
+threadInfo: ThreadInfo,
+inputState: InputState,
@@ -332,7 +332,7 @@
let typeaheadTooltip;
if (this.props.typeaheadMatchedStrings && this.textarea) {
typeaheadTooltip = (
- <MentionSuggestionTooltip
+ <TypeaheadTooltip
inputState={this.props.inputState}
textarea={this.textarea}
userSearchIndex={this.props.userSearchIndex}
@@ -534,7 +534,7 @@
() =>
inputSliceEndingAtCursor.length === props.inputState.draft.length ||
/\s/.test(props.inputState.draft[props.inputState.textCursorPosition])
- ? inputSliceEndingAtCursor.match(mentionRegex)
+ ? inputSliceEndingAtCursor.match(typeaheadRegex)
: null,
[
inputSliceEndingAtCursor,
diff --git a/web/chat/mention-suggestion-tooltip.css b/web/chat/typeahead-tooltip.css
rename from web/chat/mention-suggestion-tooltip.css
rename to web/chat/typeahead-tooltip.css
diff --git a/web/chat/mention-suggestion-tooltip.react.js b/web/chat/typeahead-tooltip.react.js
rename from web/chat/mention-suggestion-tooltip.react.js
rename to web/chat/typeahead-tooltip.react.js
--- a/web/chat/mention-suggestion-tooltip.react.js
+++ b/web/chat/typeahead-tooltip.react.js
@@ -10,14 +10,14 @@
import Button from '../components/button.react';
import type { InputState } from '../input/input-state';
import { type TypeaheadMatchedStrings } from './chat-input-bar.react';
-import css from './mention-suggestion-tooltip.css';
+import css from './typeahead-tooltip.css';
import {
getTypeaheadTooltipActions,
getTypeaheadTooltipPosition,
getTypeaheadUserSuggestions,
-} from './mention-utils';
+} from './typeahead-utils';
-export type MentionSuggestionTooltipProps = {
+export type TypeaheadTooltipProps = {
+inputState: InputState,
+textarea: HTMLTextAreaElement,
+userSearchIndex: SearchIndex,
@@ -26,9 +26,7 @@
+matchedStrings: TypeaheadMatchedStrings,
};
-function MentionSuggestionTooltip(
- props: MentionSuggestionTooltipProps,
-): React.Node {
+function TypeaheadTooltip(props: TypeaheadTooltipProps): React.Node {
const {
inputState,
textarea,
@@ -123,4 +121,4 @@
);
}
-export default MentionSuggestionTooltip;
+export default TypeaheadTooltip;
diff --git a/web/chat/mention-utils.js b/web/chat/typeahead-utils.js
rename from web/chat/mention-utils.js
rename to web/chat/typeahead-utils.js
--- a/web/chat/mention-utils.js
+++ b/web/chat/typeahead-utils.js
@@ -7,14 +7,14 @@
import { stringForUserExplicit } from 'lib/shared/user-utils';
import type { RelativeMemberInfo } from 'lib/types/thread-types';
-const mentionRegex: RegExp = new RegExp(
+const typeaheadRegex: RegExp = new RegExp(
`(?<textPrefix>(?:^(?:.|\n)*\\s+)|^)@(?<username>${oldValidUsernameRegexString})?$`,
);
import { type InputState } from '../input/input-state';
import { typeaheadStyle } from './chat-constants';
-export type MentionSuggestionTooltipAction = {
+export type TypeaheadTooltipAction = {
+key: string,
+onClick: (SyntheticEvent<HTMLButtonElement>) => mixed,
+actionButtonContent: React.Node,
@@ -93,7 +93,7 @@
suggestedUsers: $ReadOnlyArray<RelativeMemberInfo>,
matchedTextBefore: string,
matchedText: string,
-): $ReadOnlyArray<MentionSuggestionTooltipAction> {
+): $ReadOnlyArray<TypeaheadTooltipAction> {
return suggestedUsers
.filter(
suggestedUser => stringForUserExplicit(suggestedUser) !== 'anonymous',
@@ -151,7 +151,7 @@
}
export {
- mentionRegex,
+ typeaheadRegex,
getTypeaheadUserSuggestions,
getCaretOffsets,
getTypeaheadTooltipActions,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 11:55 PM (21 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577735
Default Alt Text
D5757.diff (4 KB)
Attached To
Mode
D5757: [web] Change names from Mention/Mention suggestion to Typeahead
Attached
Detach File
Event Timeline
Log In to Comment