瀏覽代碼

enhance(ux): support the shui popups for more editor commands modal

charlie 1 年之前
父節點
當前提交
89eebc6dbe
共有 1 個文件被更改,包括 12 次插入18 次删除
  1. 12 18
      src/main/frontend/components/editor.cljs

+ 12 - 18
src/main/frontend/components/editor.cljs

@@ -768,8 +768,7 @@
             pos [(+ left (:left rect) -20) (+ top (:top rect) 20)]]
         (let [pid (case action
                     :commands
-                    (shui/popup-show!
-                      pos
+                    (shui/popup-show! pos
                       (commands id format)
                       {:id :editor.commands/commands
                        :align :start
@@ -782,6 +781,16 @@
                                        :data-editor-popup-ref "commands"}
                        :force-popover? true})
 
+                    :block-commands
+                    (shui/popup-show! pos
+                      (block-commands id format)
+                      {:id :editor.commands/block-commands
+                       :align :start
+                       :content-props {:onOpenAutoFocus #(.preventDefault %)
+                                       :onCloseAutoFocus #(.preventDefault %)
+                                       :data-editor-popup-ref "commands"}
+                       :force-popover? true})
+
                     :datepicker
                     (shui/popup-show!
                       pos (datetime-comp/date-picker id format nil)
@@ -847,7 +856,7 @@
        (= action :commands-classic)
        (animated-modal "commands" (commands id format) true)
 
-       (= action :block-commands)
+       (= action :block-commands-classic)
        (animated-modal "block-commands" (block-commands id format) true)
 
        (contains? #{:page-search :page-search-hashtag} action)
@@ -865,21 +874,6 @@
        (= :property-value-search action)
        (animated-modal "property-value-search" (property-value-search id) true)
 
-       ;; date-picker in editing-mode
-       (= :datepicker-classic action)
-       (animated-modal "date-picker" (datetime-comp/date-picker id format nil) false)
-
-       (= :select-code-block-mode-classic action)
-       (animated-modal "select-code-block-mode" (code-block-mode-picker id format) true)
-
-       (= :input-classic action)
-       (animated-modal "input" (input id
-                                 (fn [command m]
-                                   (editor-handler/handle-command-input command id format m))
-                                 (fn []
-                                   (editor-handler/handle-command-input-close id)))
-         true)
-
        (= :zotero action)
        (animated-modal "zotero-search" (zotero/zotero-search id) false)