mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -05:00
Ladybird/AppKit: Implement pasting content from the clipboard
This commit is contained in:
parent
0069390e1c
commit
ed24d8f2b5
1 changed files with 12 additions and 0 deletions
|
@ -873,6 +873,15 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
||||||
copy_data_to_clipboard(m_web_view_bridge->selected_text(), NSPasteboardTypeString);
|
copy_data_to_clipboard(m_web_view_bridge->selected_text(), NSPasteboardTypeString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)paste:(id)sender
|
||||||
|
{
|
||||||
|
auto* paste_board = [NSPasteboard generalPasteboard];
|
||||||
|
|
||||||
|
if (auto* contents = [paste_board stringForType:NSPasteboardTypeString]) {
|
||||||
|
m_web_view_bridge->paste(Ladybird::ns_string_to_string(contents));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)selectAll:(id)sender
|
- (void)selectAll:(id)sender
|
||||||
{
|
{
|
||||||
m_web_view_bridge->select_all();
|
m_web_view_bridge->select_all();
|
||||||
|
@ -1003,6 +1012,9 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
||||||
[_page_context_menu addItem:[[NSMenuItem alloc] initWithTitle:@"Copy"
|
[_page_context_menu addItem:[[NSMenuItem alloc] initWithTitle:@"Copy"
|
||||||
action:@selector(copy:)
|
action:@selector(copy:)
|
||||||
keyEquivalent:@""]];
|
keyEquivalent:@""]];
|
||||||
|
[_page_context_menu addItem:[[NSMenuItem alloc] initWithTitle:@"Paste"
|
||||||
|
action:@selector(paste:)
|
||||||
|
keyEquivalent:@""]];
|
||||||
[_page_context_menu addItem:[[NSMenuItem alloc] initWithTitle:@"Select All"
|
[_page_context_menu addItem:[[NSMenuItem alloc] initWithTitle:@"Select All"
|
||||||
action:@selector(selectAll:)
|
action:@selector(selectAll:)
|
||||||
keyEquivalent:@""]];
|
keyEquivalent:@""]];
|
||||||
|
|
Loading…
Reference in a new issue