Browse Source

fix: block ref style issue

Tienson Qin 4 years ago
parent
commit
12cfde84a1
2 changed files with 15 additions and 8 deletions
  1. 8 6
      src/main/frontend/components/block.cljs
  2. 7 2
      src/main/frontend/components/block.css

+ 8 - 6
src/main/frontend/components/block.cljs

@@ -578,7 +578,7 @@
           block (db/pull-block block-id)
           repo (state/get-current-repo)]
       (if block
-        [:div.block-ref-wrap.inline
+        [:div.inline
          {:on-mouse-down
           (fn [e]
             (util/stop e)
@@ -590,11 +590,13 @@
                {:block block})
               (route-handler/redirect! {:to          :page
                                         :path-params {:name id}})))}
-         (let [title (let [title (:block/title block)]
-                       [:span.block-ref
-                        (block-content (assoc config :block-ref? true)
-                                       block nil (:block/uuid block)
-                                       (:slide? config))])
+         (let [title (let [title (:block/title block)
+                           block-content (block-content (assoc config :block-ref? true)
+                                                        block nil (:block/uuid block)
+                                                        (:slide? config))
+                           class (if (seq title) "block-ref" "block-ref-no-title")]
+                       [:span {:class class}
+                        block-content])
                inner (if label
                        (->elem
                         :span.block-ref

+ 7 - 2
src/main/frontend/components/block.css

@@ -152,11 +152,16 @@
   }
 }
 
+.block-ref-no-title {
+    cursor: alias;
+}
+
 .block-ref {
-  padding-bottom: 2px;
   border-bottom: 0.5px solid;
   border-bottom-color: var(--ls-block-ref-link-text-color);
   cursor: alias;
+  padding: 2px 5px;
+  display: inline;
 
   &:hover {
     color: var(--ls-link-text-hover-color);
@@ -477,4 +482,4 @@ span.cloze-revealed {
 
 .page-property-key {
   color: var(--ls-secondary-text-color);
-}
+}