This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-26
Channels
- # announcements (1)
- # babashka (106)
- # beginners (11)
- # biff (7)
- # calva (16)
- # clj-kondo (40)
- # clj-on-windows (5)
- # clj-yaml (10)
- # clojars (4)
- # clojure (37)
- # clojure-austin (22)
- # clojure-australia (1)
- # clojure-europe (40)
- # clojure-nl (1)
- # clojure-norway (10)
- # clojure-spec (6)
- # clojure-uk (6)
- # clojurescript (13)
- # conjure (11)
- # cursive (14)
- # datalevin (8)
- # datascript (5)
- # emacs (39)
- # events (1)
- # fulcro (55)
- # gratitude (4)
- # holy-lambda (2)
- # humbleui (9)
- # instaparse (1)
- # lsp (3)
- # malli (12)
- # meander (2)
- # membrane (7)
- # nbb (1)
- # off-topic (16)
- # pathom (9)
- # releases (3)
- # sci (14)
- # shadow-cljs (25)
Wondering if someone wrote a slatejs (react highly configurable rich text editor) port to clojurescript that plays well with reframe (or any other similar editor). I found one (https://github.com/jhund/re-frame-and-reagent-and-slatejs) that is a bit outdated..
we're using prosemirror which plays well with re-frame (we're dispatching & applying prosemirror through re-frames event loop)
@U02FP0U7J1W - If you are not too tied into reframe then you could use a more 'react aligned' UI framework like #uix which would let you use SlateJS and other JavaScript libraries easily with just a bit of javascript interop (no external wrapper required). Note, SlateJS is pretty low level - you need to use a lot of plugins and deep integration to make it work and provide rich editing functionality.
for something a bit easier to use I recommend https://tiptap.dev, it's also built on top of prosemirror
@U5H74UNSF How do you avoid the "Applying a mismatched transaction" problem when the sending of the transaction as an event and then updating the editor's state use a subscription takes longer than it takes for a user to enter another key?
It seems more of a clojurescript/reframe question then it is a prosemirror (I think)
It seems weird to me that this might even be a problem because I'm not sure the editor can rely on the default dispatchTransaction to be fast enough.. Is there a specifc way in which you update the state? I currently am holding the EditorState in the app-db (its smelly but I didn't want to hold the state in the views..).
And thank you 🙂
edit: dispatch-sync
helps but does not completely solve the problem
we keep the view in the app db state and then in the re-frame event handler we create a ::doc/render
effect
(re-frame/reg-fx
::render
(fn doc-render [{::keys [^js view state]}]
(when (.-docView view)
(.updateState view state))))
keeping the view in the state isn’t needed though as the transaction event can carry it