macOS: Improve wxWebView::Paste()

The default (javascript) implementation presents the user with a popup
menu containing a single 'Paste' menu item.
Send this action to directly paste as expected.
This commit is contained in:
Tobias Taschner
2021-03-26 10:28:48 +01:00
parent b4de7358b5
commit e63fd03611
2 changed files with 14 additions and 0 deletions

View File

@@ -82,6 +82,8 @@ public:
virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory() wxOVERRIDE;
virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item) wxOVERRIDE;
virtual void Paste() wxOVERRIDE;
//Undo / redo functionality
virtual bool CanUndo() const wxOVERRIDE;
virtual bool CanRedo() const wxOVERRIDE;

View File

@@ -568,6 +568,18 @@ void wxWebViewWebKit::LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item)
[m_webView goToBackForwardListItem:item->m_histItem];
}
void wxWebViewWebKit::Paste()
{
#if defined(__WXOSX_IPHONE__)
wxWebView::Paste();
#else
// The default (javascript) implementation presents the user with a popup
// menu containing a single 'Paste' menu item.
// Send this action to directly paste as expected.
[[NSApplication sharedApplication] sendAction:@selector(paste:) to:nil from:m_webView];
#endif
}
bool wxWebViewWebKit::CanUndo() const
{
return [[m_webView undoManager] canUndo];