Просмотр исходного кода

Provide a banal 'paste' postmessage implementation.

Browsers will allow apps to populate the clipboard, but not read
from it without user input. This patch makes it possible for
context menus with 'Paste' in them to trigger a real OS paste
when hosted inside the webview.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Michael Meeks 5 лет назад
Родитель
Сommit
ff2df17acc
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      iOSClient/Viewer/NCViewerRichdocument.swift

+ 5 - 0
iOSClient/Viewer/NCViewerRichdocument.swift

@@ -111,6 +111,11 @@ class NCViewerRichdocument: WKWebView, WKNavigationDelegate, WKScriptMessageHand
             if message.body as! String == "share" {
                 appDelegate.activeMain.openShare(with: self.detail.metadataDetail)
             }
+
+	    // Javascript cannot do this by itself, so help out.
+            if message.body as! String == "paste" {
+                self.paste(self)
+            }
         }
     }