Переглянути джерело

fix(editor): make sure aliases are a collection

Tienson Qin 5 роки тому
батько
коміт
92f9c21170
1 змінених файлів з 6 додано та 4 видалено
  1. 6 4
      src/main/frontend/handler/editor.cljs

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

@@ -437,10 +437,12 @@
          page-tags (when-let [tags (:tags new-properties)]
          page-tags (when-let [tags (:tags new-properties)]
                      (util/->tags tags))
                      (util/->tags tags))
          page-alias (when-let [alias (:alias new-properties)]
          page-alias (when-let [alias (:alias new-properties)]
-                      (map
-                       (fn [alias]
-                         {:page/name (string/lower-case alias)})
-                       (remove #{(:page/name page)} alias)))
+                      (let [alias (text/split-page-refs-without-brackets alias)
+                            alias (if (string? alias) [alias] alias)]
+                        (map
+                         (fn [alias]
+                           {:page/name (string/lower-case alias)})
+                          (remove #{(:page/name page)} alias))))
          permalink-changed? (when (and pre-block? (:permalink old-properties))
          permalink-changed? (when (and pre-block? (:permalink old-properties))
                               (not= (:permalink old-properties)
                               (not= (:permalink old-properties)
                                     (:permalink new-properties)))
                                     (:permalink new-properties)))