Rather than using an internal *clipboard* dynamic var to store copied sexps, copying should place a serialized-to-Clojure-code representation of the copied sexp in the system clipboard (for better interop with other applications that represent Clojure code as text). Likewise, pasting should retrieve the text in the system clipboard and attempt to parse it to produce a sexp.
Note that the implementation of this behavior is made more complicated by the continued use of cljs.reader to parse Clojure source text into data structures. Sexps copied from within the editor do not necessarily correspond directly to valid Clojure code (as in the case of, for example, a map with an odd number of children), so pasting the serialized form of a previously copied sexp will not necessarily succeed unless a more forgiving reader implementation is used.
I don't think this is a good idea anymore. We've moved to storing clipboard contents in the app state, which has its own advantages and doesn't rely on flaky DOM events.
Rather than using an internal
*clipboard*
dynamic var to store copied sexps, copying should place a serialized-to-Clojure-code representation of the copied sexp in the system clipboard (for better interop with other applications that represent Clojure code as text). Likewise, pasting should retrieve the text in the system clipboard and attempt to parse it to produce a sexp.Note that the implementation of this behavior is made more complicated by the continued use of
cljs.reader
to parse Clojure source text into data structures. Sexps copied from within the editor do not necessarily correspond directly to valid Clojure code (as in the case of, for example, a map with an odd number of children), so pasting the serialized form of a previously copied sexp will not necessarily succeed unless a more forgiving reader implementation is used.