Skip to content

Instantly share code, notes, and snippets.

Created Nov 22, 2017
What would you like to do?
(def editor-state (atom #{:value "foobaar"}))
(defn on-plain-text-change [& args] (println args))
(rum/defc PlainText < rum/reactive
(js/React.createElement js/Slate.Editor
#js {:placeholder "enter enter enter"
:value (:value (rum/react editor-state))}))
(rum/defc plain-text
(js/React.createElement PlainText))
(defn MyPlainText [props context updater]
(this-as this
(js/ this props context updater)
(js/goog.object.set this :state (js-obj :value (js/Slate.Plain.deserialize "foo")))
(js/goog.object.extend (.-prototype MyPlainText)
#js {:render (fn []
(this-as this
(js/React.createElement js/Slate.Editor
#js {:placeholder "bar"
:value this.state.value})))})
(set! (.. MyPlainText -prototype -constructor) MyPlainText)
(rum/defc my-plain-text
(js/React.createElement MyPlainText))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment