瀏覽代碼

fix: modals positions

close https://github.com/logseq/logseq/issues/5053
llcc 3 年之前
父節點
當前提交
3f8296135b

+ 1 - 1
src/main/frontend/components/datetime.cljs

@@ -117,7 +117,7 @@
                                         :on-enter on-submit) 100))))
   []
   (let [{:keys [time repeater]} (rum/react *timestamp)]
-    [:div#time-repeater.py-1.px-4 {:style {:min-width 300}}
+    [:div#time-repeater.py-1.px-4
      [:p.text-sm.opacity-50.font-medium.mt-4 "Time:"]
      (time-input time)
 

+ 5 - 4
src/main/frontend/components/editor.cljs

@@ -387,7 +387,6 @@
                                    (when (> ofx 0)
                                      (set! (.-transform (.-style el)) (str "translateX(-" (+ ofx 20) "px)")))))))
                            [right-sidebar? editing-key])
-        ;; FIXME: for translateY layer
         x-overflow-vw? (when (and (seq rect) (> vw-width max-width))
                          (let [delta-width (- vw-width (+ (:left rect) left))]
                            (< delta-width (* max-width 0.5))))
@@ -408,9 +407,11 @@
                :z-index    11}
               (when set-default-width?
                 {:width max-width})
-              (if config/mobile?
-                {:left 0}
-                {:left (if (and y-diff (= y-diff 0)) left 0)}))}
+              (let [^js/HTMLElement textarea
+                    (js/document.querySelector "textarea")]
+                (if (<= (.-clientWidth textarea) (+ left (if set-default-width? max-width 500)))
+                  {:right 0}
+                  {:left (if (and y-diff (= y-diff 0)) left 0)})))}
      cp]))
 
 (rum/defc transition-cp < rum/reactive

+ 11 - 0
src/main/frontend/components/editor.css

@@ -93,3 +93,14 @@ pre {
 .preview-trigger-wrapper > [data-tooltipped] {
   display: block !important;
 }
+
+#time-repeater {
+    width: 135px;
+    
+    @screen sm {
+        min-width: 300px;
+    }
+}
+
+
+