News for hackers. Stuff that matters.
Re:Inside the Guardian’s CMS: meet Scribe, an extensible ric... by marknadal on Friday March 21, 2014 @03:18AM (#7441082)
I'm a tad late, but I should mention a really important library I wrote that changes HOW one writes editors - http://github.com/amark/monotype . Save your caret, do whatever transformation you want directly with HTML manipulation, then you restore your caret. Done, that simple - don't even bother trying to use the browser's API, because yes they are wildly unreliable in their behavior. The kicker with my library is it saves your caret (your selection) based on actual content, rather than the DOM tree, so it still is able to accurately restore it even if you completely delete and replace the DOM tree.
Re:Inside the Guardian’s CMS: meet Scribe, an extensible ric... by OliverJAsh on Friday March 21, 2014 @05:30PM (#7445048)
This could be helpful, although we haven’t needed this sort of facility yet luckily. Thanks for posting.
Re:Inside the Guardian’s CMS: meet Scribe, an extensible ric... by timdown on Friday March 21, 2014 @05:46AM (#7441399)
How does it work?
Re:Inside the Guardian’s CMS: meet Scribe, an extensible ric... by marknadal on Friday March 21, 2014 @02:44PM (#7443978)
Just do:

monotype.save(editor);

Then perform your manipulation, when done call:

monotype.restore();

Tim Down! Thank you so much for your rangy library, it is a noble library, and I respect all your hard work trying to normalize the Range API. Monotype is similar to your new Text module but behaves a bit differently, please email me so we can talk more! mark at accelsor.com