|
2354 | 2354 | (keyword (str "h" heading ".block-title-wrap.as-heading" |
2355 | 2355 | (when block-ref? ".as-inline"))) |
2356 | 2356 | :span.block-title-wrap)] |
2357 | | - (->elem |
2358 | | - elem |
2359 | | - (merge |
2360 | | - {:data-hl-type (pu/lookup block :logseq.property.pdf/hl-type)} |
2361 | | - (when (and marker |
2362 | | - (not (string/blank? marker)) |
2363 | | - (not= "nil" marker)) |
2364 | | - {:data-marker (str (string/lower-case marker))}) |
2365 | | - (when bg-color |
2366 | | - (let [built-in-color? (ui/built-in-color? bg-color)] |
2367 | | - {:style {:background-color (if built-in-color? |
2368 | | - (str "var(--ls-highlight-color-" bg-color ")") |
2369 | | - bg-color) |
2370 | | - :color (when-not built-in-color? "white")} |
2371 | | - :class "px-1 with-bg-color"}))) |
| 2357 | + (when (seq block-ast-title) |
| 2358 | + (->elem |
| 2359 | + elem |
| 2360 | + (merge |
| 2361 | + {:data-hl-type (pu/lookup block :logseq.property.pdf/hl-type)} |
| 2362 | + (when (and marker |
| 2363 | + (not (string/blank? marker)) |
| 2364 | + (not= "nil" marker)) |
| 2365 | + {:data-marker (str (string/lower-case marker))}) |
| 2366 | + (when bg-color |
| 2367 | + (let [built-in-color? (ui/built-in-color? bg-color)] |
| 2368 | + {:style {:background-color (if built-in-color? |
| 2369 | + (str "var(--ls-highlight-color-" bg-color ")") |
| 2370 | + bg-color) |
| 2371 | + :color (when-not built-in-color? "white")} |
| 2372 | + :class "px-1 with-bg-color"}))) |
2372 | 2373 |
|
2373 | 2374 | ;; children |
2374 | | - (let [area? (= :area (keyword (pu/lookup block :logseq.property.pdf/hl-type))) |
2375 | | - hl-ref #(when (not (#{:default :whiteboard-shape} block-type)) |
2376 | | - [:div.prefix-link |
2377 | | - {:on-pointer-down |
2378 | | - (fn [^js e] |
2379 | | - (let [^js target (.-target e)] |
2380 | | - (case block-type |
| 2375 | + (let [area? (= :area (keyword (pu/lookup block :logseq.property.pdf/hl-type))) |
| 2376 | + hl-ref #(when (not (#{:default :whiteboard-shape} block-type)) |
| 2377 | + [:div.prefix-link |
| 2378 | + {:on-pointer-down |
| 2379 | + (fn [^js e] |
| 2380 | + (let [^js target (.-target e)] |
| 2381 | + (case block-type |
2381 | 2382 | ;; pdf annotation |
2382 | | - :annotation |
2383 | | - (if (and area? (.contains (.-classList target) "blank")) |
2384 | | - :actions |
2385 | | - (do |
2386 | | - (pdf-assets/open-block-ref! block) |
2387 | | - (util/stop e))) |
2388 | | - |
2389 | | - :dune)))} |
2390 | | - |
2391 | | - [:span.hl-page |
2392 | | - [:strong.forbid-edit |
2393 | | - (str "P" |
2394 | | - (or (pu/lookup block :logseq.property.pdf/hl-page) |
2395 | | - "?"))]] |
2396 | | - |
2397 | | - (when (and area? |
2398 | | - (or |
| 2383 | + :annotation |
| 2384 | + (if (and area? (.contains (.-classList target) "blank")) |
| 2385 | + :actions |
| 2386 | + (do |
| 2387 | + (pdf-assets/open-block-ref! block) |
| 2388 | + (util/stop e))) |
| 2389 | + |
| 2390 | + :dune)))} |
| 2391 | + |
| 2392 | + [:span.hl-page |
| 2393 | + [:strong.forbid-edit |
| 2394 | + (str "P" |
| 2395 | + (or (pu/lookup block :logseq.property.pdf/hl-page) |
| 2396 | + "?"))]] |
| 2397 | + |
| 2398 | + (when (and area? |
| 2399 | + (or |
2399 | 2400 | ;; db graphs |
2400 | | - (:logseq.property.pdf/hl-image block) |
| 2401 | + (:logseq.property.pdf/hl-image block) |
2401 | 2402 | ;; file graphs |
2402 | | - (get-in block [:block/properties :hl-stamp]))) |
2403 | | - (pdf-assets/area-display block))])] |
2404 | | - (remove-nils |
2405 | | - (concat |
2406 | | - (when (config/local-file-based-graph? (state/get-current-repo)) |
2407 | | - [(when (and (not pre-block?) |
2408 | | - (not html-export?)) |
2409 | | - (file-block/block-checkbox block (str "mr-1 cursor"))) |
2410 | | - (when (and (not pre-block?) |
2411 | | - (not html-export?)) |
2412 | | - (file-block/marker-switch block)) |
2413 | | - (file-block/marker-cp block) |
2414 | | - (file-block/priority-cp block)]) |
| 2403 | + (get-in block [:block/properties :hl-stamp]))) |
| 2404 | + (pdf-assets/area-display block))])] |
| 2405 | + (remove-nils |
| 2406 | + (concat |
| 2407 | + (when (config/local-file-based-graph? (state/get-current-repo)) |
| 2408 | + [(when (and (not pre-block?) |
| 2409 | + (not html-export?)) |
| 2410 | + (file-block/block-checkbox block (str "mr-1 cursor"))) |
| 2411 | + (when (and (not pre-block?) |
| 2412 | + (not html-export?)) |
| 2413 | + (file-block/marker-switch block)) |
| 2414 | + (file-block/marker-cp block) |
| 2415 | + (file-block/priority-cp block)]) |
2415 | 2416 |
|
2416 | 2417 | ;; highlight ref block (inline) |
2417 | | - (when-not area? [(hl-ref)]) |
| 2418 | + (when-not area? [(hl-ref)]) |
2418 | 2419 |
|
2419 | | - (conj |
2420 | | - (map-inline config block-ast-title) |
2421 | | - (when (= block-type :whiteboard-shape) [:span.mr-1 (ui/icon "whiteboard-element" {:extension? true})])) |
| 2420 | + (conj |
| 2421 | + (map-inline config block-ast-title) |
| 2422 | + (when (= block-type :whiteboard-shape) [:span.mr-1 (ui/icon "whiteboard-element" {:extension? true})])) |
2422 | 2423 |
|
2423 | 2424 | ;; highlight ref block (area) |
2424 | | - (when area? [(hl-ref)]) |
2425 | | - |
2426 | | - (when (and (seq block-ast-title) (ldb/class-instance? |
2427 | | - (entity-plus/entity-memoized (db/get-db) :logseq.class/Cards) |
2428 | | - block)) |
2429 | | - [(ui/tooltip |
2430 | | - (shui/button |
2431 | | - {:variant :ghost |
2432 | | - :size :sm |
2433 | | - :class "ml-2 !px-1 !h-5 text-xs text-muted-foreground" |
2434 | | - :on-click (fn [e] |
2435 | | - (util/stop e) |
2436 | | - (state/pub-event! [:modal/show-cards (:db/id block)]))} |
2437 | | - "Practice") |
2438 | | - [:div "Practice cards"])]))))))) |
| 2425 | + (when area? [(hl-ref)]) |
| 2426 | + |
| 2427 | + (when (and (seq block-ast-title) (ldb/class-instance? |
| 2428 | + (entity-plus/entity-memoized (db/get-db) :logseq.class/Cards) |
| 2429 | + block)) |
| 2430 | + [(ui/tooltip |
| 2431 | + (shui/button |
| 2432 | + {:variant :ghost |
| 2433 | + :size :sm |
| 2434 | + :class "ml-2 !px-1 !h-5 text-xs text-muted-foreground" |
| 2435 | + :on-click (fn [e] |
| 2436 | + (util/stop e) |
| 2437 | + (state/pub-event! [:modal/show-cards (:db/id block)]))} |
| 2438 | + "Practice") |
| 2439 | + [:div "Practice cards"])])))))))) |
2439 | 2440 |
|
2440 | 2441 | (rum/defc block-title-aux |
2441 | 2442 | [config block {:keys [query? *show-query?]}] |
|
0 commit comments