feat: save html to clipboards too

pull/5487/head
Tienson Qin 2022-05-28 15:32:37 +08:00
parent d4be2dfe31
commit f8fd6544d4
2 changed files with 8 additions and 6 deletions

View File

@ -15,8 +15,9 @@
[borkdude.rewrite-edn :as rewrite]))
(defn copy-to-clipboard-without-id-property!
[format content]
(util/copy-to-clipboard! (property/remove-id-property format content)))
[format raw-text html]
(util/copy-to-clipboard! (property/remove-id-property format raw-text))
(util/copy-to-clipboard! html true))
(defn config-with-document-mode
[config]

View File

@ -984,7 +984,8 @@
content (compose-copied-blocks-contents repo ids)
block (db/entity [:block/uuid (first ids)])]
(when block
(common-handler/copy-to-clipboard-without-id-property! (:block/format block) content)
(let [html (export/export-blocks-as-html repo ids)]
(common-handler/copy-to-clipboard-without-id-property! (:block/format block) content html))
(state/set-copied-blocks content ids)
(notification/show! "Copied!" :success)))))
@ -1192,9 +1193,10 @@
(when-let [block (db/pull [:block/uuid block-id])]
(let [repo (state/get-current-repo)
;; TODO: support org mode
md-content (compose-copied-blocks-contents repo [block-id])]
md-content (compose-copied-blocks-contents repo [block-id])
html (export/export-blocks-as-html repo [block-id])]
(state/set-copied-full-blocks md-content [block])
(common-handler/copy-to-clipboard-without-id-property! (:block/format block) md-content)
(common-handler/copy-to-clipboard-without-id-property! (:block/format block) md-content html)
(delete-block-aux! block true))))
(defn clear-last-selected-block!
@ -2964,7 +2966,6 @@
(html-parser/convert format html)
initial-text)
input (state/get-input)]
;; (def html html)
(if-not (string/blank? text)
(if (or (thingatpt/markdown-src-at-point input)
(thingatpt/org-admonition&src-at-point input))