浏览代码

fix: should also mute cursor blinks

Peng Xiao 3 年之前
父节点
当前提交
628edb4775
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/main/frontend/extensions/code.cljs

+ 4 - 2
src/main/frontend/extensions/code.cljs

@@ -230,14 +230,16 @@
         cm-options (merge default-cm-options
                           (extra-codemirror-options)
                           {:mode mode
-                           :readOnly (if ui-config/publishing? true false)
                            :extraKeys #js {"Esc" (fn [cm]
                                                    ;; Avoid reentrancy
                                                    (gobj/set cm "escPressed" true)
                                                    (save-file-or-block-when-blur-or-esc! cm textarea config state)
                                                    (when-let [block-id (:block/uuid config)]
                                                      (let [block (db/pull [:block/uuid block-id])]
-                                                       (editor-handler/edit-block! block :max block-id))))}})
+                                                       (editor-handler/edit-block! block :max block-id))))}}
+                          (when ui-config/publishing?
+                            {:readOnly true
+                             :cursorBlinkRate -1}))
         editor (when textarea
                  (from-textarea textarea (clj->js cm-options)))]
     (when editor