mirror of https://github.com/logseq/logseq
enhance: page history support reverting back
parent
7273112a00
commit
eec677873b
|
@ -3,7 +3,9 @@
|
|||
[frontend.ui :as ui]
|
||||
[frontend.util :as util]
|
||||
[clojure.string :as string]
|
||||
[frontend.handler.shell :as shell]))
|
||||
[frontend.handler.shell :as shell]
|
||||
[frontend.handler.file :as file]
|
||||
[frontend.state :as state]))
|
||||
|
||||
(rum/defcs set-git-username-and-email <
|
||||
(rum/local "" ::username)
|
||||
|
@ -43,3 +45,16 @@
|
|||
(not (string/blank? email)))
|
||||
(shell/set-git-username-and-email username email))))}
|
||||
"Submit"]]]]))
|
||||
|
||||
(rum/defc file-specific-version
|
||||
[path hash content]
|
||||
[:div.w-full.sm:max-w-lg {:style {:width 700}}
|
||||
[:div.font-bold.mb-4 (str path (util/format " (%s)" hash)) ]
|
||||
[:pre content]
|
||||
(ui/button "Revert"
|
||||
:on-click (fn []
|
||||
(file/alter-file (state/get-current-repo)
|
||||
path
|
||||
content
|
||||
{:re-render-root? true
|
||||
:skip-compare? true})))])
|
||||
|
|
|
@ -158,6 +158,9 @@
|
|||
(when-let [repo (state/get-current-repo)]
|
||||
(state/set-modal! #(diff/local-file repo path disk-content db-content))))
|
||||
|
||||
(defmethod handle :modal/display-file-version [[_ path content hash]]
|
||||
(state/set-modal! #(git-component/file-specific-version path hash content)))
|
||||
|
||||
(defmethod handle :after-db-restore [[_ repos]]
|
||||
(mapv (fn [{url :url} repo]
|
||||
;; compare :ast/version
|
||||
|
|
|
@ -53,10 +53,7 @@
|
|||
local-dir (config/get-local-dir repo)
|
||||
path (string/replace path (str local-dir "/") "")]
|
||||
(p/let [content (run-git-command! ["show" (str hash ":" path)])]
|
||||
(state/pub-event! [:modal/show
|
||||
[:div.w-full.sm:max-w-lg {:style {:width 700}}
|
||||
[:div.font-bold.mb-4 (str path (util/format " (%s)" hash)) ]
|
||||
[:pre content]]])))))
|
||||
(state/pub-event! [:modal/display-file-version path content hash])))))
|
||||
|
||||
(defn get-file-latest-git-log
|
||||
[page n]
|
||||
|
|
Loading…
Reference in New Issue