Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32345004
D8849.1765312925.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.1765312925.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
@@ -12,6 +12,7 @@
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 +398,29 @@
</Text>
),
},
+ chatMention: {
+ ...SimpleMarkdown.defaultRules.strong,
+ match: SharedMarkdown.matchChatMentions(),
+ 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,
+ ) => {
+ return (
+ <MarkdownChatMention
+ key={state.key}
+ threadInfo={node.threadInfo}
+ hasAccessToChat={node.hasAccessToChat}
+ style={styles.bold}
+ >
+ {node.content}
+ </MarkdownChatMention>
+ );
+ },
+ },
},
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 9, 8:42 PM (15 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5857677
Default Alt Text
D8849.1765312925.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