1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

Browser: Mark default action in context menu of hyperlinks

This commit is contained in:
Ben Wiederhake 2020-08-29 10:56:42 +02:00 committed by Andreas Kling
parent a5f7b7e3e7
commit b2de1ba779
2 changed files with 6 additions and 3 deletions

View file

@ -151,9 +151,11 @@ Tab::Tab(Type type)
};
m_link_context_menu = GUI::Menu::construct();
m_link_context_menu->add_action(GUI::Action::create("Open", [this](auto&) {
auto default_action = GUI::Action::create("Open", [this](auto&) {
hooks().on_link_click(m_link_context_menu_url, "", 0);
}));
});
m_link_context_menu->add_action(default_action);
m_link_context_menu_default_action = default_action;
m_link_context_menu->add_action(GUI::Action::create("Open in new tab", [this](auto&) {
hooks().on_link_click(m_link_context_menu_url, "_blank", 0);
}));
@ -174,7 +176,7 @@ Tab::Tab(Type type)
hooks().on_link_context_menu_request = [this](auto& url, auto& screen_position) {
m_link_context_menu_url = url;
m_link_context_menu->popup(screen_position);
m_link_context_menu->popup(screen_position, m_link_context_menu_default_action);
};
hooks().on_link_middle_click = [this](auto& href, auto&, auto) {