mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Ladybird: Allow copying text in the js console
This commit is contained in:
parent
8e8f124ca9
commit
d974142c7e
Notes:
sideshowbarker
2024-07-18 03:35:30 +09:00
Author: https://github.com/SebastianZaha Commit: https://github.com/SerenityOS/serenity/commit/d974142c7e Pull-request: https://github.com/SerenityOS/serenity/pull/20101 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/linusg ✅
2 changed files with 13 additions and 1 deletions
|
@ -5,7 +5,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "Tab.h"
|
||||
#include "BrowserWindow.h"
|
||||
#include "ConsoleWidget.h"
|
||||
#include "InspectorWidget.h"
|
||||
|
@ -667,6 +666,17 @@ void Tab::show_console_window()
|
|||
m_console_widget = new Ladybird::ConsoleWidget;
|
||||
m_console_widget->setWindowTitle("JS Console");
|
||||
m_console_widget->resize(640, 480);
|
||||
|
||||
// Make the copy action available in the window via the bound copy key shortcut.
|
||||
// Simply adding it to the context menu is not enough.
|
||||
m_console_widget->addAction(&m_window->copy_selection_action());
|
||||
|
||||
m_console_context_menu = make<QMenu>("Context menu", m_console_widget);
|
||||
m_console_context_menu->addAction(&m_window->copy_selection_action());
|
||||
m_console_widget->view().on_context_menu_request = [this](Gfx::IntPoint) {
|
||||
auto screen_position = QCursor::pos();
|
||||
m_console_context_menu->exec(screen_position);
|
||||
};
|
||||
m_console_widget->on_js_input = [this](auto js_source) {
|
||||
view().js_console_input(js_source);
|
||||
};
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QWidget>
|
||||
|
@ -113,5 +114,6 @@ private:
|
|||
bool m_is_history_navigation { false };
|
||||
|
||||
Ladybird::ConsoleWidget* m_console_widget { nullptr };
|
||||
OwnPtr<QMenu> m_console_context_menu;
|
||||
Ladybird::InspectorWidget* m_inspector_widget { nullptr };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue