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

This commit is contained in:
charlie
2022-11-25 12:01:26 +08:00
15 changed files with 134 additions and 32 deletions

View File

@@ -160,6 +160,9 @@
insert-today? (get-in (state/get-config)
[:quick-capture-options :insert-today]
false)
redirect-page? (get-in (state/get-config)
[:quick-capture-options :redirect-page]
false)
today-page (when (state/enable-journals?)
(string/lower-case (date/today)))
page (if (or (= page "TODAY")
@@ -195,7 +198,7 @@
(do
(when (not= page (state/get-current-page))
(page-handler/create! page {:redirect? true}))
(page-handler/create! page {:redirect? redirect-page?}))
(editor-handler/api-insert-new-block! content {:page page
:edit-block? true
:replace-empty-target? true}))))))

View File

@@ -361,7 +361,16 @@
(route-handler/sidebar-journals!)
(route-handler/go-to-journals!)))
:icon "calendar"})))
(when enable-whiteboards?
(sidebar-item
{:class "whiteboard"
:title (t :right-side-bar/whiteboards)
:href (rfe/href :whiteboards)
:active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name))
:icon "whiteboard"
:icon-extension? true}))
(when (state/enable-flashcards? (state/get-current-repo))
[:div.flashcards-nav
(flashcards srs-open?)])
@@ -378,16 +387,7 @@
:title (t :right-side-bar/all-pages)
:href (rfe/href :all-pages)
:active (and (not srs-open?) (= route-name :all-pages))
:icon "files"})
(when enable-whiteboards?
(sidebar-item
{:class "whiteboard"
:title (t :right-side-bar/whiteboards)
:href (rfe/href :whiteboards)
:active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name))
:icon "whiteboard"
:icon-extension? true}))]]
:icon "files"})]]
[:div.nav-contents-container.flex.flex-col.gap-1.pt-1
{:on-scroll on-contents-scroll}

View File

@@ -178,7 +178,7 @@
(action-fn! action true)))}
[:li.item-colors
(for [it ["yellow", "blue", "green", "red", "purple"]]
(for [it ["yellow", "red", "green", "blue", "purple"]]
[:a {:key it :data-color it :data-action it} it])]

View File

@@ -728,6 +728,12 @@
(<get-graph-encrypt-keys [this graph-uuid])
(<upload-graph-encrypt-keys [this graph-uuid public-key encrypted-private-key]))
(defprotocol IRemoteControlAPI
"api functions provided for outside the sync process"
(<delete-remote-files-control [this graph-uuid filepaths])
)
(defprotocol IToken
(<get-token [this]))
@@ -1360,6 +1366,20 @@
:public-key public-key
:encrypted-private-key encrypted-private-key})))))
(extend-type RemoteAPI
IRemoteControlAPI
(<delete-remote-files-control [this graph-uuid filepaths]
(user/<wrap-ensure-id&access-token
(let [current-txid (:TXId (<! (<get-remote-graph this nil graph-uuid)))
files (<! (<encrypt-fnames rsapi graph-uuid filepaths))]
(<! (.<request this "delete_files" {:GraphUUID graph-uuid :TXId current-txid :Files files}))))))
(comment
(declare remoteapi)
(<delete-remote-files-control remoteapi (second @graphs-txid) ["pages/aa.md"])
)
(def remoteapi (->RemoteAPI nil))

View File

@@ -56,13 +56,13 @@
(defonce icon-size (if (mobile-util/native-platform?) 26 20))
(def block-background-colors
["gray"
["yellow"
"red"
"yellow"
"pink"
"green"
"blue"
"purple"
"pink"])
"gray"])
(rum/defc ls-textarea
< rum/reactive