Skip to content

Commit 15585f1

Browse files
committed
mod+m to publish
1 parent f1a4108 commit 15585f1

5 files changed

Lines changed: 26 additions & 4 deletions

File tree

deps/publish/src/logseq/publish/render.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[logseq.publish.model :as publish-model]))
1111

1212
;; Timestamp in milliseconds used for cache busting static assets.
13-
(defonce version 1767105766059)
13+
(defonce version 1767194868810)
1414

1515
(def ref-regex
1616
(js/RegExp. "\\[\\[([0-9a-fA-F-]{36})\\]\\]|\\(\\(([0-9a-fA-F-]{36})\\)\\)" "g"))

src/main/frontend/components/page_menu.cljs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
(p/finally (fn []
3333
(set-publishing! false)
3434
(shui/dialog-close!))))))]
35-
[:div.flex.flex-col.gap-4.p-2
35+
[:form.flex.flex-col.gap-4.p-2
36+
{:on-submit (fn [e]
37+
(.preventDefault e)
38+
(submit!))}
3639
[:div.text-lg.font-medium "Publish page"]
3740
[:div.text-sm.opacity-70
3841
"Optionally protect this page with a password. Leave empty for public access."]
@@ -44,10 +47,12 @@
4447
[:div.flex.justify-end.gap-2
4548
(shui/button
4649
{:variant "ghost"
50+
:type "button"
4751
:on-click #(shui/dialog-close!)}
4852
"Cancel")
4953
(shui/button
50-
{:on-click submit!
54+
{:type "submit"
55+
:auto-focus true
5156
:disabled publishing?}
5257
(if publishing?
5358
"Publishing..."

src/main/frontend/handler/events/ui.cljs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[frontend.components.assets :as assets]
66
[frontend.components.cmdk.core :as cmdk]
77
[frontend.components.page :as component-page]
8+
[frontend.components.page-menu :as page-menu]
89
[frontend.components.plugins :as plugin]
910
[frontend.components.property.dialog :as property-dialog]
1011
[frontend.components.quick-add :as quick-add]
@@ -100,6 +101,15 @@
100101
(plugin/open-select-theme!)
101102
(route-handler/go-to-search! :themes)))
102103

104+
(defmethod events/handle :publish/open-dialog [_]
105+
(when-not config/publishing?
106+
(when-let [page-name (state/get-current-page)]
107+
(when-let [page (db/get-page page-name)]
108+
(when (db/page? page)
109+
(shui/dialog-open!
110+
(fn [] (page-menu/publish-page-dialog page))
111+
{:class "w-auto max-w-md"}))))))
112+
103113
(defmethod events/handle :ui/toggle-appearance [_]
104114
(let [popup-id "appearance_settings"]
105115
(if (gdom/getElement popup-id)

src/main/frontend/modules/shortcut/config.cljs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@
376376
:inactive (not (util/electron?))
377377
:binding "mod+s"}
378378

379+
:publish/open-dialog {:binding "mod+m"
380+
:inactive config/publishing?
381+
:fn #(state/pub-event! [:publish/open-dialog])}
382+
379383
:command/run {:binding "mod+shift+1"
380384
:inactive (not (util/electron?))
381385
:fn #(do
@@ -667,6 +671,7 @@
667671
:sidebar/open-today-page
668672
:sidebar/clear
669673
:command/run
674+
:publish/open-dialog
670675
:command-palette/toggle
671676
:editor/add-property
672677
:window/close])
@@ -847,7 +852,8 @@
847852
:ui/customize-appearance]
848853

849854
:shortcut.category/others
850-
[:pdf/previous-page
855+
[:publish/open-dialog
856+
:pdf/previous-page
851857
:pdf/next-page
852858
:pdf/close
853859
:pdf/find

src/resources/dicts/en.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@
515515
:sidebar/close-top "Closes the top item in the right sidebar"
516516
:sidebar/clear "Clear all in the right sidebar"
517517
:misc/copy "Copy"
518+
:publish/open-dialog "Open publish dialog for current page"
518519
:graph/export-as-html "Export public graph pages as html"
519520
:graph/open "Select graph to open"
520521
:graph/remove "Remove a graph"

0 commit comments

Comments
 (0)