Skip to content

Commit

Permalink
fix(test): bump version of react and react-dom
Browse files Browse the repository at this point in the history
also, fixed keyboards on datepicker
  • Loading branch information
tiensonqin committed Dec 21, 2020
1 parent bdfdf4d commit 2baa71b
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 31 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"jszip": "^3.5.0",
"mldoc": "^0.3.0",
"mousetrap": "^1.6.5",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-textarea-autosize": "^8.0.1",
"react-transition-group": "^4.3.0",
"yargs-parser": "^20.2.4"
Expand Down
3 changes: 2 additions & 1 deletion shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
:test
{:target :node-test
:output-to "static/tests.js"
:closure-defines {frontend.util/NODETEST true}}
:closure-defines {frontend.util/NODETEST true}
:devtools {:enabled false}}

:publishing
{:target :browser
Expand Down
11 changes: 5 additions & 6 deletions src/main/frontend/components/block.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
[:a.page-ref
{:href href
:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(when (gobj/get e "shiftKey")
(when-let [page-entity (db/entity [:page/name page])]
(state/sidebar-add-block!
Expand Down Expand Up @@ -290,8 +290,7 @@
(if (string/ends-with? s ".excalidraw")
[:a.page-ref
{:href (rfe/href :draw nil {:file (string/replace s (str config/default-draw-directory "/") "")})
:on-click (fn [e]
(util/stop e))}
:on-click (fn [e] (util/stop e))}
[:span
(svg/excalidraw-logo)
(string/capitalize (draw/get-file-title s))]]
Expand Down Expand Up @@ -370,7 +369,7 @@
[:span.text-gray-500 "(("]
[:a {:href (rfe/href :page {:name id})
:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(when (gobj/get e "shiftKey")
(state/sidebar-add-block!
(state/get-current-repo)
Expand Down Expand Up @@ -422,7 +421,7 @@
(if (and s (util/tag-valid? s))
[:a.tag.mr-1 {:href (rfe/href :page {:name s})
:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(let [repo (state/get-current-repo)
page (db/pull repo '[*] [:page/name (string/lower-case (util/url-decode s))])]
(when (gobj/get e "shiftKey")
Expand Down Expand Up @@ -759,7 +758,7 @@
[:a (if (not dummy?)
{:href (rfe/href :page {:name uuid})
:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(when (gobj/get e "shiftKey")
(state/sidebar-add-block!
(state/get-current-repo)
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/components/file.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
[:a.bg-base-2.p-1.ml-1 {:style {:border-radius 4}
:href (rfe/href :page {:name page})
:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(when (gobj/get e "shiftKey")
(when-let [page (db/entity [:page/name (string/lower-case page)])]
(state/sidebar-add-block!
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/components/journal.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
[:a.initial-color.title
{:href (str "/page/" encoded-page-name)
:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(when (gobj/get e "shiftKey")
(when-let [page (db/pull [:page/name (string/lower-case title)])]
(state/sidebar-add-block!
Expand Down
4 changes: 2 additions & 2 deletions src/main/frontend/components/page.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
(when (and (not sidebar?)
(not block?))
[:a {:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(when (gobj/get e "shiftKey")
(when-let [page (db/pull repo '[*] [:page/name page-name])]
(state/sidebar-add-block!
Expand Down Expand Up @@ -474,7 +474,7 @@
(let [encoded-page (util/encode-str page)]
[:tr {:key encoded-page}
[:td [:a {:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(let [repo (state/get-current-repo)
page (db/pull repo '[*] [:page/name (string/lower-case page)])]
(when (gobj/get e "shiftKey")
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/ui.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
"chosen")
;; :tab-index -1
:on-click (fn [e]
(util/stop e)
(.preventDefault e)
(if (and (gobj/get e "shiftKey") on-shift-chosen)
(on-shift-chosen item)
(on-chosen item)))}
Expand Down
9 changes: 7 additions & 2 deletions src/main/frontend/ui/date_picker.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
[frontend.mixins :as mixins]
[frontend.util :as util]
[frontend.state :as state]
[goog.object :as gobj]))
[goog.object :as gobj]
[clojure.string :as string]))

;; Adapted from re-com date-picker

Expand Down Expand Up @@ -179,10 +180,14 @@
(constantly true))]
(merge attributes {:selectable-fn selectable-fn})))

;; TODO: find a better way
(defn- input-or-select?
[]
(when-let [elem js/document.activeElement]
(or (util/input? elem) (util/select? elem))))
(or (and (util/input? elem)
(when-let [id (gobj/get elem "id")]
(not (string/starts-with? id "edit-block-"))))
(util/select? elem))))

(rum/defc date-picker < rum/reactive
(mixins/event-mixin
Expand Down
28 changes: 13 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4776,15 +4776,14 @@ randomfill@^1.0.3:
randombytes "^2.0.5"
safe-buffer "^5.1.0"

react-dom@^16.12.0:
version "16.14.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.14.0.tgz#7ad838ec29a777fb3c75c3a190f661cf92ab8b89"
integrity sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==
react-dom@^17.0.1:
version "17.0.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.1.tgz#1de2560474ec9f0e334285662ede52dbc5426fc6"
integrity sha512-6eV150oJZ9U2t9svnsspTMrWNyHc6chX0KzDeAOXftRa8bNeOKTTfCJ7KorIwenkHd2xqVTBTCZd79yk/lx/Ug==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.19.1"
scheduler "^0.20.1"

react-is@^16.8.1:
version "16.13.1"
Expand All @@ -4810,14 +4809,13 @@ react-transition-group@^4.3.0:
loose-envify "^1.4.0"
prop-types "^15.6.2"

react@^16.12.0:
version "16.14.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d"
integrity sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==
react@^17.0.1:
version "17.0.1"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127"
integrity sha512-lG9c9UuMHdcAexXtigOZLX8exLWkW0Ku29qPRU8uhF2R9BN96dLCt0psvzPLlHc5OWkgymP3qwTRgbnw5BKx3w==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"

read-cache@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -5149,10 +5147,10 @@ sax@~1.2.4:
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==

scheduler@^0.19.1:
version "0.19.1"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196"
integrity sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==
scheduler@^0.20.1:
version "0.20.1"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.1.tgz#da0b907e24026b01181ecbc75efdc7f27b5a000c"
integrity sha512-LKTe+2xNJBNxu/QhHvDR14wUXHRQbVY5ZOYpOGWRzhydZUqrLb2JBvLPY7cAqFmqrWuDED0Mjk7013SZiOz6Bw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
Expand Down

0 comments on commit 2baa71b

Please sign in to comment.