Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
This commit is contained in:
@@ -4,12 +4,12 @@ import { sanitizeForRegex } from '../utils/regex';
|
||||
const additionalBadWords: string[] = ['torture', 't0rture'];
|
||||
|
||||
const fullBadWordList = additionalBadWords.concat(
|
||||
badWords.array.filter((word) => !additionalBadWords.includes(word))
|
||||
badWords.array.filter((word) => !additionalBadWords.includes(word)),
|
||||
);
|
||||
|
||||
export const BAD_WORDS_REGEX = new RegExp(
|
||||
`(\\b|_)(${fullBadWordList.map((word) => sanitizeForRegex(word)).join('|')})(\\b|_)`,
|
||||
'g'
|
||||
'g',
|
||||
);
|
||||
|
||||
export const testBadWords = (str: string): boolean => !!str.toLowerCase().match(BAD_WORDS_REGEX);
|
||||
|
||||
@@ -31,7 +31,7 @@ export class PackMetaReader {
|
||||
if (!Array.isArray(this.meta.usage)) return this.fallbackUsage;
|
||||
|
||||
const knownUsage = this.meta.usage.filter(
|
||||
(u) => u === ImageUsage.Emoticon || u === ImageUsage.Sticker
|
||||
(u) => u === ImageUsage.Emoticon || u === ImageUsage.Sticker,
|
||||
);
|
||||
|
||||
if (knownUsage.length === 0) return this.fallbackUsage;
|
||||
|
||||
@@ -50,8 +50,7 @@ export function getRoomImagePacks(room: Room): ImagePack[] {
|
||||
|
||||
export function getGlobalImagePacks(mx: MatrixClient): ImagePack[] {
|
||||
const emoteRoomsContent = getAccountData(mx, AccountDataEvent.PoniesEmoteRooms)?.getContent() as
|
||||
| EmoteRoomsContent
|
||||
| undefined;
|
||||
EmoteRoomsContent | undefined;
|
||||
if (typeof emoteRoomsContent !== 'object') return [];
|
||||
|
||||
const { rooms: roomIdToPackInfo } = emoteRoomsContent;
|
||||
|
||||
@@ -14,7 +14,7 @@ export const runBlockRule = (
|
||||
text: string,
|
||||
rule: BlockMDRule,
|
||||
parse: BlockMDParser,
|
||||
parseInline?: (txt: string) => string
|
||||
parseInline?: (txt: string) => string,
|
||||
): string | undefined => {
|
||||
const matchResult = rule.match(text);
|
||||
if (matchResult) {
|
||||
|
||||
@@ -18,7 +18,7 @@ export type BlockMDParser = (text: string, parseInline?: (txt: string) => string
|
||||
*/
|
||||
export type BlockMatchConverter = (
|
||||
match: MatchResult,
|
||||
parseInline?: (txt: string) => string
|
||||
parseInline?: (txt: string) => string,
|
||||
) => string;
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,7 @@ const BOLD_MD_1 = '**';
|
||||
const BOLD_PREFIX_1 = `${ESC_NEG_LB}\\*{2}`;
|
||||
const BOLD_NEG_LA_1 = '(?!\\*)';
|
||||
const BOLD_REG_1 = new RegExp(
|
||||
`${URL_NEG_LB}${BOLD_PREFIX_1}${MIN_ANY}${BOLD_PREFIX_1}${BOLD_NEG_LA_1}`
|
||||
`${URL_NEG_LB}${BOLD_PREFIX_1}${MIN_ANY}${BOLD_PREFIX_1}${BOLD_NEG_LA_1}`,
|
||||
);
|
||||
export const BoldRule: InlineMDRule = {
|
||||
match: (text) => text.match(BOLD_REG_1),
|
||||
@@ -22,7 +22,7 @@ const ITALIC_MD_1 = '*';
|
||||
const ITALIC_PREFIX_1 = `${ESC_NEG_LB}\\*`;
|
||||
const ITALIC_NEG_LA_1 = '(?!\\*)';
|
||||
const ITALIC_REG_1 = new RegExp(
|
||||
`${URL_NEG_LB}${ITALIC_PREFIX_1}${MIN_ANY}${ITALIC_PREFIX_1}${ITALIC_NEG_LA_1}`
|
||||
`${URL_NEG_LB}${ITALIC_PREFIX_1}${MIN_ANY}${ITALIC_PREFIX_1}${ITALIC_NEG_LA_1}`,
|
||||
);
|
||||
export const ItalicRule1: InlineMDRule = {
|
||||
match: (text) => text.match(ITALIC_REG_1),
|
||||
@@ -36,7 +36,7 @@ const ITALIC_MD_2 = '_';
|
||||
const ITALIC_PREFIX_2 = `${ESC_NEG_LB}_`;
|
||||
const ITALIC_NEG_LA_2 = '(?!_)';
|
||||
const ITALIC_REG_2 = new RegExp(
|
||||
`${URL_NEG_LB}${ITALIC_PREFIX_2}${MIN_ANY}${ITALIC_PREFIX_2}${ITALIC_NEG_LA_2}`
|
||||
`${URL_NEG_LB}${ITALIC_PREFIX_2}${MIN_ANY}${ITALIC_PREFIX_2}${ITALIC_NEG_LA_2}`,
|
||||
);
|
||||
export const ItalicRule2: InlineMDRule = {
|
||||
match: (text) => text.match(ITALIC_REG_2),
|
||||
@@ -50,7 +50,7 @@ const UNDERLINE_MD_1 = '__';
|
||||
const UNDERLINE_PREFIX_1 = `${ESC_NEG_LB}_{2}`;
|
||||
const UNDERLINE_NEG_LA_1 = '(?!_)';
|
||||
const UNDERLINE_REG_1 = new RegExp(
|
||||
`${URL_NEG_LB}${UNDERLINE_PREFIX_1}${MIN_ANY}${UNDERLINE_PREFIX_1}${UNDERLINE_NEG_LA_1}`
|
||||
`${URL_NEG_LB}${UNDERLINE_PREFIX_1}${MIN_ANY}${UNDERLINE_PREFIX_1}${UNDERLINE_NEG_LA_1}`,
|
||||
);
|
||||
export const UnderlineRule: InlineMDRule = {
|
||||
match: (text) => text.match(UNDERLINE_REG_1),
|
||||
@@ -64,7 +64,7 @@ const STRIKE_MD_1 = '~~';
|
||||
const STRIKE_PREFIX_1 = `${ESC_NEG_LB}~{2}`;
|
||||
const STRIKE_NEG_LA_1 = '(?!~)';
|
||||
const STRIKE_REG_1 = new RegExp(
|
||||
`${URL_NEG_LB}${STRIKE_PREFIX_1}${MIN_ANY}${STRIKE_PREFIX_1}${STRIKE_NEG_LA_1}`
|
||||
`${URL_NEG_LB}${STRIKE_PREFIX_1}${MIN_ANY}${STRIKE_PREFIX_1}${STRIKE_NEG_LA_1}`,
|
||||
);
|
||||
export const StrikeRule: InlineMDRule = {
|
||||
match: (text) => text.match(STRIKE_REG_1),
|
||||
@@ -90,7 +90,7 @@ const SPOILER_MD_1 = '||';
|
||||
const SPOILER_PREFIX_1 = `${ESC_NEG_LB}\\|{2}`;
|
||||
const SPOILER_NEG_LA_1 = '(?!\\|)';
|
||||
const SPOILER_REG_1 = new RegExp(
|
||||
`${URL_NEG_LB}${SPOILER_PREFIX_1}${MIN_ANY}${SPOILER_PREFIX_1}${SPOILER_NEG_LA_1}`
|
||||
`${URL_NEG_LB}${SPOILER_PREFIX_1}${MIN_ANY}${SPOILER_PREFIX_1}${SPOILER_NEG_LA_1}`,
|
||||
);
|
||||
export const SpoilerRule: InlineMDRule = {
|
||||
match: (text) => text.match(SPOILER_REG_1),
|
||||
|
||||
@@ -12,7 +12,7 @@ import { InlineMDParser, InlineMDRule } from './type';
|
||||
export const runInlineRule = (
|
||||
text: string,
|
||||
rule: InlineMDRule,
|
||||
parse: InlineMDParser
|
||||
parse: InlineMDParser,
|
||||
): string | undefined => {
|
||||
const matchResult = rule.match(text);
|
||||
if (matchResult) {
|
||||
@@ -34,7 +34,7 @@ export const runInlineRule = (
|
||||
export const runInlineRules = (
|
||||
text: string,
|
||||
rules: InlineMDRule[],
|
||||
parse: InlineMDParser
|
||||
parse: InlineMDParser,
|
||||
): string | undefined => {
|
||||
const matchResults = rules.map((rule) => rule.match(text));
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ export const replaceMatch = <C>(
|
||||
text: string,
|
||||
match: MatchResult,
|
||||
content: C,
|
||||
processPart: (txt: string) => Array<string | C>
|
||||
processPart: (txt: string) => Array<string | C>,
|
||||
): Array<string | C> => [
|
||||
...processPart(beforeMatch(text, match)),
|
||||
content,
|
||||
|
||||
@@ -35,7 +35,7 @@ export const escapeMarkdownInlineSequences = (text: string): string => {
|
||||
const [, g1] = match;
|
||||
return `\\${g1}`;
|
||||
},
|
||||
(t) => t
|
||||
(t) => t,
|
||||
);
|
||||
|
||||
return parts.join('');
|
||||
@@ -52,7 +52,7 @@ export const escapeMarkdownInlineSequences = (text: string): string => {
|
||||
*/
|
||||
export const unescapeMarkdownBlockSequences = (
|
||||
text: string,
|
||||
processPart: (text: string) => string
|
||||
processPart: (text: string) => string,
|
||||
): string => {
|
||||
const match = text.match(ESC_BLOCK_SEQ);
|
||||
|
||||
@@ -72,7 +72,7 @@ export const unescapeMarkdownBlockSequences = (
|
||||
*/
|
||||
export const escapeMarkdownBlockSequences = (
|
||||
text: string,
|
||||
processPart: (text: string) => string
|
||||
processPart: (text: string) => string,
|
||||
): string => {
|
||||
const match = text.match(UN_ESC_BLOCK_SEQ);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export const getMatrixToRoom = (roomIdOrAlias: string, viaServers?: string[]): s
|
||||
export const getMatrixToRoomEvent = (
|
||||
roomIdOrAlias: string,
|
||||
eventId: string,
|
||||
viaServers?: string[]
|
||||
viaServers?: string[],
|
||||
): string => {
|
||||
let fragment = `${roomIdOrAlias}/${eventId}`;
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ export const usePdfJSLoader = () =>
|
||||
useCallback(async () => {
|
||||
const pdf = await import('pdfjs-dist');
|
||||
pdf.GlobalWorkerOptions.workerSrc = `${trimTrailingSlash(
|
||||
import.meta.env.BASE_URL
|
||||
import.meta.env.BASE_URL,
|
||||
)}/pdf.worker.min.js`;
|
||||
return pdf;
|
||||
}, [])
|
||||
}, []),
|
||||
);
|
||||
|
||||
export const usePdfDocumentLoader = (pdfJS: typeof PdfJsDist | undefined, src: string) =>
|
||||
@@ -23,13 +23,13 @@ export const usePdfDocumentLoader = (pdfJS: typeof PdfJsDist | undefined, src: s
|
||||
}
|
||||
const doc = await pdfJS.getDocument(src).promise;
|
||||
return doc;
|
||||
}, [pdfJS, src])
|
||||
}, [pdfJS, src]),
|
||||
);
|
||||
|
||||
export const createPage = async (
|
||||
doc: PdfJsDist.PDFDocumentProxy,
|
||||
pNo: number,
|
||||
opts: GetViewportParameters
|
||||
opts: GetViewportParameters,
|
||||
): Promise<HTMLCanvasElement> => {
|
||||
const page = await doc.getPage(pNo);
|
||||
const pageViewport = page.getViewport(opts);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable jsx-a11y/alt-text */
|
||||
import React, {
|
||||
ComponentPropsWithoutRef,
|
||||
MouseEvent,
|
||||
@@ -32,11 +31,12 @@ import {
|
||||
Text,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { Icon, Icons } from '../components/icons';
|
||||
import { IntermediateRepresentation, Opts as LinkifyOpts, OptFn } from 'linkifyjs';
|
||||
import Linkify from 'linkify-react';
|
||||
import { ErrorBoundary } from 'react-error-boundary';
|
||||
import { ChildNode } from 'domhandler';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { Icon, Icons } from '../components/icons';
|
||||
import * as css from '../styles/CustomHtml.css';
|
||||
import {
|
||||
getMxIdLocalPart,
|
||||
@@ -59,12 +59,7 @@ import { copyToClipboard, tryDecodeURIComponent } from '../utils/dom';
|
||||
import { useTimeoutToggle } from '../hooks/useTimeoutToggle';
|
||||
import { settingsAtom } from '../state/settings';
|
||||
import { useSetting } from '../state/hooks/settings';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import {
|
||||
AUTO_LANGUAGE,
|
||||
LANGUAGE_OPTIONS,
|
||||
PLAIN_LANGUAGE,
|
||||
} from './react-prism/languages';
|
||||
import { AUTO_LANGUAGE, LANGUAGE_OPTIONS, PLAIN_LANGUAGE } from './react-prism/languages';
|
||||
import { AuthenticatedImg } from '../components/authenticated-media';
|
||||
import { openExternalUrl } from '../utils/tauri';
|
||||
|
||||
@@ -75,7 +70,7 @@ const PrismCode = lazy(() => import('./react-prism/PrismCode'));
|
||||
* Click handler for external links - uses Tauri shell on desktop/mobile
|
||||
*/
|
||||
const handleExternalLinkClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
||||
const href = e.currentTarget.href;
|
||||
const { href } = e.currentTarget;
|
||||
console.log('[handleExternalLinkClick] clicked link:', href);
|
||||
if (href && (href.startsWith('http://') || href.startsWith('https://'))) {
|
||||
e.preventDefault();
|
||||
@@ -99,7 +94,7 @@ export const LINKIFY_OPTS: LinkifyOpts = {
|
||||
|
||||
export const makeMentionCustomProps = (
|
||||
handleMentionClick?: ReactEventHandler<HTMLElement>,
|
||||
content?: string
|
||||
content?: string,
|
||||
): ComponentPropsWithoutRef<'a'> => ({
|
||||
style: { cursor: 'pointer' },
|
||||
target: '_blank',
|
||||
@@ -115,7 +110,7 @@ export const renderMatrixMention = (
|
||||
mx: MatrixClient,
|
||||
currentRoomId: string | undefined,
|
||||
href: string,
|
||||
customProps: ComponentPropsWithoutRef<'a'>
|
||||
customProps: ComponentPropsWithoutRef<'a'>,
|
||||
) => {
|
||||
const userId = parseMatrixToUser(href);
|
||||
if (userId) {
|
||||
@@ -140,7 +135,7 @@ export const renderMatrixMention = (
|
||||
if (matrixToRoom) {
|
||||
const { roomIdOrAlias, viaServers } = matrixToRoom;
|
||||
const mentionRoom = mx.getRoom(
|
||||
isRoomAlias(roomIdOrAlias) ? getCanonicalAliasRoomId(mx, roomIdOrAlias) : roomIdOrAlias
|
||||
isRoomAlias(roomIdOrAlias) ? getCanonicalAliasRoomId(mx, roomIdOrAlias) : roomIdOrAlias,
|
||||
);
|
||||
|
||||
const fallbackContent = mentionRoom ? `#${mentionRoom.name}` : roomIdOrAlias;
|
||||
@@ -164,7 +159,7 @@ export const renderMatrixMention = (
|
||||
if (matrixToRoomEvent) {
|
||||
const { roomIdOrAlias, eventId, viaServers } = matrixToRoomEvent;
|
||||
const mentionRoom = mx.getRoom(
|
||||
isRoomAlias(roomIdOrAlias) ? getCanonicalAliasRoomId(mx, roomIdOrAlias) : roomIdOrAlias
|
||||
isRoomAlias(roomIdOrAlias) ? getCanonicalAliasRoomId(mx, roomIdOrAlias) : roomIdOrAlias,
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -189,7 +184,7 @@ export const renderMatrixMention = (
|
||||
};
|
||||
|
||||
export const factoryRenderLinkifyWithMention = (
|
||||
mentionRender: (href: string) => JSX.Element | undefined
|
||||
mentionRender: (href: string) => JSX.Element | undefined,
|
||||
): OptFn<(ir: IntermediateRepresentation) => any> => {
|
||||
const render: OptFn<(ir: IntermediateRepresentation) => any> = ({
|
||||
tagName,
|
||||
@@ -201,7 +196,11 @@ export const factoryRenderLinkifyWithMention = (
|
||||
if (mention) return mention;
|
||||
}
|
||||
|
||||
return <a {...attributes} onClick={handleExternalLinkClick}>{content}</a>;
|
||||
return (
|
||||
<a {...attributes} onClick={handleExternalLinkClick}>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
};
|
||||
return render;
|
||||
};
|
||||
@@ -211,13 +210,17 @@ export const scaleSystemEmoji = (text: string): (string | JSX.Element)[] =>
|
||||
text,
|
||||
EMOJI_REG_G,
|
||||
(match, pushIndex) => (
|
||||
<span key={`scaleSystemEmoji-${pushIndex}`} className={css.EmoticonBase} data-emoticon={match[0]}>
|
||||
<span
|
||||
key={`scaleSystemEmoji-${pushIndex}`}
|
||||
className={css.EmoticonBase}
|
||||
data-emoticon={match[0]}
|
||||
>
|
||||
<span className={css.Emoticon()} title={getShortcodeFor(getHexcodeForEmoji(match[0]))}>
|
||||
{match[0]}
|
||||
</span>
|
||||
</span>
|
||||
),
|
||||
(txt) => txt
|
||||
(txt) => txt,
|
||||
);
|
||||
|
||||
export const makeHighlightRegex = (highlights: string[]): RegExp | undefined => {
|
||||
@@ -228,7 +231,7 @@ export const makeHighlightRegex = (highlights: string[]): RegExp | undefined =>
|
||||
|
||||
export const highlightText = (
|
||||
regex: RegExp,
|
||||
data: (string | JSX.Element)[]
|
||||
data: (string | JSX.Element)[],
|
||||
): (string | JSX.Element)[] =>
|
||||
data.flatMap((text) => {
|
||||
if (typeof text !== 'string') return text;
|
||||
@@ -241,7 +244,7 @@ export const highlightText = (
|
||||
{match[0]}
|
||||
</span>
|
||||
),
|
||||
(txt) => txt
|
||||
(txt) => txt,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -296,7 +299,7 @@ export function CodeBlock({ children }: { children: ChildNode[] }) {
|
||||
override === AUTO_LANGUAGE ? language : override === PLAIN_LANGUAGE ? undefined : override;
|
||||
const languageLabel =
|
||||
override === AUTO_LANGUAGE
|
||||
? language ?? 'Code'
|
||||
? (language ?? 'Code')
|
||||
: (LANGUAGE_OPTIONS.find((option) => option.value === override)?.label ?? override);
|
||||
|
||||
const handleCopy = () => {
|
||||
@@ -378,8 +381,14 @@ export function CodeBlock({ children }: { children: ChildNode[] }) {
|
||||
copied ? (
|
||||
<Icon size="50" src={Icons.Check} />
|
||||
) : (
|
||||
<svg width="12" height="12" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
||||
<path d="M3 5V12.73C2.4 12.38 2 11.74 2 11V5C2 2.79 3.79 1 6 1H9C9.74 1 10.38 1.4 10.73 2H6C4.35 2 3 3.35 3 5ZM11 15H6C4.897 15 4 14.103 4 13V5C4 3.897 4.897 3 6 3H11C12.103 3 13 3.897 13 5V13C13 14.103 12.103 15 11 15ZM12 5C12 4.448 11.552 4 11 4H6C5.448 4 5 4.448 5 5V13C5 13.552 5.448 14 6 14H11C11.552 14 12 13.552 12 13V5Z"/>
|
||||
<svg
|
||||
width="12"
|
||||
height="12"
|
||||
viewBox="0 0 16 16"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M3 5V12.73C2.4 12.38 2 11.74 2 11V5C2 2.79 3.79 1 6 1H9C9.74 1 10.38 1.4 10.73 2H6C4.35 2 3 3.35 3 5ZM11 15H6C4.897 15 4 14.103 4 13V5C4 3.897 4.897 3 6 3H11C12.103 3 13 3.897 13 5V13C13 14.103 12.103 15 11 15ZM12 5C12 4.448 11.552 4 11 4H6C5.448 4 5 4.448 5 5V13C5 13.552 5.448 14 6 14H11C11.552 14 12 13.552 12 13V5Z" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -499,8 +508,14 @@ export function InlineCode({
|
||||
{copied ? (
|
||||
<Icon size="50" src={Icons.Check} />
|
||||
) : (
|
||||
<svg width="12" height="12" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
||||
<path d="M3 5V12.73C2.4 12.38 2 11.74 2 11V5C2 2.79 3.79 1 6 1H9C9.74 1 10.38 1.4 10.73 2H6C4.35 2 3 3.35 3 5ZM11 15H6C4.897 15 4 14.103 4 13V5C4 3.897 4.897 3 6 3H11C12.103 3 13 3.897 13 5V13C13 14.103 12.103 15 11 15ZM12 5C12 4.448 11.552 4 11 4H6C5.448 4 5 4.448 5 5V13C5 13.552 5.448 14 6 14H11C11.552 14 12 13.552 12 13V5Z"/>
|
||||
<svg
|
||||
width="12"
|
||||
height="12"
|
||||
viewBox="0 0 16 16"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M3 5V12.73C2.4 12.38 2 11.74 2 11V5C2 2.79 3.79 1 6 1H9C9.74 1 10.38 1.4 10.73 2H6C4.35 2 3 3.35 3 5ZM11 15H6C4.897 15 4 14.103 4 13V5C4 3.897 4.897 3 6 3H11C12.103 3 13 3.897 13 5V13C13 14.103 12.103 15 11 15ZM12 5C12 4.448 11.552 4 11 4H6C5.448 4 5 4.448 5 5V13C5 13.552 5.448 14 6 14H11C11.552 14 12 13.552 12 13V5Z" />
|
||||
</svg>
|
||||
)}
|
||||
</span>
|
||||
@@ -520,7 +535,7 @@ export const getReactCustomHtmlParser = (
|
||||
handleSpoilerClick?: ReactEventHandler<HTMLElement>;
|
||||
handleMentionClick?: ReactEventHandler<HTMLElement>;
|
||||
useAuthentication?: boolean;
|
||||
}
|
||||
},
|
||||
): HTMLReactParserOptions => {
|
||||
const opts: HTMLReactParserOptions = {
|
||||
replace: (domNode) => {
|
||||
@@ -634,7 +649,11 @@ export const getReactCustomHtmlParser = (
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return <InlineCode opts={opts} props={props}>{children}</InlineCode>;
|
||||
return (
|
||||
<InlineCode opts={opts} props={props}>
|
||||
{children}
|
||||
</InlineCode>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +669,7 @@ export const getReactCustomHtmlParser = (
|
||||
mx,
|
||||
roomId,
|
||||
href,
|
||||
makeMentionCustomProps(params.handleMentionClick, content)
|
||||
makeMentionCustomProps(params.handleMentionClick, content),
|
||||
);
|
||||
|
||||
if (mention) return mention;
|
||||
@@ -686,7 +705,12 @@ export const getReactCustomHtmlParser = (
|
||||
const htmlSrc = mxcUrlToHttp(mx, props.src, params.useAuthentication);
|
||||
if (htmlSrc && props.src.startsWith('mxc://') === false) {
|
||||
return (
|
||||
<a href={htmlSrc} target="_blank" rel="noreferrer noopener" onClick={handleExternalLinkClick}>
|
||||
<a
|
||||
href={htmlSrc}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
onClick={handleExternalLinkClick}
|
||||
>
|
||||
{props.alt || props.title || htmlSrc}
|
||||
</a>
|
||||
);
|
||||
|
||||
@@ -44,7 +44,7 @@ export class Intent {
|
||||
return new Cursor(
|
||||
cursor.start === linesCursor.start ? cursor.start : cursor.start + this.str.length,
|
||||
cursor.end + addedIntentLength,
|
||||
cursor.direction
|
||||
cursor.direction,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export class Intent {
|
||||
|
||||
const firstLineTrimLength = lines[0].length - intentLines[0].length;
|
||||
const lastLine = this.textArea.cursorLines(
|
||||
new Cursor(intentCursor.end, intentCursor.end, 'none')
|
||||
new Cursor(intentCursor.end, intentCursor.end, 'none'),
|
||||
);
|
||||
|
||||
const start = Math.max(cursor.start - firstLineTrimLength, linesCursor.start);
|
||||
|
||||
@@ -62,7 +62,7 @@ export const getViaServers = (room: Room): string[] => {
|
||||
}
|
||||
const serverToPop = getServerToPopulation();
|
||||
const sortedServers = Object.keys(serverToPop).sort(
|
||||
(svrA, svrB) => serverToPop[svrB] - serverToPop[svrA]
|
||||
(svrA, svrB) => serverToPop[svrB] - serverToPop[svrA],
|
||||
);
|
||||
const mostPop3 = sortedServers.slice(0, 3);
|
||||
if (via.length === 0) return mostPop3;
|
||||
|
||||
Reference in New Issue
Block a user