fix: remove file graph :block/file and dependent code

Also remove all file graph references in publishing and
add back publishing.db tests with db graph.
Also remove file graph behavior for cmd-k and files
This commit is contained in:
Gabriel Horner
2026-01-09 12:14:24 -05:00
parent c89d415e93
commit 6312f8236a
44 changed files with 132 additions and 336 deletions

View File

@@ -57,6 +57,13 @@
(medley/find-first #(= name (:name (second %1)))
(medley/indexed alias-dirs))))
(defn get-area-block-asset-url
"Returns asset url for an area block used by pdf assets. This lives in this ns
because it is used by this dep and needs to be independent from the frontend app"
[block]
(when-let [image (:logseq.property.pdf/hl-image block)]
(str "./assets/" (:block/uuid image) ".png")))
(defn resolve-asset-real-path-url
[repo rpath]
(when-let [rpath (and (string? rpath)

View File

@@ -6,10 +6,8 @@
[clojure.string :as string]
[datascript.core :as d]
[dommy.core :as dom]
[frontend.config :as config]
[frontend.db :as db]
[frontend.db.conn :as conn]
[frontend.fs :as fs]
[frontend.handler.config :as config-handler]
[frontend.handler.db-based.editor :as db-editor-handler]
[frontend.handler.notification :as notification]
@@ -156,24 +154,18 @@
;; =========
(defn after-page-deleted!
[repo page-name file-path tx-meta]
(let [repo-dir (config/get-repo-dir repo)]
[page-name tx-meta]
;; TODO: move favorite && unfavorite to worker too
(when-let [page-block-uuid (:block/uuid (db/get-page page-name))]
(<db-unfavorite-page! page-block-uuid))
(when-let [page-block-uuid (:block/uuid (db/get-page page-name))]
(<db-unfavorite-page! page-block-uuid))
(when (and (not= :rename-page (:real-outliner-op tx-meta))
(= (some-> (state/get-current-page) common-util/page-name-sanity-lc)
(common-util/page-name-sanity-lc page-name)))
(route-handler/redirect-to-home!))
(when (and (not= :rename-page (:real-outliner-op tx-meta))
(= (some-> (state/get-current-page) common-util/page-name-sanity-lc)
(common-util/page-name-sanity-lc page-name)))
(route-handler/redirect-to-home!))
;; TODO: why need this?
(ui-handler/re-render-root!)
(when file-path
(-> (p/let [exists? (fs/file-exists? repo-dir file-path)]
(when exists? (fs/unlink! repo (config/get-repo-fpath repo file-path) nil)))
(p/catch (fn [error] (js/console.error error)))))))
(ui-handler/re-render-root!))
(defn after-page-renamed!
[repo {:keys [page-id old-name new-name]}]

View File

@@ -1232,7 +1232,7 @@
(when (and (:db/id entity) (not (ldb/built-in? entity)))
(let [value (string/trim value)]
;; FIXME: somehow frontend.components.editor's will-unmount event will loop forever
;; maybe we shouldn't save the block/file in "will-unmount" event?
;; maybe we shouldn't save in "will-unmount" event?
(save-block-if-changed! block value opts)))))
(defn save-block!

View File

@@ -108,9 +108,9 @@
(page-handler/create-today-journal!)
(page-handler/<create! page-name opts)))
(defmethod handle :page/deleted [[_ repo page-name file-path tx-meta]]
(defmethod handle :page/deleted [[_ page-name tx-meta]]
(when-not (util/mobile?)
(page-common-handler/after-page-deleted! repo page-name file-path tx-meta)))
(page-common-handler/after-page-deleted! page-name tx-meta)))
(defmethod handle :page/renamed [[_ repo data]]
(when-not (util/mobile?)

View File

@@ -28,8 +28,7 @@
:app-state (select-keys @state/state
[:ui/theme
:ui/sidebar-collapsed-blocks])
:repo-config (get-in @state/state [:config repo])
:db-graph? true})
:repo-config (get-in @state/state [:config repo])})
html-str (str "data:text/html;charset=UTF-8,"
(js/encodeURIComponent html))]
(if (util/electron?)