mirror of https://github.com/logseq/logseq
Merge branch 'whiteboards' into whiteboards-cleanup
commit
20b5f8eab9
|
@ -1,8 +1,8 @@
|
||||||
(ns frontend.components.editor
|
(ns frontend.components.editor
|
||||||
(:require [clojure.string :as string]
|
(:require [clojure.string :as string]
|
||||||
[goog.string :as gstring]
|
|
||||||
[frontend.commands :as commands
|
[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.block :as block]
|
||||||
[frontend.components.datetime :as datetime-comp]
|
[frontend.components.datetime :as datetime-comp]
|
||||||
[frontend.components.search :as search]
|
[frontend.components.search :as search]
|
||||||
|
@ -12,9 +12,9 @@
|
||||||
[frontend.db.model :as db-model]
|
[frontend.db.model :as db-model]
|
||||||
[frontend.extensions.zotero :as zotero]
|
[frontend.extensions.zotero :as zotero]
|
||||||
[frontend.handler.editor :as editor-handler :refer [get-state]]
|
[frontend.handler.editor :as editor-handler :refer [get-state]]
|
||||||
[frontend.handler.paste :as paste-handler]
|
|
||||||
[frontend.handler.editor.lifecycle :as lifecycle]
|
[frontend.handler.editor.lifecycle :as lifecycle]
|
||||||
[frontend.handler.page :as page-handler]
|
[frontend.handler.page :as page-handler]
|
||||||
|
[frontend.handler.paste :as paste-handler]
|
||||||
[frontend.mixins :as mixins]
|
[frontend.mixins :as mixins]
|
||||||
[frontend.modules.shortcut.core :as shortcut]
|
[frontend.modules.shortcut.core :as shortcut]
|
||||||
[frontend.state :as state]
|
[frontend.state :as state]
|
||||||
|
@ -22,9 +22,10 @@
|
||||||
[frontend.util :as util]
|
[frontend.util :as util]
|
||||||
[frontend.util.cursor :as cursor]
|
[frontend.util.cursor :as cursor]
|
||||||
[frontend.util.keycode :as keycode]
|
[frontend.util.keycode :as keycode]
|
||||||
[logseq.graph-parser.util :as gp-util]
|
|
||||||
[logseq.graph-parser.property :as gp-property]
|
|
||||||
[goog.dom :as gdom]
|
[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]
|
[promesa.core :as p]
|
||||||
[react-draggable]
|
[react-draggable]
|
||||||
[rum.core :as rum]))
|
[rum.core :as rum]))
|
||||||
|
@ -149,7 +150,10 @@
|
||||||
:item-render (fn [page-name chosen?]
|
:item-render (fn [page-name chosen?]
|
||||||
[:div.preview-trigger-wrapper
|
[:div.preview-trigger-wrapper
|
||||||
(block/page-preview-trigger
|
(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?
|
:open? chosen?
|
||||||
:manual? true
|
:manual? true
|
||||||
:fixed-position? true
|
:fixed-position? true
|
||||||
|
|
|
@ -122,6 +122,9 @@
|
||||||
:new-page
|
:new-page
|
||||||
(page-handler/create! search-q {:redirect? true})
|
(page-handler/create! search-q {:redirect? true})
|
||||||
|
|
||||||
|
:new-whiteboard
|
||||||
|
(route/redirect-to-whiteboard! search-q)
|
||||||
|
|
||||||
:page
|
:page
|
||||||
(let [data (or alias data)]
|
(let [data (or alias data)]
|
||||||
(cond
|
(cond
|
||||||
|
@ -201,6 +204,10 @@
|
||||||
[:div.text.font-bold (str (t :new-page) ": ")
|
[:div.text.font-bold (str (t :new-page) ": ")
|
||||||
[:span.ml-1 (str "\"" (string/trim search-q) "\"")]]
|
[: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
|
:page
|
||||||
[:span {:data-page-ref data}
|
[:span {:data-page-ref data}
|
||||||
(when alias
|
(when alias
|
||||||
|
@ -248,7 +255,9 @@
|
||||||
(nil? result)
|
(nil? result)
|
||||||
all?)
|
all?)
|
||||||
[]
|
[]
|
||||||
[{:type :new-page}]) ;; todo: add new whiteboard
|
(if (state/enable-whiteboards?)
|
||||||
|
[{:type :new-page} {:type :new-whiteboard}]
|
||||||
|
[{:type :new-page}]))
|
||||||
result (cond
|
result (cond
|
||||||
config/publishing?
|
config/publishing?
|
||||||
(concat pages files blocks)
|
(concat pages files blocks)
|
||||||
|
|
|
@ -272,7 +272,7 @@
|
||||||
(when (state/enable-whiteboards?)
|
(when (state/enable-whiteboards?)
|
||||||
(sidebar-item
|
(sidebar-item
|
||||||
{:class "whiteboard"
|
{:class "whiteboard"
|
||||||
:title "Whiteboards"
|
:title (t :right-side-bar/whiteboards)
|
||||||
:href (rfe/href :whiteboards)
|
:href (rfe/href :whiteboards)
|
||||||
:active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name))
|
:active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name))
|
||||||
:icon "whiteboard"}))]]
|
:icon "whiteboard"}))]]
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
:right-side-bar/block-ref "Block references"
|
:right-side-bar/block-ref "Block references"
|
||||||
:right-side-bar/graph-view "Graph view"
|
:right-side-bar/graph-view "Graph view"
|
||||||
:right-side-bar/all-pages "All pages"
|
:right-side-bar/all-pages "All pages"
|
||||||
|
:right-side-bar/whiteboards "Whiteboards"
|
||||||
:right-side-bar/flashcards "Flashcards"
|
:right-side-bar/flashcards "Flashcards"
|
||||||
:right-side-bar/new-page "New page"
|
:right-side-bar/new-page "New page"
|
||||||
:right-side-bar/show-journals "Show Journals"
|
:right-side-bar/show-journals "Show Journals"
|
||||||
|
@ -220,6 +221,7 @@
|
||||||
:page-search "Search in the current page"
|
:page-search "Search in the current page"
|
||||||
:graph-search "Search graph"
|
:graph-search "Search graph"
|
||||||
:new-page "New page"
|
:new-page "New page"
|
||||||
|
:new-whiteboard "New whiteboard"
|
||||||
:go-to-whiteboard "Go to whiteboard"
|
:go-to-whiteboard "Go to whiteboard"
|
||||||
:new-file "New file"
|
:new-file "New file"
|
||||||
:new-graph "Add new graph"
|
:new-graph "Add new graph"
|
||||||
|
|
|
@ -241,7 +241,7 @@ export function usePaste(context: LogseqContextValue) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files) {
|
if (files && files.length > 0) {
|
||||||
await handleFiles(files)
|
await handleFiles(files)
|
||||||
} else {
|
} else {
|
||||||
for (const item of await navigator.clipboard.read()) {
|
for (const item of await navigator.clipboard.read()) {
|
||||||
|
|
Loading…
Reference in New Issue