Merge branch 'whiteboards' into whiteboards-cleanup

pull/6345/head
Konstantinos Kaloutas 2022-08-12 11:51:31 +03:00
commit 20b5f8eab9
5 changed files with 24 additions and 9 deletions

View File

@ -1,8 +1,8 @@
(ns frontend.components.editor
(:require [clojure.string :as string]
[goog.string :as gstring]
[frontend.commands :as commands
:refer [*first-command-group *matched-block-commands *matched-commands]]
:refer [*first-command-group *matched-block-commands
*matched-commands]]
[frontend.components.block :as block]
[frontend.components.datetime :as datetime-comp]
[frontend.components.search :as search]
@ -12,9 +12,9 @@
[frontend.db.model :as db-model]
[frontend.extensions.zotero :as zotero]
[frontend.handler.editor :as editor-handler :refer [get-state]]
[frontend.handler.paste :as paste-handler]
[frontend.handler.editor.lifecycle :as lifecycle]
[frontend.handler.page :as page-handler]
[frontend.handler.paste :as paste-handler]
[frontend.mixins :as mixins]
[frontend.modules.shortcut.core :as shortcut]
[frontend.state :as state]
@ -22,9 +22,10 @@
[frontend.util :as util]
[frontend.util.cursor :as cursor]
[frontend.util.keycode :as keycode]
[logseq.graph-parser.util :as gp-util]
[logseq.graph-parser.property :as gp-property]
[goog.dom :as gdom]
[goog.string :as gstring]
[logseq.graph-parser.property :as gp-property]
[logseq.graph-parser.util :as gp-util]
[promesa.core :as p]
[react-draggable]
[rum.core :as rum]))
@ -149,7 +150,10 @@
:item-render (fn [page-name chosen?]
[:div.preview-trigger-wrapper
(block/page-preview-trigger
{:children [:div (search/highlight-exact-query page-name q)]
{:children
[:div.flex
(when (db-model/whiteboard-page? page-name) [:span.mr-1 (ui/icon "whiteboard")])
(search/highlight-exact-query page-name q)]
:open? chosen?
:manual? true
:fixed-position? true

View File

@ -122,6 +122,9 @@
:new-page
(page-handler/create! search-q {:redirect? true})
:new-whiteboard
(route/redirect-to-whiteboard! search-q)
:page
(let [data (or alias data)]
(cond
@ -201,6 +204,10 @@
[:div.text.font-bold (str (t :new-page) ": ")
[:span.ml-1 (str "\"" (string/trim search-q) "\"")]]
:new-whiteboard
[:div.text.font-bold (str (t :new-whiteboard) ": ")
[:span.ml-1 (str "\"" (string/trim search-q) "\"")]]
:page
[:span {:data-page-ref data}
(when alias
@ -248,7 +255,9 @@
(nil? result)
all?)
[]
[{:type :new-page}]) ;; todo: add new whiteboard
(if (state/enable-whiteboards?)
[{:type :new-page} {:type :new-whiteboard}]
[{:type :new-page}]))
result (cond
config/publishing?
(concat pages files blocks)

View File

@ -272,7 +272,7 @@
(when (state/enable-whiteboards?)
(sidebar-item
{:class "whiteboard"
:title "Whiteboards"
:title (t :right-side-bar/whiteboards)
:href (rfe/href :whiteboards)
:active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name))
:icon "whiteboard"}))]]

View File

@ -66,6 +66,7 @@
:right-side-bar/block-ref "Block references"
:right-side-bar/graph-view "Graph view"
:right-side-bar/all-pages "All pages"
:right-side-bar/whiteboards "Whiteboards"
:right-side-bar/flashcards "Flashcards"
:right-side-bar/new-page "New page"
:right-side-bar/show-journals "Show Journals"
@ -220,6 +221,7 @@
:page-search "Search in the current page"
:graph-search "Search graph"
:new-page "New page"
:new-whiteboard "New whiteboard"
:go-to-whiteboard "Go to whiteboard"
:new-file "New file"
:new-graph "Add new graph"

View File

@ -241,7 +241,7 @@ export function usePaste(context: LogseqContextValue) {
return false
}
if (files) {
if (files && files.length > 0) {
await handleFiles(files)
} else {
for (const item of await navigator.clipboard.read()) {