Fix: broken linked references (#6105)

* enhance: clicking the refresh button if a query is slow

* fix: skip running slow queries if there's no need to refresh

* fix: linked reference filtering does not work on TASK items

close #1669

* fix: each block should have its own page as a reference when query page references

* fix: references

* fix: non consecutive blocks in query result and filtered linked references

* simplify filters logic

* fix: ref numbers

* Save both :block/refs and :block/path-refs for different usage

* fix: block refs

* enhance: move scheduled and deadlines to its own ns

* linked references performance tweaks

* mouse hover filters icon to expand the collapsed linked refs

* perf: react/refresh! once instead twice

* enhance: compute flashcards every hour instead of every 5s

* feat: macros as blocks

* feat: flashcards list

* fix: refed pages count

* fix: can't select in linked references

* fix: block editing on linked refs

* perf: editing in linked references

* enhance: update srs cards number when clicking flashcards

* Add a test for the case fixed in #6100

* Address feedbacks from Gabriel

* fix: Block Ref Indicator is missing from the references-blocks class

close #5375

* fix: referenced pages

* fix: page refs

* fix: Using filters pushed the title property to the second block

close #5845

Co-authored-by: Gabriel Horner <gabriel@logseq.com>
This commit is contained in:
Tienson Qin
2022-08-04 13:03:12 +08:00
committed by GitHub
parent 0694154829
commit a1ca6820df
47 changed files with 1184 additions and 933 deletions

View File

@@ -17,13 +17,18 @@
[reitit.frontend.easy :as rfe]))
(rum/defc render-item
[{:keys [id value]} chosen?]
[:div.inline-grid.grid-cols-4.gap-x-4.w-full
{:class (when chosen? "chosen")}
[:span.col-span-3 value]
[:div.col-span-1.justify-end.tip.flex
(when id
[:code.opacity-20.bg-transparent id])]])
[result chosen?]
(if (map? result)
(let [{:keys [id value]} result]
[:div.inline-grid.grid-cols-4.gap-x-4.w-full
{:class (when chosen? "chosen")}
[:span.col-span-3 value]
[:div.col-span-1.justify-end.tip.flex
(when id
[:code.opacity-20.bg-transparent id])]])
[:div.inline-grid.grid-cols-4.gap-x-4.w-full
{:class (when chosen? "chosen")}
[:span.col-span-3 result]]))
(rum/defcs select <
(shortcut/disable-all-shortcuts)
@@ -31,27 +36,31 @@
{:will-unmount (fn [state]
(state/set-state! [:ui/open-select] nil)
state)}
[state {:keys [items limit on-chosen empty-placeholder prompt-key]
[state {:keys [items limit on-chosen empty-placeholder
prompt-key input-default-placeholder close-modal?
extract-fn]
:or {limit 100
prompt-key :select/default-prompt
empty-placeholder (fn [_t] [:div])}}]
empty-placeholder (fn [_t] [:div])
close-modal? true
extract-fn :value}}]
(let [input (::input state)]
[:div.cp__select.cp__select-main
[:div.input-wrap
[:input.cp__select-input.w-full
{:type "text"
:placeholder (t prompt-key)
:placeholder (or input-default-placeholder (t prompt-key))
:auto-focus true
:value @input
:on-change (fn [e] (reset! input (util/evalue e)))}]]
[:div.item-results-wrap
(ui/auto-complete
(search/fuzzy-search items @input :limit limit :extract-fn :value)
(search/fuzzy-search items @input :limit limit :extract-fn extract-fn)
{:item-render render-item
:class "cp__select-results"
:on-chosen (fn [x]
(state/close-modal!)
(when close-modal? (state/close-modal!))
(on-chosen x))
:empty-placeholder (empty-placeholder t)})]]))