mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
Temp save of work
This commit is contained in:
@@ -9,6 +9,11 @@
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>Blockly WebView.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -69,6 +69,34 @@ class ViewController: UIViewController, WKUIDelegate {
|
||||
present(alert, animated: true)
|
||||
}
|
||||
|
||||
func webView(_ webView: WKWebView,
|
||||
runJavaScriptTextInputPanelWithPrompt prompt: String,
|
||||
defaultText: String?,
|
||||
initiatedByFrame frame: WKFrameInfo,
|
||||
completionHandler: @escaping (String?) -> Void) {
|
||||
|
||||
let alert = UIAlertController(title: prompt, message: nil, preferredStyle: .alert)
|
||||
|
||||
alert.addTextField { (textField) in
|
||||
textField.text = defaultText
|
||||
}
|
||||
|
||||
let okTitle = NSLocalizedString("OK", comment: "OK button title")
|
||||
let okAction = UIAlertAction(title: okTitle, style: .default) { (_) in
|
||||
let textInput = alert.textFields![0] as UITextField
|
||||
completionHandler(textInput.text)
|
||||
}
|
||||
alert.addAction(okAction)
|
||||
|
||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel button title")
|
||||
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel) { (_) in
|
||||
completionHandler(nil)
|
||||
}
|
||||
alert.addAction(cancelAction)
|
||||
|
||||
present(alert, animated: true)
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
|
||||
Reference in New Issue
Block a user