Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32431868
D8849.1765356103.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D8849.1765356103.diff
View Options
diff --git a/native/chat/text-message-markdown-context.js b/native/chat/text-message-markdown-context.js
--- a/native/chat/text-message-markdown-context.js
+++ b/native/chat/text-message-markdown-context.js
@@ -17,7 +17,7 @@
const TextMessageMarkdownContext: React.Context<?TextMessageMarkdownContextType> =
React.createContext<?TextMessageMarkdownContextType>(null);
-const pressableMarkdownTypes = new Set(['link', 'spoiler']);
+const pressableMarkdownTypes = new Set(['link', 'spoiler', 'chatMention']);
const markdownASTHasPressable = (node: ASTNode): boolean => {
if (Array.isArray(node)) {
return node.some(markdownASTHasPressable);
diff --git a/native/markdown/rules.react.js b/native/markdown/rules.react.js
--- a/native/markdown/rules.react.js
+++ b/native/markdown/rules.react.js
@@ -6,12 +6,14 @@
import * as SimpleMarkdown from 'simple-markdown';
import * as SharedMarkdown from 'lib/shared/markdown.js';
+import { chatMentionRegex } from 'lib/shared/mention-utils.js';
import type {
RelativeMemberInfo,
ThreadInfo,
ChatMentionCandidates,
} from 'lib/types/thread-types.js';
+import MarkdownChatMention from './markdown-chat-mention.react.js';
import MarkdownLink from './markdown-link.react.js';
import MarkdownParagraph from './markdown-paragraph.react.js';
import MarkdownSpoiler from './markdown-spoiler.react.js';
@@ -397,6 +399,26 @@
</Text>
),
},
+ chatMention: {
+ ...SimpleMarkdown.defaultRules.strong,
+ match: SimpleMarkdown.inlineRegex(chatMentionRegex),
+ parse: (capture: SharedMarkdown.Capture) =>
+ SharedMarkdown.parseChatMention(chatMentionCandidates, capture),
+ // eslint-disable-next-line react/display-name
+ react: (
+ node: SharedMarkdown.SingleASTNode,
+ output: SharedMarkdown.Output<SharedMarkdown.ReactElement>,
+ state: SharedMarkdown.State,
+ ) => (
+ <MarkdownChatMention
+ key={state.key}
+ threadInfo={node.threadInfo}
+ hasAccessToChat={node.hasAccessToChat}
+ >
+ {node.content}
+ </MarkdownChatMention>
+ ),
+ },
},
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 10, 8:41 AM (17 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5862521
Default Alt Text
D8849.1765356103.diff (2 KB)
Attached To
Mode
D8849: [native] Add chat mention rule to text message rules
Attached
Detach File
Event Timeline
Log In to Comment