Chat context menu fixes
This commit is contained in:
parent
837a3374e2
commit
e5f8bd010c
@ -41,8 +41,19 @@ export default class ChatContextMenu {
|
|||||||
}
|
}
|
||||||
if(e instanceof MouseEvent) e.cancelBubble = true;
|
if(e instanceof MouseEvent) e.cancelBubble = true;
|
||||||
|
|
||||||
const msgID = +bubble.dataset.mid;
|
let mid = +bubble.dataset.mid;
|
||||||
if(!msgID) return;
|
if(!mid) return;
|
||||||
|
|
||||||
|
// * если открыть контекстное меню для альбома не по бабблу, и последний элемент не выбран, чтобы показать остальные пункты
|
||||||
|
if(appImManager.chatSelection.isSelecting && !bubbleContainer) {
|
||||||
|
const mids = appMessagesManager.getMidsByMid(mid);
|
||||||
|
if(mids.length > 1) {
|
||||||
|
const selectedMid = appImManager.chatSelection.selectedMids.has(mid) ? mid : mids.find(mid => appImManager.chatSelection.selectedMids.has(mid));
|
||||||
|
if(selectedMid) {
|
||||||
|
mid = selectedMid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.peerID = $rootScope.selectedPeerID;
|
this.peerID = $rootScope.selectedPeerID;
|
||||||
//this.msgID = msgID;
|
//this.msgID = msgID;
|
||||||
@ -53,18 +64,19 @@ export default class ChatContextMenu {
|
|||||||
if(albumItem) {
|
if(albumItem) {
|
||||||
this.msgID = +albumItem.dataset.mid;
|
this.msgID = +albumItem.dataset.mid;
|
||||||
} else {
|
} else {
|
||||||
this.msgID = msgID;
|
this.msgID = mid;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buttons.forEach(button => {
|
this.buttons.forEach(button => {
|
||||||
let good: boolean;
|
let good: boolean;
|
||||||
|
|
||||||
if((appImManager.chatSelection.isSelecting && !button.withSelection) || (button.withSelection && !appImManager.chatSelection.isSelecting)) {
|
//if((appImManager.chatSelection.isSelecting && !button.withSelection) || (button.withSelection && !appImManager.chatSelection.isSelecting)) {
|
||||||
|
if(appImManager.chatSelection.isSelecting && !button.withSelection) {
|
||||||
good = false;
|
good = false;
|
||||||
} else {
|
} else {
|
||||||
good = bubbleContainer || isTouchSupported ?
|
good = bubbleContainer || isTouchSupported ?
|
||||||
button.verify() :
|
button.verify() :
|
||||||
button.notDirect && button.notDirect() && button.verify();
|
button.notDirect && button.verify() && button.notDirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
button.element.classList.toggle('hide', !good);
|
button.element.classList.toggle('hide', !good);
|
||||||
@ -126,8 +138,8 @@ export default class ChatContextMenu {
|
|||||||
icon: 'copy',
|
icon: 'copy',
|
||||||
text: 'Copy selected',
|
text: 'Copy selected',
|
||||||
onClick: this.onCopyClick,
|
onClick: this.onCopyClick,
|
||||||
verify: () => !![...appImManager.chatSelection.selectedMids].find(mid => !!appMessagesManager.getMessage(mid).message),
|
verify: () => appImManager.chatSelection.selectedMids.has(this.msgID) && !![...appImManager.chatSelection.selectedMids].find(mid => !!appMessagesManager.getMessage(mid).message),
|
||||||
notDirect: () => !![...appImManager.chatSelection.selectedMids].find(mid => !!appMessagesManager.getMessage(mid).message),
|
notDirect: () => true,
|
||||||
withSelection: true
|
withSelection: true
|
||||||
}, {
|
}, {
|
||||||
icon: 'pin',
|
icon: 'pin',
|
||||||
@ -171,8 +183,8 @@ export default class ChatContextMenu {
|
|||||||
icon: 'forward',
|
icon: 'forward',
|
||||||
text: 'Forward selected',
|
text: 'Forward selected',
|
||||||
onClick: this.onForwardClick,
|
onClick: this.onForwardClick,
|
||||||
verify: () => !appImManager.chatSelection.selectionForwardBtn.hasAttribute('disabled') && appImManager.chatSelection.selectedMids.has(this.msgID),
|
verify: () => appImManager.chatSelection.selectedMids.has(this.msgID) && !appImManager.chatSelection.selectionForwardBtn.hasAttribute('disabled'),
|
||||||
notDirect: () => appImManager.chatSelection.selectedMids.has(this.msgID),
|
notDirect: () => true,
|
||||||
withSelection: true
|
withSelection: true
|
||||||
}, {
|
}, {
|
||||||
icon: 'select',
|
icon: 'select',
|
||||||
@ -189,7 +201,7 @@ export default class ChatContextMenu {
|
|||||||
text: 'Clear selection',
|
text: 'Clear selection',
|
||||||
onClick: this.onClearSelectionClick,
|
onClick: this.onClearSelectionClick,
|
||||||
verify: () => appImManager.chatSelection.selectedMids.has(this.msgID),
|
verify: () => appImManager.chatSelection.selectedMids.has(this.msgID),
|
||||||
notDirect: () => appImManager.chatSelection.selectedMids.has(this.msgID),
|
notDirect: () => true,
|
||||||
withSelection: true
|
withSelection: true
|
||||||
}, {
|
}, {
|
||||||
icon: 'delete danger',
|
icon: 'delete danger',
|
||||||
@ -200,8 +212,8 @@ export default class ChatContextMenu {
|
|||||||
icon: 'delete danger',
|
icon: 'delete danger',
|
||||||
text: 'Delete selected',
|
text: 'Delete selected',
|
||||||
onClick: this.onDeleteClick,
|
onClick: this.onDeleteClick,
|
||||||
verify: () => !appImManager.chatSelection.selectionDeleteBtn.hasAttribute('disabled') && appImManager.chatSelection.selectedMids.has(this.msgID),
|
verify: () => appImManager.chatSelection.selectedMids.has(this.msgID) && !appImManager.chatSelection.selectionDeleteBtn.hasAttribute('disabled'),
|
||||||
notDirect: () => appImManager.chatSelection.selectedMids.has(this.msgID),
|
notDirect: () => true,
|
||||||
withSelection: true
|
withSelection: true
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import CheckboxField from "../checkbox";
|
|||||||
import PopupDeleteMessages from "../popupDeleteMessages";
|
import PopupDeleteMessages from "../popupDeleteMessages";
|
||||||
import PopupForward from "../popupForward";
|
import PopupForward from "../popupForward";
|
||||||
import { toast } from "../toast";
|
import { toast } from "../toast";
|
||||||
import BubbleGroups from "../bubbleGroups";
|
|
||||||
|
|
||||||
const SetTransition = (element: HTMLElement, className: string, forwards: boolean, duration: number, onTransitionEnd?: () => void) => {
|
const SetTransition = (element: HTMLElement, className: string, forwards: boolean, duration: number, onTransitionEnd?: () => void) => {
|
||||||
const timeout = element.dataset.timeout;
|
const timeout = element.dataset.timeout;
|
||||||
|
@ -835,7 +835,7 @@ img.emoji {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.chats-container #chats-container .scrollable #dialogs .rp avatar-element {
|
#folders-container .rp avatar-element {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user