|
|
@@ -185,7 +185,7 @@
|
|
|
(p/do!
|
|
|
(repo-handler/restore-and-setup-repo! graph)
|
|
|
(graph-switch graph)
|
|
|
- state/set-state! :sync-graph/init? false))
|
|
|
+ (state/set-state! :sync-graph/init? false)))
|
|
|
|
|
|
(defmethod handle :graph/switch [[_ graph opts]]
|
|
|
(let [^js sqlite @db-browser/*worker]
|
|
|
@@ -260,18 +260,18 @@
|
|
|
(when
|
|
|
(and (not (util/electron?))
|
|
|
(not (mobile-util/native-platform?)))
|
|
|
- (fn [close-fn]
|
|
|
- [:div
|
|
|
+ (fn [close-fn]
|
|
|
+ [:div
|
|
|
;; TODO: fn translation with args
|
|
|
- [:p
|
|
|
- "Grant native filesystem permission for directory: "
|
|
|
- [:b (config/get-local-dir repo)]]
|
|
|
- (ui/button
|
|
|
- (t :settings-permission/start-granting)
|
|
|
- :class "ui__modal-enter"
|
|
|
- :on-click (fn []
|
|
|
- (nfs/check-directory-permission! repo)
|
|
|
- (close-fn)))])))
|
|
|
+ [:p
|
|
|
+ "Grant native filesystem permission for directory: "
|
|
|
+ [:b (config/get-local-dir repo)]]
|
|
|
+ (ui/button
|
|
|
+ (t :settings-permission/start-granting)
|
|
|
+ :class "ui__modal-enter"
|
|
|
+ :on-click (fn []
|
|
|
+ (nfs/check-directory-permission! repo)
|
|
|
+ (close-fn)))])))
|
|
|
|
|
|
(defmethod handle :modal/nfs-ask-permission []
|
|
|
(when-let [repo (get-local-repo)]
|
|
|
@@ -378,8 +378,9 @@
|
|
|
(state/set-modal! #(diff/local-file repo path disk-content db-content)
|
|
|
{:label "diff__cp"}))))))
|
|
|
|
|
|
-(defmethod handle :modal/display-file-version [[_ path content hash]]
|
|
|
- (state/set-modal! #(git-component/file-specific-version path hash content)))
|
|
|
+
|
|
|
+(defmethod handle :modal/display-file-version-selector [[_ versions path get-content]]
|
|
|
+ (state/set-modal! #(git-component/file-version-selector versions path get-content)))
|
|
|
|
|
|
;; Hook on a graph is ready to be shown to the user.
|
|
|
;; It's different from :graph/restored, as :graph/restored is for window reloaded
|
|
|
@@ -434,8 +435,8 @@
|
|
|
|
|
|
(defmethod handle :go/proxy-settings [[_ agent-opts]]
|
|
|
(state/set-sub-modal!
|
|
|
- (fn [_] (plugin/user-proxy-settings-panel agent-opts))
|
|
|
- {:id :https-proxy-panel :center? true}))
|
|
|
+ (fn [_] (plugin/user-proxy-settings-panel agent-opts))
|
|
|
+ {:id :https-proxy-panel :center? true}))
|
|
|
|
|
|
|
|
|
(defmethod handle :redirect-to-home [_]
|
|
|
@@ -576,14 +577,14 @@
|
|
|
(if-not error-code
|
|
|
(plugin/set-updates-sub-content! (str title "...") 0)
|
|
|
(notification/show!
|
|
|
- (str "[Checked]<" title "> " error-code) :error)))))
|
|
|
+ (str "[Checked]<" title "> " error-code) :error)))))
|
|
|
|
|
|
(if (and updated? downloading?)
|
|
|
;; try to start consume downloading item
|
|
|
(if-let [next-coming (state/get-next-selected-coming-update)]
|
|
|
(plugin-handler/check-or-update-marketplace-plugin!
|
|
|
- (assoc next-coming :only-check false :error-code nil)
|
|
|
- (fn [^js e] (js/console.error "[Download Err]" next-coming e)))
|
|
|
+ (assoc next-coming :only-check false :error-code nil)
|
|
|
+ (fn [^js e] (js/console.error "[Download Err]" next-coming e)))
|
|
|
(plugin-handler/close-updates-downloading))
|
|
|
|
|
|
;; try to start consume pending item
|
|
|
@@ -591,11 +592,11 @@
|
|
|
(do
|
|
|
(println "Updates: take next pending - " (:id next-pending))
|
|
|
(js/setTimeout
|
|
|
- #(plugin-handler/check-or-update-marketplace-plugin!
|
|
|
- (assoc next-pending :only-check true :auto-check auto-checking? :error-code nil)
|
|
|
- (fn [^js e]
|
|
|
- (notification/show! (.toString e) :error)
|
|
|
- (js/console.error "[Check Err]" next-pending e))) 500))
|
|
|
+ #(plugin-handler/check-or-update-marketplace-plugin!
|
|
|
+ (assoc next-pending :only-check true :auto-check auto-checking? :error-code nil)
|
|
|
+ (fn [^js e]
|
|
|
+ (notification/show! (.toString e) :error)
|
|
|
+ (js/console.error "[Check Err]" next-pending e))) 500))
|
|
|
|
|
|
;; try to open waiting updates list
|
|
|
(do (when (and prev-pending? (not auto-checking?)
|
|
|
@@ -620,7 +621,7 @@
|
|
|
payload (js->clj event :keywordize-keys true)]
|
|
|
(fs-watcher/handle-changed! type payload)
|
|
|
(when (file-sync-handler/enable-sync?)
|
|
|
- (sync/file-watch-handler type payload))))
|
|
|
+ (sync/file-watch-handler type payload))))
|
|
|
|
|
|
(defmethod handle :rebuild-slash-commands-list [[_]]
|
|
|
(page-handler/rebuild-slash-commands-list!))
|
|
|
@@ -641,7 +642,7 @@
|
|
|
(t :yes)
|
|
|
:autoFocus "on"
|
|
|
:class "ui__modal-enter"
|
|
|
- :on-click (fn []
|
|
|
+ :on-click (fn []
|
|
|
(state/close-modal!)
|
|
|
(nfs-handler/refresh! (state/get-current-repo) refresh-cb)))]]))
|
|
|
|
|
|
@@ -661,7 +662,7 @@
|
|
|
:GraphName graph-name
|
|
|
:remote? true)
|
|
|
r))
|
|
|
- (state/get-repos)))))))
|
|
|
+ (state/get-repos)))))))
|
|
|
|
|
|
(defmethod handle :modal/remote-encryption-input-pw-dialog [[_ repo-url remote-graph-info type opts]]
|
|
|
(state/set-modal!
|
|
|
@@ -845,17 +846,17 @@
|
|
|
[:p
|
|
|
"Or, let me"
|
|
|
(ui/button "Fix"
|
|
|
- :on-click (fn []
|
|
|
- (let [dir (config/get-repo-dir repo)]
|
|
|
- (p/let [content (fs/read-file dir file)]
|
|
|
- (let [new-content (string/replace content (str id) (str (random-uuid)))]
|
|
|
- (p/let [_ (fs/write-file! repo
|
|
|
- dir
|
|
|
- file
|
|
|
- new-content
|
|
|
- {})]
|
|
|
- (reset! resolved? true))))))
|
|
|
- :class "inline mx-1")
|
|
|
+ :on-click (fn []
|
|
|
+ (let [dir (config/get-repo-dir repo)]
|
|
|
+ (p/let [content (fs/read-file dir file)]
|
|
|
+ (let [new-content (string/replace content (str id) (str (random-uuid)))]
|
|
|
+ (p/let [_ (fs/write-file! repo
|
|
|
+ dir
|
|
|
+ file
|
|
|
+ new-content
|
|
|
+ {})]
|
|
|
+ (reset! resolved? true))))))
|
|
|
+ :class "inline mx-1")
|
|
|
"it."]])]]))
|
|
|
|
|
|
(defmethod handle :file/parse-and-load-error [[_ repo parse-errors]]
|
|
|
@@ -872,13 +873,13 @@
|
|
|
(uuid? (last (:assertion data))))
|
|
|
(rum/with-key (file-id-conflict-item repo file data) file)
|
|
|
|
|
|
- :else
|
|
|
- (do
|
|
|
- (state/pub-event! [:capture-error {:error error
|
|
|
- :payload {:type :file/parse-and-load-error}}])
|
|
|
- [:li.my-1 {:key file}
|
|
|
- [:a {:on-click #(js/window.apis.openPath file)} file]
|
|
|
- [:p (.-message error)]]))))]
|
|
|
+ :else
|
|
|
+ (do
|
|
|
+ (state/pub-event! [:capture-error {:error error
|
|
|
+ :payload {:type :file/parse-and-load-error}}])
|
|
|
+ [:li.my-1 {:key file}
|
|
|
+ [:a {:on-click #(js/window.apis.openPath file)} file]
|
|
|
+ [:p (.-message error)]]))))]
|
|
|
[:p "Don't forget to re-index your graph when all the conflicts are resolved."]]
|
|
|
:status :error}]))
|
|
|
|
|
|
@@ -895,8 +896,8 @@
|
|
|
(defmethod handle :editor/toggle-own-number-list [[_ blocks]]
|
|
|
(let [batch? (sequential? blocks)
|
|
|
blocks (cond->> blocks
|
|
|
- batch?
|
|
|
- (map #(cond-> % (or (uuid? %) (string? %)) (db-model/get-block-by-uuid))))]
|
|
|
+ batch?
|
|
|
+ (map #(cond-> % (or (uuid? %) (string? %)) (db-model/get-block-by-uuid))))]
|
|
|
(if (and batch? (> (count blocks) 1))
|
|
|
(editor-handler/toggle-blocks-as-own-order-list! blocks)
|
|
|
(when-let [block (cond-> blocks batch? (first))]
|