LibWeb: Implement Window.prompt()

This commit is contained in:
Linus Groh
2021-02-20 12:05:18 +01:00
committed by Andreas Kling
parent f10967e364
commit 5e07c27e25
14 changed files with 74 additions and 2 deletions

View File

@@ -30,6 +30,7 @@
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/Clipboard.h>
#include <LibGUI/InputBox.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/Painter.h>
#include <LibGUI/ScrollBar.h>
@@ -425,4 +426,12 @@ bool InProcessWebView::page_did_request_confirm(const String& message)
return confirm_result == GUI::Dialog::ExecResult::ExecOK;
}
String InProcessWebView::page_did_request_prompt(const String& message, const String& default_)
{
String value { default_ };
if (GUI::InputBox::show(window(), value, message, "Prompt") == GUI::InputBox::ExecOK)
return value;
return {};
}
}