improve(pdf): friendly breakline for multiple language highlights text

This commit is contained in:
charlie
2022-07-28 21:51:10 +08:00
committed by Junyi Du
parent 178e2f51bb
commit 98ace5593d

View File

@@ -161,11 +161,12 @@
[text]
(when-not (string/blank? text)
(let [sp "@#~#@"]
(let [sp "|#|"]
(-> text
(string/replace #"[\r\n]+" sp)
(string/replace (str "-" sp) "")
(string/replace sp " ")))))
(string/replace #"\|#\|([a-zA-Z_])" " $1")
(string/replace sp "")))))
;; TODO: which viewer instance?
(defn next-page
@@ -179,3 +180,10 @@
(try
(js-invoke js/window.lsPdfViewer "previousPage")
(catch js/Error _e nil)))
(comment
(fix-selection-text-breakline "this is a\ntest paragraph")
(fix-selection-text-breakline "he is 1\n8 years old")
(fix-selection-text-breakline "这是一个\n\n段落")
(fix-selection-text-breakline "これ\n\nは、段落")
(fix-selection-text-breakline "this is a te-\nst paragraph"))