Skip to content

Track changes plugin for CKEditor, based on ICE (track changes for TinyMCE).

License

Notifications You must be signed in to change notification settings

jamienk/ckeditor-track-changes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Track Changes Plugin for CKEditor

  • 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.

Main Features

  • 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

Demo Page

##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';

##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.

API

  • Get a reference to the lite plugin

    To interact with the lite plugin, either access it through the editor's plugins.lite property, or listen to the event LITE.Events.INIT fired by the editor instance. The data member of the event will contain a property called lite which references the lite plugin instance, initialized and ready for action.
  • toggleTracking(bTrack, bNotify)

    Toggles change tracking in the editor.

    Parameters

    • bTrack - boolean. If undefined, change tracking is toggled, otherwise it is set to this value
    • bNotify - boolean. If false, the LITE.Events.TRACKING event is not fired.
  • toggleShow(bShow, bNotify)

    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.

    Parameters

    • bShow - boolean. If undefined, change visibility is toggled, otherwise it is set to this value
    • bNotify - boolean. If false, the LITE.Events.SHOW_HIDE event is not fired.
  • acceptAll(options)

    Accept some or all the pending changes.

    Parameters

    • 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 over include)
      • include
        an array of user ids to include from the the operation
      • filter
        a filter function that accepts an object of the form {userid, time, data} and returns a boolean. Only changes for which the filter returns true are included in the operation. The filter option can work with both exclude and include.
      All the fields you include in the options block, including custom ones, are preserved when it is sent back in the ACCEPT or REJECT events (see below).
    • rejectAll(options)

      Reject all the pending changes.

      Parameters

      • options - optional object to filter the changes to which this operation applies. See the acceptAll method for details.
    • countChanges(options)

      Returns a count of the tracked changes in the editor.

      Parameters

      • options - optional object to filter the counted changes. See the acceptAll method for details.
    • hasChanges()

      Sets the name and id of the current user. Each tracked change is associated with a user id.

      Parameters

      • none
    • setUserInfo(info)

      Sets the name and id of the current user. Each tracked change is associated with a user id.

      Parameters

      • info - An object with two members - id and name
    • setChangeData(data)

      Associates an arbitrary string with the changes made from now on. This string is passed to the optional filter function in options 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.

      Parameters

      • data - Arbitrary data (converted to a string by the LITE plugin).

    Events

    The LITE plugin events are listed in lite_interface.js under LITE.Events. The following events are fired by the LITE plugin instance through its instance of ckeditor, with the parameter in the data member of the event info:

    • INIT (parameters: lite, the LITE instance)
      Fired each time LITE creates and initializes an instance of the ICE change tracker. This happens, e.g., when you switch back from Source mode to Wysiwyg.
    • 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.

    LGPL

    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

    MPL

    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)

About

Track changes plugin for CKEditor, based on ICE (track changes for TinyMCE).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published