Telegram Web K with changes to work inside I2P https://web.telegram.i2p/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB

import { isTouchSupported } from "../../helpers/touchSupport";
import appImManager from "../../lib/appManagers/appImManager";
import AppSelectPeers from "../appSelectPeers";
import PopupElement from ".";
export default class PopupForward extends PopupElement {
private selector: AppSelectPeers;
//private scrollable: Scrollable;
constructor(fromPeerId: number, mids: number[], onSelect?: () => Promise<void> | void, onClose?: () => void) {
super('popup-forward', null, {closable: true, overlayClosable: true, body: true});
if(onClose) this.onClose = onClose;
this.selector = new AppSelectPeers({
appendTo: this.body,
onChange: async() => {
const peerId = this.selector.getSelected()[0];
this.btnClose.click();
this.selector = null;
await (onSelect ? onSelect() || Promise.resolve() : Promise.resolve());
appImManager.setInnerPeer(peerId);
appImManager.chat.input.initMessagesForward(fromPeerId, mids.slice());
},
peerType: ['dialogs', 'contacts'],
onFirstRender: () => {
this.show();
this.selector.checkForTriggers(); // ! due to zero height before mounting
if(!isTouchSupported) {
this.selector.input.focus();
}
},
chatRightsAction: 'send',
multiSelect: false,
rippleEnabled: false
});
//this.scrollable = new Scrollable(this.body);
this.selector.input.placeholder = 'Forward to...';
this.title.append(this.selector.input);
}
}