Skip to content

Instantly share code, notes, and snippets.

@selfsame
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selfsame/c09f6123455b5fa6ab19 to your computer and use it in GitHub Desktop.
Save selfsame/c09f6123455b5fa6ab19 to your computer and use it in GitHub Desktop.
;saved documents have data for :filesystem, :filepath, :unsaved-changes, :file-uid
(defn get-iframe [data]
"Returns the iframe element for the given
Workspace cursor"
(let [id (:iframe-id data)]
(.getElementById js/document id)))
(defn to-html [element]
"Returns the HTML string of the element and it's contents, when given an iframe returns only content HTML.")
(defn save [data owner]
(let [target (chan)
iframe nil
html (.inner text iframe)]
(dialogue {:callback target
:title "save"
:view :file-browser
:role :save-as})
(go (while true
(save-to-system (!< target) html)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment