js transformer enhanced and focus method added in wv-element
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
(require racket/class
|
||||
"racket-webview.rkt"
|
||||
"private/js-transform.rkt"
|
||||
)
|
||||
|
||||
(provide wv-element%)
|
||||
@@ -87,6 +88,13 @@
|
||||
(define/public (attr/datetime attr)
|
||||
(webview-attr/datetime wv element-id attr))
|
||||
|
||||
(define/public (focus!)
|
||||
(let ((s (js (let* ((el (send document getElementById (eval element-id))))
|
||||
(if (=== el null)
|
||||
(console.log (+ "Element " (eval element-id) " not found"))
|
||||
(send el focus))))))
|
||||
(webview-run-js wv s)))
|
||||
|
||||
(super-new)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user