Skip to content

Commit 99870e9

Browse files
author
Sorita Heng
committed
Update docs to include Review Permissions V1
1 parent 8fa5056 commit 99870e9

File tree

4 files changed

+109
-15
lines changed

4 files changed

+109
-15
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<textarea id="trackchanges">
2+
{{logofordemoshtml}}
3+
4+
<h2 style="text-align: center;">Welcome to the TinyMCE Suggested Edits demo with review permissions!</h2>
5+
6+
<p style="text-align: center;">In this demo, the user has a 'read' access to the Suggested Edits view. Try typing in the editor and then clicking the Review Changes button in the toolbar to see how it works!</p>
7+
8+
<p style="text-align: center;">Try setting the editor read-only mode to true to restrict editing permission.</p>
9+
10+
<h2>A simple table to play with</h2>
11+
12+
<table style="border-collapse: collapse; width: 100%;" border="1">
13+
<thead>
14+
<tr style="text-align: left;">
15+
<th>Product</th>
16+
<th>Cost</th>
17+
<th>Really?</th>
18+
</tr>
19+
</thead>
20+
<tbody>
21+
<tr>
22+
<td>TinyMCE Cloud</td>
23+
<td>Get started for free</td>
24+
<td><strong>Yes!</strong></td>
25+
</tr>
26+
<tr>
27+
<td>Plupload</td>
28+
<td>Free</td>
29+
<td><strong>Yes!</strong></td>
30+
</tr>
31+
</tbody>
32+
</table>
33+
34+
</textarea>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
tinymce.init({
2+
selector: 'textarea#trackchanges',
3+
height: 500,
4+
plugins: 'trackchanges',
5+
toolbar: 'trackchanges',
6+
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
7+
trackchanges_uid: 'adamhenderson',
8+
trackchanges_access: 'read', //change this value to set permission to the Suggested Edits view
9+
readonly: false //set to true to restrict a user's editing permission
10+
});

modules/ROOT/examples/live-demos/suggestededits/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ tinymce.init({
3535
trackchanges_uid: 'adamhenderson',
3636
trackchanges_user_lookup,
3737
});
38+

modules/ROOT/partials/configuration/suggestededits-options.adoc

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1+
[[suggestededits_uid]]
2+
== `suggestededits_uid`
3+
4+
The `{plugincode}_uid` is a _required_ option that takes as input a unique string to identify the current user. This is used to attribute changes made by the user.
5+
6+
*Type:* `+String+`
7+
8+
=== Example: using `{plugincode}_uid`
9+
10+
// Add a working and tested configuration.
11+
[source,js]
12+
----
13+
tinymce.init({
14+
selector: 'textarea', // Change this value according to your HTML
15+
plugins: 'suggestededits',
16+
toolbar: 'suggestededits',
17+
suggestededits_uid: 'unique-identifier' // replace this with a unique string to identify the user
18+
});
19+
----
20+
121
[[suggestededits_model]]
222
== `suggestededits_model`
323

4-
The `suggestededits_model` option sets the initial model of the document to begin tracking changes. It takes as input an object representing the document. If no value is set, the plugin will generate the model by default.
24+
The `{plugincode}_model` option sets the initial model of the document to begin tracking changes. It takes as input an object representing the document. If no value is set, the plugin will generate the model by default.
525

626
//*Type:* xref:#trackeddocument[TrackedDocument] `+Object+`
727

8-
=== Example: using `suggestededits_model`
28+
=== Example: using `{plugincode}_model`
929

1030
// Add a working and tested configuration.
1131
[source,js]
@@ -14,6 +34,7 @@ tinymce.init({
1434
selector: 'textarea', // Change this value according to your HTML
1535
plugins: 'suggestededits',
1636
toolbar: 'suggestededits',
37+
suggestededits_uid: 'unique-identifier', // replace this with a unique string to identify the user
1738
suggestededits_model: {
1839
version: 1,
1940
maxId: 0,
@@ -29,36 +50,64 @@ tinymce.init({
2950
});
3051
----
3152

32-
[[suggestededits_uid]]
33-
== `suggestededits_uid`
53+
[[suggestededits_access]]
54+
== `suggestededits_access`
3455

35-
The `suggestededits_uid` is a _required_ option that takes as input a unique string to identify the current user. This is used to attribute changes made by the user.
56+
To configure a user's permission to edit the document and review changes, the `{plugincode}_access` option can be set alongside the editor mode.
3657

3758
*Type:* `+String+`
3859

39-
=== Example: using `suggestededits_uid`
60+
*Possible Values*: `'full'`, `'suggest'`, `'read'`, `'none'`
4061

41-
// Add a working and tested configuration.
42-
[source,js]
62+
*Default Value*: `'full'`
63+
64+
The possible values set the access level of the review permissions as follows:
65+
66+
[cols="20%,80%"]
67+
|===
68+
|Value | Review Permission
69+
70+
|`+'full'+`
71+
|Access to the {pluginname} view, with permission to accept, reject, or add suggestions to changes.
72+
73+
|`+'suggest'+`
74+
|Access to the {pluginname} view, with permission to add suggestions to changes.
75+
76+
|`+'read'+`
77+
|Readonly access to the {pluginname} view.
78+
79+
|`+'none'+`
80+
|No access to the {pluginname} view.
81+
|===
82+
83+
[NOTE]
84+
The `{plugincode}_access` option can be used in combination with the editor's read-only mode to restrict a user’s editing permission.
85+
86+
.Example
87+
[source,javascript]
4388
----
4489
tinymce.init({
4590
selector: 'textarea', // Change this value according to your HTML
4691
plugins: 'suggestededits',
4792
toolbar: 'suggestededits',
48-
suggestededits_uid: 'unique-identifier' // replace this with a unique string to identify the user
93+
suggestededits_uid: 'unique-identifier', // replace this with a unique string to identify the user
94+
suggestededits_access: 'full' //change this value to set permission to the Suggested Edits view
95+
readonly: false //set to true to restrict a user's editing permission
4996
});
5097
----
5198

99+
liveDemo::suggestededits-access[]
100+
52101
[[suggestededits_css_url]]
53102
== `suggestededits_css_url`
54103

55-
The `suggestededits_css_url` option sets the location where a CSS file containing change annotations in the {pluginname} view should be loaded from. To override the default CSS classes, use this option alongside `suggestededits_diff_classes`.
104+
The `{plugincode}_css_url` option sets the location where a CSS file containing change annotations in the {pluginname} view should be loaded from. To override the default CSS classes, use this option alongside `{plugincode}_diff_classes`.
56105

57106
*Type:* `+String+`
58107

59-
*Default value:* `'${pluginUrl}/css/suggestededits.css'`
108+
*Default value:* `'${pluginUrl}/css/{plugincode}.css'`
60109

61-
=== Example: using `suggestededits_css_url`
110+
=== Example: using `{plugincode}_css_url`
62111

63112
// Add a working and tested configuration.
64113
[source,js]
@@ -72,10 +121,10 @@ tinymce.init({
72121
[[suggestededits_diff_classes]]
73122
== `suggestededits_diff_classes`
74123

75-
The `suggestededits_diff_classes` option configures the CSS classes applied to the change annotations in the {pluginname} view. This is useful to set custom styles and must be used in combination with the `suggestededits_css_url` option.
124+
The `{plugincode}_diff_classes` option configures the CSS classes applied to the change annotations in the {pluginname} view. This is useful to set custom styles and must be used in combination with the `{plugincode}_css_url` option.
76125

77126
[NOTE]
78-
The CSS class names must exist in the xref:suggestededits_css_url[`+suggestededits_css_url+`].
127+
The CSS class names must exist in the xref:{plugincode}_css_url[`+{plugincode}_css_url+`].
79128

80129
*Type:* `+Object+`
81130

@@ -92,7 +141,7 @@ Below are the default CSS classes:
92141
}
93142
----
94143

95-
=== Example: using `suggestededits_diff_classes`
144+
=== Example: using `{plugincode}_diff_classes`
96145

97146
[source,js]
98147
----

0 commit comments

Comments
 (0)