Skip to content

Commit 0e1756f

Browse files
author
Sorita Heng
committed
Add description of plugin and examples for API options
1 parent facd970 commit 0e1756f

File tree

3 files changed

+109
-302
lines changed

3 files changed

+109
-302
lines changed

modules/ROOT/pages/trackchanges.adoc

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,43 @@ include::partial$misc/admon-iframe-only.adoc[]
2121

2222
== How it works
2323

24+
The Track Changes plugin monitors edits made to a document by comparing its current state to the original version. Each change is attributed to its respective author and can be approved or rejected before being applied to the document.
25+
26+
[NOTE]
27+
Since the comparison is made against the original version of the document, if there are unresolved changes by multiple authors affecting the same part, the most recent change will be used for comparison. The `hasChanges` API can be used to implement a safeguard that prevents further edits on a document with unresolved changes.
28+
29+
The plugin includes a dedicated view for reviewing current changes, accessible via the `{plugincode} toolbar button or the menu option under the `View` menu. The key components are:
30+
31+
. **Read-only Diff View**:
32+
+
33+
Highlights the current changes made to the document, using the following color codes:
34+
+
35+
* Green: New content.
36+
* Blue: Modified content. Modifications to HTML content implies attributes or formatting (e.g. bold, italic, etc.).
37+
* Red: Removed content.
38+
39+
. **Sidebar**:
40+
+
41+
Contains a header with the following buttons:
42+
+
43+
* Show Changes: A toggle button which hides/unhides the change annotations.
44+
* Complete: Ends the review applies the resolved changes.
45+
* Cancel: Ends the review without any further action.
46+
47+
+
48+
The sidebar also displays all tracked changes that need to be resolved. Each change can be handled in the following ways:
49+
* Accept: Applies the change to the document.
50+
* Reject: Removes the change from the document.
51+
* Revert: Undoes a previously accepted or rejected change.
52+
2453
== Basic setup
2554

2655
To setup the {pluginname} plugin in the editor:
2756

2857
* add `{plugincode}` to the `plugins` option in the editor configuration;
2958
* add `{plugincode}` to the `toolbar` option in the editor configuration;
59+
* add `{plugincode}_model` to the editor configuration.
60+
* add `{plugincode}_uid` to the editor configuration.
3061

3162
For example:
3263

@@ -36,45 +67,22 @@ tinymce.init({
3667
selector: 'textarea', // change this value according to your HTML
3768
plugins: 'trackchanges',
3869
toolbar: 'trackchanges',
39-
// track changes options
70+
trackchanges_model: {
71+
version: 1,
72+
maxId: 0,
73+
contents: [
74+
{
75+
type: 'p',
76+
children: [
77+
{ text: 'Hello, World!' }
78+
]
79+
}
80+
]
81+
}
82+
trackchanges_uid: 'unique-identifier' // replace this with a unique string to identify the user
4083
});
4184
----
4285

43-
== Data structure
44-
45-
=== TrackedDocument
46-
47-
`TrackedDocument` is an `+Object+` that contains the following fields:
48-
49-
[cols="1,1,1,3",options="header"]
50-
|===
51-
| Field | Type | Required? | Description
52-
| `+version+` | `+Number+` | required | <description>
53-
| `+maxId+` | `+Number+` | required | <description>
54-
| `+contents+` | xref:#trackednode[TrackedNode] `+Object+` `+Array+` | required | <description>
55-
|===
56-
57-
=== TrackedNode
58-
59-
`TrackedNode` is an `+Object+` that contains the following fields:
60-
61-
[cols="1,1,1,3",options="header"]
62-
|===
63-
| Field | Type | Required? | Description
64-
| `+type+` | `+String+` | required | <description>
65-
| `+attrs+` | `` | optional | <description>
66-
| `+oldAttrs+` | `` | optional | <description>
67-
| `+text+` | `+String+` | required | <description>
68-
| `+_opData+` | xref:#trackedData[TrackedData] `+Object+` `+Array+` | optional | <description>
69-
| `+format+` | xref:#textformat[TextFormat] `+Object+` | optional | <description>
70-
| `+oldFormat+` | xref:#textformat[TextFormat] `+Object+` | optional | <description>
71-
| `+children+` | xref:#trackednode[TrackedNode] `+Object+` `+Array+` | optional | <description>
72-
|===
73-
74-
=== TrackedData
75-
76-
=== TextFormat
77-
7886
== Options
7987

8088
The following configuration options affect the behavior of the {pluginname} plugin.

0 commit comments

Comments
 (0)