signal-desktop/ts/windows/main/start.ts

30 lines
804 B
TypeScript
Raw Normal View History

// Copyright 2017-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as log from '../../logging/log';
import './phase1-ipc';
import '../preload';
import './phase2-dependencies';
import './phase3-post-signal';
import './phase4-test';
window.addEventListener('contextmenu', e => {
const node = e.target as Element | null;
const isEditable = Boolean(
node?.closest('textarea, input, [contenteditable="true"]')
);
const isLink = Boolean(node?.closest('a'));
const isImage = Boolean(node?.closest('.Lightbox img'));
const hasSelection = Boolean(window.getSelection()?.toString());
if (!isEditable && !hasSelection && !isLink && !isImage) {
e.preventDefault();
}
});
if (window.SignalContext.config.proxyUrl) {
log.info('Using provided proxy url');
}