Jelajahi Sumber

Revert "PoC that a markdown+edn file can persist"

This reverts commit c26e4ca4d78113d003a392e2adfbe0f732f70035.
Gabriel Horner 3 tahun lalu
induk
melakukan
d050566b9b

+ 2 - 19
deps/graph-parser/src/logseq/graph_parser.cljs

@@ -8,7 +8,6 @@
             [logseq.graph-parser.config :as gp-config]
             [logseq.db.schema :as db-schema]
             [clojure.string :as string]
-            [clojure.edn :as edn]
             [clojure.set :as set]))
 
 (defn- retract-blocks-tx
@@ -69,9 +68,6 @@
         retain-uuids (set (keep :block/uuid retain-uuid-blocks))]
     (retract-blocks-tx (distinct blocks) retain-uuids)))
 
-;; TODO: Pass this as arg to parse-file
-(def edn-files (atom {}))
-
 (defn parse-file
   "Parse file and save parsed data to the given db. Main parse fn used by logseq app.
 Options available:
@@ -100,25 +96,12 @@ Options available:
                :or   {pages []
                       blocks []
                       ast []}}
-              (cond
-                (contains? gp-config/mldoc-support-formats format)
-                (let [res (extract/extract file content extract-options')
-                      edn-file (string/replace-first file #"\.(.*)$" ".edn")]
-                  (if-let [edn-file-content (some-> (@edn-files edn-file) edn/read-string)]
-                    (update res :pages (fn [pages]
-                                         (into [(merge (first pages)
-                                                       (:page edn-file-content))]
-                                               (rest pages))))
-                    res))
+              (cond (contains? gp-config/mldoc-support-formats format)
+                (extract/extract file content extract-options')
 
                 (gp-config/whiteboard? file)
                 (extract/extract-whiteboard-edn file content extract-options')
 
-                ;; Save edn files for later
-                (string/ends-with? file ".edn")
-                (do (swap! edn-files assoc file content)
-                  {})
-
                 :else nil)
               block-ids (map (fn [block] {:block/uuid (:block/uuid block)}) blocks)
               delete-blocks (delete-blocks-fn @conn (first pages) file block-ids)

+ 2 - 15
src/main/frontend/handler/property.cljs

@@ -3,7 +3,6 @@
   (:require [frontend.state :as state]
             [frontend.db :as db]
             [clojure.string :as string]
-            [frontend.handler.file :as file-handler]
             [logseq.graph-parser.util :as gp-util]
             [logseq.graph-parser.util.page-ref :as page-ref]))
 
@@ -14,22 +13,10 @@
 ;; TODO spec
 (defn set-property-schema!
   [entity key value]
-  ;; schema is a partial schema that is only good enough for diffs/txs
   (let [schema (assoc (:block/property-schema entity) key value)]
     (db/transact! (state/get-current-repo)
-                  [{:db/id (:db/id entity)
-                    :block/property-schema schema}])
-    ;; Persist schema here since this is the only to update edn file
-    (let [db-ent (db/entity (:db/id entity))
-          file (get-in db-ent [:block/file :file/path])
-          full-schema (assoc (:block/property-schema db-ent) key value)
-          ;; TODO: Update this so that property entities that don't have pages work
-          edn-file (string/replace-first file #"\.(.*)$" ".edn")
-          repo (state/get-current-repo)
-          file-content (pr-str {:page
-                                {:block/property-schema full-schema}})
-          files [[edn-file file-content]]]
-      (file-handler/alter-files-handler! repo files {} {}))))
+      [{:db/id (:db/id entity)
+        :block/property-schema schema}])))
 
 (defn validate
   "Check whether the `value` validate against the `schema`."