mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix(app): restore composer menus and present action styling (#1585)
This commit is contained in:
1 parent
5cc92469aa
commit
27f459e6bd
3 files changed
+33
-39
No files matched your search
@@ -60,6 +60,23 @@ function findUserData(element: HTMLElement): {userId?: string; guildId?: string;
|
||||
return {};
|
||||
}
|
||||
|
||||
function isEditableContextMenuTarget(target: HTMLElement): boolean {
|
||||
let current: HTMLElement | null = target;
|
||||
while (current != null) {
|
||||
const contentEditable = current.getAttribute('contenteditable')?.toLowerCase();
|
||||
if (
|
||||
contentEditable === '' ||
|
||||
contentEditable === 'true' ||
|
||||
contentEditable === 'plaintext-only' ||
|
||||
current.isContentEditable
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
current = current.parentElement;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function handleContextMenu(e: MouseEvent): void {
|
||||
const target = e.target as HTMLElement;
|
||||
const {userId, guildId, channelId} = findUserData(target);
|
||||
@@ -139,7 +156,7 @@ export function handleContextMenu(e: MouseEvent): void {
|
||||
}
|
||||
node = node.parentElement;
|
||||
}
|
||||
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
|
||||
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || isEditableContextMenuTarget(target)) {
|
||||
return;
|
||||
}
|
||||
if (selectedText) {
|
||||
|
||||
Reference in new issue
Block a user