mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +00:00
LibWeb: Add a hook for when an URL is dropped on an HtmlView
Embedders of HtmlView can now react to this by hooking on_url_drop.
This commit is contained in:
parent
f1708b3832
commit
fc26aefe81
Notes:
sideshowbarker
2024-07-19 06:44:53 +09:00
Author: https://github.com/awesomekling
Commit: fc26aefe81
2 changed files with 14 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <AK/FileSystemPath.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/ScrollBar.h>
|
||||
|
@ -590,4 +591,15 @@ void HtmlView::run_javascript_url(const String& url)
|
|||
document()->run_javascript(source);
|
||||
}
|
||||
|
||||
void HtmlView::drop_event(GUI::DropEvent& event)
|
||||
{
|
||||
if (event.mime_data().has_urls()) {
|
||||
if (on_url_drop) {
|
||||
on_url_drop(event.mime_data().urls().first());
|
||||
return;
|
||||
}
|
||||
}
|
||||
ScrollableWidget::drop_event(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue