innerHTmL problems. Not synchronous?
This commit is contained in:
@@ -745,7 +745,8 @@
|
|||||||
(if (string? html)
|
(if (string? html)
|
||||||
(let ((r (webview-call-js wv
|
(let ((r (webview-call-js wv
|
||||||
(with-id id el
|
(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))
|
(if r 'oke 'failed))
|
||||||
(webview-set-innerHTML! wv id (xexpr->string html))
|
(webview-set-innerHTML! wv id (xexpr->string html))
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -89,38 +89,46 @@
|
|||||||
(type (if (null? type*) #f (car type*))))
|
(type (if (null? type*) #f (car type*))))
|
||||||
(when (eq? elem #f)
|
(when (eq? elem #f)
|
||||||
(when (eq? type #f)
|
(when (eq? type #f)
|
||||||
(let ((js-type (webview-call-js wv
|
(let ((js-type -1))
|
||||||
(format
|
(set! js-type (webview-call-js wv
|
||||||
|
(format
|
||||||
(string-append
|
(string-append
|
||||||
"{ let el = document.getElementById('~a');\n"
|
"{ 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 === null) {\n"
|
" if (a == -1) {\n"
|
||||||
" return false;\n"
|
" return a;\n"
|
||||||
" } else {\n"
|
" else { \n"
|
||||||
" return a;\n"
|
" if (a === null) {\n"
|
||||||
|
" return false;\n"
|
||||||
|
" } else {\n"
|
||||||
|
" return a;\n"
|
||||||
|
" }"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}")
|
"}")
|
||||||
id))))
|
id))))
|
||||||
(set! type (if (eq? js-type #f)
|
(set! type (if (eq? js-type #f)
|
||||||
#f
|
(if (= js-type -1)
|
||||||
(string->symbol (string-downcase js-type))))
|
'unknown
|
||||||
)
|
(string->symbol (string-downcase js-type)))))
|
||||||
)
|
(let ((cl (cond
|
||||||
(let ((cl (cond
|
((eq? type 'text) wv-input/text%)
|
||||||
((eq? type 'text) wv-input/text%)
|
((eq? type 'date) wv-input/date%)
|
||||||
((eq? type 'date) wv-input/date%)
|
((eq? type 'time) wv-input/time%)
|
||||||
((eq? type 'time) wv-input/time%)
|
((eq? type 'datetime-local) wv-input/datetime%)
|
||||||
((eq? type 'datetime-local) wv-input/datetime%)
|
((eq? type 'range) wv-input/range%)
|
||||||
((eq? type 'range) wv-input/range%)
|
((eq? type 'number) wv-input/number%)
|
||||||
((eq? type 'number) wv-input/number%)
|
((eq? type 'checkbox) wv-input/check%)
|
||||||
((eq? type 'checkbox) wv-input/check%)
|
((eq? type 'radio) wv-input/radio%)
|
||||||
((eq? type 'radio) wv-input/radio%)
|
((eq? type 'color) wv-input/color%)
|
||||||
((eq? type 'color) wv-input/color%)
|
((eq? type 'unknown) (begin
|
||||||
(else wv-element%)
|
(err-webview "Element with id '~a' not found"
|
||||||
)))
|
id)
|
||||||
(set! elem (new cl [window this] [element-id id]))
|
wv-element%))
|
||||||
(hash-set! element-hash id elem))
|
(else wv-element%)
|
||||||
)
|
)))
|
||||||
|
(set! elem (new cl [window this] [element-id id]))
|
||||||
|
(hash-set! element-hash id elem))
|
||||||
|
))
|
||||||
elem
|
elem
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user