Fork me on GitHub
#reagent
<
2019-04-16
>
oconn14:04:03

@weavejester I’m using Draft.js with reagent. Got it working by using adapt-react-class and mounting the component in a form-2 comonent. editor-state is an ratom.

(def Editor
  (reagent/adapt-react-class
   (gobj/get draft-js "Editor")))

(def EditorState
  (gobj/get draft-js "EditorState"))

;; Render Method 
;; ...
[Editor {:editorState @editor-state
         :customStyleMap (clj->js style-map)
         :handleKeyCommand (partial handle-key-command editor-state)
         :onChange #(do
                      (reset! editor-state %)
                      (on-change))
         :ref #(reset! !ref %)}]

oconn14:04:30

As for referencing the component (draftjs editor), I used a react ref and stored that in an atom.

Bravi23:04:47

has anyone ever used react-sortablejs with reagent?