fix: don't render embed page when the current container is the same page

This commit is contained in:
Tienson Qin
2020-11-25 17:47:23 +08:00
parent 4303ea4ed9
commit 320ac8ad55
4 changed files with 25 additions and 26 deletions

View File

@@ -18,7 +18,6 @@
(let [block? (util/uuid-string? page-name)
block-id (and block? (uuid page-name))
page-name (string/lower-case page-name)
encoded-page-name (util/url-encode page-name)
journal? (date/valid-journal-title? (string/capitalize page-name))
ref-blocks (cond
priority?
@@ -44,13 +43,13 @@
"SCHEDULED AND DEADLINE")]
[:div.references-blocks.mb-6
(let [ref-hiccup (block/->hiccup scheduled-or-deadlines
{:id (str encoded-page-name "-agenda")
{:id (str page-name "-agenda")
:start-level 2
:ref? true
:group-by-page? true
:editor-box editor/box}
{})]
(content/content encoded-page-name
(content/content page-name
{:hiccup ref-hiccup}))]))
(ui/foldable
@@ -58,30 +57,29 @@
(str n-ref " Linked References"))]
[:div.references-blocks
(let [ref-hiccup (block/->hiccup ref-blocks
{:id encoded-page-name
{:id page-name
:start-level 2
:ref? true
:breadcrumb-show? true
:group-by-page? true
:editor-box editor/box}
{})]
(content/content encoded-page-name
(content/content page-name
{:hiccup ref-hiccup}))])]]))))
(rum/defc unlinked-references-aux < rum/reactive db-mixins/query
[page-name n-ref]
(let [ref-blocks (db/get-page-unlinked-references page-name)
encoded-page-name (util/url-encode page-name)]
(let [ref-blocks (db/get-page-unlinked-references page-name)]
(reset! n-ref (count ref-blocks))
[:div.references-blocks
(let [ref-hiccup (block/->hiccup ref-blocks
{:id (str encoded-page-name "-unlinked-")
{:id (str page-name "-unlinked-")
:start-level 2
:ref? true
:group-by-page? true
:editor-box editor/box}
{})]
(content/content encoded-page-name
(content/content page-name
{:hiccup ref-hiccup}))]))
(rum/defcs unlinked-references < rum/reactive