Handle tg://join as tg://joinchat
Fix editing monospace text in messageEntityPre
This commit is contained in:
parent
5767876abd
commit
9b7b63bcfb
@ -486,18 +486,20 @@ export class AppImManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
['joinchat' as const, 'join' as const].forEach(name => {
|
||||||
this.addAnchorListener<{
|
this.addAnchorListener<{
|
||||||
uriParams: {
|
uriParams: {
|
||||||
invite: string
|
invite: string
|
||||||
}
|
}
|
||||||
}>({
|
}>({
|
||||||
name: 'joinchat',
|
name,
|
||||||
protocol: 'tg',
|
protocol: 'tg',
|
||||||
callback: ({uriParams}) => {
|
callback: ({uriParams}) => {
|
||||||
const link = this.makeLink(INTERNAL_LINK_TYPE.JOIN_CHAT, uriParams);
|
const link = this.makeLink(INTERNAL_LINK_TYPE.JOIN_CHAT, uriParams);
|
||||||
this.processInternalLink(link);
|
this.processInternalLink(link);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
this.onHashChange();
|
this.onHashChange();
|
||||||
this.attachKeydownListener();
|
this.attachKeydownListener();
|
||||||
@ -688,8 +690,8 @@ export class AppImManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private addAnchorListener<Params extends {pathnameParams?: any, uriParams?: any}>(options: {
|
private addAnchorListener<Params extends {pathnameParams?: any, uriParams?: any}>(options: {
|
||||||
name: 'showMaskedAlert' | 'execBotCommand' | 'searchByHashtag' | 'addstickers' | 'joinchat' | 'im' |
|
name: 'showMaskedAlert' | 'execBotCommand' | 'searchByHashtag' | 'addstickers' | 'im' |
|
||||||
'resolve' | 'privatepost' | 'addstickers' | 'voicechat',
|
'resolve' | 'privatepost' | 'addstickers' | 'voicechat' | 'joinchat' | 'join',
|
||||||
protocol?: 'tg',
|
protocol?: 'tg',
|
||||||
callback: (params: Params, element?: HTMLAnchorElement) => boolean | any,
|
callback: (params: Params, element?: HTMLAnchorElement) => boolean | any,
|
||||||
noPathnameParams?: boolean,
|
noPathnameParams?: boolean,
|
||||||
|
@ -564,7 +564,9 @@ namespace RichTextProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'messageEntityPre': {
|
case 'messageEntityPre': {
|
||||||
if(!options.noTextFormat) {
|
if(options.wrappingDraft) {
|
||||||
|
insertPart(entity, '<span style="font-family: monospace;">', '</span>');
|
||||||
|
} else if(!options.noTextFormat) {
|
||||||
insertPart(entity, `<pre><code${entity.language ? ' class="language-' + encodeEntities(entity.language) + '"' : ''}>`, '</code></pre>');
|
insertPart(entity, `<pre><code${entity.language ? ' class="language-' + encodeEntities(entity.language) + '"' : ''}>`, '</code></pre>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user