Browse Source

enhance: Chinese input for both page and block refs

Tienson Qin 4 years ago
parent
commit
96d7d2dc00
1 changed files with 16 additions and 0 deletions
  1. 16 0
      src/main/frontend/handler/editor.cljs

+ 16 - 0
src/main/frontend/handler/editor.cljs

@@ -2457,6 +2457,22 @@
           value (gobj/get input "value")
           c (util/nth-safe value (dec current-pos))]
       (when-not (state/get-editor-show-input)
+        (when (and (= k "【")
+                   (> current-pos 0)
+                   (= "【" (util/nth-safe value (dec (dec current-pos)))))
+          (commands/handle-step [:editor/input "[[]]" {:last-pattern "【【"
+                                                       :backward-pos 2}])
+          (commands/handle-step [:editor/search-page])
+          (reset! commands/*slash-caret-pos (util/get-caret-pos input)))
+
+        (when (and (= k "(")
+                   (> current-pos 0)
+                   (= "(" (util/nth-safe value (dec (dec current-pos)))))
+          (commands/handle-step [:editor/input "(())" {:last-pattern "(("
+                                                       :backward-pos 2}])
+          (commands/handle-step [:editor/search-block :reference])
+          (reset! commands/*slash-caret-pos (util/get-caret-pos input)))
+
         (when (= c " ")
           (when (or (= (util/nth-safe value (dec (dec current-pos))) "#")
                     (not (state/get-editor-show-page-search?)))