Forráskód Böngészése

fix: don't show new option if it's a child of the current page

When setting parent page.
Tienson Qin 1 éve
szülő
commit
e64bb2e8c4
1 módosított fájl, 3 hozzáadás és 2 törlés
  1. 3 2
      src/main/frontend/components/property/value.cljs

+ 3 - 2
src/main/frontend/components/property/value.cljs

@@ -367,10 +367,11 @@
                              (if (every? de/entity? v)
                                (map :db/id v)
                                [(:db/id v)])))
+        parent-property? (= (:db/ident property) :logseq.property/parent)
         nodes
         (->>
          (cond
-           (= (:db/ident property) :logseq.property/parent)
+           parent-property?
            (let [children-pages (model/get-structured-children repo (:db/id block))
                  ;; Disallows cyclic hierarchies
                  exclude-ids (-> (set (map (fn [id] (:block/uuid (db/entity id))) children-pages))
@@ -433,7 +434,7 @@
                                               "Choose nodes"
                                               :else
                                               "Choose node")
-                 :show-new-when-not-exact-match? true
+                 :show-new-when-not-exact-match? (if parent-property? false true)
                  :extract-chosen-fn :value
                  :extract-fn (fn [x] (or (:label-value x) (:label x)))
                  :input-opts input-opts