- Track changes plugin for CKEditor, based on ICE (NYTimes track changes for
contentEditable
documents). - The LITE plugin contains an edited version of ICE, we hope to merge with the ICE repository in the near future.
- Enable / disable track changes mode
- Show / hide tracked changes
- Accept all changes
- Reject all changes
- Accept a single change
- Reject a single change
- Display timestamp and user info for each change
##Demo
##Site LoopIndex
##Getting Started
- Include the lite plugin's interface in your html, e.g.
<script type="text/javascript" src="ckeditor/plugins/lite/lite_interface.js"></script>
- 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';
- 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
lite
plugin, either access it through the editor'splugins.lite
property, or listen to the eventLITE.Events.INIT
fired by the editor instance. Thedata
member of the event will contain a property calledlite
which 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.TRACKING
event 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_HIDE
event 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:exclude
an array of user ids to exclude from the the operation (takes precedence overinclude
)include
an array of user ids to include from the the operationfilter
a filter function that accepts an object of the form{userid, time, data}
and returns aboolean
. Only changes for which the filter returnstrue
are included in the operation. Thefilter
option can work with bothexclude
andinclude
.
options
block, including custom ones, are preserved when it is sent back in theACCEPT
orREJECT
events (see below).-
Reject all the pending changes.
options
- optional object to filter the changes to which this operation applies. See theacceptAll
method for details.
-
Returns a count of the tracked changes in the editor.
options
- optional object to filter the counted changes. See theacceptAll
method 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 -id
andname
-
Associates an arbitrary string with the changes made from now on. This string is passed to the optional
filter
function inoptions
block 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 theLITE
plugin).
The LITE plugin events are listed in
lite_interface.js
underLITE.Events
. The following events are fired by the LITE plugin instance through its instance ofckeditor
, with the parameter in thedata
member of the event info:- INIT (parameters: lite, the LITE instance)Fired each time
LITE
creates and initializes an instance of theICE
change tracker. This happens, e.g., when you switch back fromSource
mode toWysiwyg
. - ACCEPT(parameter : the
options
object passed to acceptAll, if relevant)Fired after some changes (possibly all) were accepted. - REJECT (parameter : the
options
object 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.
##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 Lesser General Public License 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program as the file lgpl.txt. If not, see http://www.gnu.org/licenses/lgpl.txt
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Written by (David *)Frenkiel (https://github.com/imdfl)