Created
November 22, 2017 20:43
-
-
Save laynor/93e185584e48d866bd45fab7f0cbe3ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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/React.Component.call this props context updater) | |
(js/goog.object.set this :state (js-obj :value (js/Slate.Plain.deserialize "foo"))) | |
this)) | |
(js/goog.object.extend (.-prototype MyPlainText) | |
js/React.Component.prototype | |
#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