Reimplement Cirru Editor in Respo.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
entry
src/cirru_editor
.gitattributes
.gitignore
README.md
build.boot
coir.edn
package.json
shadow-cljs.edn
yarn.lock

README.md

Respo Cirru Editor

Reimplement Cirru Editor in Respo.

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

Usage

Clojars Project

[cirru/editor "0.2.5"]

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/stack-workflow

License

MIT