chore: upgrade i18next 26, prettier 3, fontsource-variable, domhandler 6, lint-staged 17
CI / Build & Quality Checks (push) Successful in 10m13s

- i18next 23->26 + react-i18next 15->17
- prettier 2->3, reformat all files
- replace @fontsource/inter with @fontsource-variable/inter 5, update import path
- domhandler 5->6 (aligns with transitive deps)
- lint-staged 16->17
This commit is contained in:
Lotus Bot
2026-05-21 23:30:50 -04:00
parent 98fde12682
commit 23008670f3
363 changed files with 1443 additions and 1419 deletions
+2 -2
View File
@@ -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);
+7 -7
View File
@@ -22,7 +22,7 @@ export class CallControl extends EventEmitter implements CallControlState {
private get screenshareButton(): HTMLElement | undefined {
const screenshareBtn = this.document?.querySelector(
'[data-testid="incall_screenshare"]'
'[data-testid="incall_screenshare"]',
) as HTMLElement | null;
return screenshareBtn ?? undefined;
@@ -43,7 +43,7 @@ export class CallControl extends EventEmitter implements CallControlState {
private get spotlightButton(): HTMLInputElement | undefined {
const spotlightButton = this.document?.querySelector(
'input[value="spotlight"]'
'input[value="spotlight"]',
) as HTMLInputElement | null;
return spotlightButton ?? undefined;
@@ -51,7 +51,7 @@ export class CallControl extends EventEmitter implements CallControlState {
private get gridButton(): HTMLInputElement | undefined {
const gridButton = this.document?.querySelector(
'input[value="grid"]'
'input[value="grid"]',
) as HTMLInputElement | null;
return gridButton ?? undefined;
@@ -106,7 +106,7 @@ export class CallControl extends EventEmitter implements CallControlState {
desired.video,
desired.sound,
this.screenshare,
this.spotlight
this.spotlight,
);
await this.applyState();
}
@@ -158,7 +158,7 @@ export class CallControl extends EventEmitter implements CallControlState {
data.video_enabled ?? this.video,
this.sound,
this.screenshare,
this.spotlight
this.spotlight,
);
this.state = state;
@@ -180,7 +180,7 @@ export class CallControl extends EventEmitter implements CallControlState {
this.video,
this.sound,
screenshare,
spotlight
spotlight,
);
this.emitStateUpdate();
@@ -226,7 +226,7 @@ export class CallControl extends EventEmitter implements CallControlState {
this.video,
sound,
this.screenshare,
this.spotlight
this.spotlight,
);
this.state = state;
this.emitStateUpdate();
+1 -1
View File
@@ -14,7 +14,7 @@ export class CallControlState {
video: boolean,
sound: boolean,
screenshare = false,
spotlight = false
spotlight = false,
) {
this.microphone = microphone;
this.video = video;
+6 -6
View File
@@ -96,7 +96,7 @@ export class CallEmbed {
themeKind: ElementCallThemeKind,
noiseSuppression = true,
initialAudio = true,
initialVideo = false
initialVideo = false,
): Widget {
const userId = mx.getSafeUserId();
const deviceId = mx.getDeviceId() ?? '';
@@ -130,7 +130,7 @@ export class CallEmbed {
const widgetUrl = new URL(
`${trimTrailingSlash(import.meta.env.BASE_URL)}/public/element-call/index.html`,
window.location.origin
window.location.origin,
);
widgetUrl.search = params.toString();
@@ -170,10 +170,10 @@ export class CallEmbed {
room: Room,
widget: Widget,
container: HTMLElement,
initialControlState?: CallControlState
initialControlState?: CallControlState,
) {
const iframe = CallEmbed.getIframe(
widget.getCompleteUrl({ currentUserId: mx.getSafeUserId() })
widget.getCompleteUrl({ currentUserId: mx.getSafeUserId() }),
);
container.append(iframe);
@@ -199,7 +199,7 @@ export class CallEmbed {
return;
}
this.control.onMediaState(evt);
})
}),
);
this.start();
@@ -243,7 +243,7 @@ export class CallEmbed {
// Room widgets get locked to the room they were added in
this.call.setViewedRoomId(this.roomId);
this.disposables.push(
this.listenAction(ElementWidgetActions.JoinCall, this.onCallJoined.bind(this))
this.listenAction(ElementWidgetActions.JoinCall, this.onCallJoined.bind(this)),
);
// Populate the map of "read up to" events for this widget with the current event in every room.
+20 -17
View File
@@ -32,7 +32,10 @@ export class CallWidgetDriver extends WidgetDriver {
private readonly mx: MatrixClient;
public constructor(mx: MatrixClient, private inRoomId: string) {
public constructor(
mx: MatrixClient,
private inRoomId: string,
) {
super();
this.mx = mx;
@@ -51,7 +54,7 @@ export class CallWidgetDriver extends WidgetDriver {
eventType: string,
content: IContent,
stateKey: string | null = null,
targetRoomId: string | null = null
targetRoomId: string | null = null,
): Promise<ISendEventDetails> {
const client = this.mx;
const roomId = targetRoomId || this.inRoomId;
@@ -64,7 +67,7 @@ export class CallWidgetDriver extends WidgetDriver {
roomId,
eventType as keyof StateEvents,
content as StateEvents[keyof StateEvents],
stateKey
stateKey,
);
} else if (eventType === EventType.RoomRedaction) {
// special case: extract the `redacts` property and call redact
@@ -73,7 +76,7 @@ export class CallWidgetDriver extends WidgetDriver {
r = await client.sendEvent(
roomId,
eventType as keyof TimelineEvents,
content as TimelineEvents[keyof TimelineEvents]
content as TimelineEvents[keyof TimelineEvents],
);
}
@@ -86,7 +89,7 @@ export class CallWidgetDriver extends WidgetDriver {
eventType: string,
content: IContent,
stateKey: string | null = null,
targetRoomId: string | null = null
targetRoomId: string | null = null,
): Promise<ISendDelayedEventDetails> {
const client = this.mx;
const roomId = targetRoomId || this.inRoomId;
@@ -115,7 +118,7 @@ export class CallWidgetDriver extends WidgetDriver {
delayOpts,
eventType as keyof StateEvents,
content as StateEvents[keyof StateEvents],
stateKey
stateKey,
);
} else {
// message event
@@ -124,7 +127,7 @@ export class CallWidgetDriver extends WidgetDriver {
delayOpts,
null,
eventType as keyof TimelineEvents,
content as TimelineEvents[keyof TimelineEvents]
content as TimelineEvents[keyof TimelineEvents],
);
}
@@ -136,7 +139,7 @@ export class CallWidgetDriver extends WidgetDriver {
public async updateDelayedEvent(
delayId: string,
action: UpdateDelayedEventAction
action: UpdateDelayedEventAction,
): Promise<void> {
const client = this.mx;
@@ -148,7 +151,7 @@ export class CallWidgetDriver extends WidgetDriver {
public async sendToDevice(
eventType: string,
encrypted: boolean,
contentMap: { [userId: string]: { [deviceId: string]: object } }
contentMap: { [userId: string]: { [deviceId: string]: object } },
): Promise<void> {
const client = this.mx;
@@ -176,11 +179,11 @@ export class CallWidgetDriver extends WidgetDriver {
const batch = await crypto.encryptToDeviceMessages(
eventType,
recipients,
JSON.parse(stringifiedContent)
JSON.parse(stringifiedContent),
);
await client.queueToDevice(batch);
})
}),
);
} else {
await client.queueToDevice({
@@ -190,7 +193,7 @@ export class CallWidgetDriver extends WidgetDriver {
userId,
deviceId,
payload: content,
}))
})),
),
});
}
@@ -202,7 +205,7 @@ export class CallWidgetDriver extends WidgetDriver {
msgtype: string | undefined,
stateKey: string | undefined,
limit: number,
since: string | undefined
since: string | undefined,
): Promise<IRoomEvent[]> {
const safeLimit =
limit > 0 ? Math.min(limit, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER; // relatively arbitrary
@@ -240,7 +243,7 @@ export class CallWidgetDriver extends WidgetDriver {
public async readRoomState(
roomId: string,
eventType: string,
stateKey: string | undefined
stateKey: string | undefined,
): Promise<IRoomEvent[]> {
const room = this.mx.getRoom(roomId);
if (room === null) return [];
@@ -261,7 +264,7 @@ export class CallWidgetDriver extends WidgetDriver {
from?: string,
to?: string,
limit?: number,
direction?: 'f' | 'b'
direction?: 'f' | 'b',
): Promise<IReadEventRelationsResult> {
const client = this.mx;
const dir = direction as Direction;
@@ -276,7 +279,7 @@ export class CallWidgetDriver extends WidgetDriver {
eventId,
relationType ?? null,
eventType ?? null,
{ from, to, limit, dir }
{ from, to, limit, dir },
);
return {
@@ -288,7 +291,7 @@ export class CallWidgetDriver extends WidgetDriver {
public async searchUserDirectory(
searchTerm: string,
limit?: number
limit?: number,
): Promise<ISearchUserDirectoryResult> {
const client = this.mx;
+3 -3
View File
@@ -10,7 +10,7 @@ import { CallControlState } from './CallControlState';
export const useClientWidgetApiEvent = <T>(
api: ClientWidgetApi | undefined,
type: string,
callback: (event: CustomEvent<T>) => void
callback: (event: CustomEvent<T>) => void,
) => {
useEffect(() => {
api?.on(`action:${type}`, callback);
@@ -24,9 +24,9 @@ export const useSendClientWidgetApiAction = (api: ClientWidgetApi) => {
const sendWidgetAction = useCallback(
async <T extends IWidgetApiRequestData = IWidgetApiRequestData>(
action: string,
data: T
data: T,
): Promise<IWidgetApiAcknowledgeResponseData> => api.transport.send(action, data),
[api]
[api],
);
return sendWidgetAction;
+17 -17
View File
@@ -9,7 +9,7 @@ import { EventType } from 'matrix-js-sdk';
export function getCallCapabilities(
roomId: string,
userId: string,
deviceId: string
deviceId: string,
): Set<Capability> {
const capabilities: Set<Capability> = new Set();
@@ -24,60 +24,60 @@ export function getCallCapabilities(
capabilities.add(`org.matrix.msc2762.state:${roomId}`);
capabilities.add(
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomMember).raw
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomMember).raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(EventDirection.Receive, 'org.matrix.msc3401.call').raw
WidgetEventCapability.forStateEvent(EventDirection.Receive, 'org.matrix.msc3401.call').raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomEncryption).raw
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomEncryption).raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomName).raw
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomName).raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(
EventDirection.Send,
'org.matrix.msc3401.call.member',
userId
).raw
userId,
).raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(
EventDirection.Send,
'org.matrix.msc3401.call.member',
`_${userId}_${deviceId}_m.call`
).raw
`_${userId}_${deviceId}_m.call`,
).raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(
EventDirection.Send,
'org.matrix.msc3401.call.member',
`${userId}_${deviceId}_m.call`
).raw
`${userId}_${deviceId}_m.call`,
).raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(
EventDirection.Send,
'org.matrix.msc3401.call.member',
`_${userId}_${deviceId}`
).raw
`_${userId}_${deviceId}`,
).raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(
EventDirection.Send,
'org.matrix.msc3401.call.member',
`${userId}_${deviceId}`
).raw
`${userId}_${deviceId}`,
).raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(EventDirection.Receive, 'org.matrix.msc3401.call.member')
.raw
.raw,
);
capabilities.add(
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomCreate).raw
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomCreate).raw,
);
[
@@ -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;
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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;
/**
+6 -6
View File
@@ -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),
+2 -2
View File
@@ -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));
+1 -1
View File
@@ -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,
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -18,7 +18,7 @@ export const getMatrixToRoom = (roomIdOrAlias: string, viaServers?: string[]): s
export const getMatrixToRoomEvent = (
roomId: string,
eventId: string,
viaServers?: string[]
viaServers?: string[],
): string => {
let fragment = `${roomId}/${eventId}`;
+4 -4
View File
@@ -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);
+11 -11
View File
@@ -59,7 +59,7 @@ export const LINKIFY_OPTS: LinkifyOpts = {
export const makeMentionCustomProps = (
handleMentionClick?: ReactEventHandler<HTMLElement>,
content?: string
content?: string,
): ComponentPropsWithoutRef<'a'> => ({
style: { cursor: 'pointer' },
target: '_blank',
@@ -75,7 +75,7 @@ export const renderMatrixMention = (
mx: MatrixClient,
currentRoomId: string | undefined,
href: string,
customProps: ComponentPropsWithoutRef<'a'>
customProps: ComponentPropsWithoutRef<'a'>,
) => {
const userId = parseMatrixToUser(href);
if (userId) {
@@ -99,7 +99,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;
@@ -123,7 +123,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 (
@@ -148,7 +148,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,
@@ -176,7 +176,7 @@ export const scaleSystemEmoji = (text: string): (string | JSX.Element)[] =>
</span>
</span>
),
(txt) => txt
(txt) => txt,
);
export const makeHighlightRegex = (highlights: string[]): RegExp | undefined => {
@@ -187,7 +187,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;
@@ -200,7 +200,7 @@ export const highlightText = (
{match[0]}
</span>
),
(txt) => txt
(txt) => txt,
);
});
@@ -243,7 +243,7 @@ export function CodeBlock({
const LINE_LIMIT = 14;
const largeCodeBlock = useMemo(
() => extractTextFromChildren(children).split('\n').length > LINE_LIMIT,
[children]
[children],
);
const [expanded, setExpand] = useState(false);
@@ -319,7 +319,7 @@ export const getReactCustomHtmlParser = (
handleSpoilerClick?: ReactEventHandler<HTMLElement>;
handleMentionClick?: ReactEventHandler<HTMLElement>;
useAuthentication?: boolean;
}
},
): HTMLReactParserOptions => {
const opts: HTMLReactParserOptions = {
replace: (domNode) => {
@@ -450,7 +450,7 @@ export const getReactCustomHtmlParser = (
mx,
roomId,
tryDecodeURIComponent(props.href),
makeMentionCustomProps(params.handleMentionClick, content)
makeMentionCustomProps(params.handleMentionClick, content),
);
if (mention) return mention;
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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;