HTMl generation delayed to the last key press
This commit is contained in:
+11
-1
@@ -25,14 +25,24 @@
|
|||||||
; try to detect iOS
|
; try to detect iOS
|
||||||
(def ios-detected (.match (.-userAgent js/navigator) "(iPad|iPod|iPhone)"))
|
(def ios-detected (.match (.-userAgent js/navigator) "(iPad|iPod|iPhone)"))
|
||||||
|
|
||||||
|
(def timer nil)
|
||||||
|
|
||||||
|
(def timerDelay
|
||||||
|
; TODO: also test for Android
|
||||||
|
(if ios-detected 800 400))
|
||||||
|
|
||||||
(defn update-preview
|
(defn update-preview
|
||||||
"Updates the preview"
|
"Updates the preview"
|
||||||
[]
|
[]
|
||||||
(do
|
(do
|
||||||
|
(js/clearTimeout timer)
|
||||||
|
(def timer
|
||||||
|
(js/setTimeout
|
||||||
|
#(do
|
||||||
(show $dashed-line)
|
(show $dashed-line)
|
||||||
(show $input-elems)
|
(show $input-elems)
|
||||||
(inner $preview
|
(inner $preview
|
||||||
(.makeHtml md-converter (val $draft)))))
|
(.makeHtml md-converter (val $draft)))) timerDelay))))
|
||||||
|
|
||||||
; set focus to the draft textarea (if there is one)
|
; set focus to the draft textarea (if there is one)
|
||||||
(when $action
|
(when $action
|
||||||
|
|||||||
Reference in New Issue
Block a user