enhance: paste from clipboard (#8642)

replace the selected part from the clipboard
instead of formatting it to a link if it's within the link
This commit is contained in:
megayu
2023-02-21 15:55:59 +08:00
committed by GitHub
parent 40ad524443
commit a4a5758afc
3 changed files with 77 additions and 16 deletions

View File

@@ -127,7 +127,7 @@
(defn html-link-format!
([]
(html-link-format! nil))
([link]
([text]
(when-let [m (get-selection-and-format)]
(let [{:keys [selection-start selection-end format selection value edit-id input]} m
cur-pos (cursor/pos input)
@@ -137,8 +137,11 @@
empty-selection?
(config/get-empty-link-and-forward-pos format)
link
(config/with-label-link format selection link)
(and text selection-link?)
(config/with-label-link format text selection)
text
(config/with-label-link format selection text)
selection-link?
(config/with-default-link format selection)