Liking cljdoc? Tell your friends :D

Respo Cirru Editor

Reimplement Cirru Editor in Respo.

Demo http://repo.cirru.org/respo-cirru-editor/

Support several basic shortcuts from Clacit Editor.

Usage

Clojars Project

[cirru/editor "0.3.0-a1"]

Import comp-editor like this:

[cirru-editor.comp.editor :refer [comp-editor]]
[cirru-editor.util.dom :refer [focus!]]

Arguments of comp-editor:

(defn on-update! [snapshot dispatch!]
  (dispatch! :update snapshot))

(defn on-command [snapshot dispatch! e])

(defn schema {:snaphot {:tree []
                        :focus []
                        :clipboard []}})

; states comes from Respo@4.x states management
(defn render [states snapshot]
  (fn [cursor]
    (div {:style {}}
      (comp-editor states snapshot on-update! on-command))))

focus! is a side-effect. You have to make sure it's called only editor is changed. Respo does not provide a didMount hook, you have to handle it globally on you own. Take src/cirru_editor/main.cljs for example.

Develop

https://github.com/mvc-works/calcit-workflow

License

MIT

Can you improve this documentation? These fine people already did:
jiyinyiyong & ChenYong
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close