|
@@ -54,6 +54,31 @@
|
|
|
(page-handler/add-page-to-recent! repo page-original-name)
|
|
|
(db/get-page-blocks repo page-name)))))
|
|
|
|
|
|
+(rum/defc page-blocks-inner <
|
|
|
+ {:did-mount (fn [state]
|
|
|
+ (let [block (first (nth (:rum/args state) 1))]
|
|
|
+ (when (:block/dummy? block)
|
|
|
+ (editor-handler/edit-block! block 0 (:block/format block) (:block/uuid block))))
|
|
|
+ state)}
|
|
|
+ [page-name page-blocks hiccup sidebar?]
|
|
|
+ [:div.page-blocks-inner
|
|
|
+ ;; (when (and (seq grouped-blocks-by-file)
|
|
|
+ ;; (> (count grouped-blocks-by-file) 1))
|
|
|
+ ;; (ui/admonition
|
|
|
+ ;; :warning
|
|
|
+ ;; [:div.text-sm
|
|
|
+ ;; [:p.font-medium "Those pages have the same title, you might want to only keep one file."]
|
|
|
+ ;; [:ol
|
|
|
+ ;; (for [[file-path blocks] (into (sorted-map) grouped-blocks-by-file)]
|
|
|
+ ;; [:li [:a {:key file-path
|
|
|
+ ;; :href (rfe/href :file {:path file-path})} file-path]])]]))
|
|
|
+
|
|
|
+ (rum/with-key
|
|
|
+ (content/content page-name
|
|
|
+ {:hiccup hiccup
|
|
|
+ :sidebar? sidebar?})
|
|
|
+ (str page-name "-hiccup"))])
|
|
|
+
|
|
|
(rum/defc page-blocks-cp < rum/reactive
|
|
|
db-mixins/query
|
|
|
[repo page file-path page-name page-original-name encoded-page-name sidebar? journal? block? block-id format]
|
|
@@ -78,23 +103,7 @@
|
|
|
:editor-box editor/box}
|
|
|
hiccup-config (common-handler/config-with-document-mode hiccup-config)
|
|
|
hiccup (block/->hiccup page-blocks hiccup-config {})]
|
|
|
- [:div.page-blocks-inner
|
|
|
- ;; (when (and (seq grouped-blocks-by-file)
|
|
|
- ;; (> (count grouped-blocks-by-file) 1))
|
|
|
- ;; (ui/admonition
|
|
|
- ;; :warning
|
|
|
- ;; [:div.text-sm
|
|
|
- ;; [:p.font-medium "Those pages have the same title, you might want to only keep one file."]
|
|
|
- ;; [:ol
|
|
|
- ;; (for [[file-path blocks] (into (sorted-map) grouped-blocks-by-file)]
|
|
|
- ;; [:li [:a {:key file-path
|
|
|
- ;; :href (rfe/href :file {:path file-path})} file-path]])]]))
|
|
|
-
|
|
|
- (rum/with-key
|
|
|
- (content/content page-name
|
|
|
- {:hiccup hiccup
|
|
|
- :sidebar? sidebar?})
|
|
|
- (str encoded-page-name "-hiccup"))]))
|
|
|
+ (page-blocks-inner page-name page-blocks hiccup sidebar?)))
|
|
|
|
|
|
(defn contents-page
|
|
|
[{:block/keys [name original-name file] :as contents}]
|