Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with card preview links disappearing #7014

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/cljs/nr/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@
(map (fn [c] [(tr-data :title c) (span-of (:title c) (tr-data :title c))]))
(sort-by (comp count str first) >))))))

(def card-patterns (memoize card-patterns-impl))
(def card-patterns-memo (memoize card-patterns-impl))
(defn card-patterns [] (card-patterns-memo (:cards-loaded @app-state)))

(defn contains-card-pattern-impl
"A card pattern regex, used to match a card name in text to check if the rest
Expand All @@ -221,7 +222,8 @@
(map (fn [k] (join "|" (map regex-escape (distinct [(:title k) (tr-data :title k)])))))
(join "|"))))

(def contains-card-pattern (memoize contains-card-pattern-impl))
(def contains-card-pattern-memo (memoize contains-card-pattern-impl))
(defn contains-card-pattern [] (contains-card-pattern-memo (:cards-loaded @app-state)))

(def special-patterns
(letfn [(regex-of [icon-code] (re-pattern (str "(?i)" (regex-escape icon-code))))]
Expand Down
Loading