mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
Ladybird: Open target _blank links in new tab
This commit is contained in:
parent
05a2d1f0e0
commit
14c9ef2563
3 changed files with 26 additions and 9 deletions
|
@ -369,6 +369,25 @@ Tab& BrowserWindow::new_tab(QString const& url, Web::HTML::ActivateTab activate_
|
|||
return tab.view().handle();
|
||||
};
|
||||
|
||||
tab_ptr->view().on_tab_open_request = [this](auto url, auto activate_tab) {
|
||||
auto& tab = new_tab(qstring_from_ak_deprecated_string(url.to_deprecated_string()), activate_tab);
|
||||
return tab.view().handle();
|
||||
};
|
||||
|
||||
tab_ptr->view().on_link_click = [this](auto url, auto target, unsigned modifiers) {
|
||||
// TODO: maybe activate tabs according to some configuration, this is just normal current browser behavior
|
||||
if (modifiers == Mod_Ctrl) {
|
||||
m_current_tab->view().on_tab_open_request(url, Web::HTML::ActivateTab::No);
|
||||
} else if (target == "_blank") {
|
||||
m_current_tab->view().on_tab_open_request(url, Web::HTML::ActivateTab::Yes);
|
||||
}
|
||||
};
|
||||
|
||||
tab_ptr->view().on_link_middle_click = [this](auto url, auto target, unsigned modifiers) {
|
||||
m_current_tab->view().on_link_click(url, target, Mod_Ctrl);
|
||||
(void)modifiers;
|
||||
};
|
||||
|
||||
tab_ptr->view().on_get_all_cookies = [this](auto const& url) {
|
||||
return m_cookie_jar.get_all_cookies(url);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue