1
0
Эх сурвалжийг харах

feat: displaying whiteboard text shape in outliner

Peng Xiao 3 жил өмнө
parent
commit
45798ba714

+ 1 - 1
deps/graph-parser/src/logseq/graph_parser/extract.cljc

@@ -193,7 +193,7 @@
 
 (defn with-whiteboard-block-props
   [shape]
-  (merge {}
+  (merge {:block/uuid (uuid (:id shape))}
          (with-whiteboard-block-refs shape)
          (with-whiteboard-content shape)))
 

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

@@ -770,6 +770,9 @@
                       ;; pdf annotation
                       [:annotation true] (pdf-assets/open-block-ref! block)
 
+                      [:whiteboard-shape true] (route-handler/redirect-to-whiteboard!
+                                                (get-in block [:block/page :block/name]) {:block-id block-id})
+
                       ;; default open block page
                       :else (route-handler/redirect-to-page! id))))))}
 
@@ -2075,6 +2078,9 @@
           (seq title)
           (build-block-title config block)
 
+          (= block-type :whiteboard-shape)
+          content
+
           :else
           nil)]
 
@@ -2095,7 +2101,8 @@
                  (let [hidden? (property/properties-hidden? properties)]
                    (not hidden?))
                  (not (and block-ref? (or (seq title) (seq body))))
-                 (not (:slide? config)))
+                 (not (:slide? config))
+                 (not= block-type :whiteboard-shape))
         (properties-cp config block))
 
       (when (and (not block-ref-with-title?) (seq body))

+ 3 - 8
src/main/frontend/handler/whiteboard.cljs

@@ -33,16 +33,11 @@
                             :pageId page-title}])))))
 
 (defn- block->shape [block]
-  (let [properties (:block/properties block)
-        uuid (str (:block/uuid block))]
-    (merge properties
-           ;; Use the block's id as the shape's id.
-           {:id uuid})))
+  (:block/properties block))
 
 (defn- shape->block [shape page-name]
-  (let [properties shape
-        block {:block/uuid (uuid (:id properties))
-               :block/page {:block/name page-name}
+  (let [properties (assoc shape :ls-type :whiteboard-shape)
+        block {:block/page {:block/name page-name}
                :block/properties properties}
         additional-props (with-whiteboard-block-props shape)]
     (merge block additional-props)))

+ 1 - 0
src/main/frontend/modules/outliner/file.cljs

@@ -23,6 +23,7 @@
 
 (def blocks-pull-keys-with-persisted-ids
   '[:block/properties
+    :block/uuid
     {:block/page      [:block/name :block/uuid]}
     {:block/left      [:block/name :block/uuid]}
     {:block/parent    [:block/name :block/uuid]}

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/shapes/TextShape.tsx

@@ -30,7 +30,7 @@ export class TextShape extends TLTextShape<TextShapeProps> {
     fontSize: 20,
     fontWeight: 400,
     padding: 4,
-    fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
+    fontFamily: "var(--ls-font-family), 'Helvetica Neue', Helvetica, Arial, sans-serif",
     borderRadius: 0,
     stroke: 'var(--tl-foreground, #000)',
     fill: '#ffffff',

+ 1 - 0
tldraw/apps/tldraw-logseq/src/styles.css

@@ -405,6 +405,7 @@
   justify-content: center;
   pointer-events: none;
   user-select: none;
+  font-family: var(--ls-font-family);
 }
 
 .logseq-tldraw .text-label-inner-wrapper {