mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibDevTools+LibWebView+WebContent: Implement editing DOM node HTML
These commands are used for the "Edit As HTML" feature in DevTools. This renames our existing HTML getter IPC to indicate that it is for outer HTML. DevTools will need a separate inner HTML getter.
This commit is contained in:
parent
aca4385daf
commit
d75eadc3c4
Notes:
github-actions[bot]
2025-03-11 13:52:05 +00:00
Author: https://github.com/trflynn89
Commit: d75eadc3c4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3898
11 changed files with 155 additions and 32 deletions
|
@ -504,6 +504,29 @@ static void edit_dom_node(DevTools::TabDescription const& description, Applicati
|
|||
edit(*view);
|
||||
}
|
||||
|
||||
void Application::get_dom_node_outer_html(DevTools::TabDescription const& description, Web::UniqueNodeID node_id, OnDOMNodeHTMLReceived on_complete) const
|
||||
{
|
||||
auto view = ViewImplementation::find_view_by_id(description.id);
|
||||
if (!view.has_value()) {
|
||||
on_complete(Error::from_string_literal("Unable to locate tab"));
|
||||
return;
|
||||
}
|
||||
|
||||
view->on_received_dom_node_html = [&view = *view, on_complete = move(on_complete)](auto html) {
|
||||
view.on_received_dom_node_html = nullptr;
|
||||
on_complete(html);
|
||||
};
|
||||
|
||||
view->get_dom_node_outer_html(node_id);
|
||||
}
|
||||
|
||||
void Application::set_dom_node_outer_html(DevTools::TabDescription const& description, Web::UniqueNodeID node_id, String const& value, OnDOMNodeEditComplete on_complete) const
|
||||
{
|
||||
edit_dom_node(description, move(on_complete), [&](auto& view) {
|
||||
view.set_dom_node_outer_html(node_id, value);
|
||||
});
|
||||
}
|
||||
|
||||
void Application::set_dom_node_text(DevTools::TabDescription const& description, Web::UniqueNodeID node_id, String const& value, OnDOMNodeEditComplete on_complete) const
|
||||
{
|
||||
edit_dom_node(description, move(on_complete), [&](auto& view) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue