forked from loopindex/ckeditor-track-changes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme.html
142 lines (126 loc) · 8.84 KB
/
readme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<html>
<head><title>LITE (Track changes for CKEditor)</title>
<style>body{font-family:sans-serif;}</style>
</head>
<body>
<div id="preview" class="shadowbox" style="background-image: url(file:///E:/readme.html);"><h1 id="track-changes-plugin-for-ckeditor">Track Changes Plugin for CKEditor</h1>
<ul>
<li>Track changes plugin for CKEditor, based on <a href="https://github.com/NYTimes/ice" target="_blank">ICE</a> (NYTimes track changes for <code>contentEditable</code> documents). </li>
</ul>
<h2 id="main-features">Main Features</h2>
<ul>
<li>Enable / disable track changes mode</li>
<li>Show / hide tracked changes</li>
<li>Accept/Reject all/some changes</li>
<li>Accept/Reject a single change</li>
<li>Display customizable tooltips for each change</li>
</ul>
<h2 id="demo">Demo</h2>
<p><a href="http://www.loopindex.com/lite/demo">Demo Page</a></p>
<h2 id="site">Site</h2>
<p><a href="http://www.loopindex.com/lite">LoopIndex</a></p>
<h2 id="getting-started">Getting Started</h2>
<ul>
<li>Add the lite plugin to ckeditor. The simplest way to do this is by adding the following line to ckeditor's <code>config.js</code>:<pre><code class="lang-javascript"> config.extraPlugins = <span class="hljs-string">'lite'</span>;
</code></pre>
</li>
<li><p>Optionally include <code>lite-interface.js</code> in your source, so you can use the various constants defined in it rather than string literals.</p>
<pre><code class="lang-javascript"> <span class="hljs-tag"><span class="hljs-title">script</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">"text/javascript"</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"ckeditor/plugins/lite/lite-interface.js"</span>></span><span class="javascript"></span><span class="hljs-tag"></<span class="hljs-title">script</span>></span>
</code></pre>
</li>
<li><p>See the <a href="http://www.loopindex.com/lite/docs/" target="_blank">documentation</a> for all the configuration options.</p>
</li>
</ul>
<h2 id="configuration">Configuration</h2>
<p>The LITE plugin is automatically activated after you install it and edit <code>config.js</code> as described above. For the full details of tweaking the loading process, toolbar commands, users and more, see the <a href="http://www.loopindex.com/lite/docs/" target="_blank">documentation</a>.</p>
<h2 id="api">API</h2>
<p><ul>
<li><h3>Get a reference to the lite plugin</h3>
To interact with the <code>lite</code> plugin, either access it through the editor's <code>plugins.lite</code> property, or listen to the event <code>LITE.Events.INIT</code> fired by the editor instance. The <code>data</code> member of the event will
contain a property called <code>lite</code> which references the lite plugin instance, initialized and ready for action.
<li><h3>toggleTracking(bTrack, bNotify)</h3>
Toggles change tracking in the editor.
<h4>Parameters</h4>
<ul>
<li><code>bTrack</code> - boolean. If <code>undefined</code>, change tracking is toggled, otherwise it is set to this value
<li><code>bNotify</code> - boolean. If false, the <code>LITE.Events.TRACKING</code> event is not fired.
</ul>
<li><h3>toggleShow(bShow, bNotify)</h3>
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.
<h4>Parameters</h4>
<ul>
<li><code>bShow</code> - boolean. If <code>undefined</code>, change visibility is toggled, otherwise it is set to this value
<li><code>bNotify</code> - boolean. If false, the <code>LITE.Events.SHOW_HIDE</code> event is not fired.
</ul>
</p>
<p><li><h3>acceptAll(options)</h3>
Accept some or all the pending changes.</p>
<p><h4>Parameters</h4>
<ul>
<li><code>options</code> - optional object filter the changes to which this operation applies with the following properties:
<ul><li><code>exclude</code><div>an array of user ids to exclude from the the operation (takes precedence over <code>include</code>)</div>
<li><code>include</code><div>an array of user ids to include from the the operation</div>
<li><code>filter</code><div>a filter function that accepts an object of the form <code>{userid, time, data}</code> and returns a <code>boolean</code>. Only changes for which the filter returns <code>true</code> are included in the operation. The <code>filter</code> option can work with both <code>exclude</code> and <code>include</code>.</div>
</ul>
All the fields you include in the <code>options</code> block, including custom ones, are preserved when it is sent back in the <code>ACCEPT</code> or <code>REJECT</code> events (see below).
<li><h3>rejectAll(options)</h3>
Reject all the pending changes.
<h4>Parameters</h4>
<ul>
<li><code>options</code> - optional object to filter the changes to which this operation applies. See the <code>acceptAll</code> method for details.
</ul>
<li><h3>countChanges(options)</h3>
Returns a count of the tracked changes in the editor.
<h4>Parameters</h4>
<ul>
<li><code>options</code> - optional object to filter the counted changes. See the <code>acceptAll</code> method for details.
</ul>
<li><h3>hasChanges()</h3>
Sets the name and id of the current user. Each tracked change is associated with a user id.
<h4>Parameters</h4>
<ul>
<li>none
</ul>
<li><h3>setUserInfo(info)</h3>
Sets the name and id of the current user. Each tracked change is associated with a user id.
<h4>Parameters</h4>
<ul>
<li><code>info</code> - An object with two members - <code>id</code> and <code>name</code>
</ul>
<li><h3>setChangeData(data)</h3>
Associates an arbitrary string with the changes made from now on. This string is passed to the optional <code>filter</code> function in <code>options</code> 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.
<h4>Parameters</h4>
<ul>
<li><code>data</code> - Arbitrary data (converted to a string by the <code>LITE</code> plugin).
</ul>
</ul>
<h3>Events</h3>
The LITE plugin events are listed in <code>lite-interface.js</code> under <code>LITE.Events</code>. The following events are fired by the LITE plugin instance through its instance of <code>ckeditor</code>, with the parameter in the <code>data</code> member of the event info:
<ul>
<li>INIT (parameters: lite, the LITE instance)<div>Fired each time <code>LITE</code> creates and initializes an instance of the <code>ICE</code> change tracker. This happens, e.g., when you switch back from <code>Source</code> mode to <code>Wysiwyg</code>.</div></li>
<li>ACCEPT(parameter : the <code>options</code> object passed to acceptAll, if relevant)<div>Fired after some changes (possibly all) were accepted.</div></li>
<li>REJECT (parameter : the <code>options</code> object passed to acceptAll, if relevant)<div>Fired after some changes (possibly all) were rejected. </div></li>
<li>SHOW_HIDE(parameter: show {boolean})
<div>Fired after a change in the visibility of tracked changes.</div></li>
<li>TRACKING (parameter: tracking{boolean})
<div>Fired after a change in the change tracking state.</div></li>
</ul>
<h3>Known Issues</h3>
<em> 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.
</em> See the <a href="https://github.com/NYTimes/ice/blob/master/README.md" target="_blank">ICE page</a> for known issues related to ICE.
<em> Note that the ICE engine adds markup to the editor content.
</em> 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.
<h4>LGPL</h4>
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.<br/>
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 <a href="http://www.gnu.org/licenses/lgpl.txt">http://www.gnu.org/licenses/lgpl.txt</a><br/>
<h4>MPL</h4>
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 <a href="http://mozilla.org/MPL/2.0/">http://mozilla.org/MPL/2.0/</a>.
<br>
Written by (David *)Frenkiel (<a href="https://github.com/imdfl">https://github.com/imdfl</a>)
</div></body>
</html>