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

all pages: filter by whiteboard

Peng Xiao 3 жил өмнө
parent
commit
a2103a0d45

+ 17 - 4
src/main/frontend/components/page.cljs

@@ -785,6 +785,7 @@
   (rum/local :block/updated-at ::sort-by-item)
   (rum/local true ::desc?)
   (rum/local false ::journals)
+  (rum/local false ::whiteboards)
   (rum/local nil ::filter-fn)
   (rum/local 1 ::current-page)
   [state]
@@ -793,6 +794,7 @@
         *sort-by-item (get state ::sort-by-item)
         *desc? (::desc? state)
         *journal? (::journals state)
+        *whiteboard? (::whiteboards state)
         *results (::results state)
         *results-all (::results-all state)
         *checks (::checks state)
@@ -845,16 +847,19 @@
                                                              :block/backlinks (count (:block/_refs (db/entity (:db/id page))))
                                                              :block/idx idx))))]
            (reset! *filter-fn
-                   (memoize (fn [sort-by-item desc? journal?]
+                   (memoize (fn [sort-by-item desc? journal? whiteboard?]
                               (->> pages
-                                   (filter #(or (boolean journal?)
-                                                (= false (boolean (:block/journal? %)))))
+                                   (filter #(and
+                                             (or (boolean journal?)
+                                                 (= false (boolean (:block/journal? %))))
+                                             (or (boolean whiteboard?)
+                                                 (= false (boolean (:block/whiteboard? %))))))
                                    (sort-pages-by sort-by-item desc?)))))
            (reset! *pages pages)))
 
        ;; filter results
        (when @*filter-fn
-         (let [pages (@*filter-fn @*sort-by-item @*desc? @*journal?)
+         (let [pages (@*filter-fn @*sort-by-item @*desc? @*journal? @*whiteboard?)
 
                ;; search key
                pages (if-not (string/blank? @*search-key)
@@ -921,6 +926,14 @@
                   (ui/icon "x")])])]]
 
           [:div.r.flex.items-center.justify-between
+           [:div
+            (ui/tippy
+             {:html  [:small (str (t :page/show-whiteboards) " ?")]
+              :arrow true}
+             [:a.button.whiteboard
+              {:class    (util/classnames [{:active (boolean @*whiteboard?)}])
+               :on-click #(reset! *whiteboard? (not @*whiteboard?))}
+              (ui/icon "artboard" {:style {:fontSize ui/icon-size}})])]
            [:div
             (ui/tippy
              {:html  [:small (str (t :page/show-journals) " ?")]

+ 2 - 0
src/main/frontend/dicts.cljc

@@ -99,6 +99,7 @@
         :page/add-to-favorites "Add to Favorites"
         :page/unfavorite "Unfavorite page"
         :page/show-journals "Show journals"
+        :page/show-whiteboards "Show whiteboards"
         :page/show-name "Show page name"
         :page/hide-name "Hide page name"
         :block/name "Page name"
@@ -1198,6 +1199,7 @@
            :page/add-to-favorites "添加收藏"
            :page/unfavorite "取消收藏"
            :page/show-journals "显示日志"
+           :page/show-whiteboards "显示白板"
            :page/show-name "显示页面名"
            :page/hide-name "隐藏页面名"
            :block/name "页面名称"

+ 5 - 1
tldraw/packages/react/src/components/Canvas/Canvas.tsx

@@ -158,7 +158,11 @@ export const Canvas = observer(function Renderer<S extends TLReactShape>({
           {selectedShapes && selectionBounds && (
             <>
               {showSelection && components.SelectionForeground && (
-                <Container data-type="SelectionForeground" bounds={selectionBounds} zIndex={10002}>
+                <Container
+                  data-type="SelectionForeground"
+                  bounds={selectionBounds}
+                  zIndex={editingShape && selectedShapes.includes(editingShape) ? 1002 : 10002}
+                >
                   <components.SelectionForeground
                     zoom={zoom}
                     shapes={selectedShapes}

+ 1 - 1
tldraw/packages/react/src/components/Indicator/Indicator.tsx

@@ -34,7 +34,7 @@ export const Indicator = observer(function Shape({
       bounds={bounds}
       rotation={rotation}
       scale={scale}
-      zIndex={10000}
+      zIndex={isEditing ? 1000 : 10000}
     >
       <SVGContainer>
         <g className={`tl-indicator-container ${isSelected ? 'tl-selected' : 'tl-hovered'}`}>