Tienson Qin 3 years ago
parent
commit
59b924f25d

+ 1 - 0
deps/graph-parser/test/logseq/graph_parser/util/page_ref_test.cljs

@@ -7,5 +7,6 @@
   (are [x y] (= (page-ref/page-ref? x) y)
        "[[page]]" true
        "[[another page]]" true
+       "[[some [[nested]] page]]" true
        "[single bracket]" false
        "no brackets" false))

+ 1 - 1
src/main/frontend/diff.cljs

@@ -47,7 +47,7 @@
 
                       :else
                       (recur r1 t2 (inc i1) i2))))
-            current-line (text-util/get-current-line-by-pos markup pos)]
+            current-line (:line (text-util/get-current-line-by-pos markup pos))]
         (cond
           (= (util/nth-safe markup pos)
              (util/nth-safe markup (inc pos))

+ 7 - 4
src/main/frontend/handler/editor.cljs

@@ -1855,9 +1855,8 @@
 
       (and
        (not= :property-search (state/get-editor-action))
-       (when-let [current-line (text-util/get-current-line-by-pos (.-value input) (dec pos))]
-         (or (wrapped-by? current-line "" gp-property/colons)
-             (wrapped-by? current-line "\n" gp-property/colons))))
+       (let [{:keys [line start-pos]} (text-util/get-current-line-by-pos (.-value input) (dec pos))]
+         (text-util/wrapped-by? line (dec (- pos start-pos)) "" gp-property/colons)))
 
       (do
         (state/set-editor-action-data! {:pos (cursor/get-caret-pos input)})
@@ -2697,7 +2696,7 @@
         (on-tab direction)))
     nil))
 
-(defn keydown-not-matched-handler
+(defn ^:large-vars/cleanup-todo keydown-not-matched-handler
   [format]
   (fn [e _key-code]
     (let [input-id (state/get-edit-input-id)
@@ -2711,6 +2710,10 @@
                        (surround-by? input "#" :end)
                        (= key "#"))]
       (cond
+        (and (contains? #{"ArrowLeft" "ArrowRight" "ArrowUp" "ArrowDown"} key)
+             (contains? #{:property-search :property-value-search} (state/get-editor-action)))
+        (state/clear-editor-action!)
+
         (and (util/event-is-composing? e true) ;; #3218
              (not hashtag?) ;; #3283 @Rime
              (not (state/get-editor-show-page-search-hashtag?))) ;; #3283 @MacOS pinyin

+ 3 - 2
src/main/frontend/util/text.cljs

@@ -59,9 +59,10 @@
         result (reduce (fn [acc line]
                          (let [new-pos (+ acc (count line))]
                            (if (>= new-pos pos)
-                             (reduced line)
+                             (reduced {:line line
+                                       :start-pos acc})
                              (inc new-pos)))) 0 lines)]
-    (when (string? result)
+    (when (map? result)
       result)))
 
 (defn surround-by?