Browse Source

Merge branch 'master' into feat/hnswlib+transformer-js

Tienson Qin 4 months ago
parent
commit
67a0f7cd8c

+ 5 - 1
clj-e2e/src/logseq/e2e/playwright_page.clj

@@ -4,6 +4,10 @@
             [logseq.e2e.config :as config]
             [wally.main :as w]))
 
+(defn get-test-url
+  [port]
+  (str "http://localhost:" (or port @config/*port) "?rtc-test=true"))
+
 (defn get-pages
   [pw-ctx]
   (.pages pw-ctx))
@@ -11,7 +15,7 @@
 (defn open-pages
   "Pages in same pw-ctx share cookies and storages"
   [pw-ctx n]
-  (let [url (str "http://localhost:" @config/*port)]
+  (let [url (get-test-url nil)]
     (dotimes [_i n]
       (let [page (.newPage pw-ctx)]
         (.navigate page url)

+ 3 - 2
clj-e2e/test/logseq/e2e/fixtures.clj

@@ -4,6 +4,7 @@
             [logseq.e2e.custom-report :as custom-report]
             [logseq.e2e.graph :as graph]
             [logseq.e2e.page :as page]
+            [logseq.e2e.playwright-page :as pw-page]
             [logseq.e2e.settings :as settings]
             [wally.main :as w]))
 
@@ -18,7 +19,7 @@
     (w/grant-permissions :clipboard-write :clipboard-read)
     (binding [custom-report/*pw-contexts* #{(.context (w/get-page))}
               custom-report/*pw-page->console-logs* (atom {})]
-      (w/navigate (str "http://localhost:" (or port @config/*port)))
+      (w/navigate (pw-page/get-test-url port))
       (settings/developer-mode)
       (w/refresh)
       (assert/assert-graph-loaded?)
@@ -48,7 +49,7 @@
               w/*page* (delay (throw (ex-info "Don't use *page*, use *page1* and *page2* instead" {})))]
       (run!
        #(w/with-page %
-          (w/navigate (str "http://localhost:" port'))
+          (w/navigate (pw-page/get-test-url port))
           (settings/developer-mode)
           (w/refresh)
           (assert/assert-graph-loaded?)

+ 4 - 1
deps/db/src/logseq/db/common/view.cljs

@@ -420,7 +420,10 @@
     :else
     (let [view (d/entity db view-id)
           group-by-property (:logseq.property.view/group-by-property view)
-          list-view? (= :logseq.property.view/type.list (:db/ident (:logseq.property.view/type view)))
+          db-based? (entity-plus/db-based-graph? db)
+          list-view? (or (= :logseq.property.view/type.list (:db/ident (:logseq.property.view/type view)))
+                         (and (not db-based?)
+                              (contains? #{:linked-references :unlinked-references} view-feature-type)))
           group-by-property-ident (or (:db/ident group-by-property) group-by-property-ident)
           group-by-closed-values? (some? (:property/closed-values group-by-property))
           ref-property? (= (:db/valueType group-by-property) :db.type/ref)

+ 2 - 0
deps/outliner/src/logseq/outliner/core.cljs

@@ -524,6 +524,8 @@
 (defn- get-target-block-page
   [target-block]
   (or
+   (when (ldb/page? target-block)
+     (:db/id target-block))
    (:db/id (:block/page target-block))
    ;; target parent is a page
    (when-let [parent (:block/parent target-block)]

+ 6 - 2
resources/js/preload.js

@@ -1,5 +1,6 @@
 const fs = require('fs')
 const path = require('path')
+const os = require('os')
 const { ipcRenderer, contextBridge, shell, clipboard, webFrame } = require('electron')
 
 const IS_MAC = process.platform === 'darwin'
@@ -86,8 +87,11 @@ contextBridge.exposeInMainWorld('apis', {
     await shell.openExternal(url, options)
   },
 
-  async openPath (path) {
-    await shell.openPath(path)
+  async openPath (relativePath) {
+    const absolutePath = path.resolve(
+      relativePath.startsWith('~') ? path.join(os.homedir(), relativePath.slice(1)) : relativePath
+    );
+    await shell.openPath(absolutePath)
   },
 
   /**

+ 0 - 5
shadow-cljs.edn

@@ -38,7 +38,6 @@
 
         :output-dir       "./static/js"
         :asset-path       "/static/js"
-        :release          {:asset-path "https://asset.logseq.com/static/js"}
         :compiler-options {:infer-externs      :auto
                            :output-feature-set :es-next-in
                            :source-map true
@@ -58,10 +57,6 @@
                           frontend.config/ENABLE-RTC-SYNC-PRODUCTION #shadow/env ["ENABLE_RTC_SYNC_PRODUCTION" :as :bool :default true]
                           frontend.config/REVISION #shadow/env ["LOGSEQ_REVISION" :default "dev"]} ;; set by git-revision-hook
 
-        ;; NOTE: electron, browser/mobile-app use different asset-paths.
-        ;;   For browser/mobile-app devs, assets are located in /static/js(via HTTP root).
-        ;;   For electron devs, assets are located in ./js(via relative path).
-        ;; :dev      {:asset-path "./js"}
         :devtools {:before-load frontend.core/stop          ;; before live-reloading any code call this function
                    :after-load frontend.core/start          ;; after live-reloading finishes call this function
                    :watch-path "/static"

+ 34 - 41
src/main/frontend/components/block.cljs

@@ -308,6 +308,10 @@
   [asset-block src title metadata {:keys [breadcrumb? positioned? local? full-text]}]
   (let [*el-ref (rum/use-ref nil)
         image-src (fs/asset-path-normalize src)
+        src' (if (or (string/starts-with? src "/")
+                     (string/starts-with? src "~"))
+               (str "file://" src)
+               src)
         get-blockid #(some-> (rum/deref *el-ref) (.closest "[blockid]") (.getAttribute "blockid") (uuid))]
     [:div.asset-container
      {:key "resize-asset-container"
@@ -321,7 +325,7 @@
       (merge
        {:loading "lazy"
         :referrerPolicy "no-referrer"
-        :src src
+        :src src'
         :title title}
        metadata)]
      (when (and (not breadcrumb?)
@@ -600,6 +604,9 @@
                     (util/starts-with? href "http")
                     href
 
+                    (or (util/starts-with? href "/") (util/starts-with? href "~"))
+                    href
+
                     config/publishing?
                     (subs href 1)
 
@@ -702,7 +709,7 @@
    All page-names are sanitized except page-name-in-block"
   [state
    {:keys [contents-page? whiteboard-page? other-position? show-unique-title?
-           on-context-menu with-parent?]
+           on-context-menu with-parent? stop-event-propagation?]
     :or {with-parent? true}
     :as config}
    page-entity children label]
@@ -727,6 +734,8 @@
        :on-drag-start (fn [e]
                         (editor-handler/block->data-transfer! page-name e true))
        :on-pointer-down (fn [^js e]
+                          (when stop-event-propagation?
+                            (util/stop-propagation e))
                           (cond
                             (util/link? (.-target e))
                             nil
@@ -1250,11 +1259,6 @@
              (string? (last (first label))))
     (common-util/safe-decode-uri-component (last (first label)))))
 
-(defn- get-page
-  [label]
-  (when-let [label-text (get-label-text label)]
-    (db/get-page label-text)))
-
 (defn- macro->text
   [name arguments]
   (if (and (seq arguments)
@@ -1533,7 +1537,7 @@
     (show-link? config metadata s full_text)
     (media-link config url s label metadata full_text)
 
-    (or (util/electron?) (config/db-based-graph? (state/get-current-repo)))
+    (util/electron?)
     (let [path (cond
                  (string/starts-with? s "file://")
                  (string/replace s "file://" "")
@@ -1591,7 +1595,7 @@
 
       :else
       (let [href (string-of-url url)
-            [protocol path] (or (and (= "Complex" (first url)) url)
+            [protocol path] (or (and (= "Complex" (first url)) [(:protocol (second url)) (:link (second url))])
                                 (and (= "File" (first url)) ["file" (second url)]))]
         (cond
           (and (= (get-in config [:block :block/format] :markdown) :org)
@@ -1609,36 +1613,23 @@
           (= protocol "file")
           (if (show-link? config metadata href full_text)
             (media-link config url href label metadata full_text)
-            (let [redirect-page-name (when (string? path) (text/get-page-name path))
-                  config (assoc config :redirect-page-name redirect-page-name)
-                  label-text (get-label-text label)
-                  page (if (string/blank? label-text)
-                         {:block/name (file-model/get-file-page (string/replace href "file:" "") false)}
-                         (get-page label))
-                  show-brackets? (state/show-brackets?)]
-              (if (and page
-                       (when-let [ext (util/get-file-ext href)]
-                         (common-config/mldoc-support? ext)))
-                [:span.page-reference
-                 (when show-brackets? [:span.text-gray-500 page-ref/left-brackets])
-                 (page-cp config page)
-                 (when show-brackets? [:span.text-gray-500 page-ref/right-brackets])]
-
-                (let [href* (if (util/electron?)
-                              (relative-assets-path->absolute-path href)
-                              href)]
-                  (->elem
-                   :a
-                   (cond-> (if (util/electron?)
-                             {:on-click (fn [e]
-                                          (util/stop e)
-                                          (js/window.apis.openPath path))
-                              :data-href href*}
-                             {:href      (path/path-join "file://" href*)
-                              :data-href href*
-                              :target    "_blank"})
-                     title (assoc :title title))
-                   (map-inline config label))))))
+            (let [href* (if (util/electron?)
+                          (relative-assets-path->absolute-path href)
+                          href)]
+              [:div.flex.flex-row.items-center
+               (ui/icon "file" {:class "opacity-50"})
+               (->elem
+                :a
+                (cond-> (if (util/electron?)
+                          {:on-click (fn [e]
+                                       (util/stop e)
+                                       (js/window.apis.openPath path))
+                           :data-href href*}
+                          {:href      (path/path-join "file://" href*)
+                           :data-href href*
+                           :target    "_blank"})
+                  title (assoc :title title))
+                (map-inline config label))]))
 
           (show-link? config metadata href full_text)
           (media-link config url href label metadata full_text)
@@ -3304,7 +3295,8 @@
 (rum/defc breadcrumb
   [config repo block-id {:keys [_show-page? _indent? _end-separator? _navigating-block]
                          :as opts}]
-  (let [[block set-block!] (hooks/use-state nil)]
+  (let [[block set-block!] (hooks/use-state (when (uuid? block-id)
+                                              (db/entity [:block/uuid block-id])))]
     (hooks/use-effect!
      (fn []
        (p/let [block (db-async/<get-block (state/get-current-repo)
@@ -4396,7 +4388,8 @@
 
 (rum/defc block-list
   [config blocks]
-  (let [[virtualized? _] (rum/use-state (not (or (and (:journals? config) (< (count blocks) 50))
+  (let [[virtualized? _] (rum/use-state (not (or (string/includes? js/window.location.search "?rtc-test=true")
+                                                 (and (:journals? config) (< (count blocks) 50))
                                                  (and (util/mobile?) (ldb/journal? (:block/page (first blocks))))
                                                  (:block-children? config))))
         render-item (fn [idx]

+ 112 - 107
src/main/frontend/components/container.cljs

@@ -81,101 +81,104 @@
        [:span.b (or more (ui/icon "chevron-right" {:class "more" :size 15}))]]
       (when child [:div.bd child])]]))
 
-(rum/defc page-name
-  [page icon recent?]
-  (let [repo (state/get-current-repo)
-        db-based? (config/db-based-graph? repo)
-        title (:block/title page)
-        untitled? (db-model/untitled-page? title)
-        name (:block/name page)
-        file-rpath (when (util/electron?) (page-util/get-page-file-rpath name))
-        ctx-icon #(shui/tabler-icon %1 {:class "scale-90 pr-1 opacity-80"})
-        open-in-sidebar #(state/sidebar-add-block!
-                          (state/get-current-repo)
-                          (:db/id page)
-                          :page)
-        x-menu-content (fn []
-                         (let [x-menu-item shui/dropdown-menu-item
-                               x-menu-shortcut shui/dropdown-menu-shortcut]
-                           [:<>
-                            (when-not recent?
+(rum/defc page-name < rum/reactive db-mixins/query
+  [page recent?]
+  (when-let [id (:db/id page)]
+    (let [page (db/sub-block id)
+          repo (state/get-current-repo)
+          db-based? (config/db-based-graph? repo)
+          icon (icon/get-node-icon-cp page {:size 16})
+          title (:block/title page)
+          untitled? (db-model/untitled-page? title)
+          name (:block/name page)
+          file-rpath (when (util/electron?) (page-util/get-page-file-rpath name))
+          ctx-icon #(shui/tabler-icon %1 {:class "scale-90 pr-1 opacity-80"})
+          open-in-sidebar #(state/sidebar-add-block!
+                            (state/get-current-repo)
+                            (:db/id page)
+                            :page)
+          x-menu-content (fn []
+                           (let [x-menu-item shui/dropdown-menu-item
+                                 x-menu-shortcut shui/dropdown-menu-shortcut]
+                             [:<>
+                              (when-not recent?
+                                (x-menu-item
+                                 {:key "unfavorite"
+                                  :on-click #(page-handler/<unfavorite-page! (if db-based? (str (:block/uuid page)) title))}
+                                 (ctx-icon "star-off")
+                                 (t :page/unfavorite)
+                                 (x-menu-shortcut (when-let [binding (shortcut-dh/shortcut-binding :command/toggle-favorite)]
+                                                    (some-> binding
+                                                            (first)
+                                                            (shortcut-utils/decorate-binding))))))
+                              (when-let [page-fpath (and (util/electron?) file-rpath
+                                                         (config/get-repo-fpath (state/get-current-repo) file-rpath))]
+                                [:<>
+                                 (x-menu-item
+                                  {:key "open-in-folder"
+                                   :on-click #(ipc/ipc :openFileInFolder page-fpath)}
+                                  (ctx-icon "folder")
+                                  (t :page/open-in-finder))
+
+                                 (x-menu-item
+                                  {:key "open with default app"
+                                   :on-click #(js/window.apis.openPath page-fpath)}
+                                  (ctx-icon "file")
+                                  (t :page/open-with-default-app))])
                               (x-menu-item
-                               {:key "unfavorite"
-                                :on-click #(page-handler/<unfavorite-page! (if db-based? (str (:block/uuid page)) title))}
-                               (ctx-icon "star-off")
-                               (t :page/unfavorite)
-                               (x-menu-shortcut (when-let [binding (shortcut-dh/shortcut-binding :command/toggle-favorite)]
-                                                  (some-> binding
-                                                          (first)
-                                                          (shortcut-utils/decorate-binding))))))
-                            (when-let [page-fpath (and (util/electron?) file-rpath
-                                                       (config/get-repo-fpath (state/get-current-repo) file-rpath))]
-                              [:<>
-                               (x-menu-item
-                                {:key "open-in-folder"
-                                 :on-click #(ipc/ipc :openFileInFolder page-fpath)}
-                                (ctx-icon "folder")
-                                (t :page/open-in-finder))
-
-                               (x-menu-item
-                                {:key "open with default app"
-                                 :on-click #(js/window.apis.openPath page-fpath)}
-                                (ctx-icon "file")
-                                (t :page/open-with-default-app))])
-                            (x-menu-item
-                             {:key "open in sidebar"
-                              :on-click open-in-sidebar}
-                             (ctx-icon "layout-sidebar-right")
-                             (t :content/open-in-sidebar)
-                             (x-menu-shortcut (shortcut-utils/decorate-binding "shift+click")))]))]
+                               {:key "open in sidebar"
+                                :on-click open-in-sidebar}
+                               (ctx-icon "layout-sidebar-right")
+                               (t :content/open-in-sidebar)
+                               (x-menu-shortcut (shortcut-utils/decorate-binding "shift+click")))]))]
 
     ;; TODO: move to standalone component
-    [:a.link-item.group
-     (cond->
-      {:on-click
-       (fn [e]
-         (if (gobj/get e "shiftKey")
-           (open-in-sidebar)
-           (route-handler/redirect-to-page! (:block/uuid page) {:click-from-recent? recent?})))
-       :on-context-menu (fn [^js e]
-                          (shui/popup-show! e (x-menu-content)
-                                            {:as-dropdown? true
-                                             :content-props {:on-click (fn [] (shui/popup-hide!))
-                                                             :class "w-60"}})
-                          (util/stop e))}
-       (ldb/object? page)
-       (assoc :title (block-handler/block-unique-title page)))
-     [:span.page-icon {:key "page-icon"} icon]
-     [:span.page-title {:key "title"
-                        :class (when untitled? "opacity-50")
-                        :style {:display "ruby"}}
-      (cond
-        (not (db/page? page))
-        (block/inline-text :markdown (:block/title page))
-        untitled? (t :untitled)
-        :else (let [title' (pdf-utils/fix-local-asset-pagename title)
-                    parent (:block/parent page)]
-                (if (and parent
-                         (not (or (ldb/class? page)
-                                  (and (:logseq.property/built-in? parent)
-                                       (= (:block/title parent)
-                                          common-config/library-page-name)))))
-                  (str (:block/title parent) ns-util/parent-char title')
-                  title')))]
+      [:a.link-item.group
+       (cond->
+        {:on-click
+         (fn [e]
+           (if (gobj/get e "shiftKey")
+             (open-in-sidebar)
+             (route-handler/redirect-to-page! (:block/uuid page) {:click-from-recent? recent?})))
+         :on-context-menu (fn [^js e]
+                            (shui/popup-show! e (x-menu-content)
+                                              {:as-dropdown? true
+                                               :content-props {:on-click (fn [] (shui/popup-hide!))
+                                                               :class "w-60"}})
+                            (util/stop e))}
+         (ldb/object? page)
+         (assoc :title (block-handler/block-unique-title page)))
+       [:span.page-icon {:key "page-icon"} icon]
+       [:span.page-title {:key "title"
+                          :class (when untitled? "opacity-50")
+                          :style {:display "ruby"}}
+        (cond
+          (not (db/page? page))
+          (block/inline-text :markdown (:block/title page))
+          untitled? (t :untitled)
+          :else (let [title' (pdf-utils/fix-local-asset-pagename title)
+                      parent (:block/parent page)]
+                  (if (and parent
+                           (not (or (ldb/class? page)
+                                    (and (:logseq.property/built-in? parent)
+                                         (= (:block/title parent)
+                                            common-config/library-page-name)))))
+                    (str (:block/title parent) ns-util/parent-char title')
+                    title')))]
 
      ;; dots trigger
-     (shui/button
-      {:key "more actions"
-       :size :sm
-       :variant :ghost
-       :class "absolute !bg-transparent right-0 top-0 px-1.5 scale-75 opacity-40 hidden group-hover:block hover:opacity-80 active:opacity-100"
-       :on-click #(do
-                    (shui/popup-show! (.-target %) (x-menu-content)
-                                      {:as-dropdown? true
-                                       :content-props {:on-click (fn [] (shui/popup-hide!))
-                                                       :class "w-60"}})
-                    (util/stop %))}
-      [:i.relative {:style {:top "4px"}} (shui/tabler-icon "dots")])]))
+       (shui/button
+        {:key "more actions"
+         :size :sm
+         :variant :ghost
+         :class "absolute !bg-transparent right-0 top-0 px-1.5 scale-75 opacity-40 hidden group-hover:block hover:opacity-80 active:opacity-100"
+         :on-click #(do
+                      (shui/popup-show! (.-target %) (x-menu-content)
+                                        {:as-dropdown? true
+                                         :content-props {:on-click (fn [] (shui/popup-hide!))
+                                                         :class "w-60"}})
+                      (util/stop %))}
+        [:i.relative {:style {:top "4px"}} (shui/tabler-icon "dots")])])))
 
 (defn sidebar-item
   [{:keys [on-click-handler class title icon icon-extension? active href shortcut more]}]
@@ -352,10 +355,9 @@
      (when (seq favorite-entities)
        (let [favorite-items (map
                              (fn [e]
-                               (let [icon (icon/get-node-icon-cp e {:size 16})]
-                                 {:id (str (:db/id e))
-                                  :value (:block/uuid e)
-                                  :content [:li.favorite-item.font-medium (page-name e icon false)]}))
+                               {:id (str (:db/id e))
+                                :value (:block/uuid e)
+                                :content [:li.favorite-item.font-medium (page-name e false)]})
                              favorite-entities)]
          (dnd-component/items favorite-items
                               {:on-drag-end (fn [favorites']
@@ -376,7 +378,7 @@
         [:li.recent-item.select-none.font-medium
          {:key (str "recent-" (:db/id page))
           :title (block-handler/block-unique-title page)}
-         (page-name page (icon/get-node-icon-cp page {:size 16}) true)])])))
+         (page-name page true)])])))
 
 (defn get-default-home-if-valid
   []
@@ -467,7 +469,7 @@
        [:div.sidebar-header-container
         ;; sidebar graphs
         (when (not config/publishing?)
-         (sidebar-graphs))
+          (sidebar-graphs))
 
         ;; sidebar sticky navigations
         (sidebar-navigations
@@ -1040,17 +1042,20 @@
         (when (util/electron?)
           (find-in-page/search))
 
-        (main {:route-match route-match
-               :margin-less-pages? margin-less-pages?
-               :logged? logged?
-               :home? home?
-               :route-name route-name
-               :indexeddb-support? indexeddb-support?
-               :light? light?
-               :db-restoring? db-restoring?
-               :main-content main-content'
-               :show-action-bar? show-action-bar?
-               :show-recording-bar? show-recording-bar?})]
+        (if (state/sub :rtc/uploading?)
+          [:div.flex.items-center.justify-center.full-height-without-header
+           (ui/loading "Creating remote graph...")]
+          (main {:route-match route-match
+                 :margin-less-pages? margin-less-pages?
+                 :logged? logged?
+                 :home? home?
+                 :route-name route-name
+                 :indexeddb-support? indexeddb-support?
+                 :light? light?
+                 :db-restoring? db-restoring?
+                 :main-content main-content'
+                 :show-action-bar? show-action-bar?
+                 :show-recording-bar? show-recording-bar?}))]
 
        (when window-controls?
          (window-controls/container))

+ 55 - 37
src/main/frontend/components/file_based/query_table.cljs

@@ -1,5 +1,6 @@
 (ns frontend.components.file-based.query-table
-  (:require [frontend.components.svg :as svg]
+  (:require [clojure.string :as string]
+            [frontend.components.svg :as svg]
             [frontend.date :as date]
             [frontend.db :as db]
             [frontend.db.query-dsl :as query-dsl]
@@ -22,8 +23,11 @@
   ;; FIXME: Look up by property id if still supporting clock-time
   (let [ks [:block/properties :clock-time]
         result (map (fn [b]
-                      (let [b (block/parse-title-and-body b)]
-                        (assoc-in b ks (or (clock/clock-summary (:block.temp/ast-body b) false) 0))))
+                      (let [b (update (block/parse-title-and-body b)
+                                      :block/properties (fn [properties] (if (map? properties) properties {})))]
+                        (try (assoc-in b ks (or (clock/clock-summary (:block.temp/ast-body b) false) 0))
+                             (catch :default _e
+                               b))))
                     result)]
     (if (every? #(zero? (get-in % ks)) result)
       (map #(medley/dissoc-in % ks) result)
@@ -173,11 +177,45 @@
     ;; string values will attempt to be rendered as pages, falling back to
     ;; inline-text when no page entity is found
     (string? value) (if-let [page (and (string? value) (db/get-page value))]
-                      (page-cp {} page)
+                      (page-cp {:stop-event-propagation? true} page)
                       (inline-text row-block row-format value))
     ;; anything else should just be rendered as provided
     :else value))
 
+(rum/defc table-row
+  [row columns config page? select? *mouse-down? map-inline page-cp ->elem inline-text]
+  (let [format (get row :block/format :markdown)
+        property-separated-by-commas? (partial text/separated-by-commas? (state/get-config))]
+    [:tr.cursor
+     (for [column columns]
+       (let [[cell-format value] (build-column-value row
+                                                     column
+                                                     {:page? page?
+                                                      :->elem ->elem
+                                                      :map-inline map-inline
+                                                      :config config
+                                                      :comma-separated-property? (property-separated-by-commas? column)})]
+         [:td.whitespace-nowrap
+          {:data-key (pr-str column)
+           :on-pointer-down (fn []
+                              (reset! *mouse-down? true)
+                              (reset! select? false))
+           :on-mouse-move (fn [] (reset! select? true))
+           :on-pointer-up (fn []
+                            (when (and @*mouse-down? (not @select?))
+                              (state/sidebar-add-block!
+                               (state/get-current-repo)
+                               (:db/id row)
+                               :block)
+                              (reset! *mouse-down? false)))}
+          (when (some? value)
+            (render-column-value {:row-block row
+                                  :row-format format
+                                  :cell-format cell-format
+                                  :value value}
+                                 page-cp
+                                 inline-text))]))]))
+
 (rum/defcs result-table-v1 < rum/reactive
   (rum/local false ::select?)
   (rum/local false ::mouse-down?)
@@ -186,8 +224,7 @@
         *mouse-down? (::mouse-down? state)
         clock-time-total (when-not page?
                            (->> (map #(get-in % [:block/properties :clock-time] 0) sort-result')
-                                (apply +)))
-        property-separated-by-commas? (partial text/separated-by-commas? (state/get-config))]
+                                (apply +)))]
     [:div.overflow-x-auto {:on-pointer-down (fn [e] (.stopPropagation e))
                            :style {:width "100%"}
                            :class "query-table"}
@@ -202,41 +239,22 @@
             (sortable-title title column sort-state (:block/uuid current-block))))]]
       [:tbody
        (for [row sort-result']
-         (let [format (get row :block/format :markdown)]
-           [:tr.cursor
-            (for [column columns]
-              (let [[cell-format value] (build-column-value row
-                                                            column
-                                                            {:page? page?
-                                                             :->elem ->elem
-                                                             :map-inline map-inline
-                                                             :config config
-                                                             :comma-separated-property? (property-separated-by-commas? column)})]
-                [:td.whitespace-nowrap
-                 {:data-key (pr-str column)
-                  :on-pointer-down (fn []
-                                     (reset! *mouse-down? true)
-                                     (reset! select? false))
-                  :on-mouse-move (fn [] (reset! select? true))
-                  :on-pointer-up (fn []
-                                   (when (and @*mouse-down? (not @select?))
-                                     (state/sidebar-add-block!
-                                      (state/get-current-repo)
-                                      (:db/id row)
-                                      :block-ref)
-                                     (reset! *mouse-down? false)))}
-                 (when (some? value)
-                   (render-column-value {:row-block row
-                                         :row-format format
-                                         :cell-format cell-format
-                                         :value value}
-                                        page-cp
-                                        inline-text))]))]))]]]))
+         (table-row row columns config page? select? *mouse-down? map-inline page-cp ->elem inline-text))]]]))
 
 (rum/defc result-table < rum/reactive
   [config current-block result {:keys [page?] :as options} map-inline page-cp ->elem inline-text]
   (when current-block
-    (let [result' (if page? result (attach-clock-property result))
+    (let [result (map (fn [item]
+                        (if (and (map? item) (:db/id item))
+                          (if-let [entity-title (:block/title (db/entity (:db/id item)))]
+                            (assoc item :block/title entity-title)
+                            (update item :block/title (fn [title]
+                                                        (some-> title
+                                                                (string/replace "$pfts_2lqh>$" "")
+                                                                (string/replace "$<pfts_2lqh$" "")))))
+                          item))
+                      result)
+          result' (if page? result (attach-clock-property result))
           columns (get-columns current-block result' {:page? page?})
           ;; Sort state needs to be in sync between final result and sortable title
           ;; as user needs to know if there result is sorted

+ 5 - 5
src/main/frontend/components/header.cljs

@@ -333,15 +333,15 @@
 
 (rum/defc block-breadcrumb
   [page-name]
-  [:div.ls-block-breadcrumb
-   (when-let [page (when (and page-name (common-util/uuid-string? page-name))
-                     (db/entity [:block/uuid (uuid page-name)]))]
-     (when (:block/parent page)
+  (when-let [page (when (and page-name (common-util/uuid-string? page-name))
+                    (db/entity [:block/uuid (uuid page-name)]))]
+    (when (and (ldb/page? page) (:block/parent page))
+      [:div.ls-block-breadcrumb
        [:div.text-sm
         (component-block/breadcrumb {}
                                     (state/get-current-repo)
                                     (:block/uuid page)
-                                    {:header? true})]))])
+                                    {:header? true})]])))
 
 (rum/defc semantic-search-progressing
   [repo]

+ 16 - 8
src/main/frontend/components/icon.cljs

@@ -35,7 +35,10 @@
                                   opts)]]
 
                (and (= :tabler-icon (:type icon')) (:id icon'))
-               (ui/icon (:id icon') opts))]
+               (ui/icon (:id icon') opts)
+
+               :else
+               icon')]
     (if color?
       [:span.inline-flex.items-center.ls-icon-color-wrap
        {:style {:color (or (some-> icon' :color) "inherit")}} item]
@@ -65,13 +68,18 @@
 (defn get-node-icon-cp
   [node-entity opts]
   (let [opts' (merge {:size 14} opts)
-        node-icon (cond
-                    (:own-icon? opts)
-                    (get node-entity (pu/get-pid :logseq.property/icon))
-                    (:link? opts)
-                    "arrow-narrow-right"
-                    :else
-                    (get-node-icon node-entity))]
+        node-icon* (cond
+                     (:own-icon? opts)
+                     (get node-entity (pu/get-pid :logseq.property/icon))
+                     (:link? opts)
+                     "arrow-narrow-right"
+                     :else
+                     (get-node-icon node-entity))
+        node-icon (if (config/db-based-graph?)
+                    node-icon*
+                    (or (when-let [icon' (get-in node-entity [:block/properties :icon])]
+                          [:span icon'])
+                        node-icon*))]
     (when-not (or (string/blank? node-icon) (and (contains? #{"letter-n" "file"} node-icon) (:not-text-or-page? opts)))
       [:div.icon-cp-container.flex.items-center
        (merge {:style {:color (or (:color node-icon) "inherit")}}

+ 5 - 1
src/main/frontend/components/page.cljs

@@ -8,6 +8,7 @@
             [frontend.components.db-based.page :as db-page]
             [frontend.components.editor :as editor]
             [frontend.components.file-based.hierarchy :as hierarchy]
+            [frontend.components.icon :as icon-component]
             [frontend.components.library :as library]
             [frontend.components.objects :as objects]
             [frontend.components.plugins :as plugins]
@@ -342,6 +343,9 @@
                                         (not (ldb/built-in? page)))
                                (reset! *input-value (if untitled? "" old-name))
                                (reset! *edit? true)))))}
+            (when-not (config/db-based-graph?)
+              (when (get-in page [:block/properties :icon])
+                (icon-component/get-node-icon-cp page {})))
 
             (if @*edit?
               (page-title-editor page {:*title-value *title-value
@@ -642,7 +646,7 @@
                                         :preview? preview?})))
                (lsp-pagebar-slot)])
 
-            (when (and block? (util/capacitor-new?))
+            (when (and block? (not sidebar?))
               (component-block/breadcrumb {} repo (:block/uuid page) {}))
 
             (when (and db-based? (ldb/library? page))

+ 2 - 1
src/main/frontend/components/property.css

@@ -431,7 +431,8 @@ a.control-link {
 }
 
 .ls-property-choices-sub-pane {
-  @apply w-[220px] p-0;
+  @apply w-[220px] px-0 pb-8 overflow-y-scroll;
+  max-height: 100vh;
 
   > ul.choices-list {
     @apply m-0 px-1.5 pt-1 pb-[1px];

+ 11 - 9
src/main/frontend/components/property/value.cljs

@@ -1236,12 +1236,16 @@
         set-property-value! (fn [value & {:keys [exit-editing?]
                                           :or {exit-editing? true}}]
                               (p/do!
-                               (when (and (not (string/blank? value))
-                                          (not= (string/trim (str number-value))
-                                                (string/trim (str value))))
-                                 (db-property-handler/set-block-property! (:db/id block)
-                                                                          (:db/ident property)
-                                                                          value))
+                               (if (string/blank? value)
+                                 (db-property-handler/remove-block-property! (:db/id block) (:db/ident property))
+                                 (when (not= (string/trim (str number-value))
+                                             (string/trim (str value)))
+                                   (db-property-handler/set-block-property! (:db/id block)
+                                                                            (:db/ident property)
+                                                                            value)))
+
+                               (set-value! (str (db-property/property-value-content
+                                                 (get (db/entity (:db/id block)) (:db/ident property)))))
 
                                (when exit-editing?
                                  (set-editing! false))))]
@@ -1266,9 +1270,7 @@
                       (reset! *value (util/evalue e)))
          :on-blur (fn [_e]
                     (p/do!
-                     (set-property-value! value)
-                     (when (not= value (db-property/property-value-content (db/entity (:db/id value-block))))
-                       (set-value! (db-property/property-value-content value-block)))))
+                     (set-property-value! value)))
          :on-key-down (fn [e]
                         (let [input (rum/deref *input-ref)
                               pos (cursor/pos input)

+ 2 - 1
src/main/frontend/components/repo.cljs

@@ -127,6 +127,7 @@
                                            (state/pub-event! [:graph/unlinked repo (state/get-current-repo)]))))))}
               "Delete local graph"))
            (when (and db-based? root
+                      (user-handler/logged-in?)
                       (not remote?)
                       (= url (state/get-current-repo)))
              (shui/dropdown-menu-item
@@ -151,7 +152,7 @@
                                   (p/do!
                                    (rtc-flows/trigger-rtc-start repo)
                                    (rtc-handler/<get-remote-graphs)))))))}
-              "Use Logseq sync (Beta testing)"))
+              "Use Logseq sync (Alpha testing)"))
            (when (and remote? (or (and db-based? manager?) (not db-based?)))
              (shui/dropdown-menu-item
               {:key "delete-remotely"

+ 0 - 5
src/main/frontend/extensions/code.cljs

@@ -585,11 +585,6 @@
                      (reset! (:last-theme state) next-theme)
                      (.setOption editor' "theme" next-theme)))
                  (reset! (:code-options state) (last (:rum/args state)))
-                 (when-not (:file? (first (:rum/args state)))
-                   (let [code (nth (:rum/args state) 3)
-                         editor' @(:editor-atom state)]
-                     (when (and editor' (not= (.getValue editor') code))
-                       (.setValue editor' code))))
                  state)}
   [state _config id attr code _theme _options]
   [:div.extensions__code.flex.flex-1

+ 4 - 1
src/main/frontend/handler/editor.cljs

@@ -330,10 +330,14 @@
                                       (:custom-query? config))
                                   (not (:ref-query-child? config)))
         has-children? (db/has-children? (:block/uuid current-block))
+        library? (:library? config)
         sibling? (cond
                    ref-query-top-block?
                    false
 
+                   (and library? (ldb/page? current-block))
+                   true
+
                    (boolean? sibling?)
                    sibling?
 
@@ -342,7 +346,6 @@
 
                    :else
                    (not has-children?))
-        library? (:library? config)
         new-block' (if library?
                      (-> new-block
                          (-> (assoc :block/tags #{:logseq.class/Page}

+ 1 - 1
src/main/frontend/worker/rtc/client_op.cljs

@@ -356,7 +356,7 @@
   [repo]
   (and (sqlite-util/db-based-graph? repo)
        (or (exists? js/process)
-           (some? (get-local-tx repo)))))
+           (some? (get-graph-uuid repo)))))
 
 (defn create-pending-block-ops-count-flow
   [repo]

+ 2 - 2
src/main/frontend/worker/rtc/remote_update.cljs

@@ -476,8 +476,8 @@ so need to pull earlier remote-data from websocket."})
 
 (defn- remote-op-value->schema-tx-data
   [block-uuid op-value]
-  (when-let [schema-map (some-> op-value :client/schema ldb/read-transit-str)]
-    (when-let [db-ident (:db/ident op-value)]
+  (when-let [db-ident (:db/ident op-value)]
+    (let [schema-map (some-> op-value :client/schema ldb/read-transit-str)]
       [(merge {:block/uuid block-uuid :db/ident db-ident} schema-map)])))
 
 (defn- update-block-order