- Track changes plugin for CKEditor, based on ICE (NYTimes track changes for
contentEditabledocuments).
- Enable / disable track changes mode
- Show / hide tracked changes
- Accept/Reject all/some changes
- Accept/Reject a single change
- Display customizable tooltips for each change
##Demo
##Site LoopIndex
##Getting Started
- Add the lite plugin to ckeditor. The simplest way to do this is by adding the following line to ckeditor's
config.js:
config.extraPlugins = 'lite';- Optionally include
lite-interface.jsin your source, so you can use the various constants defined in it rather than string literals.
<script type="text/javascript" src="ckeditor/plugins/lite/lite-interface.js"></script>- See the documentation for all the configuration options.
##Configuration
The LITE plugin is automatically activated after you install it and edit config.js as described above. For the full details of tweaking the loading process, toolbar commands, users and more, see the documentation.
-
To interact with the
liteplugin, either access it through the editor'splugins.liteproperty, or listen to the eventLITE.Events.INITfired by the editor instance. Thedatamember of the event will contain a property calledlitewhich references the lite plugin instance, initialized and ready for action. -
Toggles change tracking in the editor.
bTrack- boolean. Ifundefined, change tracking is toggled, otherwise it is set to this valuebNotify- boolean. If false, theLITE.Events.TRACKINGevent is not fired.
-
Change the visibility of tracked changes. Visible changes are marked by a special style, otherwise insertions appear in their original format and deletions are hidden.
bShow- boolean. Ifundefined, change visibility is toggled, otherwise it is set to this valuebNotify- boolean. If false, theLITE.Events.SHOW_HIDEevent is not fired.
-
Accept some or all the pending changes.
options- optional object filter the changes to which this operation applies with the following properties:excludean array of user ids to exclude from the the operation (takes precedence overinclude)includean array of user ids to include from the the operationfiltera filter function that accepts an object of the form{userid, time, data}and returns aboolean. Only changes for which the filter returnstrueare included in the operation. Thefilteroption can work with bothexcludeandinclude.
optionsblock, including custom ones, are preserved when it is sent back in theACCEPTorREJECTevents (see below).-
Reject all the pending changes.
options- optional object to filter the changes to which this operation applies. See theacceptAllmethod for details.
-
Returns a count of the tracked changes in the editor.
options- optional object to filter the counted changes. See theacceptAllmethod for details.
-
Sets the name and id of the current user. Each tracked change is associated with a user id.
- none
-
Sets the name and id of the current user. Each tracked change is associated with a user id.
info- An object with two members -idandname
-
Associates an arbitrary string with the changes made from now on. This string is passed to the optional
filterfunction inoptionsblock passed to various methods that accept change filtering. For example, you may associate a revision number with the current change set and later on filter changes according to their revision.data- Arbitrary data (converted to a string by theLITEplugin).
The LITE plugin events are listed in
lite-interface.jsunderLITE.Events. The following events are fired by the LITE plugin instance through its instance ofckeditor, with the parameter in thedatamember of the event info:- INIT (parameters: lite, the LITE instance)Fired each time
LITEcreates and initializes an instance of theICEchange tracker. This happens, e.g., when you switch back fromSourcemode toWysiwyg. - ACCEPT(parameter : the
optionsobject passed to acceptAll, if relevant)Fired after some changes (possibly all) were accepted. - REJECT (parameter : the
optionsobject passed to acceptAll, if relevant)Fired after some changes (possibly all) were rejected. - SHOW_HIDE(parameter: show <boolean>)
Fired after a change in the visibility of tracked changes.
- TRACKING (parameter: tracking<boolean>)
Fired after a change in the change tracking state.
##Known Issues
- Adjacent changes from different collaborators may affect each other if you accept/reject a single change in the sequence. This is related to an issue in ICE which we hope to resolve with the developers.
- See the ICE page for known issues related to ICE.
- Note that the ICE engine adds markup to the editor content.
- LITE tracks only text insertion and deletion. Other changes, such as style edits, are not tracked.
##Browser Compatibility LITE has been tested on Firefox 15+, Chrome 13+ and MSIE 9+. Support for MSIE 8 is not guaranteed, although the current version seems to work on it.
##License
Copyright (c) LoopIndex.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program as the file gpl.txt. If not, see http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
Written by (David *)Frenkiel (https://github.com/imdfl)