浏览代码

fix: set the codemirror block as the edited block when it is clicked (#2299)

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

+ 5 - 3
src/main/frontend/extensions/code.cljs

@@ -155,9 +155,11 @@
                                  (save-file-or-block-when-blur-or-esc! editor textarea config state))))
           (.addEventListener element "mousedown"
                              (fn [e]
-                               (state/clear-selection!)
-                               (util/stop e)
-                               (state/set-block-component-editing-mode! true)))
+                               (let [block (into {} (db/get-block-by-uuid (:block/uuid config)))]
+                                 (state/clear-selection!)
+                                 (state/set-editing! id (.getValue editor) block nil false)
+                                 (util/stop e)
+                                 (state/set-block-component-editing-mode! true))))
           (.save editor)
           (.refresh editor)))
       editor)))