Skip to content

Commit

Permalink
fix: paste text should overwrite the current selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Jun 6, 2022
1 parent cd6e2ca commit da51051
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/main/frontend/handler/editor.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,6 @@
copied-block-ids (:copy/block-ids copied-blocks)
copied-graph (:copy/graph copied-blocks)
input (state/get-input)]
(util/stop e)
(cond
;; Internal blocks by either copy or cut blocks
(and
Expand Down Expand Up @@ -2933,22 +2932,30 @@
(nil? (util/safe-re-find #"(?m)^\s*\*+\s+" text))
(nil? (util/safe-re-find #"(?:\r?\n){2,}" text))]
[:markdown false _ _]
(paste-text-parseable format text)
(do
(util/stop e)
(paste-text-parseable format text))

[:org _ false _]
(paste-text-parseable format text)
(do
(util/stop e)
(paste-text-parseable format text))

[:markdown true _ false]
(paste-segmented-text format text)
(do
(util/stop e)
(paste-segmented-text format text))

[:markdown true _ true]
(commands/simple-insert! (state/get-edit-input-id) text nil)
nil

[:org _ true false]
(paste-segmented-text format text)
(do
(util/stop e)
(paste-segmented-text format text))

[:org _ true true]
(commands/simple-insert! (state/get-edit-input-id) text nil))))))
nil)))))

(defn paste-text-in-one-block-at-point
[]
Expand Down

0 comments on commit da51051

Please sign in to comment.