|
@@ -229,13 +229,14 @@ independent of format as format specific heading characters are stripped"
|
|
|
|
|
|
(defn get-block-deep-last-open-child-id
|
|
|
[db db-id]
|
|
|
- (loop [node (db-utils/entity db db-id)]
|
|
|
- (if-let [last-child-id (get-block-last-direct-child-id db (:db/id node) true)]
|
|
|
- (let [e (db-utils/entity db last-child-id)]
|
|
|
- (if (or (:block/collapsed? e) (empty? (:block/_parent e)))
|
|
|
- last-child-id
|
|
|
- (recur e)))
|
|
|
- nil)))
|
|
|
+ (when db
|
|
|
+ (loop [node (db-utils/entity db db-id)]
|
|
|
+ (if-let [last-child-id (get-block-last-direct-child-id db (:db/id node) true)]
|
|
|
+ (let [e (db-utils/entity db last-child-id)]
|
|
|
+ (if (or (:block/collapsed? e) (empty? (:block/_parent e)))
|
|
|
+ last-child-id
|
|
|
+ (recur e)))
|
|
|
+ nil))))
|
|
|
|
|
|
(def page? ldb/page?)
|
|
|
|