瀏覽代碼

fix(editor): wrong last pos when hashtag pressed

Andelf 4 年之前
父節點
當前提交
c6d6871684
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/main/frontend/handler/editor.cljs

+ 3 - 1
src/main/frontend/handler/editor.cljs

@@ -2977,7 +2977,9 @@
         hashtag?
         hashtag?
         (do
         (do
           (commands/handle-step [:editor/search-page-hashtag])
           (commands/handle-step [:editor/search-page-hashtag])
-          (state/set-last-pos! (cursor/pos input))
+          (if (= key "#")
+            (state/set-last-pos! (inc (cursor/pos input))) ;; In keydown handler, the `#` is not inserted yet.
+            (state/set-last-pos! (cursor/pos input)))
           (reset! commands/*slash-caret-pos (cursor/get-caret-pos input)))
           (reset! commands/*slash-caret-pos (cursor/get-caret-pos input)))
 
 
         (let [sym "$"]
         (let [sym "$"]