fix: remove whiteboards and tldraw from rest of codebase

Also remove some old excalidraw refs that should've been removed awhile
back
This commit is contained in:
Gabriel Horner
2026-01-16 14:19:02 -05:00
parent 538d10a20a
commit 208b4bc205
44 changed files with 114 additions and 293 deletions

1
.gitignore vendored
View File

@@ -52,7 +52,6 @@ ios/App/App/public
startup.png
/src/main/frontend/tldraw-logseq.js
/src/test/docs*
~*~

View File

@@ -12,7 +12,6 @@
-/resources/static/js/mhchem.min.js
-/resources/static/js/mldoc.min.js
-/resources/static/js/sci.min.js
-/resources/static/js/excalidraw.min.js
-/resources/static/js/react-force-graph.min.js
-/resources/js/lsplugin.user.js
-/resources/js/pdf_viewer2.js

View File

@@ -60,7 +60,6 @@ This is overview of this repository's most important directories and files.
- `packages/` contains JavaScript dependencies used by the frontend
- `packages/ui/` - The frontend's component system based on shadcn
- `packags/tldraw/` - Custom fork of tldraw which powers whiteboards
- `scripts` - Dev scripts
- `clj-e2e/` - end to end clj frontend tests
- `android/` - Android app

View File

@@ -83,8 +83,6 @@ To get started with the DB version:
[Logseq](https://logseq.com) is a **knowledge management** and **collaboration** platform. It focuses on **privacy**, **longevity**, and [**user control**](https://www.gnu.org/philosophy/free-sw.en.html). Logseq offers a range of **powerful tools** for **knowledge management**, **collaboration**, **PDF annotation**, and **task management** with support for multiple file formats, including **Markdown** and **Org-mode**, and **various features** for organizing and structuring your notes.
Logseq's **Whiteboard** feature lets you organize your knowledge and ideas using a spatial **canvas** with **shapes**, **drawings**, **website embeds**, and **connectors**. You can **visually group** and **link** your **notes** and external media (such as **videos** and **images**), enabling visual thinkers to compose, remix, **annotate**, and connect content from their knowledge base and emerging thoughts in a new way.
In addition to its core features, Logseq has a growing ecosystem of **plugins** and **themes** that enable a wide range of workflows and **customization** options. **Mobile apps** are also available, providing access to most of the features of the desktop application. Whether you're a student, a professional, or anyone who values a clear and organized approach to managing your ideas and notes, Logseq is an excellent choice for anyone looking to improve their productivity and streamline their workflow.
![logseq-demo](https://user-images.githubusercontent.com/25513724/221387376-4dc419c2-0d0a-460c-a920-2d211e78b456.gif)

View File

@@ -1,7 +1,6 @@
{:meta/version 1
;; Hide empty block properties
;; This is _only_ for DB graphs.
;; Default value: false
;; :ui/hide-empty-properties? false
@@ -34,10 +33,6 @@
;; Default value: true
;; :feature/enable-flashcards? true
;; Enable whiteboards.
;; Default value: true
;; :feature/enable-whiteboards? true
;; Disable the journal's built-in 'Scheduled tasks and deadlines' query.
;; Default value: false
;; :feature/disable-scheduled-and-deadline-query? false

View File

@@ -66,12 +66,6 @@
(string/replace-first asset-protocol "file://"))
s))
(defonce default-draw-directory "draws")
(defn draw?
[path]
(string/starts-with? path default-draw-directory))
(defn text-formats
[]
#{:json :org :md :yml :dat :asciidoc :rst :txt :markdown :adoc :html :js :ts :edn :clj :ml :rb :ex :erl :java :php :c :css
@@ -103,7 +97,8 @@
:property-pages/excludelist
:srs/learning-fraction
:srs/initial-interval
:whiteboards-directory]
:whiteboards-directory
:feature/enable-whiteboards?]
(repeat "is not used in DB graphs"))
{:preferred-format
"is not used in DB graphs as there is only markdown mode."

View File

@@ -207,7 +207,6 @@
(def class? entity-util/class?)
(def property? entity-util/property?)
(def closed-value? entity-util/closed-value?)
(def whiteboard? entity-util/whiteboard?)
(def journal? entity-util/journal?)
(def hidden? entity-util/hidden?)
(def object? entity-util/object?)
@@ -412,7 +411,6 @@
(= 1 (count children))
(contains? #{"" "-" "*"} (string/trim (:block/title first-child))))))
(not (contains? built-in-pages name'))
(not (whiteboard? page))
(not (property? page))
;; a/b/c might be deleted but a/b/c/d still exists (for backward compatibility)
(not (and (string/includes? name' "/")

View File

@@ -32,6 +32,7 @@
:properties {:logseq.property.class/extends :logseq.class/Page
:logseq.property.journal/title-format "MMM do, yyyy"}}
;; TODO: Remove deprecated
:logseq.class/Whiteboard
{:title "Whiteboard"
:properties {:logseq.property.class/extends :logseq.class/Page}}

View File

@@ -29,7 +29,7 @@
(or (entity-util/class? page) (entity-util/internal-page? page))
false
;; Default to true for closed value and future internal types.
;; Other types like whiteboard are not considered because they aren't built-in
;; Other types are not considered because they aren't built-in
:else
true))

View File

@@ -33,11 +33,6 @@
[entity]
(has-tag? entity :logseq.class/Property))
(defn whiteboard?
"Given a page entity or map, check if it is a whiteboard page"
[entity]
(has-tag? entity :logseq.class/Whiteboard))
(defn closed-value?
[entity]
(some? (:block/closed-value-property entity)))
@@ -52,8 +47,7 @@
(or (internal-page? entity)
(journal? entity)
(class? entity)
(property? entity)
(whiteboard? entity)))
(property? entity)))
(defn asset?
"Given an entity or map, check if it is an asset block"
@@ -80,7 +74,6 @@
(let [ident->type {:logseq.class/Tag :class
:logseq.class/Property :property
:logseq.class/Journal :journal
:logseq.class/Whiteboard :whiteboard
:logseq.class/Page :page}]
(set (map #(ident->type (:db/ident %)) (:block/tags entity)))))

View File

@@ -3,6 +3,7 @@
(:require [clojure.set :as set]
[clojure.string :as string]
[datascript.core :as d]
[datascript.impl.entity :as de]
[logseq.db.common.entity-plus :as entity-plus]
[logseq.db.common.order :as db-order]
[logseq.db.frontend.class :as db-class]
@@ -408,6 +409,7 @@
[:block/link {:optional true} :int]
[:logseq.property/created-from-property {:optional true} :int]])
;; TODO: Remove deprecated
(def whiteboard-block
"A (shape) block for whiteboard"
(vec
@@ -526,6 +528,14 @@
[:block/created-at {:optional true} :int]
[:block/updated-at {:optional true} :int]])
(defn- whiteboard?
[entity]
(when (or (map? entity) (de/entity? entity))
(some (fn [t]
(or (keyword-identical? (:db/ident t) :logseq.class/Whiteboard)
(keyword-identical? t :logseq.class/Whiteboard)))
(:block/tags entity))))
(defn entity-dispatch-key [db ent]
(let [d (if (:block/uuid ent) (d/entity db [:block/uuid (:block/uuid ent)]) ent)
;; order matters as some block types are a subset of others e.g. :whiteboard
@@ -536,7 +546,8 @@
:class
(entity-util/hidden? d)
:hidden
(entity-util/whiteboard? d)
;; TODO: Remove deprecated
(whiteboard? d)
:normal-page
(entity-util/page? d)
:normal-page

View File

@@ -229,7 +229,7 @@
:logseq.property/asset {:title "Asset"
:schema {:type :entity
:hide? true}}
;; used by pdf and whiteboard
;; used by pdf
;; TODO: remove ls-type
:logseq.property/ls-type {:schema {:type :keyword
:hide? true}}
@@ -268,9 +268,11 @@
:schema {:type :node
:cardinality :many
:hide? true}}
;; TODO: Remove deprecated
:logseq.property.tldraw/page {:title "Tldraw Page"
:schema {:type :map
:hide? true}}
;; TODO: Remove deprecated
:logseq.property.tldraw/shape {:title "Tldraw Shape"
:schema {:type :map
:hide? true}}
@@ -892,8 +894,4 @@
[db block db-ident]
(when db
(let [block (or (d/entity db (:db/id block)) block)]
(lookup block db-ident))))
(defn shape-block?
[db block]
(= :whiteboard-shape (get-block-property-value db block :logseq.property/ls-type)))
(lookup block db-ident))))

View File

@@ -53,8 +53,7 @@
(and
(= url-type "Page_ref")
(and (string? value)
(not (or (common-config/local-relative-asset? value)
(common-config/draw? value))))
(not (common-config/local-relative-asset? value)))
value)
(and

View File

@@ -194,12 +194,7 @@
(not (contains? #{"Page_ref" "Block_ref"} ref-type))
(and (contains? #{"Page_ref"} ref-type)
(or
;; 2. excalidraw link
(common-config/draw? ref-value)
;; 3. local asset link
(boolean (common-config/local-relative-asset? ref-value))))))))
(boolean (common-config/local-relative-asset? ref-value)))))))
(defn mldoc-link?
"Check whether s is a link (including page/block refs)."

View File

@@ -86,11 +86,9 @@
(assoc :real-outliner-op :rename-page)))
true))))))
(defn- build-page-tx [db properties page {:keys [whiteboard? class? tags class-ident-namespace]}]
(defn- build-page-tx [db properties page {:keys [class? tags class-ident-namespace]}]
(when (:block/uuid page)
(let [type-tag (cond class? :logseq.class/Tag
whiteboard? :logseq.class/Whiteboard
:else :logseq.class/Page)
(let [type-tag (if class? :logseq.class/Tag :logseq.class/Page)
tags' (if (:block/journal-day page) tags (conj tags type-tag))
page' (update page :block/tags
(fnil into [])
@@ -237,7 +235,7 @@
"Pure function without side effects"
[db title*
{uuid' :uuid
:keys [tags properties persist-op? whiteboard?
:keys [tags properties persist-op?
class? today-journal? split-namespace? class-ident-namespace]
:or {properties nil
persist-op? true}
@@ -251,8 +249,6 @@
title (sanitize-title title*)
types (cond class?
#{:logseq.class/Tag}
whiteboard?
#{:logseq.class/Whiteboard}
today-journal?
#{:logseq.class/Journal}
(seq tags)
@@ -306,7 +302,7 @@
(outliner-validate/validate-page-title-characters (str (:block/title parent)) {:node parent})))
(let [page-uuid (:block/uuid page)
page-txs (build-page-tx db properties page (select-keys options [:whiteboard? :class? :tags :class-ident-namespace]))
page-txs (build-page-tx db properties page (select-keys options [:class? :tags :class-ident-namespace]))
txs (concat
;; transact doesn't support entities
(remove de/entity? parents')

View File

@@ -2,18 +2,16 @@
"Provides tree fns and INode protocol"
(:require [datascript.core :as d]
[datascript.impl.entity :as de]
[logseq.db :as ldb]
[logseq.db.frontend.property :as db-property]))
[logseq.db :as ldb]))
(defprotocol INode
(-save [this *txs-state conn opts])
(-del [this *txs-state db]))
(defn- blocks->vec-tree-aux
[db blocks root]
[blocks root]
(let [root-id (:db/id root)
blocks (remove #(db-property/shape-block? db %) blocks)
parent-blocks (group-by #(get-in % [:block/parent :db/id]) blocks) ;; exclude whiteboard shapes
parent-blocks (group-by #(get-in % [:block/parent :db/id]) blocks)
sort-fn (fn [parent]
(when-let [children (get parent-blocks parent)]
(ldb/sort-by-order children)))
@@ -60,7 +58,7 @@
[page? root] (get-root-and-page db root-id)]
(if-not root ; custom query
blocks
(let [result (blocks->vec-tree-aux db blocks root)]
(let [result (blocks->vec-tree-aux blocks root)]
(if (and page? (not (:link option)))
result
;; include root block

View File

@@ -59,8 +59,6 @@ $ bb lang:missing es
| :translation-key | :string-to-translate | :file |
|---------------------------------------+-------------------------------------------------------+---------------|
| :command.editor/toggle-number-list | Toggle number list | dicts/es.edn |
| :command.whiteboard/bring-forward | Move forward | dicts/es.edn |
| :command.whiteboard/bring-to-front | Move to front | dicts/es.edn |
...
```
@@ -73,8 +71,6 @@ $ bb lang:missing es --copy
;; For dicts/es.edn
:command.editor/toggle-number-list "Toggle number list"
:command.whiteboard/bring-forward "Move forward"
:command.whiteboard/bring-to-front "Move to front"
...
```

View File

@@ -184,31 +184,27 @@
"Allows certain keys in a language to have the same translation
as English. Happens more in romance languages but pretty rare otherwise"
{:fr #{:port :type :help/docs :search-item/page :shortcut.category/navigating :text/image
:settings-of-plugins :code :shortcut.category/plugins :whiteboard/rectangle :whiteboard/triangle}
:de #{:graph :host :plugins :port :right-side-bar/whiteboards
:settings-of-plugins :code :shortcut.category/plugins}
:de #{:graph :host :plugins :port
:settings-of-plugins :shortcut.category/navigating
:settings-page/enable-tooltip :settings-page/enable-whiteboards :settings-page/plugin-system}
:ca #{:port :settings-page/tab-editor :settings-page/tab-general
:whiteboard/color :whiteboard/connector :whiteboard/text :whiteboard/triangle}
:es #{:settings-page/tab-general :settings-page/tab-editor :whiteboard/color}
:settings-page/enable-tooltip :settings-page/plugin-system}
:ca #{:port :settings-page/tab-editor :settings-page/tab-general}
:es #{:settings-page/tab-general :settings-page/tab-editor}
:it #{:home :handbook/home :host :help/awesome-logseq
:settings-page/tab-account :settings-page/tab-editor :whiteboard/link}
:settings-page/tab-account :settings-page/tab-editor}
:nl #{:plugins :type :left-side-bar/nav-recent-pages :plugin/update}
:pl #{:port :home :host :plugin/marketplace :whiteboard/link}
:pl #{:port :home :host :plugin/marketplace}
:pt-BR #{:plugins :right-side-bar/flashcards :settings-page/enable-flashcards :page/backlinks
:host :settings-page/tab-editor :shortcut.category/plugins :whiteboard/link :settings-of-plugins :whiteboard
:whiteboards :on-boarding/quick-tour-journal-page-desc-2 :plugin/downloads :plugin/popular
:right-side-bar/whiteboards :settings-page/enable-whiteboards :settings-page/plugin-system
:shortcut.category/whiteboard :command.whiteboard/zoom-in :command.whiteboard/zoom-out}
:host :settings-page/tab-editor :shortcut.category/plugins :settings-of-plugins
:on-boarding/quick-tour-journal-page-desc-2 :plugin/downloads :plugin/popular
:settings-page/plugin-system}
:pt-PT #{:plugins :settings-of-plugins :plugin/downloads :right-side-bar/flashcards
:settings-page/enable-flashcards :settings-page/plugin-system}
:nb-NO #{:port :type :whiteboard :right-side-bar/flashcards :right-side-bar/whiteboards
:settings-page/enable-flashcards :settings-page/enable-whiteboards
:settings-page/tab-editor :shortcut.category/whiteboard :whiteboard/medium
:whiteboard/twitter-url :whiteboard/youtube-url :linked-references/filter-heading}
:nb-NO #{:port :type :right-side-bar/flashcards :settings-page/enable-flashcards
:settings-page/tab-editor :linked-references/filter-heading}
:tr #{:help/awesome-logseq}
:id #{:host :port}
:cs #{:host :port :help/blog :settings-page/tab-editor :whiteboard/text}})
:cs #{:host :port :help/blog :settings-page/tab-editor}})
(defn- validate-languages-dont-have-duplicates
"Looks up duplicates for all languages"

View File

@@ -8,7 +8,6 @@
[frontend.db :as db]
[frontend.db.async :as db-async]
[frontend.handler.notification :as notification]
[frontend.handler.property.util :as pu]
[frontend.handler.route :as route-handler]
[frontend.handler.search :as search-handler]
[frontend.handler.ui :as ui-handler]
@@ -67,9 +66,7 @@
block-id
(p/let [block (db-async/<get-block (state/get-current-repo) block-id {:children? false})]
(if block
(if (pu/shape-block? block)
(route-handler/redirect-to-page! (get-in block [:block/page :block/uuid]) {:block-id block-id})
(route-handler/redirect-to-page! block-id))
(route-handler/redirect-to-page! block-id)
(notification/show! (str "Open link failed. Block-id `" block-id "` doesn't exist in the graph.") :error false)))))))
(safe-api-call "foundInPage"

View File

@@ -1655,9 +1655,6 @@
(defn- bullet-on-click
[e block uuid {:keys [on-redirect-to-page]}]
(cond
(pu/shape-block? block)
(route-handler/redirect-to-page! (get-in block [:block/page :block/uuid]) {:block-id uuid})
(gobj/get e "shiftKey")
(do
(state/sidebar-add-block!

View File

@@ -2,7 +2,6 @@
(:require [cljs-time.coerce :as tc]
[cljs.pprint :as pp]
[clojure.string :as string]
[dommy.core :as d]
[frontend.commands :as commands]
[frontend.components.editor :as editor]
[frontend.components.export :as export]
@@ -72,8 +71,7 @@
(let [block-uuids (state/get-selection-block-ids)]
(shui/popup-hide!)
(shui/dialog-open!
#(export/export-blocks block-uuids {:whiteboard? false
:export-type :selected-nodes}))))}
#(export/export-blocks block-uuids {:export-type :selected-nodes}))))}
(t :content/copy-export-as))
(shui/dropdown-menu-item
@@ -168,8 +166,7 @@
{:key "Copy as"
:on-click (fn [_]
(shui/dialog-open!
#(export/export-blocks [block-id] {:whiteboard? false
:export-type :block})))}
#(export/export-blocks [block-id] {:export-type :block})))}
(t :content/copy-export-as))
(when-not property-default-value?
@@ -336,25 +333,8 @@
[:div.cursor (t :content/click-to-edit)]
content)]))))
(defn- set-draw-iframe-style!
[]
(let [width (gobj/get js/window "innerWidth")]
(when (>= width 1024)
(let [draws (d/by-class "draw-iframe")
width (- width 200)]
(doseq [draw draws]
(d/set-style! draw :width (str width "px"))
(let [height (max 700 (/ width 2))]
(d/set-style! draw :height (str height "px")))
(d/set-style! draw :margin-left (str (- (/ (- width 570) 2)) "px")))))))
(rum/defcs content < rum/reactive
{:did-mount (fn [state]
(set-draw-iframe-style!)
state)
:did-update (fn [state]
(set-draw-iframe-style!)
state)}
{}
[state id {:keys [format
config
hiccup

View File

@@ -227,7 +227,7 @@
(rum/local nil ::content)
{:will-mount (fn [state]
(let [top-level-uuids (get-top-level-uuids (first (:rum/args state)))]
(reset! *export-block-type (if (:whiteboard? (last (:rum/args state))) :png :text))
(reset! *export-block-type :text)
(if (= @*export-block-type :png)
(do (reset! (::content state) nil)
(get-image-blob top-level-uuids
@@ -238,7 +238,7 @@
(reset! (::text-indent-style state) (state/get-export-block-text-indent-style))
(reset! (::text-other-options state) (state/get-export-block-text-other-options))
(assoc state ::top-level-uuids top-level-uuids)))}
[state _selection-ids {:keys [whiteboard? export-type] :as options}]
[state _selection-ids {:keys [export-type] :as options}]
(let [top-level-uuids (::top-level-uuids state)
tp @*export-block-type
*text-other-options (::text-other-options state)
@@ -249,34 +249,34 @@
[:div.export.resize
{:class "-m-5"}
[:div.p-6
(when-not whiteboard?
[:div.flex.pb-3
(ui/button "Text"
[:div.flex.pb-3
(ui/button "Text"
:class "mr-4 w-20"
:on-click #(do (reset! *export-block-type :text)
(reset! *content (export-helper top-level-uuids))))
(ui/button "OPML"
:class "mr-4 w-20"
:on-click #(do (reset! *export-block-type :opml)
(reset! *content (export-helper top-level-uuids))))
(ui/button "HTML"
:class "mr-4 w-20"
:on-click #(do (reset! *export-block-type :html)
(reset! *content (export-helper top-level-uuids))))
;; TODO: Remove if this is no longer used after whiteboard removal
(when-not (seq? top-level-uuids)
(ui/button "PNG"
:class "mr-4 w-20"
:on-click #(do (reset! *export-block-type :text)
(reset! *content (export-helper top-level-uuids))))
(ui/button "OPML"
:class "mr-4 w-20"
:on-click #(do (reset! *export-block-type :opml)
(reset! *content (export-helper top-level-uuids))))
(ui/button "HTML"
:class "mr-4 w-20"
:on-click #(do (reset! *export-block-type :html)
(reset! *content (export-helper top-level-uuids))))
(when-not (seq? top-level-uuids)
(ui/button "PNG"
:class "mr-4 w-20"
:on-click #(do (reset! *export-block-type :png)
(reset! *content nil)
(get-image-blob top-level-uuids (merge options {:transparent-bg? false}) (fn [blob] (reset! *content blob))))))
(ui/button "EDN"
:class "w-20"
:on-click #(do (reset! *export-block-type :edn)
(p/let [result (<export-edn-helper top-level-uuids export-type)
pull-data (with-out-str (pprint/pprint result))]
(if (:export-edn-error result)
(notification/show! (:export-edn-error result) :error)
(reset! *content pull-data)))))])
:on-click #(do (reset! *export-block-type :png)
(reset! *content nil)
(get-image-blob top-level-uuids (merge options {:transparent-bg? false}) (fn [blob] (reset! *content blob))))))
(ui/button "EDN"
:class "w-20"
:on-click #(do (reset! *export-block-type :edn)
(p/let [result (<export-edn-helper top-level-uuids export-type)
pull-data (with-out-str (pprint/pprint result))]
(if (:export-edn-error result)
(notification/show! (:export-edn-error result) :error)
(reset! *content pull-data)))))]
(if (= :png tp)
[:div.flex.items-center.justify-center.relative
(when (not @*content) [:div.absolute (ui/loading "")])

View File

@@ -49,9 +49,7 @@
(let [file-id file]
[:tr {:key file-id}
[:td
(let [href (if (common-config/draw? file)
(rfe/href :draw nil {:file (string/replace file (str common-config/default-draw-directory "/") "")})
(rfe/href :file {:path file-id}))]
(let [href (rfe/href :file {:path file-id})]
[:a {:href href}
file])]
(when-not mobile?

View File

@@ -60,8 +60,6 @@
(ldb/class? node-entity)
"hash"
(ldb/property? node-entity)
"letter-p"
(ldb/whiteboard? node-entity)
"writing"
(ldb/page? node-entity)
"file"

View File

@@ -81,8 +81,7 @@
[page]
(when-let [page-name (and page (db/page? page) (:block/name page))]
(let [page-title (str (:block/uuid page))
whiteboard? (ldb/whiteboard? page)
block? (and page (util/uuid-string? page-name) (not whiteboard?))
block? (and page (util/uuid-string? page-name))
contents? (= page-name "contents")
public? (:logseq.property/publishing-public? page)
_favorites-updated? (state/sub :favorites/updated?)
@@ -116,8 +115,7 @@
{:title (t :export-page)
:options {:on-click #(shui/dialog-open!
(fn []
(export/export-blocks [(:block/uuid page)] {:whiteboard? whiteboard?
:export-type :page}))
(export/export-blocks [(:block/uuid page)] {:export-type :page}))
{:class "w-auto md:max-w-4xl max-h-[80vh] overflow-y-auto"})}})
(when (and page (not config/publishing?))

View File

@@ -769,7 +769,7 @@
:label label
:value id
:disabled? (and tags? (contains?
(set/union #{:logseq.class/Journal :logseq.class/Whiteboard}
(set/union #{:logseq.class/Journal}
(set/difference ldb/internal-tags #{:logseq.class/Page}))
(:db/ident node)))))) nodes)
classes' (remove (fn [class] (= :logseq.class/Root (:db/ident class))) classes)

View File

@@ -27,7 +27,6 @@
:shortcut.category/block-selection
:shortcut.category/formatting
:shortcut.category/toggle
:shortcut.category/whiteboard
:shortcut.category/plugins
:shortcut.category/others))

View File

@@ -28,8 +28,7 @@
get-block-immediate-children get-file
get-latest-journals get-page get-case-page
get-page-format journal-page? page? sub-block
page-exists? get-alias-source-page
has-children? whiteboard-page?])
page-exists? get-alias-source-page has-children?])
(defn start-db-conn!
([repo]

View File

@@ -288,14 +288,6 @@ independent of format as format specific heading characters are stripped"
(when (string? page-name)
(ldb/journal? (ldb/get-page (conn/get-db) page-name))))
(defn whiteboard-page?
"Given a page entity, page object or page name, check if it is a whiteboard page"
[page]
(let [page (if (string? page)
(get-page page)
page)]
(ldb/whiteboard? page)))
;; FIXME: use `Untitled` instead of UUID for db based graphs
(defn untitled-page?
[page-name]

View File

@@ -128,7 +128,8 @@
If path is relative path, return blob url or file url according to environment."
([path] (<make-asset-url path (try (js/URL. path) (catch :default _ nil))))
([path ^js js-url]
;; path start with "/assets"(editor) or compatible for "../assets"(whiteboards)
;; path start with "/assets"(editor)
;; TODO: Remove compatible for "../assets" related to whiteboards?
(if config/publishing?
;; Relative path needed since assets are not under '/' if published graph is not under '/'
(string/replace-first path #"^/" "")

View File

@@ -175,7 +175,7 @@
page (db/entity repo page-id)]
;; Redirect to the newly renamed page
(when (and redirect? (not (db/whiteboard-page? page)))
(when redirect?
(route-handler/redirect! {:to :page
:push false
:path-params {:name (str (:block/uuid page))}}))

View File

@@ -64,8 +64,7 @@
(page-handler/init-commands!)
;; load config
(repo-config-handler/restore-repo-config! graph)
(when-not (= :draw (state/get-current-route))
(route-handler/redirect-to-home!))
(route-handler/redirect-to-home!)
(graph-handler/settle-metadata-to-local! {:last-seen-at (js/Date.now)}))
;; Parameters for the `persist-db` function, to show the notification messages
@@ -203,14 +202,6 @@
(when-not (mobile-util/native-platform?)
(state/pub-event! [:graph/ready graph])))
(defmethod handle :whiteboard-link [[_ shapes]]
(route-handler/go-to-search! :whiteboard/link)
(state/set-state! :whiteboard/linked-shapes shapes))
(defmethod handle :whiteboard-go-to-link [[_ link]]
(route-handler/redirect! {:to :page
:path-params {:name link}}))
(defmethod handle :graph/save-db-to-disk [[_ _opts]]
(persist-db/export-current-graph! {:succ-notification? true :force-save? true}))

View File

@@ -64,19 +64,6 @@
(re-matches #"^https://x\.com.*?$" url))
(util/format "{{twitter %s}}" url)))
(defn- try-parse-as-json
"Result is not only to be an Object.
Maybe JSON types like string, number, boolean, null, array"
[text]
(try (js/JSON.parse text)
(catch :default _ #js{})))
(defn- get-whiteboard-tldr-from-text
[text]
(when-let [matched-text (util/safe-re-find #"<whiteboard-tldr>(.*)</whiteboard-tldr>"
(common-util/safe-decode-uri-component text))]
(try-parse-as-json (second matched-text))))
(defn- selection-within-link?
[selection-and-format]
(let [{:keys [selection-start selection-end selection value]} selection-and-format]
@@ -125,17 +112,10 @@
(commands/simple-insert! input-id text nil)))
text (string/replace *text "\r\n" "\n") ;; Fix for Windows platform
input-id (state/get-edit-input-id)
shape-refs-text (when (and (not (string/blank? html))
(get-whiteboard-tldr-from-text html))
;; text should always be prepared block-ref generated in tldr
text)
{:keys [selection] :as selection-and-format} (editor-handler/get-selection-and-format)
text-url? (common-util/url? text)
selection-url? (common-util/url? selection)]
(cond
(not (string/blank? shape-refs-text))
(commands/simple-insert! input-id shape-refs-text nil)
;; When a url is selected in a formatted link, replaces it with pasted text
(or (and (or text-url? selection-url?)
(selection-within-link? selection-and-format))
@@ -178,7 +158,6 @@
(replace-text-f text'))))))
(defn- paste-copied-blocks-or-text
;; todo: logseq/whiteboard-shapes is now text/html
[input text e html]
(util/stop e)
(let [repo (state/get-current-repo)]
@@ -258,7 +237,6 @@
- pastes file if it exists
- wraps certain urls with macros
- wraps selected urls with link formatting
- whiteboard friendly pasting
- paste replaces selected text"
[id]
(fn [e]

View File

@@ -12,10 +12,4 @@
"Get the value of a built-in block's property by its db-ident"
[block db-ident]
(let [db (conn/get-db (state/get-current-repo))]
(db-property/get-block-property-value db block db-ident)))
(defn shape-block?
[block]
(let [repo (state/get-current-repo)
db (conn/get-db repo)]
(db-property/shape-block? db block)))
(db-property/get-block-property-value db block db-ident)))

View File

@@ -146,8 +146,6 @@
(str "#" (:name path-params))
:diff
"Git diff"
:draw
"Draw"
:settings
"Settings"
:import

View File

@@ -131,10 +131,10 @@
(swap! open? not)))))))
(def container-id
"Notice: the first parameter needs to be a `config` with `id`, optional `sidebar?`, `whiteboard?`"
"Notice: the first parameter needs to be a `config` with `id`, optional `sidebar?`"
{:init (fn [state]
(let [config (first (:rum/args state))
key (select-keys config [:id :sidebar? :whiteboard? :embed? :custom-query? :query :current-block :table? :block? :db/id :page-name])
key (select-keys config [:id :sidebar? :embed? :custom-query? :query :current-block :table? :block? :db/id :page-name])
container-id (or (:container-id config) (state/get-container-id key))]
(assoc state :container-id container-id)))})

View File

@@ -126,16 +126,13 @@
(teardown)))}
[]
(if-let [route-match (state/sub :route-match)]
(let [route-name (get-in route-match [:data :name])]
(when-let [view (:view (:data route-match))]
(ui/catch-error-and-notify
(helpful-default-error-screen)
[:<>
(if (= :draw route-name)
(view route-match)
(container/root-container
route-match
(view route-match)))
(when config/lsp-enabled?
(plugin/hook-daemon-renderers))])))
(when-let [view (:view (:data route-match))]
(ui/catch-error-and-notify
(helpful-default-error-screen)
[:<>
(container/root-container
route-match
(view route-match))
(when config/lsp-enabled?
(plugin/hook-daemon-renderers))]))
(not-found)))

View File

@@ -11,7 +11,6 @@
[:feature/enable-search-remove-accents? :boolean]
[:feature/enable-journals? :boolean]
[:feature/enable-flashcards? :boolean]
[:feature/enable-whiteboards? :boolean]
[:feature/disable-scheduled-and-deadline-query? :boolean]
[:scheduled/future-days :int]
[:start-of-week [:enum 0 1 2 3 4 5 6]]

View File

@@ -82,7 +82,6 @@
:network/online? true
:me nil
:git/current-repo current-graph
:draw? false
:db/restoring? nil
:search/q ""
@@ -148,7 +147,6 @@
:editor/start-pos (atom nil)
:editor/async-unsaved-chars (atom nil)
:editor/hidden-editors #{} ;; page names
:editor/draw-mode? false
:editor/action (atom nil)
:editor/action-data nil

View File

@@ -513,8 +513,7 @@
tx-data)
_ (when context (worker-state/set-context! context))
tx-meta' (cond-> tx-meta
(and (not (:whiteboard/transact? tx-meta))
(not (:rtc-download-graph? tx-meta))) ; delay writes to the disk
(not (:rtc-download-graph? tx-meta)) ; delay writes to the disk
(assoc :skip-store? true)
true

View File

@@ -25,7 +25,6 @@
* :uuid - when set, use this uuid instead of generating a new one.
* :class? - when true, adds a :block/tags ':logseq.class/Tag'
* :whiteboard? - when true, adds a :block/tags ':logseq.class/Whiteboard'
* :tags - tag uuids that are added to :block/tags
* :persist-op? - when true, add an update-page op
* :properties - properties to add to the page

View File

@@ -126,7 +126,7 @@
[:db/add eid :logseq.property.class/extends :logseq.class/Root]
[:db/retract eid :block/tags :logseq.class/Page]])
;; remove #Page from tags/journals/whiteboards, etc.
;; remove #Page from tags/journals etc.
(= (:db/id page-tag) (:v datom))
(let [tags (->> entity
:block/tags

View File

@@ -123,27 +123,6 @@
:gen-undo-ops? false
:rtc-op? true}))
(defmethod transact-db! :delete-whiteboard-blocks [_ conn block-uuids]
(ldb/transact! conn
(mapv (fn [block-uuid] [:db/retractEntity [:block/uuid block-uuid]]) block-uuids)
{:persist-op? false
:gen-undo-ops? false
:rtc-op? true}))
(defmethod transact-db! :upsert-whiteboard-block [_ conn blocks]
(ldb/transact! conn blocks {:persist-op? false
:gen-undo-ops? false
:rtc-op? true}))
(defn- group-remote-remove-ops-by-whiteboard-block
"return {true [<whiteboard-block-ops>], false [<other-ops>]}"
[db remote-remove-ops]
(group-by (fn [{:keys [block-uuid]}]
(boolean
(when-let [block (d/entity db [:block/uuid block-uuid])]
(ldb/whiteboard? (:block/parent block)))))
remote-remove-ops))
(defn- apply-remote-remove-ops-helper
[conn remove-ops]
(let [block-uuid->entity (into {}
@@ -164,32 +143,28 @@
:block-uuids-to-remove block-uuid-set}))
(defn- apply-remote-remove-ops
[conn remove-ops]
(let [{whiteboard-block-ops true other-ops false} (group-remote-remove-ops-by-whiteboard-block @conn remove-ops)]
(transact-db! :delete-whiteboard-blocks conn (map :block-uuid whiteboard-block-ops))
(let [{:keys [block-uuids-need-move block-uuids-to-remove]}
(apply-remote-remove-ops-helper conn other-ops)]
[conn other-ops]
(let [{:keys [block-uuids-need-move block-uuids-to-remove]}
(apply-remote-remove-ops-helper conn other-ops)]
;; move to page-block's first child
(doseq [block-uuid block-uuids-need-move]
(when-let [b (d/entity @conn [:block/uuid block-uuid])]
(when-let [target-b
(d/entity @conn (:db/id (:block/page (d/entity @conn [:block/uuid block-uuid]))))]
(transact-db! :move-blocks&persist-op conn [b] target-b {:sibling? false}))))
(let [deleting-blocks (keep (fn [block-uuid]
(d/entity @conn [:block/uuid block-uuid]))
block-uuids-to-remove)]
(when (seq deleting-blocks)
(transact-db! :delete-blocks conn deleting-blocks {}))))))
(doseq [block-uuid block-uuids-need-move]
(when-let [b (d/entity @conn [:block/uuid block-uuid])]
(when-let [target-b
(d/entity @conn (:db/id (:block/page (d/entity @conn [:block/uuid block-uuid]))))]
(transact-db! :move-blocks&persist-op conn [b] target-b {:sibling? false}))))
(let [deleting-blocks (keep (fn [block-uuid]
(d/entity @conn [:block/uuid block-uuid]))
block-uuids-to-remove)]
(when (seq deleting-blocks)
(transact-db! :delete-blocks conn deleting-blocks {})))))
(defn- insert-or-move-block
[conn block-uuid remote-parents remote-block-order move? op-value]
(when (or (seq remote-parents) remote-block-order) ;at least one of parent|order exists
(let [first-remote-parent (first remote-parents)
local-parent (when first-remote-parent (d/entity @conn [:block/uuid first-remote-parent]))
whiteboard-page-block? (boolean (ldb/whiteboard? local-parent))
b (d/entity @conn [:block/uuid block-uuid])]
(case [whiteboard-page-block? (some? local-parent) (some? remote-block-order)]
(case [false (some? local-parent) (some? remote-block-order)]
[false true true]
(do
(if move?
@@ -209,9 +184,6 @@
(when (and (empty? remote-parents) move?)
(transact-db! :update-block-order-directly conn block-uuid nil remote-block-order))
([true false false] [true false true] [true true false] [true true true])
(throw (ex-info "Not implemented yet for whiteboard" {:op-value op-value}))
(let [e (ex-info "Don't know where to insert" {:block-uuid block-uuid
:remote-parents remote-parents
:remote-block-order remote-block-order

View File

@@ -1,7 +1,6 @@
(ns frontend.handler.paste-test
(:require [cljs.test :refer [deftest are is testing]]
[frontend.test.helper :as test-helper :include-macros true :refer [deftest-async]]
[goog.object :as gobj]
["/frontend/utils" :as utils]
[frontend.state :as state]
[frontend.commands :as commands]
@@ -12,34 +11,6 @@
[frontend.handler.editor :as editor-handler]
[frontend.handler.paste :as paste-handler]))
(deftest try-parse-as-json-result-parse-test
(are [x y] (let [result (#'paste-handler/try-parse-as-json x)
obj-result (if (object? result) result #js{})]
(gobj/get obj-result "foo") ;; This op shouldn't throw
(gobj/getValueByKeys obj-result "foo" "bar") ;; This op shouldn't throw
(gobj/equals result y))
"{\"number\": 1234}" #js{:number 1234}
"1234" 1234
"null" nil
"true" true
"[1234, 5678]" #js[1234 5678]
;; invalid JSON
"{number: 1234}" #js{}))
(deftest try-parse-as-json-result-get-test
(are [x y z] (let [result (#'paste-handler/try-parse-as-json x)
obj-result (if (object? result) result #js{})]
(and (gobj/equals (gobj/get obj-result "foo") y)
(gobj/equals (gobj/getValueByKeys obj-result "foo" "bar") z)))
"{\"foo\": {\"bar\": 1234}}" #js{:bar 1234} 1234
"{\"number\": 1234}" nil nil
"1234" nil nil
"null" nil nil
"true" nil nil
"[{\"number\": 1234}]" nil nil
;; invalid JSON
"{number: 1234}" nil nil))
(deftest selection-within-link-test
(are [x y] (= (#'paste-handler/selection-within-link? x) y)
{:format :markdown