1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-05-23 21:50:21 +02:00

Block the shortcut to view the HTML source code (Control+U) in MiniBrowser

This commit is contained in:
Salvador Díaz Fau 2025-02-12 10:44:12 +01:00
parent c0a03f0098
commit 2081ad570a
2 changed files with 15 additions and 5 deletions

View File

@ -1118,13 +1118,21 @@ end;
procedure TMiniBrowserFrm.Chromium1PreKeyEvent(Sender: TObject;
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
out isKeyboardShortcut, Result: Boolean);
const
VK_U = $55;
begin
Result := False;
if (event <> nil) and
(event.kind in [KEYEVENT_KEYDOWN, KEYEVENT_KEYUP]) and
(event.windows_key_code = VK_F12) then
isKeyboardShortcut := True;
if (event <> nil) then
case event.windows_key_code of
VK_F12 : // Handle the shortcut for the DevTools in Chromium1KeyEvent
if (event.kind in [KEYEVENT_KEYDOWN, KEYEVENT_KEYUP]) then
isKeyboardShortcut := True;
VK_U : // Block the shortcut to view the HTML source code (Control+U).
if (event.kind in [KEYEVENT_RAWKEYDOWN, KEYEVENT_KEYUP]) then
Result := (event.modifiers and EVENTFLAG_CONTROL_DOWN) <> 0;
end;
end;
procedure TMiniBrowserFrm.Chromium1RenderCompMsg(Sender: TObject; var aMessage : TMessage; var aHandled: Boolean);
@ -1523,6 +1531,8 @@ begin
Chromium1.WebRTCMultipleRoutes := STATE_DISABLED;
Chromium1.WebRTCNonproxiedUDP := STATE_DISABLED;
//Chromium1.AcceptLanguageList := 'en-GB,en';
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
// If it's not initialized yet, we use a simple timer to create the browser later.
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 698,
"InternalVersion" : 699,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "132.3.2"
}