innerHTmL problems. Not synchronous?
This commit is contained in:
@@ -745,7 +745,8 @@
|
||||
(if (string? html)
|
||||
(let ((r (webview-call-js wv
|
||||
(with-id id el
|
||||
("el.innerHTML = '~a'; return true;" (esc-quote html))))))
|
||||
("el.innerHTML = '~a';
|
||||
await new Promise(resolve => setTimeout(resolve, 0)); return true;" (esc-quote html))))))
|
||||
(if r 'oke 'failed))
|
||||
(webview-set-innerHTML! wv id (xexpr->string html))
|
||||
)
|
||||
|
||||
@@ -89,23 +89,27 @@
|
||||
(type (if (null? type*) #f (car type*))))
|
||||
(when (eq? elem #f)
|
||||
(when (eq? type #f)
|
||||
(let ((js-type (webview-call-js wv
|
||||
(let ((js-type -1))
|
||||
(set! js-type (webview-call-js wv
|
||||
(format
|
||||
(string-append
|
||||
"{ let el = document.getElementById('~a');\n"
|
||||
" let a = (el === null) ? null : el.getAttribute('type');\n"
|
||||
" let a = (el === null) ? -1 : el.getAttribute('type');\n"
|
||||
" if (a == -1) {\n"
|
||||
" return a;\n"
|
||||
" else { \n"
|
||||
" if (a === null) {\n"
|
||||
" return false;\n"
|
||||
" } else {\n"
|
||||
" return a;\n"
|
||||
" }"
|
||||
" }\n"
|
||||
"}")
|
||||
id))))
|
||||
(set! type (if (eq? js-type #f)
|
||||
#f
|
||||
(string->symbol (string-downcase js-type))))
|
||||
)
|
||||
)
|
||||
(if (= js-type -1)
|
||||
'unknown
|
||||
(string->symbol (string-downcase js-type)))))
|
||||
(let ((cl (cond
|
||||
((eq? type 'text) wv-input/text%)
|
||||
((eq? type 'date) wv-input/date%)
|
||||
@@ -116,11 +120,15 @@
|
||||
((eq? type 'checkbox) wv-input/check%)
|
||||
((eq? type 'radio) wv-input/radio%)
|
||||
((eq? type 'color) wv-input/color%)
|
||||
((eq? type 'unknown) (begin
|
||||
(err-webview "Element with id '~a' not found"
|
||||
id)
|
||||
wv-element%))
|
||||
(else wv-element%)
|
||||
)))
|
||||
(set! elem (new cl [window this] [element-id id]))
|
||||
(hash-set! element-hash id elem))
|
||||
)
|
||||
))
|
||||
elem
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user