Ver código fonte

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 anos atrás
pai
commit
ff2df17acc
1 arquivos alterados com 5 adições e 0 exclusões
  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)
+            }
         }
     }