I am working on an open source product to allow collaborative editing in a CMS. The use case is the following: While user A is editing some tiny node user B updates the same node. Everything is working fine updating user's A tiny editor except preserving his cursor position. I.e.
var bookmark = editor.selection.getBookmark();
editor.setContent(content);
editor.selection.moveToBookmark(bookmark);
will not work if the contents have changed before the caret. http://tinymce.moxiecode.com/forum/viewtopic.php?id=20458 mentions that 开发者_运维百科there would be an update to deal with this kind of situation, but is there something I could do now? Thank you in advance!
This can be a fumbling thing to achieve, but here is a onother way. You could use a formalized bookmark. The code will look like
var bookmark = editor.selection.getBookmark(2, true);
editor.setContent(content);
editor.selection.moveToBookmark(bookmark);
精彩评论