1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:48:11 +00:00

Ladybird+LibWebView: Add an Inspector action to copy a node's HTML/text

This commit is contained in:
Timothy Flynn 2023-12-06 11:16:28 -05:00 committed by Andreas Kling
parent 51a0673b5c
commit e3df035c5d
7 changed files with 55 additions and 0 deletions

View file

@ -233,6 +233,18 @@ void InspectorClient::context_menu_edit_dom_node()
m_context_menu_data.clear();
}
void InspectorClient::context_menu_copy_dom_node()
{
VERIFY(m_context_menu_data.has_value());
if (auto html = m_content_web_view.get_dom_node_html(m_context_menu_data->dom_node_id); html.has_value()) {
if (m_content_web_view.on_insert_clipboard_entry)
m_content_web_view.on_insert_clipboard_entry(*html, "unspecified"_string, "text/plain"_string);
}
m_context_menu_data.clear();
}
void InspectorClient::context_menu_remove_dom_node()
{
VERIFY(m_context_menu_data.has_value());