stream-chat-react 13.6.4 → 13.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,12 @@
1
1
  import React from 'react';
2
2
  import ReactMarkdown from 'react-markdown';
3
- export const renderPreviewText = (text) => (React.createElement(ReactMarkdown, { skipHtml: true }, text));
3
+ import { htmlToTextPlugin } from '../Message';
4
+ import remarkGfm from 'remark-gfm';
5
+ const remarkPlugins = [
6
+ htmlToTextPlugin,
7
+ [remarkGfm, { singleTilde: false }],
8
+ ];
9
+ export const renderPreviewText = (text) => (React.createElement(ReactMarkdown, { remarkPlugins: remarkPlugins, skipHtml: true }, text));
4
10
  const getLatestPollVote = (latestVotesByOption) => {
5
11
  let latestVote;
6
12
  for (const optionVotes of Object.values(latestVotesByOption)) {
@@ -24,7 +24,7 @@ export const useChat = ({ client, defaultLanguage = 'en', i18nInstance, initialN
24
24
  useEffect(() => {
25
25
  if (!client)
26
26
  return;
27
- const version = "13.6.4";
27
+ const version = "13.6.6";
28
28
  const userAgent = client.getUserAgent();
29
29
  if (!userAgent.includes('stream-chat-react')) {
30
30
  // result looks like: 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
@@ -32,6 +32,12 @@ export const defaultAllowedTagNames = [
32
32
  // custom types (tagNames)
33
33
  'emoji',
34
34
  'mention',
35
+ 'h1',
36
+ 'h2',
37
+ 'h3',
38
+ 'h4',
39
+ 'h5',
40
+ 'h6',
35
41
  ];
36
42
  function formatUrlForDisplay(url) {
37
43
  try {
@@ -88,14 +88,17 @@ const useAttachmentSelectorActionsFiltered = (original) => {
88
88
  const { PollCreationDialog = DefaultPollCreationDialog, ShareLocationDialog = DefaultLocationDialog, } = useComponentContext();
89
89
  const { channelCapabilities } = useChannelStateContext();
90
90
  const messageComposer = useMessageComposer();
91
+ const channelConfig = messageComposer.channel.getConfig();
91
92
  return original
92
93
  .filter((action) => {
93
94
  if (action.type === 'uploadFile')
94
- return channelCapabilities['upload-file'];
95
+ return channelCapabilities['upload-file'] && channelConfig?.uploads;
95
96
  if (action.type === 'createPoll')
96
- return channelCapabilities['send-poll'] && !messageComposer.threadId;
97
+ return (channelCapabilities['send-poll'] &&
98
+ !messageComposer.threadId &&
99
+ channelConfig?.polls);
97
100
  if (action.type === 'addLocation') {
98
- return messageComposer.config.location.enabled && !messageComposer.threadId;
101
+ return channelConfig?.shared_locations && !messageComposer.threadId;
99
102
  }
100
103
  return true;
101
104
  })