Pārlūkot izejas kodu

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 6 gadi atpakaļ
vecāks
revīzija
ff2df17acc
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  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" {
             if message.body as! String == "share" {
                 appDelegate.activeMain.openShare(with: self.detail.metadataDetail)
                 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)
+            }
         }
         }
     }
     }