stream-chat-react 13.6.6 → 13.7.0
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.
- package/dist/components/ChannelPreview/utils.js +3 -1
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/Message/renderText/remarkPlugins/imageToLink.d.ts +12 -0
- package/dist/components/Message/renderText/remarkPlugins/imageToLink.js +27 -0
- package/dist/components/Message/renderText/remarkPlugins/index.d.ts +2 -0
- package/dist/components/Message/renderText/remarkPlugins/index.js +2 -0
- package/dist/components/Message/renderText/remarkPlugins/plusPlusToEmphasis.d.ts +6 -0
- package/dist/components/Message/renderText/remarkPlugins/plusPlusToEmphasis.js +64 -0
- package/dist/components/Message/renderText/renderText.js +4 -1
- package/dist/experimental/index.browser.cjs +105 -44
- package/dist/experimental/index.browser.cjs.map +4 -4
- package/dist/experimental/index.node.cjs +105 -44
- package/dist/experimental/index.node.cjs.map +4 -4
- package/dist/index.browser.cjs +157 -91
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +159 -91
- package/dist/index.node.cjs.map +4 -4
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactMarkdown from 'react-markdown';
|
|
3
|
-
import { htmlToTextPlugin } from '../Message';
|
|
3
|
+
import { htmlToTextPlugin, imageToLink, plusPlusToEmphasis } from '../Message';
|
|
4
4
|
import remarkGfm from 'remark-gfm';
|
|
5
5
|
const remarkPlugins = [
|
|
6
6
|
htmlToTextPlugin,
|
|
7
7
|
[remarkGfm, { singleTilde: false }],
|
|
8
|
+
plusPlusToEmphasis,
|
|
9
|
+
imageToLink,
|
|
8
10
|
];
|
|
9
11
|
export const renderPreviewText = (text) => (React.createElement(ReactMarkdown, { remarkPlugins: remarkPlugins, skipHtml: true }, text));
|
|
10
12
|
const getLatestPollVote = (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.
|
|
27
|
+
const version = "13.7.0";
|
|
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'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Node } from 'unist';
|
|
2
|
+
export type ImageToLinkPluginOptions = {
|
|
3
|
+
getTextLabelFrom?: 'alt' | 'title' | 'url';
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Converts image Markdown links ()
|
|
7
|
+
* to HTML <a href={url}>{url | title | alt}</a>
|
|
8
|
+
*
|
|
9
|
+
* By default, the anchor text content is the image url so that image preview can be generated / enriched on the server.
|
|
10
|
+
* @param getTextLabelFrom
|
|
11
|
+
*/
|
|
12
|
+
export declare function imageToLink({ getTextLabelFrom }?: ImageToLinkPluginOptions): (tree: Node) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SKIP, visit } from 'unist-util-visit';
|
|
2
|
+
const text = (value) => ({ type: 'text', value });
|
|
3
|
+
/**
|
|
4
|
+
* Converts image Markdown links ()
|
|
5
|
+
* to HTML <a href={url}>{url | title | alt}</a>
|
|
6
|
+
*
|
|
7
|
+
* By default, the anchor text content is the image url so that image preview can be generated / enriched on the server.
|
|
8
|
+
* @param getTextLabelFrom
|
|
9
|
+
*/
|
|
10
|
+
export function imageToLink({ getTextLabelFrom = 'url' } = {}) {
|
|
11
|
+
return (tree) => {
|
|
12
|
+
const visitor = (node, index, parent) => {
|
|
13
|
+
if (parent == null || index == null)
|
|
14
|
+
return;
|
|
15
|
+
const label = node[getTextLabelFrom] ?? node.url; // node.alt || node.title || node.url;
|
|
16
|
+
const link = {
|
|
17
|
+
children: [text(label)],
|
|
18
|
+
title: node.title ?? node.alt ?? node.url,
|
|
19
|
+
type: 'link',
|
|
20
|
+
url: node.url,
|
|
21
|
+
};
|
|
22
|
+
parent.children.splice(index, 1, link);
|
|
23
|
+
return [SKIP, index + 1];
|
|
24
|
+
};
|
|
25
|
+
visit(tree, 'image', visitor);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Plugin } from 'unified';
|
|
2
|
+
/**
|
|
3
|
+
* Converts MD "++Some text++" to inserted text element rendered in HTML as <ins>Some text</ins>
|
|
4
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ins
|
|
5
|
+
*/
|
|
6
|
+
export declare const plusPlusToEmphasis: Plugin<[]>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SKIP, visit } from 'unist-util-visit';
|
|
2
|
+
/**
|
|
3
|
+
* \S → first char must be non-whitespace
|
|
4
|
+
* (?:...)?→ optional middle+closing when length > 1
|
|
5
|
+
* [\s\S]*?→ anything (including newlines), lazy
|
|
6
|
+
* final \S→ last char non-whitespace (only required when there’s more than 1)
|
|
7
|
+
*
|
|
8
|
+
* Matches:
|
|
9
|
+
* ++a++
|
|
10
|
+
* Does not match:
|
|
11
|
+
* ++++
|
|
12
|
+
* ++ ++
|
|
13
|
+
*/
|
|
14
|
+
const INS_REGEX = /\+\+(\S(?:[\s\S]*?\S)?)\+\+/g;
|
|
15
|
+
const IGNORE_NODE_TYPES = new Set([
|
|
16
|
+
'code',
|
|
17
|
+
'inlineCode',
|
|
18
|
+
'link',
|
|
19
|
+
'linkReference',
|
|
20
|
+
'definition',
|
|
21
|
+
'math',
|
|
22
|
+
'inlineMath',
|
|
23
|
+
]);
|
|
24
|
+
/**
|
|
25
|
+
* Converts MD "++Some text++" to inserted text element rendered in HTML as <ins>Some text</ins>
|
|
26
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ins
|
|
27
|
+
*/
|
|
28
|
+
export const plusPlusToEmphasis = () => {
|
|
29
|
+
const visitor = (node, index, parent) => {
|
|
30
|
+
// 1) Don’t traverse inside ignored nodes
|
|
31
|
+
if (IGNORE_NODE_TYPES.has(node.type))
|
|
32
|
+
return SKIP;
|
|
33
|
+
// 2) Only transform text nodes with a valid parent + index
|
|
34
|
+
if (node.type !== 'text' || parent == null || typeof index !== 'number')
|
|
35
|
+
return;
|
|
36
|
+
const value = node.value;
|
|
37
|
+
// Reset lastIndex to 0 per node so each node is scanned from the beginning
|
|
38
|
+
INS_REGEX.lastIndex = 0;
|
|
39
|
+
let match;
|
|
40
|
+
let last = 0;
|
|
41
|
+
const out = [];
|
|
42
|
+
while ((match = INS_REGEX.exec(value))) {
|
|
43
|
+
const [full, inner] = match;
|
|
44
|
+
const start = match.index;
|
|
45
|
+
if (start > last)
|
|
46
|
+
out.push({ type: 'text', value: value.slice(last, start) });
|
|
47
|
+
// Render as <ins>…</ins> (remark-rehype respects data.hName)
|
|
48
|
+
out.push({
|
|
49
|
+
children: [{ type: 'text', value: inner }],
|
|
50
|
+
data: { hName: 'ins' },
|
|
51
|
+
type: 'emphasis',
|
|
52
|
+
});
|
|
53
|
+
last = start + full.length;
|
|
54
|
+
}
|
|
55
|
+
if (out.length === 0)
|
|
56
|
+
return; // nothing to change
|
|
57
|
+
if (last < value.length)
|
|
58
|
+
out.push({ type: 'text', value: value.slice(last) });
|
|
59
|
+
parent.children.splice(index, 1, ...out);
|
|
60
|
+
// Skip re-visiting the replaced range; continue after inserted nodes
|
|
61
|
+
return [SKIP, index + out.length];
|
|
62
|
+
};
|
|
63
|
+
return (tree) => visit(tree, visitor);
|
|
64
|
+
};
|
|
@@ -5,7 +5,7 @@ import remarkGfm from 'remark-gfm';
|
|
|
5
5
|
import { Anchor, Emoji, Mention } from './componentRenderers';
|
|
6
6
|
import { detectHttp, matchMarkdownLinks, messageCodeBlocks } from './regex';
|
|
7
7
|
import { emojiMarkdownPlugin, mentionsMarkdownPlugin } from './rehypePlugins';
|
|
8
|
-
import { htmlToTextPlugin, keepLineBreaksPlugin } from './remarkPlugins';
|
|
8
|
+
import { htmlToTextPlugin, imageToLink, keepLineBreaksPlugin, plusPlusToEmphasis, } from './remarkPlugins';
|
|
9
9
|
import { ErrorBoundary } from '../../UtilityComponents';
|
|
10
10
|
export const defaultAllowedTagNames = [
|
|
11
11
|
'html',
|
|
@@ -38,6 +38,7 @@ export const defaultAllowedTagNames = [
|
|
|
38
38
|
'h4',
|
|
39
39
|
'h5',
|
|
40
40
|
'h6',
|
|
41
|
+
'ins',
|
|
41
42
|
];
|
|
42
43
|
function formatUrlForDisplay(url) {
|
|
43
44
|
try {
|
|
@@ -124,6 +125,8 @@ export const renderText = (text, mentionedUsers, { allowedTagNames = defaultAllo
|
|
|
124
125
|
htmlToTextPlugin,
|
|
125
126
|
keepLineBreaksPlugin,
|
|
126
127
|
[remarkGfm, { singleTilde: false }],
|
|
128
|
+
plusPlusToEmphasis,
|
|
129
|
+
imageToLink,
|
|
127
130
|
];
|
|
128
131
|
const rehypePlugins = [emojiMarkdownPlugin];
|
|
129
132
|
if (mentionedUsers?.length) {
|
|
@@ -3366,7 +3366,7 @@ function resolveAllAttention(events, context) {
|
|
|
3366
3366
|
let index2 = -1;
|
|
3367
3367
|
let open;
|
|
3368
3368
|
let group;
|
|
3369
|
-
let
|
|
3369
|
+
let text8;
|
|
3370
3370
|
let openingSequence;
|
|
3371
3371
|
let closingSequence;
|
|
3372
3372
|
let use;
|
|
@@ -3404,7 +3404,7 @@ function resolveAllAttention(events, context) {
|
|
|
3404
3404
|
},
|
|
3405
3405
|
end
|
|
3406
3406
|
};
|
|
3407
|
-
|
|
3407
|
+
text8 = {
|
|
3408
3408
|
type: use > 1 ? "strongText" : "emphasisText",
|
|
3409
3409
|
start: {
|
|
3410
3410
|
...events[open][1].end
|
|
@@ -3432,9 +3432,9 @@ function resolveAllAttention(events, context) {
|
|
|
3432
3432
|
if (events[open][1].end.offset - events[open][1].start.offset) {
|
|
3433
3433
|
nextEvents = push(nextEvents, [["enter", events[open][1], context], ["exit", events[open][1], context]]);
|
|
3434
3434
|
}
|
|
3435
|
-
nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter",
|
|
3435
|
+
nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text8, context]]);
|
|
3436
3436
|
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index2), context));
|
|
3437
|
-
nextEvents = push(nextEvents, [["exit",
|
|
3437
|
+
nextEvents = push(nextEvents, [["exit", text8, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]);
|
|
3438
3438
|
if (events[index2][1].end.offset - events[index2][1].start.offset) {
|
|
3439
3439
|
offset = 2;
|
|
3440
3440
|
nextEvents = push(nextEvents, [["enter", events[index2][1], context], ["exit", events[index2][1], context]]);
|
|
@@ -4876,7 +4876,7 @@ function resolveHeadingAtx(events, context) {
|
|
|
4876
4876
|
let contentEnd = events.length - 2;
|
|
4877
4877
|
let contentStart = 3;
|
|
4878
4878
|
let content3;
|
|
4879
|
-
let
|
|
4879
|
+
let text8;
|
|
4880
4880
|
if (events[contentStart][1].type === "whitespace") {
|
|
4881
4881
|
contentStart += 2;
|
|
4882
4882
|
}
|
|
@@ -4892,13 +4892,13 @@ function resolveHeadingAtx(events, context) {
|
|
|
4892
4892
|
start: events[contentStart][1].start,
|
|
4893
4893
|
end: events[contentEnd][1].end
|
|
4894
4894
|
};
|
|
4895
|
-
|
|
4895
|
+
text8 = {
|
|
4896
4896
|
type: "chunkText",
|
|
4897
4897
|
start: events[contentStart][1].start,
|
|
4898
4898
|
end: events[contentEnd][1].end,
|
|
4899
4899
|
contentType: "text"
|
|
4900
4900
|
};
|
|
4901
|
-
splice(events, contentStart, contentEnd - contentStart + 1, [["enter", content3, context], ["enter",
|
|
4901
|
+
splice(events, contentStart, contentEnd - contentStart + 1, [["enter", content3, context], ["enter", text8, context], ["exit", text8, context], ["exit", content3, context]]);
|
|
4902
4902
|
}
|
|
4903
4903
|
return events;
|
|
4904
4904
|
}
|
|
@@ -5788,7 +5788,7 @@ function resolveToLabelEnd(events, context) {
|
|
|
5788
5788
|
...events[close][1].end
|
|
5789
5789
|
}
|
|
5790
5790
|
};
|
|
5791
|
-
const
|
|
5791
|
+
const text8 = {
|
|
5792
5792
|
type: "labelText",
|
|
5793
5793
|
start: {
|
|
5794
5794
|
...events[open + offset + 2][1].end
|
|
@@ -5799,9 +5799,9 @@ function resolveToLabelEnd(events, context) {
|
|
|
5799
5799
|
};
|
|
5800
5800
|
media = [["enter", group, context], ["enter", label, context]];
|
|
5801
5801
|
media = push(media, events.slice(open + 1, open + offset + 3));
|
|
5802
|
-
media = push(media, [["enter",
|
|
5802
|
+
media = push(media, [["enter", text8, context]]);
|
|
5803
5803
|
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));
|
|
5804
|
-
media = push(media, [["exit",
|
|
5804
|
+
media = push(media, [["exit", text8, context], events[close - 2], events[close - 1], ["exit", label, context]]);
|
|
5805
5805
|
media = push(media, events.slice(close + 1));
|
|
5806
5806
|
media = push(media, [["exit", group, context]]);
|
|
5807
5807
|
splice(events, open, events.length, media);
|
|
@@ -6181,7 +6181,7 @@ var setextUnderline = {
|
|
|
6181
6181
|
function resolveToSetextUnderline(events, context) {
|
|
6182
6182
|
let index2 = events.length;
|
|
6183
6183
|
let content3;
|
|
6184
|
-
let
|
|
6184
|
+
let text8;
|
|
6185
6185
|
let definition3;
|
|
6186
6186
|
while (index2--) {
|
|
6187
6187
|
if (events[index2][0] === "enter") {
|
|
@@ -6190,7 +6190,7 @@ function resolveToSetextUnderline(events, context) {
|
|
|
6190
6190
|
break;
|
|
6191
6191
|
}
|
|
6192
6192
|
if (events[index2][1].type === "paragraph") {
|
|
6193
|
-
|
|
6193
|
+
text8 = index2;
|
|
6194
6194
|
}
|
|
6195
6195
|
} else {
|
|
6196
6196
|
if (events[index2][1].type === "content") {
|
|
@@ -6204,15 +6204,15 @@ function resolveToSetextUnderline(events, context) {
|
|
|
6204
6204
|
const heading3 = {
|
|
6205
6205
|
type: "setextHeading",
|
|
6206
6206
|
start: {
|
|
6207
|
-
...events[
|
|
6207
|
+
...events[text8][1].start
|
|
6208
6208
|
},
|
|
6209
6209
|
end: {
|
|
6210
6210
|
...events[events.length - 1][1].end
|
|
6211
6211
|
}
|
|
6212
6212
|
};
|
|
6213
|
-
events[
|
|
6213
|
+
events[text8][1].type = "setextHeadingText";
|
|
6214
6214
|
if (definition3) {
|
|
6215
|
-
events.splice(
|
|
6215
|
+
events.splice(text8, 0, ["enter", heading3, context]);
|
|
6216
6216
|
events.splice(definition3 + 1, 0, ["exit", events[content3][1], context]);
|
|
6217
6217
|
events[content3][1].end = {
|
|
6218
6218
|
...events[definition3][1].end
|
|
@@ -6316,10 +6316,10 @@ function initializeFactory(field) {
|
|
|
6316
6316
|
function initializeText(effects) {
|
|
6317
6317
|
const self2 = this;
|
|
6318
6318
|
const constructs2 = this.parser.constructs[field];
|
|
6319
|
-
const
|
|
6319
|
+
const text8 = effects.attempt(constructs2, start2, notText);
|
|
6320
6320
|
return start2;
|
|
6321
6321
|
function start2(code4) {
|
|
6322
|
-
return atBreak(code4) ?
|
|
6322
|
+
return atBreak(code4) ? text8(code4) : notText(code4);
|
|
6323
6323
|
}
|
|
6324
6324
|
function notText(code4) {
|
|
6325
6325
|
if (code4 === null) {
|
|
@@ -6333,7 +6333,7 @@ function initializeFactory(field) {
|
|
|
6333
6333
|
function data(code4) {
|
|
6334
6334
|
if (atBreak(code4)) {
|
|
6335
6335
|
effects.exit("data");
|
|
6336
|
-
return
|
|
6336
|
+
return text8(code4);
|
|
6337
6337
|
}
|
|
6338
6338
|
effects.consume(code4);
|
|
6339
6339
|
return data;
|
|
@@ -7352,7 +7352,7 @@ function compiler(options) {
|
|
|
7352
7352
|
const siblings = node2.children;
|
|
7353
7353
|
let tail = siblings[siblings.length - 1];
|
|
7354
7354
|
if (!tail || tail.type !== "text") {
|
|
7355
|
-
tail =
|
|
7355
|
+
tail = text8();
|
|
7356
7356
|
tail.position = {
|
|
7357
7357
|
start: point3(token.start),
|
|
7358
7358
|
// @ts-expect-error: we’ll add `end` later.
|
|
@@ -7597,7 +7597,7 @@ function compiler(options) {
|
|
|
7597
7597
|
children: []
|
|
7598
7598
|
};
|
|
7599
7599
|
}
|
|
7600
|
-
function
|
|
7600
|
+
function text8() {
|
|
7601
7601
|
return {
|
|
7602
7602
|
type: "text",
|
|
7603
7603
|
value: ""
|
|
@@ -7879,13 +7879,13 @@ function image(state, node2) {
|
|
|
7879
7879
|
|
|
7880
7880
|
// node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
|
|
7881
7881
|
function inlineCode(state, node2) {
|
|
7882
|
-
const
|
|
7883
|
-
state.patch(node2,
|
|
7882
|
+
const text8 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") };
|
|
7883
|
+
state.patch(node2, text8);
|
|
7884
7884
|
const result = {
|
|
7885
7885
|
type: "element",
|
|
7886
7886
|
tagName: "code",
|
|
7887
7887
|
properties: {},
|
|
7888
|
-
children: [
|
|
7888
|
+
children: [text8]
|
|
7889
7889
|
};
|
|
7890
7890
|
state.patch(node2, result);
|
|
7891
7891
|
return state.applyData(node2, result);
|
|
@@ -10968,6 +10968,65 @@ var transform = (tree) => {
|
|
|
10968
10968
|
};
|
|
10969
10969
|
var htmlToTextPlugin = () => transform;
|
|
10970
10970
|
|
|
10971
|
+
// src/components/Message/renderText/remarkPlugins/imageToLink.ts
|
|
10972
|
+
var text5 = (value) => ({ type: "text", value });
|
|
10973
|
+
function imageToLink({ getTextLabelFrom = "url" } = {}) {
|
|
10974
|
+
return (tree) => {
|
|
10975
|
+
const visitor2 = (node2, index2, parent) => {
|
|
10976
|
+
if (parent == null || index2 == null) return;
|
|
10977
|
+
const label = node2[getTextLabelFrom] ?? node2.url;
|
|
10978
|
+
const link3 = {
|
|
10979
|
+
children: [text5(label)],
|
|
10980
|
+
title: node2.title ?? node2.alt ?? node2.url,
|
|
10981
|
+
type: "link",
|
|
10982
|
+
url: node2.url
|
|
10983
|
+
};
|
|
10984
|
+
parent.children.splice(index2, 1, link3);
|
|
10985
|
+
return [SKIP, index2 + 1];
|
|
10986
|
+
};
|
|
10987
|
+
visit(tree, "image", visitor2);
|
|
10988
|
+
};
|
|
10989
|
+
}
|
|
10990
|
+
|
|
10991
|
+
// src/components/Message/renderText/remarkPlugins/plusPlusToEmphasis.ts
|
|
10992
|
+
var INS_REGEX = /\+\+(\S(?:[\s\S]*?\S)?)\+\+/g;
|
|
10993
|
+
var IGNORE_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
10994
|
+
"code",
|
|
10995
|
+
"inlineCode",
|
|
10996
|
+
"link",
|
|
10997
|
+
"linkReference",
|
|
10998
|
+
"definition",
|
|
10999
|
+
"math",
|
|
11000
|
+
"inlineMath"
|
|
11001
|
+
]);
|
|
11002
|
+
var plusPlusToEmphasis = () => {
|
|
11003
|
+
const visitor2 = (node2, index2, parent) => {
|
|
11004
|
+
if (IGNORE_NODE_TYPES.has(node2.type)) return SKIP;
|
|
11005
|
+
if (node2.type !== "text" || parent == null || typeof index2 !== "number") return;
|
|
11006
|
+
const value = node2.value;
|
|
11007
|
+
INS_REGEX.lastIndex = 0;
|
|
11008
|
+
let match;
|
|
11009
|
+
let last = 0;
|
|
11010
|
+
const out = [];
|
|
11011
|
+
while (match = INS_REGEX.exec(value)) {
|
|
11012
|
+
const [full, inner] = match;
|
|
11013
|
+
const start2 = match.index;
|
|
11014
|
+
if (start2 > last) out.push({ type: "text", value: value.slice(last, start2) });
|
|
11015
|
+
out.push({
|
|
11016
|
+
children: [{ type: "text", value: inner }],
|
|
11017
|
+
data: { hName: "ins" },
|
|
11018
|
+
type: "emphasis"
|
|
11019
|
+
});
|
|
11020
|
+
last = start2 + full.length;
|
|
11021
|
+
}
|
|
11022
|
+
if (out.length === 0) return;
|
|
11023
|
+
if (last < value.length) out.push({ type: "text", value: value.slice(last) });
|
|
11024
|
+
parent.children.splice(index2, 1, ...out);
|
|
11025
|
+
return [SKIP, index2 + out.length];
|
|
11026
|
+
};
|
|
11027
|
+
return (tree) => visit(tree, visitor2);
|
|
11028
|
+
};
|
|
11029
|
+
|
|
10971
11030
|
// node_modules/ccount/index.js
|
|
10972
11031
|
function ccount(value, character) {
|
|
10973
11032
|
const source = String(value);
|
|
@@ -12156,12 +12215,12 @@ function linkReference2(node2, _, state, info) {
|
|
|
12156
12215
|
let subexit = state.enter("label");
|
|
12157
12216
|
const tracker = state.createTracker(info);
|
|
12158
12217
|
let value = tracker.move("[");
|
|
12159
|
-
const
|
|
12218
|
+
const text8 = state.containerPhrasing(node2, {
|
|
12160
12219
|
before: value,
|
|
12161
12220
|
after: "]",
|
|
12162
12221
|
...tracker.current()
|
|
12163
12222
|
});
|
|
12164
|
-
value += tracker.move(
|
|
12223
|
+
value += tracker.move(text8 + "][");
|
|
12165
12224
|
subexit();
|
|
12166
12225
|
const stack = state.stack;
|
|
12167
12226
|
state.stack = [];
|
|
@@ -12174,7 +12233,7 @@ function linkReference2(node2, _, state, info) {
|
|
|
12174
12233
|
subexit();
|
|
12175
12234
|
state.stack = stack;
|
|
12176
12235
|
exit3();
|
|
12177
|
-
if (type === "full" || !
|
|
12236
|
+
if (type === "full" || !text8 || text8 !== reference) {
|
|
12178
12237
|
value += tracker.move(reference + "]");
|
|
12179
12238
|
} else if (type === "shortcut") {
|
|
12180
12239
|
value = value.slice(0, -1);
|
|
@@ -12419,7 +12478,7 @@ function strongPeek(_, _1, state) {
|
|
|
12419
12478
|
}
|
|
12420
12479
|
|
|
12421
12480
|
// node_modules/mdast-util-to-markdown/lib/handle/text.js
|
|
12422
|
-
function
|
|
12481
|
+
function text6(node2, _, state, info) {
|
|
12423
12482
|
return state.safe(node2.value, info);
|
|
12424
12483
|
}
|
|
12425
12484
|
|
|
@@ -12460,7 +12519,7 @@ var handle = {
|
|
|
12460
12519
|
paragraph: paragraph2,
|
|
12461
12520
|
root: root3,
|
|
12462
12521
|
strong: strong2,
|
|
12463
|
-
text:
|
|
12522
|
+
text: text6,
|
|
12464
12523
|
thematicBreak: thematicBreak3
|
|
12465
12524
|
};
|
|
12466
12525
|
|
|
@@ -12748,27 +12807,27 @@ var emailAutolink = {
|
|
|
12748
12807
|
tokenize: tokenizeEmailAutolink,
|
|
12749
12808
|
previous: previousEmail
|
|
12750
12809
|
};
|
|
12751
|
-
var
|
|
12810
|
+
var text7 = {};
|
|
12752
12811
|
function gfmAutolinkLiteral() {
|
|
12753
12812
|
return {
|
|
12754
|
-
text:
|
|
12813
|
+
text: text7
|
|
12755
12814
|
};
|
|
12756
12815
|
}
|
|
12757
12816
|
var code3 = 48;
|
|
12758
12817
|
while (code3 < 123) {
|
|
12759
|
-
|
|
12818
|
+
text7[code3] = emailAutolink;
|
|
12760
12819
|
code3++;
|
|
12761
12820
|
if (code3 === 58) code3 = 65;
|
|
12762
12821
|
else if (code3 === 91) code3 = 97;
|
|
12763
12822
|
}
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12823
|
+
text7[43] = emailAutolink;
|
|
12824
|
+
text7[45] = emailAutolink;
|
|
12825
|
+
text7[46] = emailAutolink;
|
|
12826
|
+
text7[95] = emailAutolink;
|
|
12827
|
+
text7[72] = [emailAutolink, protocolAutolink];
|
|
12828
|
+
text7[104] = [emailAutolink, protocolAutolink];
|
|
12829
|
+
text7[87] = [emailAutolink, wwwAutolink];
|
|
12830
|
+
text7[119] = [emailAutolink, wwwAutolink];
|
|
12772
12831
|
function tokenizeEmailAutolink(effects, ok3, nok) {
|
|
12773
12832
|
const self2 = this;
|
|
12774
12833
|
let dot;
|
|
@@ -13367,17 +13426,17 @@ function gfmStrikethrough(options) {
|
|
|
13367
13426
|
start: Object.assign({}, events[open][1].start),
|
|
13368
13427
|
end: Object.assign({}, events[index2][1].end)
|
|
13369
13428
|
};
|
|
13370
|
-
const
|
|
13429
|
+
const text8 = {
|
|
13371
13430
|
type: "strikethroughText",
|
|
13372
13431
|
start: Object.assign({}, events[open][1].end),
|
|
13373
13432
|
end: Object.assign({}, events[index2][1].start)
|
|
13374
13433
|
};
|
|
13375
|
-
const nextEvents = [["enter", strikethrough2, context], ["enter", events[open][1], context], ["exit", events[open][1], context], ["enter",
|
|
13434
|
+
const nextEvents = [["enter", strikethrough2, context], ["enter", events[open][1], context], ["exit", events[open][1], context], ["enter", text8, context]];
|
|
13376
13435
|
const insideSpan2 = context.parser.constructs.insideSpan.null;
|
|
13377
13436
|
if (insideSpan2) {
|
|
13378
13437
|
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(open + 1, index2), context));
|
|
13379
13438
|
}
|
|
13380
|
-
splice(nextEvents, nextEvents.length, 0, [["exit",
|
|
13439
|
+
splice(nextEvents, nextEvents.length, 0, [["exit", text8, context], ["enter", events[index2][1], context], ["exit", events[index2][1], context], ["exit", strikethrough2, context]]);
|
|
13381
13440
|
splice(events, open - 1, index2 - open + 3, nextEvents);
|
|
13382
13441
|
index2 = open + nextEvents.length - 2;
|
|
13383
13442
|
break;
|
|
@@ -14418,9 +14477,11 @@ var InfiniteScrollPaginator = (props) => {
|
|
|
14418
14477
|
// src/components/ChannelPreview/utils.tsx
|
|
14419
14478
|
var remarkPlugins = [
|
|
14420
14479
|
htmlToTextPlugin,
|
|
14421
|
-
[remarkGfm, { singleTilde: false }]
|
|
14480
|
+
[remarkGfm, { singleTilde: false }],
|
|
14481
|
+
plusPlusToEmphasis,
|
|
14482
|
+
imageToLink
|
|
14422
14483
|
];
|
|
14423
|
-
var renderPreviewText = (
|
|
14484
|
+
var renderPreviewText = (text8) => /* @__PURE__ */ import_react32.default.createElement(Markdown, { remarkPlugins, skipHtml: true }, text8);
|
|
14424
14485
|
var getLatestPollVote = (latestVotesByOption) => {
|
|
14425
14486
|
let latestVote;
|
|
14426
14487
|
for (const optionVotes of Object.values(latestVotesByOption)) {
|