我使用jbefbrowser构建我的应用程序(IntelliJ插件)。我需要处理的按钮或链接点击在Java代码(不是JavaScript)。谁能给点建议怎么做?
谢谢!
val javaScriptEngineProxy: JBCefJSQuery = JBCefJSQuery.create(browser as JBCefBrowserBase)
javaScriptEngineProxy.addHandler { result ->
println(result)
null
}
val injectedJavaScript = """
window.goToLine = function() {
var filePath = document.getElementById("go-to-filepath").value
var lineNumber = document.getElementById("go-to-line-number").value
var goToPath = filePath + ":" + lineNumber
${javaScriptEngineProxy.inject("goToPath")}
}
""".trimIndent()
browser.cefBrowser.executeJavaScript(injectedJavaScript, browser.cefBrowser.url, 0)