Hi Paul, we've built a Content Editable widget in Om (and while it needs some more polish I'm hoping we can release it soon). For now I can only tell you about my experiences:
The first iteration I wrote had contenteditable getting turned on and off using local state updates. This worked well enough but gave us some trouble with focus on IE8 and IE9 if I recall correctly--other modern browsers (desktop Chrome, FF, Safari is as far as we test) were fine. After I discovered that I simply (and somewhat disappointingly) changed it to use lower-level direct DOM JS API calls to clear text content, set contenteditable to true, and set focus. In order to make the widget modular, we use a channel hooked up to onChange (we actually have our own version of Google Closure's delayedchange) to pass the text content out of the field to whatever wants to list on the channel the widget provides. An alternative, I suppose, would be to pass in a function to be used as an event handler, and let the user figure that out. We also provide channels to trigger resets and blurring of the field. So far, it works pretty well and we haven't had too many problems--we are looking to replace all of our usage of Google Closure's ContentEditableField (http://docs.closure-library.googlecode.com/git/class_goog_editor_ContentEditableField.html) in the near term, but have to give it a bit more thorough testing first. I'll see about getting this code out there and available ASAP. But hopefully this gives you some help in terms of possibilities to consider as you hack on your own version... DD (2014/04/22 19:58), Paul Butcher wrote: > After working my way through the various samples and tutorials out > there, I’m about to start on my first Om app (yay!). > > Possibly foolishly, I’m planning to make heavy use of contentEditable. > In essence, what I need to do is replicate something similar to Word’s > “track changes” functionality. Ideally, I’d like to get this to play > nicely with Om’s undo - the complication being that as well as changes > made by the app, I’d also need to undo changes made by the user (ideally > wrapping changes made by both into a single logical undo). > > I’ve done quite a bit of searching, and getting React to play nicely > with contentEditable seems to be a largely unexplored area? Chas > Emerick’s message on the React mailing list seems to capture the current > state of the art: > > https://groups.google.com/d/msg/reactjs/ff5YlPKiqmc/ngDTsk_i2mYJ > > Although this looks promising: > > http://stackoverflow.com/a/22678516/268371 > > Is there anything else that I should be aware of? Any words of wisdom or > advice before I dive into this (including “don’t use Om for this - it’s > the wrong tool for the job” :-)? > > -- > paul.butcher->msgCount++ > > Silverstone, Brands Hatch, Donington Park... > Who says I have a one track mind? > > http://www.paulbutcher.com <http://www.paulbutcher.com/>/ > LinkedIn: http://www.linkedin.com/in/paulbutcher > Skype: paulrabutcher > > Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel > http://pragprog.com/book/pb7con > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google > Groups "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
