loopindex / ckeditor-track-changes

Track changes plugin for CKEditor, based on ICE (track changes for TinyMCE).
www.loopindex.com
Other
51 stars 55 forks source link

Jump to next change option on right click menu #149

Closed sekhar-88 closed 6 years ago

sekhar-88 commented 6 years ago

If we want to jump to a next change that needs to be accepted/rejected we have to scroll all the way up and down if there are huge amount of text in the editor.

So can we add 'jump to next change' to the right click popup menu , so that it would be easier.

For now is there a way we can do it programmatically ?

imdfl commented 6 years ago

The outline of the relevant code would be:

  1. get the caret position from the editor (i.e. editor.getSelection().getRanges()[ 0 ])
  2. Collect all the remaining tracked nodes (e.g. jQuery(editor.editable().$).find(".ice-ins, .ice-del")
  3. Sort the nodes by their order, using the Element method compareDocumentPosition() (maybe the jQuery method closest() will suffice).
  4. select the closest node through ckeditor's api (if necessary, trigger the editor's selectionChangeevent to force LITE to refresh the commands' state).