Suppress the webview's default right-click menu
Reload/Inspect Element no longer appear on uncontrolled right-clicks in any window; text fields keep the system text menu. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import { NgIcon } from '@ng-icons/core';
|
||||
import { EDITOR_CONTEXT, IS_MAC_CHROME } from '../platform';
|
||||
import { blockNativeContextMenu, EDITOR_CONTEXT, IS_MAC_CHROME } from '../platform';
|
||||
import { RpcService } from '../rpc.service';
|
||||
import { SettingsService } from '../settings.service';
|
||||
import { ToastService } from '../toast.service';
|
||||
@@ -31,7 +31,11 @@ const DRAFT_DEBOUNCE_MS = 400;
|
||||
selector: 'app-root',
|
||||
imports: [NgIcon, Toasts],
|
||||
templateUrl: './editor-window.html',
|
||||
host: { '(window:keydown)': 'onKeydown($event)', '(window:blur)': 'flushDraft()' },
|
||||
host: {
|
||||
'(window:keydown)': 'onKeydown($event)',
|
||||
'(window:blur)': 'flushDraft()',
|
||||
'(window:contextmenu)': 'blockContextMenu($event)',
|
||||
},
|
||||
})
|
||||
export class EditorWindow {
|
||||
readonly ctx = EDITOR_CONTEXT;
|
||||
@@ -126,6 +130,10 @@ export class EditorWindow {
|
||||
queueMicrotask(() => this.box()?.nativeElement.focus());
|
||||
}
|
||||
|
||||
blockContextMenu(event: Event): void {
|
||||
blockNativeContextMenu(event);
|
||||
}
|
||||
|
||||
onInput(value: string): void {
|
||||
this.text.set(value);
|
||||
this.scheduleDraft();
|
||||
|
||||
Reference in New Issue
Block a user