enhance: persistent "Copy As" options

This commit is contained in:
Tienson Qin
2021-08-24 23:11:49 +08:00
parent 81e93cbd5e
commit e2abf01deb
3 changed files with 25 additions and 18 deletions

View File

@@ -150,9 +150,10 @@
;; copied blocks
:copy/blocks {:copy/content nil :copy/block-tree nil}
:copy/export-block-text-indent-style (atom "dashes")
:copy/export-block-text-remove-options (atom #{})
:copy/export-block-text-indent-style (or (storage/get :copy/export-block-text-indent-style)
"dashes")
:copy/export-block-text-remove-options (or (storage/get :copy/export-block-text-remove-options)
#{})
:date-picker/date nil
:view/components {}})))
@@ -1385,9 +1386,21 @@
(defn get-export-block-text-indent-style []
(:copy/export-block-text-indent-style @state))
(defn set-export-block-text-indent-style!
[v]
(set-state! :copy/export-block-text-indent-style v)
(storage/set :copy/export-block-text-indent-style v))
(defn get-export-block-text-remove-options []
(:copy/export-block-text-remove-options @state))
(defn update-export-block-text-remove-options!
[e k]
(let [f (if (util/echecked? e) conj disj)]
(update-state! :copy/export-block-text-remove-options
#(f % k))
(storage/set :copy/export-block-text-remove-options
(get-export-block-text-remove-options))))
(defn set-editor-args!
[args]