input fields, elements, windows
This commit is contained in:
@@ -16,6 +16,9 @@ Some input text: <input type="Text" id="inp1" value="Default input value" />
|
||||
<p>
|
||||
Some input date: <input type="Date" id="inp2" value="2026-01-01" />
|
||||
</p>
|
||||
<p>
|
||||
Some color input: <input type="Color" id="inp3" value="#8732422" />
|
||||
</p>
|
||||
|
||||
<div id="test" class="yellow">
|
||||
<p> Hi there! <a href="/">Click here to load this page again</a></p>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
(require "racket-webview-qt.rkt"
|
||||
"utils.rkt"
|
||||
"mimetypes.rkt"
|
||||
"rgba.rkt"
|
||||
racket/async-channel
|
||||
web-server/http
|
||||
web-server/servlet-dispatch
|
||||
@@ -69,14 +70,14 @@
|
||||
webview-set-innerHTML!
|
||||
|
||||
webview-set-value!
|
||||
|
||||
webview-value
|
||||
webview-value/bool
|
||||
webview-value/boolean
|
||||
webview-value/symbol
|
||||
webview-value/number
|
||||
webview-value/date
|
||||
webview-value/time
|
||||
webview-value/datetime
|
||||
webview-value/color
|
||||
|
||||
webview-add-class!
|
||||
webview-remove-class!
|
||||
@@ -86,12 +87,13 @@
|
||||
|
||||
webview-set-attr!
|
||||
webview-attr
|
||||
webview-attr/bool
|
||||
webview-attr/boolean
|
||||
webview-attr/symbol
|
||||
webview-attr/number
|
||||
webview-attr/date
|
||||
webview-attr/time
|
||||
webview-attr/datetime
|
||||
webview-attr/color
|
||||
|
||||
;webview-del-attr!
|
||||
|
||||
@@ -615,7 +617,7 @@
|
||||
)
|
||||
|
||||
(define/contract (webview-set-value! wv id val)
|
||||
(-> wv? symbol? (or/c symbol? string? number? boolean? g:date? g:time? g:datetime?) symbol?)
|
||||
(-> wv? symbol? (or/c symbol? string? number? boolean? g:date? g:time? g:datetime? rgba?) symbol?)
|
||||
(webview-run-js wv
|
||||
(with-id id el
|
||||
((string-append
|
||||
@@ -626,12 +628,14 @@
|
||||
"}")
|
||||
(if (eq? val #f) "false" "true")
|
||||
(cond
|
||||
([(g:date? val)]
|
||||
([g:date? val]
|
||||
(date->string val))
|
||||
([(g:time? val)]
|
||||
([g:time? val]
|
||||
(time->string val))
|
||||
([(g:datetime? val)]
|
||||
([g:datetime? val]
|
||||
(datetime->string val))
|
||||
([rgba? val]
|
||||
(rgba->hex val))
|
||||
(else
|
||||
(esc-quote (format "~a" val))))
|
||||
)
|
||||
@@ -673,7 +677,8 @@
|
||||
(wvv webview-value/datetime g:datetime? string->datetime)
|
||||
(wvv webview-value/number number? string->number)
|
||||
(wvv webview-value/symbol symbol? string->symbol)
|
||||
(wvv webview-value/bool boolean? (λ (e) (if (string=? e "true") #t #f)))
|
||||
(wvv webview-value/color rgba? hex->rgba)
|
||||
(wvv webview-value/boolean boolean? (λ (e) (if (string=? e "true") #t #f)))
|
||||
|
||||
|
||||
(define/contract (webview-add-class! wv id-or-selector class)
|
||||
@@ -814,6 +819,7 @@
|
||||
([g:date? v] (date->string v))
|
||||
([g:time? v] (time->string v))
|
||||
([g:datetime? v] (datetime->string v))
|
||||
([rgba? v] (rgba->hex v))
|
||||
(else (format "~a" v))))
|
||||
)) ae*))
|
||||
(cl (mk-js-array ae**))
|
||||
@@ -860,10 +866,11 @@
|
||||
|
||||
(wva webview-attr/number number? string->number)
|
||||
(wva webview-attr/symbol symbol? string->symbol)
|
||||
(wva webview-attr/color rgba? hex->rgba)
|
||||
(wva webview-attr/date g:date? string->date)
|
||||
(wva webview-attr/time g:time? string->time)
|
||||
(wva webview-attr/datetime g:datetime string->datetime)
|
||||
(wvv webview-attr/bool boolean? (λ (e) (if (string=? e "true") #t #f)))
|
||||
(wvv webview-attr/boolean boolean? (λ (e) (if (string=? e "true") #t #f)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; testing
|
||||
|
||||
Reference in New Issue
Block a user