Merge branch 'master' into enhance/mobile-ux-2

This commit is contained in:
charlie
2022-11-28 10:55:03 +08:00
40 changed files with 861 additions and 426 deletions

View File

@@ -385,8 +385,12 @@
share-fn (fn [event]
(util/stop event)
(when (mobile-util/native-platform?)
(.share Share #js {:url path
:title "Open file with your favorite app"})))]
;; File URL must be legal, so filename muse be URI-encoded
(let [[rel-dir basename] (util/get-dir-and-basename href)
basename (js/encodeURIComponent basename)
asset-url (str repo-dir rel-dir "/" basename)]
(.share Share (clj->js {:url asset-url
:title "Open file with your favorite app"})))))]
(cond
(contains? config/audio-formats ext)
@@ -401,7 +405,7 @@
[:a.asset-ref.is-plaintext {:href (rfe/href :file {:path path})
:on-click (fn [_event]
(p/let [result (fs/read-file repo-dir path)]
(db/set-file-content! repo path result )))}
(db/set-file-content! repo path result)))}
title]
(= ext :pdf)
@@ -2491,12 +2495,14 @@
(rum/defc breadcrumb-separator [] [:span.mx-2.opacity-50 "➤"])
(defn breadcrumb
"block-id - uuid of the target block of breadcrumb. page uuid is also acceptable"
[config repo block-id {:keys [show-page? indent? end-separator? level-limit _navigating-block]
:or {show-page? true
level-limit 3}
:as opts}]
(let [parents (db/get-block-parents repo block-id (inc level-limit))
page (db/get-block-page repo block-id)
page (or (db/get-block-page repo block-id) ;; only return for block uuid
(model/query-block-by-uuid block-id)) ;; return page entity when received page uuid
page-name (:block/name page)
page-original-name (:block/original-name page)
show? (or (seq parents) show-page? page-name)