|
34 | 34 | [frontend.extensions.latex :as latex] |
35 | 35 | [frontend.extensions.lightbox :as lightbox] |
36 | 36 | [frontend.extensions.pdf.assets :as pdf-assets] |
37 | | - [frontend.extensions.pdf.utils :as pdf-utils] |
38 | 37 | [frontend.extensions.sci :as sci] |
39 | 38 | [frontend.extensions.video.youtube :as youtube] |
40 | 39 | [frontend.extensions.zotero :as zotero] |
|
84 | 83 | [logseq.common.util.page-ref :as page-ref] |
85 | 84 | [logseq.db :as ldb] |
86 | 85 | [logseq.db.common.entity-plus :as entity-plus] |
87 | | - [logseq.db.frontend.content :as db-content] |
88 | 86 | [logseq.graph-parser.block :as gp-block] |
89 | 87 | [logseq.graph-parser.mldoc :as gp-mldoc] |
90 | 88 | [logseq.graph-parser.text :as text] |
|
715 | 713 |
|
716 | 714 | All page-names are sanitized except page-name-in-block" |
717 | 715 | [state |
718 | | - {:keys [contents-page? whiteboard-page? other-position? show-unique-title? |
719 | | - on-context-menu with-parent? stop-event-propagation?] |
720 | | - :or {with-parent? true} |
| 716 | + {:keys [contents-page? whiteboard-page? other-position? |
| 717 | + on-context-menu stop-event-propagation? with-tags?] |
| 718 | + :or {with-tags? true} |
721 | 719 | :as config} |
722 | 720 | page-entity children label] |
723 | 721 | (let [*mouse-down? (::mouse-down? state) |
|
780 | 778 | [:span {:class (str "icon-emoji-wrap " (when emoji? "as-emoji"))} |
781 | 779 | icon]))) |
782 | 780 |
|
783 | | - (when (and (ldb/page? page-entity) with-parent?) |
784 | | - (when-let [parent (:block/parent page-entity)] |
785 | | - (when-not (ldb/library? parent) |
786 | | - [:span.select-none (str (:block/title parent) "/")]))) |
787 | | - |
788 | 781 | [:span |
789 | 782 | (if (and (coll? children) (seq children)) |
790 | 783 | (for [child children] |
|
793 | 786 | (let [{:keys [content children]} (last child) |
794 | 787 | page-name (subs content 2 (- (count content) 2))] |
795 | 788 | (rum/with-key (page-reference (assoc config :children children) page-name nil) page-name)))) |
796 | | - (let [page-component (cond |
797 | | - (and label |
798 | | - (string? label) |
799 | | - (not (string/blank? label))) ; alias |
800 | | - label |
801 | | - |
802 | | - (coll? label) |
803 | | - (->elem :span (map-inline config label)) |
804 | | - |
805 | | - show-unique-title? |
806 | | - (block-handler/block-unique-title page-entity) |
807 | | - |
808 | | - :else |
809 | | - (let [title (:block/title page-entity) |
810 | | - s (cond untitled? |
811 | | - (t :untitled) |
812 | | - |
813 | | - ;; The page-name-in-block generated by the auto-complete is not page-name-sanitized |
814 | | - (pdf-utils/hls-file? page-name) |
815 | | - (pdf-utils/fix-local-asset-pagename page-name) |
816 | | - |
817 | | - (not= (util/safe-page-name-sanity-lc title) page-name) |
818 | | - page-name ;; page-name-in-block might be overridden (legacy)) |
819 | | - |
820 | | - title |
821 | | - (util/trim-safe title) |
822 | | - |
823 | | - :else |
824 | | - (util/trim-safe page-name)) |
825 | | - _ (when-not page-entity (js/console.warn "page-inner's page-entity is nil, given page-name: " page-name)) |
826 | | - s (cond |
827 | | - (not (string? s)) |
828 | | - (do |
829 | | - (prn :debug :unknown-title-error :title s |
830 | | - :data (db/pull (:db/id page-entity))) |
831 | | - "Unknown title") |
832 | | - (re-find db-content/id-ref-pattern s) |
833 | | - (db-content/content-id-ref->page s (:block/refs page-entity)) |
834 | | - :else |
835 | | - s) |
836 | | - s (if (and tag? (not (:hide-tag-symbol? config))) (str "#" s) s)] |
837 | | - (if (ldb/page? page-entity) |
838 | | - s |
839 | | - (block-title (assoc config :page-ref? true) page-entity {}))))] |
840 | | - page-component))]])) |
| 789 | + (cond |
| 790 | + (and label |
| 791 | + (string? label) |
| 792 | + (not (string/blank? label))) ; alias |
| 793 | + label |
| 794 | + |
| 795 | + (coll? label) |
| 796 | + (->elem :span (map-inline config label)) |
| 797 | + |
| 798 | + (ldb/page? page-entity) |
| 799 | + (if untitled? |
| 800 | + (t :untitled) |
| 801 | + (let [s (util/trim-safe (block-handler/block-unique-title page-entity {:with-tags? with-tags?}))] |
| 802 | + (if (and tag? (not (:hide-tag-symbol? config))) |
| 803 | + (str "#" s) |
| 804 | + s))) |
| 805 | + |
| 806 | + :else |
| 807 | + (block-title (assoc config :page-ref? true) page-entity {})))]])) |
841 | 808 |
|
842 | 809 | (rum/defc popup-preview-impl |
843 | 810 | [children {:keys [*timer *timer1 visible? set-visible! render *el-popup]}] |
|
3302 | 3269 | (let [parents-props (doall |
3303 | 3270 | (for [{:block/keys [uuid name title] :as block} parents] |
3304 | 3271 | (if name |
3305 | | - [block (page-cp {:disable-preview? true |
3306 | | - :with-parent? false} block) true] |
| 3272 | + [block (page-cp {:disable-preview? true} block) true] |
3307 | 3273 | (let [result (block/parse-title-and-body |
3308 | 3274 | uuid |
3309 | 3275 | (get block :block/format :markdown) |
|
0 commit comments