Enhance/PDF viewer (#7369)

* fix(pdf): WIP potential memory leaks
* enhance(pdf): sync page number in highlights metafile
* enhance(pdf): support preview highlight area image in a lightbox
* fix: clojurescript unit tests
* fix(pdf): page number overflow when more digits
This commit is contained in:
Charlie
2022-11-17 20:31:08 +08:00
committed by GitHub
parent a6f6b0abae
commit dd2ef163ba
12 changed files with 208 additions and 115 deletions

View File

@@ -296,10 +296,6 @@
;; (re-)fetches get-current-repo needlessly
;; TODO: Add consistent validation. Only a few config options validate at get time
(defn get-current-pdf
[]
(:pdf/current @state))
(def default-config
"Default config for a repo-specific, user config"
{:feature/enable-search-remove-accents? true
@@ -1967,3 +1963,16 @@ Similar to re-frame subscriptions"
[]
(when (mobile-util/native-ios?)
(get-in @state [:mobile/container-urls :iCloudContainerUrl])))
(defn get-current-pdf
[]
(:pdf/current @state))
(defn set-current-pdf!
[inflated-file]
(let [settle-file! #(set-state! :pdf/current inflated-file)]
(if-not (get-current-pdf)
(settle-file!)
(when (apply not= (map :identity [inflated-file (get-current-pdf)]))
(set-state! :pdf/current nil)
(js/setTimeout #(settle-file!) 16)))))